Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【V5】Legend Marker 自定义 string 的时候不生效 #5316

Closed
BinghuiXie opened this issue Jul 16, 2023 · 0 comments
Closed

【V5】Legend Marker 自定义 string 的时候不生效 #5316

BinghuiXie opened this issue Jul 16, 2023 · 0 comments

Comments

@BinghuiXie
Copy link
Contributor

  • G2 Version:
  • Platform:
  • Mini Showcase(like screenshots):
  • CodePen Link:

如图所示
image
配置 itemMarker 为字符串的时候图例 marker 不生效。

根据官方文档,itemMarker 只支持 DisplayObject 或者对应的函数,但是默认值又给了一个 circle
image
如果没有一些内置的 marker,通过 DisplayObject 或者函数的形式实现一个不同样式的 marker 是否成本太高?
image
官方 demo 有一个是设置了 string 类型的 itemMarker,也没有展示出来

PS:
看了下代码,问题应该在 legendCategory.ts 这个文件里面
20230716203509_rec_

这里在拷贝的时候,style 的优先级是最高的,会覆盖 legendStyle 的同名属性,而由于自己配置的 itemMarker 会被解构在 style 里面;而在前一步给 legendStyle 推断 marker shape(inferItemMarker) 的时候,会生成同名的 legendMarker 函数。
因此 legendStyle 里面的会被覆盖

image

在实际绘制的时候,会直接 document.createElement('point'),所以不会生效

@antvis antvis locked and limited conversation to collaborators Jul 17, 2023
@pearmini pearmini converted this issue into discussion #5317 Jul 17, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant