vue echarts仪表盘渐变色


效果如图

 

 

    // this.$echarts 为 echarts对象,该代码是使用在vue中的
       let option4 = {
            series: [
                {
                type: 'gauge',
                center: ['40%', '60%'],
                startAngle: 200,
                endAngle: -20,
                min: 0,
                max: 60,
                splitNumber: 7,
                itemStyle: {
                    color: new this.$echarts.graphic.LinearGradient(0,0,1,0,[
                        {
                            offset: 0.1,
                            color: "#FFC600"
                        },
                        {
                            offset: 0.6,
                            color: "#30D27C"
                        },
                        {
                            offset: 1,
                            color: "#0B95FF"
                        }
                    ]),
                },
                progress: {
                    show: true,
                    width: 5
                },
                pointer: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        width: 30,
                        color:'#FFAB91'
                    }
                },
                axisTick: {
                    distance: -45,
                    splitNumber: 9,
                    lineStyle: {
                        width: 1,
                        color: new this.$echarts.graphic.LinearGradient(0,0,1,0,[
                            {
                                offset: 0.1,
                                color: "#FFC600"
                            },
                            {
                                offset: 0.6,
                                color: "#30D27C"
                            },
                            {
                                offset: 1,
                                color: "#0B95FF"
                            }
                        ]),
                    }
                },
                splitLine: {
                    distance: -52,
                    length: 11,
                    lineStyle: {
                        width: 2,
                        color: new this.$echarts.graphic.LinearGradient(0,0,1,0,[
                            {
                                offset: 0.1,
                                color: "#FFC600"
                            },
                            {
                                offset: 0.6,
                                color: "#30D27C"
                            },
                            {
                                offset: 1,
                                color: "#0B95FF"
                            }
                    ]),
                    }
                },
                axisLabel: {
                    distance: -20,
                    color: new this.$echarts.graphic.LinearGradient(0,0,1,0,[
                            {
                                offset: 0.1,
                                color: "#FFC600"
                            },
                            {
                                offset: 0.6,
                                color: "#30D27C"
                            },
                            {
                                offset: 1,
                                color: "#0B95FF"
                            }
                        ]),
                    fontSize: 0
                },
                anchor: {
                    show: false
                },
                title: {
                    show: true
                },
          // 图中的34%是我另外添加的,把下面的show设置为true可以显示自带的数字
                detail: {
                    valueAnimation: true,
                    width: '60%',
                    lineHeight: 40,
                    borderRadius: 8,
                    offsetCenter: [0, '-15%'],
                    fontSize: 10,
                    fontWeight: 'bolder',
                    formatter: '{value}',
                    color: '#FFAB91',
                    show:false
                },
                data: [
                    {
                        value: 100
                    }
                ]
                }
            ]
        };    

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM