'X axis labels with extra decimal...increase step to 1
i need help with line chart….i am providing h axis label as 15,16,17,18 but on the graph plotted i also get 15.5, 16.5….how to remove it??? i also used max: 4 in hAxis…still same issue....I also tried tickInterval: 1 but then graph is showing nothing .
<script>
google.charts.load('current', {'packages':['line']});
google.charts.setOnLoadCallback(drawChart);
var val = {{valuess | tojson}}
var tags = {{labelss | tojson}}
var week_ranges = {{week_range | tojson}}
console.log(week_ranges)
function drawChart() {
var data = new google.visualization.DataTable();
for (i = 0; i < tags.length; i++){
data.addColumn('number', tags[i]);
}
data.addRows(val);
var options = {
chart: {
title: 'Incoming Tag Trends For Resolver Group : {{rg}}',
subtitle: 'Year - {{year}} Start Week - {{sweek}} End Week - {{eweek}}'
},
width: 900,
height: 500,
hAxis : {
viewWindow: {
min: 1,
max: week_ranges.length
},
ticks: week_ranges
}
};
var chart = new google.charts.Line(document.getElementById('curve_chart'));
chart.draw(data, google.charts.Line.convertOptions(options));
}
</script>
Solution 1:[1]
you can use the format config option to specify the number format of the ticks...
hAxis : {
viewWindow: {
min: 1,
max: week_ranges.length
},
ticks: week_ranges,
format: '#,##0'
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | WhiteHat |
