Hi,
I am working in asp.net 4.5 and i tried to plot the column chart with
Google API. But seems i am missing the Vaxis line and i am helpless how to
plot the vaxis line. usually there will be L shape on this. but i ma
missing the V axis. please show me some sample how to plot the v-axis line.
My Sample Code posted here,
Enter code here...<script type="text/javascript">
//debugger;
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(drawChart);
function drawChart() {
var options = {
title: 'Data'
};
$.ajax({
type: "POST",
url: "Sample.aspx/Report",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
//var data = google.visualization.arrayToDataTable(r.d);
var Reportdata = new google.visualization.DataTable();
Reportdata.addColumn('string', 'Month');
Reportdata.addColumn('number', 'Mark');
Reportdata.addColumn({ type: 'string', role: 'style' });
var chartData = [];
$.each(r.d, function (i, item) {
var mark = parseInt(item.Mark);
var markcolor;
if (mark <= 39)
{
markcolor = "color:red";
}
if (mark > 39 && mark <=69) {
markcolor = "color:orange";
}
if (mark >= 70) {
markcolor = "color:green";
}
chartData.push([item.Month, mark, markcolor])
});
Reportdata.addRows(chartData);
var view = new google.visualization.DataView(Reportdata);
//view.setColumns([0, 1,
// {
// calc: "stringify",
// sourceColumn: 1,
// type: "string",
// role: "annotation"
// },
// 2]);
var options = {
title: "Six Month Graph",
width: 600,
height: 400,
slantedText: true,
bar: { groupWidth: "95%" },
legend: { position: "none" },
hAxis: {
//direction: -1,
slantedText: true,
slantedTextAngle: 90 // here you can even use 180
},
};
var chart = new
google.visualization.ColumnChart($("#chart")[0]);
chart.draw(view, options);
},
failure: function (r) {
alert(r.d);
},
error: function (r) {
alert(r.d);
}
});
}
</script>
--
You received this message because you are subscribed to the Google Groups
"Google Chart API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-chart-api.
For more options, visit https://groups.google.com/d/optout.