antvis/G2

V5版本设置使用回调函数设置style,回调函数参数错误 #5936

chi-gao posted onGitHub

问题描述

我使用最新版本的G2绘制图表时,发现使用回调函数动态设置style时,回调函数的三个参数都返回了整个数组,而不是单个项目的值。与文档不一致。 文档链接:https://g2.antv.antgroup.com/manual/core/style image

重现链接

https://codesandbox.io/p/sandbox/bold-glitter-wpyx6l?file=%2Findex.ts%3A26%2C45

重现步骤

运行Demo,可以参考下console.log打印出来的值。 image

预期行为

我理解回调函数应该作用于数组中的每一项, 基于单项中的特定值设置不同的样式, 而不是作用于整个数组。

平台

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

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


柱形图返回的是数组每一项,折线图返回的是数组,因为折线图的一条线是数组中的数据绘制的。

posted by hustcc over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests