Welcome

首页 / 脚本样式 / Echarts / echarts的图例富文本设置

// 配置项,只展示关键信息


const options = {

  legend: {

    formatter: function (name) {

      return [

        `{name|${name}}{percent|30%}`,

        "{num|300}",

        `{others|others}`,

      ].join("\n");

    },

    textStyle: {

      rich: {

        name: {

          fontSize: 12,

        },

        percent: {

          color: "#77b9c3",

        },

        num: {

          fontSize: 20,

          color: "#bd8776",

          padding: [10, 0],

        },

        others: {},

      },

    },

  },

};