ant-design / ant-design-charts

A React Chart Library
https://ant-design-charts.antgroup.com/
MIT License
1.95k stars 364 forks source link

🧐[问题] 版本 @ant-design/plots@2.1.12, 使用 Treemap 一直报错 d.id is undefined #2407

Open guuuoxuuun opened 9 months ago

guuuoxuuun commented 9 months ago

🧐 版本 @ant-design/plots@2.1.12, 使用 Treemap 一直报错 d.id is undefined

💻

const defult_tree = {
  name: 'root',
  children: [
    { name: '分类 1', value: 560 },
 ......................................//此处直接复制了demo
  ],
};

const [tdata, setTdata] = useState(defult_tree);

useEffect(() => {
    getROIData({ group, account }).then(result => { 
      setTdata(result.data);
    });
  }, [group, account]);

const config = {
    data : tdata,
    colorField: 'value',
    valueField: 'value',
    scale: {
      color: {
        range: [
          '#4e79a7',
          '#f28e2c',
          '#e15759',
          '#76b7b2',
          '#59a14f',
          '#edc949',
          '#af7aa1',
          '#ff9da7',
          '#9c755f',
          '#bab0ab',
        ],
      },
    },
    legend: false,
  };

🚑 数据结构打印出来与demo是完全一样的

微信截图_20240214114148 微信截图_20240214114225

修改了value全部为正值仍然是相同错误

lxfu1 commented 9 months ago

能提供个 codesandbox 的复现吗?