Echarts玫瑰图

【前言】
Echarts----世界流向图 demo

【效果图】
效果图如下:
在这里插入图片描述
【CODE】
code如下:

var colorArr=["#218de0", "#01cbb3", "#85e647", "#5d5cda", "#05c5b0", "#c29927"];
var colorAlpha=['rgba(60,170,211,0.05)','rgba(1,203,179,0.05)','rgba(133,230,71,0.05)','rgba(93,92,218,0.05)','rgba(5,197,176,0.05)','rgba(194,153,39,0.05)']
option = {
    backgroundColor:"#090e36",
    grid: {
        left: -100,
        top: 50,
        bottom: 10,
        right: 10,
        containLabel: true
    },
    tooltip: {
        trigger: 'item',
        formatter: "{b} : {c} ({d}%)"
    },
    legend: {
      show:false
    },
    
    polar: {},
    angleAxis: {
        interval: 1,
        type: 'category',
        data: [],
        z: 10,
        axisLine: {
            show: false,
            lineStyle: {
                color: "#0B4A6B",
                width: 1,
                type: "solid"
            },
        },
        axisLabel: {
            interval: 0,
            show: true,
            color: "#0B4A6B",
            margin: 8,
            fontSize: 16
        },
    },
    radiusAxis: {
        min: 20,
        max: 120,
        interval: 20,
        axisLine: {
            show: false,
            lineStyle: {
                color: "#0B3E5E",
                width: 1,
                type: "solid"
            },
        },
        axisLabel: {
            formatter: '{value} %',
            show: false,
            padding: [0, 0, 20, 0],
            color: "#0B3E5E",
            fontSize: 16
        },
        splitLine: {
            lineStyle: {
                color: "#07385e",
                width: 2,
                type: "dashed"
            }
        }
    },
    calculable: true,
    series: [ {
        stack: 'a',
        type: 'pie',
        radius: '80%',
        roseType: 'radius',
        zlevel:10,
       startAngle: 100,
        label: {
            normal: {
                formatter: [ '{b|{b}}','{d|{d}%}'].join('\n'),
                rich: {
                    b: {
                        color: '#3bd2fe',
                        fontSize: 14,
                        lineHeight: 20
                    },
                    d: {
                        color: '#d0fffc',
                        fontSize: 14,
                        height: 20
                    },
                },
            }
        },
        labelLine: {
            normal: {
                show: true,
                length: 10,
                length2: 45,
                lineStyle: {
                color: '#0096b1'
                    
                }
            },
            emphasis: {
                show: false
            }
        },
        data: [{
                value: 63,
                name: '容量小设备老旧',
                 itemStyle: {
                  borderColor: colorArr[0],
                  borderWidth:2,
                  shadowBlur: 20,
                  shadowColor: "#41a8f8",
                  shadowOffsetx: 25,
                  shadowOffsety: 20,
                  color:colorAlpha[0]
                    }
            },
            {
                value: 27,
                name: '季节性企业用电',
                itemStyle: {
                  borderColor: colorArr[1],
                  borderWidth:2,
                  shadowBlur: 20,
                  shadowColor: colorArr[1],
                  shadowOffsetx: 25,
                  shadowOffsety: 20,
                  color:colorAlpha[1]
                    }
            },
            {
                value: 7,
                name: '企业用电高峰',
                itemStyle: {
                  borderColor: colorArr[2],
                  borderWidth:2,
                  shadowBlur: 20,
                  shadowColor: colorArr[2],
                  shadowOffsetx: 25,
                  shadowOffsety: 20,
                  color:colorAlpha[2]
                    }
            },
            {
                value: 13,
                name: '节假日',
                itemStyle: {
                  borderColor: colorArr[3],
                  borderWidth:2,
                  shadowBlur: 20,
                  shadowColor: colorArr[3],
                  shadowOffsetx: 25,
                  shadowOffsety: 20,
                  color:colorAlpha[3]
                    }
            },
            {
                value: 10,
                name: '临时用电',
                itemStyle: {
                  borderColor: colorArr[4],
                  borderWidth:2,
                  shadowBlur: 20,
                  shadowColor: colorArr[4],
                  shadowOffsetx: 25,
                  shadowOffsety: 20,
                  color:colorAlpha[4]
                    }
            },
            {
                value: 6,
                name: '三相用电不平衡',
                itemStyle: {
                  borderColor: colorArr[5],
                  borderWidth:2,
                  shadowBlur: 20,
                  shadowColor: colorArr[5],
                  shadowOffsetx: 25,
                  shadowOffsety: 20,
                  color:colorAlpha[5]
                    }
            }
        ]
    }, ]
}

感谢 Thanks!!!

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Vue Echarts 是一个基于 Vue.js 的 Echarts 图表组件。Echarts 是一个由百度开发的强大的数据可视化库。而玫瑰图Echarts 中的一种图表类型,用于展示各个类别在整体中的比例关系。 玫瑰图以圆形为基础,通过半径和角度的变化来展示数据。每个类别对应一个扇区,扇区的大小表示该类别在整体中的占比。扇区的角度决定了数据的大小,而半径则表示数据的值。通常,玫瑰图的半径越长,对应的数据值就越大。玫瑰图可以同时展示多个类别,并且可以通过颜色来区分各个类别。 在使用 Vue Echarts 组件时,你可以通过传递相应的数据和配置项来创建玫瑰图。数据部分包括类别名称和对应的数值,而配置项则包括图表的标题、图例、颜色等设置。你可以根据自己的需求自定义这些参数来创建符合你要展示的数据的玫瑰图。 下面是一个使用 Vue Echarts 组件创建玫瑰图的示例代码: ``` <template> <div> <v-chart :options="chartOptions"></v-chart> </div> </template> <script> import { RoseChart } from 'vue-echarts'; export default { components: { 'v-chart': RoseChart, }, data() { return { chartOptions: { title: { text: '玫瑰图', }, series: [ { type: 'pie', radius: '55%', roseType: 'angle', data: [ { value: 335, name: '类别1' }, { value: 310, name: '类别2' }, { value: 234, name: '类别3' }, { value: 135, name: '类别4' }, { value: 1548, name: '类别5' }, ], }, ], }, }; }, }; </script> ``` 以上代码中,我们通过传递一个 `chartOptions` 对象来设置玫瑰图的相关参数。其中,`title` 设置了图表的标题,`series` 设置了图表的数据系列。在 `series` 中,我们使用了 `type: 'pie'` 来指定使用饼图类型,并通过 `roseType: 'angle'` 来将饼图转化为玫瑰图。 你可以根据自己的需求修改 `chartOptions` 中的数据和配置项来创建适合你的玫瑰图。希望这个示例对你有帮助!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值