echarts柱状图的背景色设置

时间:2024-03-30 10:41:07

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

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柱状图的背景色设置