Echarts模板(六):馅饼图

Echarts模板(一):南丁格尔玫瑰图

Echarts模板(二):簇状柱形图

Echarts模板(三):分裂饼图

Echarts模板(四):环形图

Echarts模板(五):树状图

本人刚参加完市场调查大赛,在这个过程中为了画图试过很多软件,相比于Tableau的所见即所得,虽然操作简单,但步骤繁琐,最后我选择使用Echarts画图,它不仅操作简单,而且图像美观,只需要一点点代码基础就能实现。接下来,我向大家分享以下我用到的几个图的模板代码,你在使用的时候均可通过以下代码进行修改,由于本人没有学过JS,不对的地方还请大家多多指教

option = {
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            magicType : {
                show: true,
                type: ['pie', 'funnel']
            },
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    backgroundColor: '#FDFEFE',
    title: {
        text: '',
        left: 'center',
        top: 20,
        textStyle: {
            color: '#ccc'
        }
    },

    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },

    visualMap: {
        show: false,
        min: 30,
        max: 130,
        inRange: {
            colorLightness: [0, 1]
        }
    },
    series : [
        {
            name:'访问来源',
            type:'pie',
            radius : '75%',
            center: ['50%', '50%'],
            
            data:[
                {value:93, name:'年卡'},
                {value:82, name:'季卡'},
                {value:62, name:'半年卡'},
                {value:62, name:'月卡'},
                {value:53, name:'单次体验卡'}
            ].sort(function (a, b) { return a.value - b.value; }),
            roseType: 'radius',
            label: {
                normal: {
                    formatter: '{b}({d}%)',
                    textStyle: {
                        color: 'rgba(0, 0, 0)',
                        fontSize:20
                    }
                }
            },
            labelLine: {
                normal: {
                    lineStyle: {
                        color: 'rgba(0, 0, 0, 0.3)'
                    },
                    smooth: 0.2,
                    length: 10,
                    length2: 20
                }
            },
            itemStyle: {
                normal: {
                    color: '#c23531',
                    shadowBlur: 200,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            },
            animationType: 'scale',
            animationEasing: 'elasticOut',
            animationDelay: function (idx) {
                return Math.random() * 200;
            }
        }
    ]
};

以下是效果图

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值