I am using Google Charts API
to display a vertical line on a LineChart
(at a specific point) using annotations
.
Is it possible to style the annotation line, to make it more visible (change its color/thickness, in case I add some vertical gridlines
etc.)?
I'm only interested in the annotation line style, not in the annotation text style, as asked in this question.
I have the following code:
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'x');
data.addColumn({type: 'string', role: 'annotation'});
data.addColumn('number', '');
data.addColumn({
type: 'boolean',
role: 'certainty'
});
data.addRows([
["-6", null, 1, true],
["-5", null, 2, true],
["-4", null, 4, true],
["-3", null, 8, true],
["-2", null, 7, true],
["-1", null, 7, true],
["0", '', 8, true],
["1", null, 4, false],
["2", null, 2, false],
["3", null, 3, false],
["4", null, 3, false],
["5", null, 1, false],
["6", null, 1, false]
]);
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {
curveType: 'function',
width: 500,
height: 400,
annotations: {
style: 'line'
}
});
}
You can play with the code in this fiddle.