有时候产品会对UI界面一些要求,比如下面这个,解决办法也很简单,就是添加一些配置参数。

在series配置项中配置label、labelLine、labelLayout参数就好了

  series: [
    {
      name: 'Access From',
      type: 'pie',
      radius: '50%',
      data: [
        { value: 1048, name: 'Search Engine' },
        { value: 735, name: 'Direct' },
        { value: 580, name: 'Email' },
        { value: 484, name: 'Union Ads' },
        { value: 300, name: 'Video Ads' }
      ],
      // 重点配置项 --->
      label: {
        padding: [0, -40],
      },
      labelLine: {
        length: 10,
        length2: 50,
      },
      labelLayout: {
        verticalAlign: "bottom",
        dy: -10,
      },
      // <---
    }
  ]

Logo

更多推荐