带有额外小数的X轴标签



我需要线形图....的帮助我把h轴标记为15,16,17,18但在图上我也得到了15.5 16.5....如何去除??我也用max: 4在hAxis…仍然是同样的问题....我也尝试了tickInterval: 1,但是图形没有显示任何东西。

<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>

您可以使用format配置选项来指定刻度的数字格式…

hAxis : {
viewWindow: {
min: 1,
max: week_ranges.length
},
ticks: week_ranges,
format: '#,##0'
}

相关内容

  • 没有找到相关文章

最新更新