【问题标题】:How i can display values on PIE chart in angular ? i am using ngx-echarts我如何在 PIE 图表上以角度显示值?我正在使用 ngx-echarts
【发布时间】:2021-08-10 10:15:28
【问题描述】:

这是我的 echarts 选项,我不知道在哪里添加选项以在饼图上显示我的数据值。或任何指标来显示没有悬停事件的值。

 this.options = {
  backgroundColor: this.eTheme.bg,
  tooltip: {
    trigger: 'item',
    formatter: '{b} : {c}',
  },
  legend: {
    orient: 'vertical',
    left: 'left',
    data: [],
  },
  series: [
    {
      name: 'Users',
      type: 'pie',
      radius: '50%',
      center: ['50%', '70%'],
      data: [],
    },
  ],
};

my pie chart

【问题讨论】:

    标签: angular echarts ngx-echarts


    【解决方案1】:

    没有直接在图表上显示值的选项,您必须使用标签格式化程序来执行此操作。

    例如:

     this.options = {
      backgroundColor: this.eTheme.bg,
      tooltip: {
        trigger: 'item',
        formatter: '{b} : {c}',
      },
      legend: {
        orient: 'vertical',
        left: 'left',
        data: [],
      },
      series: [
        {
          name: 'Users',
          type: 'pie',
          label: {
              formatter: '{a|{a}}{abg|}\n{hr|}\n  {b|{b}:}{c}  {per|{d}%}  '
          },
          radius: '50%',
          center: ['50%', '70%'],
          data: [],
        },
      ],
    };
    

    您可以根据需要调整格式化程序。

    【讨论】:

    • 我明白了,非常感谢,没关系,我只需要显示值而不在图表上进行悬停事件
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-09
    • 2018-06-28
    • 2020-01-18
    • 1970-01-01
    • 2021-10-17
    • 1970-01-01
    相关资源
    最近更新 更多