Welcome

首页 / 脚本样式 / Echarts / echarts柱状图颜色渐变效果和设置宽度

series: [{

        name: '威胁值',

        type: 'bar',

        barWidth:70,

        data: [30,49,26, 60, 26],        //数据

        itemStyle: {

            normal: {

                color: new echarts.graphic.LinearGradient(

                    0, 0, 0, 1,

                    [

                        {offset: 0, color: '#06B5D7'},                   //柱图渐变色

                        {offset: 0.5, color: '#44C0C1'},                 //柱图渐变色

                        {offset: 1, color: '#71C8B1'},                   //柱图渐变色

                    ]

                )

            },

            emphasis: {

                color: new echarts.graphic.LinearGradient(

                    0, 0, 0, 1,

                    [

                        {offset: 0, color: '#71C8B1'},                  //柱图高亮渐变色

                        {offset: 0.7, color: '#44C0C1'},                //柱图高亮渐变色

                        {offset: 1, color: '#06B5D7'}                   //柱图高亮渐变色

                    ]

                )

            }

        },

    }]