場景:柱狀圖實現重合並且以虛線展示
措施:代碼如下
barGap表示不同系列的柱間距離,默認為30%
表示柱子寬度的 30%
option = { xAxis: { data: ['a', 'b', 'c', 'd'], axisTick: {show: false} }, yAxis: { splitLine: {show: false} }, animationDurationUpdate: 1200, series: [{ type: 'bar', itemStyle: { normal: { color: 'transparent', barBorderColor: 'tomato', barBorderWidth:2, barBorderRadius:0, borderType:"dotted" } }, silent: true, barWidth: 40, barGap: '-100%', // 柱子重疊 data: [60, 60, 60, 60] }, { type: 'bar', barWidth: 40, z: 10, data: [45, 60, 13, 25] }] };