如何删除ANTD甜甜圈图表悬停并选择效果

发布于 2025-01-27 04:12:37 字数 989 浏览 4 评论 0原文

在 @ant-design/int的甜甜圈图中,

  1. 悬停在甜甜圈图的各个部分周围有一个黑色边界。
  2. 选择时,单个部分将从中心转移。

如何停止/控制这些行为?

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,
      content: {
        style: {
          whiteSpace: 'pre-wrap',
          overflow: 'hidden',
          textOverflow: 'ellipsis',
        },
        content: 'AntV\nG2Plot',
      },
    },
  };

In the donut chart in @ant-design/plots,

  1. There is a black border around the individual sections of the donut chart when hovered.
  2. The individual section is translated away from the center when selected.

How to stop/ control these behavior?

enter image description here

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,
      content: {
        style: {
          whiteSpace: 'pre-wrap',
          overflow: 'hidden',
          textOverflow: 'ellipsis',
        },
        content: 'AntV\nG2Plot',
      },
    },
  };

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心是晴朗的。 2025-02-03 04:12:37

处理配置中的交互

  1. 悬停在甜甜圈图的各个部分周围有一个黑色边界。

删除对象类型:'元素激活'

注意:通过在下面的代码中评论来传达删除。

 interactions: [
      ...
      // {
      //  type: 'element-active',
      // },
    ]
  1. 选择时,单个部分将从中心转移。

删除对象类型:“元素选择”'

注意:通过在下面的代码中评论来传达删除。

 interactions: [
      ...
      // {
      //  type: 'element-selected',
      // },
    ]

为了实现这两者,您可以简单地从配置对象中删除交互

Deal with interactions in config

  1. There is a black border around the individual sections of the donut chart when hovered.

Remove the object type:'element-active'

Note: Removing is conveyed by commenting out in the code below.

 interactions: [
      ...
      // {
      //  type: 'element-active',
      // },
    ]
  1. The individual section is translated away from the center when selected.

Remove the object type: 'element-selected'

Note: Removing is conveyed by commenting out in the code below.

 interactions: [
      ...
      // {
      //  type: 'element-selected',
      // },
    ]

To achieve both you can simply remove the interactions from the config object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文