谷歌线图y轴出现2次(加倍) [英] Google line chart y axis appear 2 times (doubled)
本文介绍了谷歌线图y轴出现2次(加倍)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用google折线图绘制折线图。如果用于绘制图表的数据只有一个值,如图所示,在图表的vaxis上显示轴 1 2次,我不想这个。我想vaxis是正常的,只有一个时间轴号。
用于vaxis的代码是:
I am using google line chart to draw a line chart.If the data used to draw the chart has only one value, as shown in the image, on the vaxis of the chart appear the axis 1 for 2 times and I don't want this.I would like the vaxis to be normal, only with one time axis number. The code used for vaxis is:
vAxis:
{
format: '#',
minValue: 0,
gridlines: {
count: 4
}
图表为:
绘制图表
任何回应表示赞赏
推荐答案
将 vAxis.ticks
设置为包含所需刻度线的数组。
数组也可以从数据中动态构建...
Set vAxis.ticks
to an array containing the tick marks needed.
The array could also be built dynamically from the data...
google.charts.load('44', {
callback: drawChart,
packages: ['corechart']
});
function drawChart() {
var data = new google.visualization.DataTable({
cols: [
{id: '', label: 'Month', type: 'string'},
{id: '', label: 'Downloads', type: 'number'},
{id: '', role: 'annotation', type: 'string'}
],
rows: [
{c:[{v: 'February'}, {v: 1}, {v: '1'}]}
]
});
var options = {
vAxis: {
format: '#',
minValue: 0,
ticks: [0, 1, 2]
}
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
这篇关于谷歌线图y轴出现2次(加倍)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文