echarts 餅狀圖顏色漸變


series: [
          {
            name: "完成率",
            type: "pie",
            radius: ["60%", "87%"],
            avoidLabelOverlap: false,
            itemStyle :{
                normal : {
                    label : {
                        show : true,
                       position : 'center',
                        formatter : this.correctRate + "%",
                        textStyle : {
                            color : '#3D414B',
                            fontSize : '30',
                            fontFamily : '微軟雅黑',
                            fontWeight : 'bold'
                        }
                    },
                    labelLine : {
                        show : false
                    }
                }
            },
            data: [
              {
                value: 100-this.correctRate,
                name: "未完成"
              },
              {
                value: this.correctRate,
                name: "完成",
                itemStyle: {
                    normal: {//顏色漸變
                        color: new echarts.graphic.LinearGradient(
                            0, 0, 0, 1,
                            [
                                {offset: 0, color: '#0095FF'},
                                {offset: 0.5, color: '#0CB9FF'},
                                {offset: 1, color: '#0095FF'}
                            ]
                        )
                    }
                }
              }
            ]
            
          }
        ],

效果圖如下:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM