在 Google 图表中设置图例和轴的格式
我是 Google 图表新手,无法通过图表周围的文本获得良好的结果。
这就是我的图表的外观:
如您所见,它确实切割了水平轴和传说,所以最后的结果并不如想象的那么好。有办法解决这个问题吗?我一直在阅读官方文档和这里的一些帖子,但我还没有找到方法来做到这一点。
回顾:我们如何修改图例或轴文本以使它们完全可见?
I'm new with Google Charts and I am not able to obtain a fine result with the texts surrounding the graph.
This is how my chart looks:
As you can see, it does cut both Horizontal-Axis and Legends, so the final result is not as good as It could be. Is there a way to solve this? I've been reading the official documentation and some posts from here, but I haven't found the way to do this.
Recap: How do we modify the legend or the axis texts so they are fully visible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过一段时间的实验,我敢说不可能选择可以显示图例或轴上的文字的多少部分。
然而,您可以调整它们的大小和位置,这样您或多或少就能得到我们想要的东西。
这是可以做的:
我还把图像放大了一点,这样它就可以毫无问题地适合 x 轴(还可以选择缩小其文本)。
所以这样做,这就是你得到的:
After some time experimenting, I daresay it is not posible to choose how much part of the words on legend or axis you can show.
However, you can play with their sizes and position so you get -more or less- what we were looking for.
This is what can be done:
I've also made the image a little bit bigger so it fits the x-axis without problems (There was also the option of making its text smaller).
So doing this, this is what you get:
它基本上是关于设置图表区域与宽度/高度。
ref https://stackoverflow.com/a/6870732/661584
另外,正如@ArcDare所说,使用其他可用的样式选项,例如如字体大小等
Its basically about setting your chart area vs width / height.
ref https://stackoverflow.com/a/6870732/661584
Also as @ArcDare says using the other available styling options such as font size etc
对于优化的图表区域,
技巧是设置 axis textStyle fontsize 可以更好地将图例放置在图表底部,因为图表区域约为 60-70%
随意使用我的自定义 Google Charts 插件来创建这两个图表和表格。
https://github.com/cosmoarunn/gapiExt
For optmized chart area,
The trick is setting axis textStyle fontsize will enable better placement of legend on the bottom of the chart as the chart Area is about 60-70%
Feel free to use my custom Google Charts plugin which creates both chart and table.
https://github.com/cosmoarunn/gapiExt