echarts双柱_百度echarts柱状图(二)

该博客展示了如何使用 ECharts 创建双柱状图,对比了不同数据量下的 ECharts2 和 ECharts1 的性能表现。通过多系列层叠的方式,详细设置了图表的样式,包括颜色、标签和数据标记,并提供了完整的代码示例。
摘要由CSDN通过智能技术生成

多系列层叠,个性化样式,代码如下:

option = {

title : {

text: 'ECharts2 vs ECharts1',

subtext: 'Chrome下测试数据'

},

tooltip : {

trigger: 'axis'

},

legend: {

data:[

'ECharts1 - 2k数据','ECharts1 - 2w数据','ECharts1 - 20w数据','',

'ECharts2 - 2k数据','ECharts2 - 2w数据','ECharts2 - 20w数据'

]

},

toolbox: {

show : true,

feature : {

mark : {show: true},

dataView : {show: true, readOnly: false},

magicType : {show: true, type: ['line', 'bar']},

restore : {show: true},

saveAsImage : {show: true}

}

},

calculable : true,

grid: {y: 70, y2:30, x2:20},

xAxis : [

{

type : 'category',

data : ['Line','Bar','Scatter','K','Map']

},

{

type : 'category',

axisLine: {show:false},

axisTick: {show:false},

axisLabel: {show:false},

splitArea: {show:false},

splitLine: {show:false},

data : ['Line','Bar','Scatter','K','Map']

}

],

yAxis : [

{

type : 'value',

axisLabel:{formatter:'{value} ms'}

}

],

series : [

{

name:'ECharts2 - 2k数据',

type:'bar',

itemStyle: {normal: {color:'rgba(193,35,43,1)', label:{show:true}}},

data:[40,155,95,75, 0]

},

{

name:'ECharts2 - 2w数据',

type:'bar',

itemStyle: {normal: {color:'rgba(181,195,52,1)', label:{show:true,textStyle:{color:'#27727B'}}}},

data:[100,200,105,100,156]

},

{

name:'ECharts2 - 20w数据',

type:'bar',

itemStyle: {normal: {color:'rgba(252,206,16,1)', label:{show:true,textStyle:{color:'#E87C25'}}}},

data:[906,911,908,778,0]

},

{

name:'ECharts1 - 2k数据',

type:'bar',

xAxisIndex:1,

itemStyle: {normal: {color:'rgba(193,35,43,0.5)', label:{show:true,formatter:function(p){return p.value > 0 ? (p.value +'\n'):'';}}}},

data:[96,224,164,124,0]

},

{

name:'ECharts1 - 2w数据',

type:'bar',

xAxisIndex:1,

itemStyle: {normal: {color:'rgba(181,195,52,0.5)', label:{show:true}}},

data:[491,2035,389,955,347]

},

{

name:'ECharts1 - 20w数据',

type:'bar',

xAxisIndex:1,

itemStyle: {normal: {color:'rgba(252,206,16,0.5)', label:{show:true,formatter:function(p){return p.value > 0 ? (p.value +'+'):'';}}}},

data:[3000,3000,2817,3000,0]

}

]

};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值