本文介绍了长名称的条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个相当简单的条形图。 问题是,我应该有相当长的名称
I have an quite simple bar chart. http://jsfiddle.net/6m2t6/3/ The problem is that I should have quite long names of LPU in my app and they overlap each other as you can see in fiddle.
data = '[{"lpu":"Some very Long Name (VERY VERY LONG) #1","amount":"1"},{"lpu":"Some very Long Name (VERY VERY LONG) #2","amount":"0"},{"lpu":"Some very Long Name (VERY VERY LONG) #3","amount":"0"},{"lpu":"Some very Long Name (VERY VERY LONG)","amount":"1"}]';
阻止它重叠和有可能查看全名的最好方法是什么? p>
What is the best way to prevent it from overlaping and to have possibility to view full name?
推荐答案
您应该在x轴上旋转标签。
You should rotate the labels on the x axis.
一个伟大的博客文章:
This is a great blog post on that: http://www.d3noob.org/2013/01/how-to-rotate-text-labels-for-x-axis-of.html
还请记住在图表底部放置更多空间,为您的标签留下空间。
Also remember to put more space on the bottom of the chart to leave room for your labels
希望这有助于。
这篇关于长名称的条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!