G2 icon indicating copy to clipboard operation
G2 copied to clipboard

当data/options变更后图例的顺序出现异常

Open CullenNg opened this issue 1 year ago • 0 comments

问题描述

当data/options(scale)变更后图例的顺序出现了异常,scale.color.domain 配置的顺序失效

重现链接

https://codesandbox.io/p/sandbox/xmgl3j

重现步骤

  1. 正常加载数据A,此时的图例顺序是正常的 image

  2. 切换成数据B并更新了scale.color配置,因为数据B只有1组数据,目前为止一切正常

scale: {
  color: {
    domain: ["无情感"],
    range: ["#65789B"],
  }
}

image

  1. 再切切回数据A并更新了scale.color配置,图例的顺序就错了
scale: {
  color: {
    domain: ["正面", "负面", "中性", "无情感"],
    range: ["#60DDA9", "#F08A8A", "#5B8FF9", "#65789B"],
  }
}

image 正确的顺序应该是如下: image

预期行为

更新数据+options.scale之后的图例顺序正常 image

平台

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

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

CullenNg avatar Oct 09 '24 06:10 CullenNg