gpt4 book ai didi

javascript - 如何使用选项从 Google 图表中删除轴?

转载 作者:行者123 更新时间:2023-11-28 05:28:41 24 4
gpt4 key购买 nike

我试图隐藏右侧显示的 Y 轴值。我一直在查看谷歌文档,但不知道什么可以让我做到这一点。我假设如果该选项存在,它也会隐藏网格线。

enter image description here

var options = {
bars: 'vertical',
series: {
2: {targetAxisIndex:2},
3: {targetAxisIndex:3},
4: {targetAxisIndex:4},
5: {targetAxisIndex:5}
},
axes: {
x: {
0: { side: 'top', label: ''} // Top x-axis.
}
},
vAxis: {viewWindowMode: 'pretty'},
height: 400,
width: 900
};
var chart = new google.charts.Bar(document.getElementById('ocGraph'));
chart.draw(data, google.charts.Bar.convertOptions(options));

最佳答案

明白了,

 var options = {
bars: 'vertical',
series: {
2: {targetAxisIndex:2},
3: {targetAxisIndex:3},
4: {targetAxisIndex:4},
5: {targetAxisIndex:5}
},
axes: {
x: {
0: { side: 'top', label: ''} // Top x-axis.
},
y: {
2: { side: 'top' , label: ''},
3: { side: 'top', label: ''},
4: { side: 'top' , label: ''},
5: { side: 'top' , label: ''}
}
},
vAxis: {viewWindowMode: 'pretty'},
vAxes: {
2: {
gridlines: { count:0},
ticks: [0],
textStyle: {fontSize: 0}
},
3: {
gridlines: { count:0},
ticks: [0],
textStyle: {fontSize: 0}
},
4: {
gridlines: { count:0},
ticks: [0],
textStyle: {fontSize: 0}
},
5: {
gridlines: { count:0},
ticks: [0],
textStyle: {fontSize: 0}
}
},

关于javascript - 如何使用选项从 Google 图表中删除轴?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39907817/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com