学无先后,达者为师

网站首页 编程语言 正文

自定义设置echarts label里的颜色

作者:酒渣 更新时间: 2023-07-13 编程语言

自定义echarts label里的颜色

在这里插入图片描述

在这里插入图片描述

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [120, 200, 150, 80, 70, 110, 130],
      type: 'bar',
      label:{
        show: true,
        formatter: function (params){
          console.log(params)
          if (params.value > 100){
            return '{a|'+ params.value +'}'
          } else {
            return '{b|'+ params.value +'}'
          }
        },
        rich: {
          a: {
            color: "#ff0000",
            fontSize: 20,
            },
          b: {
            color: '#fff',
            fontSize: 20,
          }
        }
      }
    }
  ]
};

原文链接:https://blog.csdn.net/weixin_40923558/article/details/131665501

  • 上一篇:没有了
  • 下一篇:没有了
栏目分类
最近更新