echart 不同颜色(柱状图)

echart 不同颜色(柱状图)
强烈推介IDEA2021.1.3破解激活,IntelliJ IDEA 注册码,2021.1.3IDEA 激活码  

大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说echart 不同颜色(柱状图),希望能够帮助大家进步!!!

var option = {
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [
                {
                    type: 'category',
                    data: DATA.xData,
                    axisTick: {
                        alignWithLabel: true
                    }
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    name: count
                }
            ],
            series: [
                {
                    name: count,
                    type: 'bar',
                    barWidth: '60%',
                    itemStyle: { normal: { color: function(params) {
                               var colorList = ["#3398db", "#434348", "#90ed7d", "#f7a35c", "#61a0a8", "#61a0a8", "#91c7ae", "#2f4554"]; return colorList[params.dataIndex] } } },
                    label: {
                        normal: {
                            show: true,
                            position: 'top'
                        }
                    },
                    data: DATA.yData
                }
            ]
        };

 

转载于:https://www.cnblogs.com/nelsonlei/p/11540911.html

本文来源weixin_30595035,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/29268

发表评论