Incubator-echarts: echart3 面积图/折线图 x轴显示不完全

Created on 2 Mar 2016  ·  12Comments  ·  Source: apache/incubator-echarts

image

如图,已经预留了足够的Grid,x轴是02-19到02-26,总共8天。如果图够大,8天全部显示是可以的,但图表小的时候,echart会自动平均的隐藏中间的部分x轴,而像8这类的数没法整除出平均的分段值,导致最后一天显示不出来,这种情况可以通过配置来避免吗?

enhancement

Most helpful comment

在xAxis项加上axisLabel:{interval:0,rotate:45}试试

All 12 comments

@zhump 这个似乎没用,遇到无法算出平均分段的值时,还是会像1楼的图一样显示不全。
我觉得理想情况应该是无论如何最后一格都强行闭合,像这样:
image

在xAxis项加上axisLabel:{interval:0,rotate:45}试试

@lei1992 @Coffcer : lei1992的方法很不错,下面是我的解决方案。
axisLabel:{interval:0,rotate:45}中的rotate值可以根据图表x轴labels的长度来修改旋转角度,这样图标的显示会更灵活些。

@yugasun 旋转后文字被截掉了,有办法设置 x 轴 label 的高度吗?

@wm370857724 可以试试在 grid 中设置一下 bottom

grid: {
    bottom: '8%'
}

ECharts 3.5.2 版本起,支持 axisLabel.showMinLabel 以及 axisLabel.showMaxLabel,分别用来控制第一个和最后一个标签是否强制显示,设为 true 则强制显示。

最后一个数据点也显示不出来 该怎么设置

@Smile-lrn 可以使用 series-line.showAllSymbol 配置来显示所有数据点。

设置了 itemStyle : { normal: {label : {show: true}}}, data: [], type: 'line', showAllSymbol: true, //标注所有数据点, 无效

请点击上面的api链接,正确的进行配置。

在 2018-03-12 15:04:22,"Yuga Sun" notifications@github.com 写道:

请点击上面的api链接,正确的进行配置。


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

谢谢啦 已经解决了

Was this page helpful?
0 / 5 - 0 ratings