echarts 修改图形的主题颜色

1.下载echarts

2.在html页面引入echarts相应的js文件

<script src="../../node_modules/echarts/dist/echarts.min.js"></script>
<script src="../../node_modules/echarts-gl/dist/echarts-gl.min.js"></script>

3.定义图形节点

 <div id="pie" style="width: 700px;height:400px;"></div>

4.接入数据

 // 基于准备好的dom,初始化echarts实例
    var Pie = echarts.init(document.getElementById('pie'));
    // 使用刚指定的配置项和数据显示图表。
    Pie.setOption({
        title: {
            text: '正常、异常、严重隐患一览',
            left: 'center'
        },
        animation: false,
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}: {c} ({d}%)'
        },
        legend: {
            // orient: 'vertical',
            // top: 'middle',
            bottom: 10,
            left: 'center',
            data: ['正常', '异常', '严重']
        },
        series: [
            {
                name: '企业',
                type: 'pie',
                radius: ['40%', '55%'],
                label: {
                    formatter: '{a|{a}}{abg|}\n{hr|}\n  {b|{b}:}{c}  {per|{d}%}  ',
                    backgroundColor: '#eee',
                    borderColor: '#aaa',
                    borderWidth: 1,
                    borderRadius: 4,
                    // shadowBlur:3,
                    // shadowOffsetX: 2,
                    // shadowOffsetY: 2,
                    // shadowColor: '#999',
                    // padding: [0, 7],
                    rich: {
                        a: {
                            color: '#999',
                            lineHeight: 22,
                            align: 'center'
                        },
                        // abg: {
                        //     backgroundColor: '#333',
                        //     width: '100%',
                        //     align: 'right',
                        //     height: 22,
                        //     borderRadius: [4, 4, 0, 0]
                        // },
                        hr: {
                            borderColor: '#aaa',
                            width: '100%',
                            borderWidth: 0.5,
                            height: 0
                        },
                        b: {
                            fontSize: 16,
                            lineHeight: 33
                        },
                        per: {
                            color: '#eee',
                            backgroundColor: '#334455',
                            padding: [2, 4],
                            borderRadius: 2
                        }
                    }
                },
                data: [
                    {value: lastzhengqiye, name: '正常'},
                    {value: lastyichangqiye, name: '异常'},
                    {value: lastyanqiye, name: '严重隐患'}

                ]
            }
        ]
    })

.5.效果

6.在节点后面加入‘’light'

var Pie = echarts.init(document.getElementById('pie'),'light');

7.效果

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值