如何在JavaScript中设置Google Charts图例宽度? [英] How to set Google Charts legend width in JavaScript?
本文介绍了如何在JavaScript中设置Google Charts图例宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Google JS API生成此Google折线图.如您所见,标签非常狭窄.如何使整个标签文本可见?
I am generating this Google Line Chart using the Google JS API. As you can see, the labels are very narrow. How do I make it so that the whole label text is visible?
推荐答案
Here are some samples based on the google code playground line charts. Adjusting the chartArea width option gives more space for labels:
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {curveType: "function",
width: 500, height: 400,
vAxis: {maxValue: 10},
chartArea: {width: '50%'}}
);
如果可以选择的话,还可以将标签放置在图表下方,这样可以提供更大的空间:
If it's an option, you could also position the labels beneath the chart, which gives considerably more space:
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {curveType: "function",
width: 500, height: 400,
vAxis: {maxValue: 10},
legend: 'bottom'}
);
这篇关于如何在JavaScript中设置Google Charts图例宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文