echarts全局设置饼图的颜色

🌷第一步  在js文件中写入你需要的颜色 这里的颜色也可以写渐变的

🌷下一步  在main.is中引用全局挂载

 🌷最后一步  在初始化的时候加一个macarons即可



🌷第一步  在js文件中写入你需要的颜色 这里的颜色也可以写渐变的

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['exports', 'echarts'], factory);
  } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
    factory(exports, require('echarts'));
  } else {
    factory({}, root.echarts);
  }
}(this, function (exports, echarts) {
  var log = function (msg) {
    if (typeof console !== 'undefined') {
      console && console.error && console.error(msg);
    }
  };
  if (!echarts) {
    log('ECharts is not Loaded');
    return;
  }
  echarts.registerTheme('macarons', {
    "color": [
      "rgba(51, 87, 217, 1)",
      "rgba(55, 197, 237, 1)",
      "rgba(105, 210, 179, 1)",
      "rgba(213, 237, 91, 1)",
      "rgba(250, 142, 46, 1)",
      "rgba(255, 71, 71, 1)",
      "rgba(184, 88, 177, 1)",
      "rgba(100, 141, 221, 1)",
      "rgba(35, 172, 202, 1)",
      "rgba(101, 167, 251, 1)",
      "rgba(90, 187, 154, 1)",
      "rgba(254, 219, 73, 1)",
      "rgba(255, 110, 48, 1)",
      "rgba(231, 22, 36, 1)",
      "rgba(202, 22, 135, 1)",
      "rgba(45, 162, 232, 1)",
      "rgba(23, 206, 235, 1)",
      "rgba(73, 202, 157, 1)",
      "rgba(254, 184, 72, 1)",
      "rgba(250, 130, 111, 1)",
      "rgba(236, 100, 140, 1)",
      "rgba(146, 135, 236, 1)",
      "rgba(58, 177, 229, 1)",
      "rgba(156, 219, 130, 1)",
      "rgba(78, 229, 225, 1)",
      "rgba(255, 159, 82, 1)",
      "rgba(253, 99, 95, 1)",
      "rgba(115, 121, 223, 1)",
      "rgba(214, 98, 171, 1)",
      "rgba(95, 104, 232, 1)",
    ],
 
  });
}));

🌷下一步  在main.is中引用全局挂载

import macarons from "@/utils/macarons.js"
Vue.use(macarons)

 🌷最后一步  在初始化的时候加一个macarons即可

通过 echarts.registerTheme(name, theme) 方法注册到 echarts 中。在这里,name 是主题的名称,theme 是主题的配置信息对象。

  • 9
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值