gpt4 book ai didi

google-visualization - 如何在 JavaScript 中设置 Google 图表图例宽度?

转载 作者:行者123 更新时间:2023-12-03 07:38:33 25 4
gpt4 key购买 nike

我正在使用 Google JS API 生成此 Google 折线图。正如您所看到的,标签非常狭窄。如何使整个标签文本可见?

enter image description here

最佳答案

以下是一些基于 google code playground line charts 的示例。调整图表区域宽度选项为标签提供更多空间:

new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {curveType: "function",
width: 500, height: 400,
vAxis: {maxValue: 10},
chartArea: {width: '50%'}}
);

如果可以选择,您还可以将标签放置在图表下方,这样可以提供更多空间:

new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {curveType: "function",
width: 500, height: 400,
vAxis: {maxValue: 10},
legend: 'bottom'}
);

关于google-visualization - 如何在 JavaScript 中设置 Google 图表图例宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6869967/

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