antvis/G2

饼图数据很大时候 #5986

97702573 posted onGitHub

问题描述

当饼图其中一个类目的数值比较大时,会导致饼图的颜色丢失。这个能否修复一下呢。 官方示例: import { Pie } from '@antv/g2plot';

const data = [ { type: '分类一', value: 2 }, { type: '分类二', value: 2999999900000943945 }, { type: '分类三', value: 1 }, { type: '分类四', value: 3333333 }, { type: '分类五', value: 1 }, { type: '其他', value: 53 }, ];

const piePlot = new Pie('container', { appendPadding: 10, data, angleField: 'value', colorField: 'type', radius: 0.9, label: { type: 'inner', offset: '-30%', content: ({ percent }) => ${(percent * 100).toFixed(0)}%, style: { fontSize: 14, textAlign: 'center', }, }, interactions: [{ type: 'element-active' }], });

piePlot.render();

重现链接

No response

重现步骤

https://g2plot.antv.antgroup.com/examples/pie/basic/#basic

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

Uploading iwEcAqNwbmcDAQTRCqYF0QaMBrDNql9yPVAARAV8Dp0kijgAB9MAAAAAv93vnAgACaJpbQoAC9IAIRG0.png_720x720q90.jpg…

补充说明(可选)

No response


2999999900000943945 这个数超过 js 表示的精读了,如果这种情况建议把数据处理成可以表示的范围,通过 fomatter 处理一下。

posted by pearmini over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests