echarts柱状图的背景色设置

echarts柱状图的背景色设置方法,官方推荐的例子中是又添加一组最大值来当背景(不建议),设置backgroundStyle即可(从 v4.7.0 开始支持):

series: {

                    name: '违法违规国家排行',

                    type: 'bar',

                    barWidth: '15',

                    showBackground: true,

                    backgroundStyle: {

                        color: 'rgba(110, 193, 244, 0.2)',

                    },

                    itemStyle: {

                        normal: {

                            label: {

                                show: true,

                                position: 'top',

                            },

                        },

                    },

                    data: [100, 52, 190, 134, 190, 120, 120],

                }

 

效果图:

echarts柱状图的背景色设置_第1张图片

你可能感兴趣的:(javascript,web前端,javascript)