首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何删除蚂蚁设计甜甜圈图中的图例

如何删除蚂蚁设计甜甜圈图中的图例
EN

Stack Overflow用户
提问于 2022-05-08 04:56:01
回答 1查看 667关注 0票数 0

我不想让我的甜甜圈图上的传说出现在@ant设计/情节里。

我尝试过在图表配置的统计中传递legend:false

代码语言:javascript
复制
const config = {
    appendPadding: 10,
    data,
    angleField: 'value',
    colorField: 'type',
    radius: 1,
    innerRadius: 0.6,
    label: {
      type: 'inner',
      offset: '-50%',
      content: '{value}',
      style: {
        textAlign: 'center',
        fontSize: 14,
      },
    },
    interactions: [
      {
        type: 'element-selected',
      },
      {
        type: 'element-active',
      },
    ],
    statistic: {
      title: false,
      legend:false,
      content: {
        style: {
          whiteSpace: 'pre-wrap',
          overflow: 'hidden',
          textOverflow: 'ellipsis',
        },
        content: 'AntV\nG2Plot',
      },
    },
  };

EN

回答 1

Stack Overflow用户

发布于 2022-05-08 05:12:48

移动图例:false to config对象

您应该直接在配置对象中使用legend:false,而不是在统计对象中使用。

下面的代码将根据需要从甜甜圈图中删除图例。

代码语言:javascript
复制
const config = {
    legend:false,
    appendPadding: 10,
    data,
    angleField: 'value',
    colorField: 'type',
    radius: 1,
    innerRadius: 0.6,
    label: {
      type: 'inner',
      offset: '-50%',
      content: '{value}',
      style: {
        textAlign: 'center',
        fontSize: 14,
      },
    },
    interactions: [
      {
        type: 'element-selected',
      },
      {
        type: 'element-active',
      },
    ],
    statistic: {
      title: false,
      content: {
        style: {
          whiteSpace: 'pre-wrap',
          overflow: 'hidden',
          textOverflow: 'ellipsis',
        },
        content: 'AntV\nG2Plot',
      },
    },
  };
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72158174

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档