I use a stacked Google Columns chart with a Dataview to add the value to the column. However the number is sometimes displayed outside the column on another column.
How do I prevent this, or center the number in the middle of the column?
Furthermore it also displays numbers when the value is 0, which is annoying.
Jsfiddle: https://jsfiddle.net/p44byfa7/
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawBasic);
function drawBasic() {
var data = new google.visualization.arrayToDataTable([
['Month', 'A', 'B', 'C'],
['Jan', 1, 4, 6],
['Feb', 0, 2, 11],
['Mar', 4, 0, 1],
['Apr', 0, 0, 0],
['May', 14, 1, 11],
['Jun', 12, 1, 7]
]);
var view = new google.visualization.DataView(data);
view.setColumns([0, 1,
{
calc: "stringify",
sourceColumn: 1,
type: "string",
role: "annotation"
},
2,
{
calc: "stringify",
sourceColumn: 2,
type: "string",
role: "annotation"
},
3,
{
calc: "stringify",
sourceColumn: 3,
type: "string",
role: "annotation" }]);
var options = {
legend: { position: 'top', maxLines: 3 },
isStacked: true,
height: 600
};
var chart = new google.visualization.ColumnChart(
document.getElementById('chart_div'));
chart.draw(view, options);
}