I am using a google chart where x axis data column type is date. But i want
the x axis to be discrete. Is there any way to accomplish this.
When I changed the 'type' option of the axis to be 'category' then i am
unable to see trendlines
here is my code
google.load('visualization', '1.1', {packages: ['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var revenueChart_93;
var data = new google.visualization.DataTable();
data.addColumn('date', 'Month');
data.addColumn('number', 'Predicted Grade');
data.addColumn('number', 'Working Grade');
data.addColumn('number', 'Estimated Grade');
data.addRow([new Date(2015, 2, 12), 1.0, 1.0, 1.0 ]);
data.addRow([new Date(2015, 5, 12), 4.5, 5.0, 6.5]);
data.addRow([new Date(2015, 6, 1), 5.0, 6.0, 4.5]);
data.addRow([new Date(2015, 11, 1), 6.5, 7.0, 5.0]);
var formatter = new google.visualization.NumberFormat({
fractionDigits: 2,
});
formatter.format(data, 1);
var dateFormatter = new google.visualization.NumberFormat({
pattern: 'yyyy MMM'
});
dateFormatter.format(data, 0);
var chartHeight = 550;
var chartWidth = 750;
var chartOptions = {
trendlines: {
1: {
color: 'yellow',
//tooltip: false
}
},
title: 'Progress Report',
isStacked: true,
width: chartWidth,
height: chartHeight,
hAxis: {
title: 'Year',
slantedText: true,
slantedTextAngle: 45,
textStyle: {
fontSize: 10
},
format: 'MMM yyyy',
},
vAxis:{title: "Grade",
minValue: 1,
maxValue: 10,
gridlines: {
count: 19
},
baselineColor: 'none',
},
series: {
2: { lineDashStyle: [2, 2] },
},
legend: { position: 'right', alignment: 'start' },
};
revenueChart_93 = new
google.visualization.LineChart(document.getElementById('progress'));
revenueChart_93.draw(data, chartOptions);
}
--
You received this message because you are subscribed to the Google Groups
"Google Visualization 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-visualization-api.
For more options, visit https://groups.google.com/d/optout.