The idea is to make the annotation text of type line stay on the column.
I have tried to create another annotation for the same column, but I did not succeed.
JS:
google.charts.load("current", {
packages: ['corechart']
});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'x');
data.addColumn({type: 'string', role: 'annotation'});
data.addColumn('number', 'Faixas');
data.addColumn({type: 'string', role: 'annotation'});
data.addRow(["até 4", null, 0, '0']);
data.addRow(["4.5", null, 0, '0']);
data.addRow(["5", null, 0, '0']);
data.addRow(["5.5", null, 0, '0']);
data.addRow(["6", null, 0, '0']);
data.addRow(["6.5", null, 0, '0']);
data.addRow(["7", null, 1, '1']);
data.addRow(["7.5", null, 2, '2']);
data.addRow(["8", 'Você', 5, '5']);
data.addRow(["8.5", null, 6, '6']);
data.addRow(["9", null, 2, '2']);
data.addRow(["9.5", null, 0, '0']);
data.addRow(["10", null, 3, '3']);
var view = new google.visualization.DataView(data);
var chart = new google.visualization.ColumnChart(document.getElementById("grafico"));
chart.draw(view, {
legend: {position: 'bottom'},
curveType: 'function',
vAxis: {
maxValue: 10,
format: 0
},
annotation: {
1: {
style: 'line'
}
}
});
$(document).ready(function () {
$(window).resize(function () {
drawChart();
});
});
}
HTML:
<div id="grafico"></div>
EXPECTED OUTCOME: