antvis / G2Plot

:dango: An interactive and responsive charting library based on G2.
https://g2plot.antv.antgroup.com
MIT License
2.55k stars 605 forks source link

🤔 [QUESTION] 请问mix有多个折线图如何配置label #3726

Open feijihe opened 8 months ago

feijihe commented 8 months ago

🐛 Question description [Please make everyone to understand it]

配置了top: true共享顶层data的mix图表给每个plot单独配置label只有最后一个图层会生效,label好像也不支持在顶层配置。

💻 Link to minimal reproduction

链接

🏞 Expected result

期望每个图层的label都生效

🚑 Any additional [like screenshots]

feijihe commented 8 months ago

临时解决

修改node_modules/@antv/g2plot/esm/utils/geometry.js。

export function findGeomotry(view, type) {
  // return view.geometries.find(function (g) { return g.type === type });
  return view.geometries.findLast(function (g) { return g.type === type });
}

这个改动不知道为啥会有用,也不知道会不会产生其他bug。(能力有限,真看不懂源码)

feijihe commented 3 months ago

防止链接打不开,贴一张图

image