I'd like to have a google line chart with one of the line series a dashed line.
Is this possible using the google jsapi (javascript)?
I'm actually planning on using a ComboChart, with an AreaChart for most of the data, but one series using a LineChart. And I'd like that line to be a dashed line...
Yes, you can. Just read about the data table roles on the doc
Every point you draw could be certain (certainty : true) or uncertain (certainty : false). Between two points, if one or both are uncertain, the line between will be dashed.
you just have to do like this :
var data = new google.visualization.DataTable();
data.addColumn('string', 'Month');
data.addColumn('number', 'Sales');
data.addColumn({type:'boolean',role:'certainty'}); // certainty col.
data.addRows([
['April',1000, true],
['May', 1170, true],
['June', 660, true],
['July', 1030, false]
]);
var chartLineWithDash = new google.visualization.LineChart(yourDiv);
chartLineWithDash .draw(data);
the line between June and July will be dashed.
For the moment it is style "Experimental", but feel free to ask! :) Hope it has helped you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With