Echarts设置y轴值间隔 以及设置 barWidth : 30,//柱图宽度

需求:如图,y轴之间的距离太小,这样就太过于拥挤了,现在要修改echarts里面的属性,设置y轴值间隔让图表看上去舒服一些。

 
 

其实很多问题,真的只是因为自己没有好好的看文档,很多文档上面都写的清清楚楚的,主要是设置这段代码,max(设置y轴最大值)和splitNumber

总结一下公式就是,

max/ splitNumber=y轴值间隔

(比如将y轴200平均成5个点,每个点的间距就是40)


yAxis : [ { // 纵轴标尺固定
            type : 'value',
            scale : true,
            max : 200,
            min : 0,
            splitNumber : 5,
            boundaryGap : [ 0.2, 0.2 ]
        } ],

可以看一下修改之后的结果:比之前好很多。


 
=====================================================================================================
//宽度 图的里面的宽度设置
series : [
{
name:'做市',
type:'bar',
stack: '总量',
/*itemStyle : { normal: {label : {show: true, position: 'insideTop',textStyle:{color:'#000'}}}},*/
data:serieszs
},
{
name:'协议',
type:'bar',
stack: '总量',
barWidth : 30,//柱图宽度
/*itemStyle : { normal: {label : {show: true, position: 'insideTop',textStyle:{color:'#000'}}}},*/
data:seriesyx
}
]

猜你喜欢

转载自www.cnblogs.com/xiaoxiaoxun/p/11294323.html
今日推荐