We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
按照上述实例中的代码书配置useHtml: true后,无法渲染出html格式的图例
预览图:
上图中并未出现html元素。
The text was updated successfully, but these errors were encountered:
该问题有临时解决方案, 图例出现的前提条件:必须在G2中geomType必须配置color的field参数才能渲染出对应的图例。
G2
geomType
field
这个问题,貌似出自color的field参数对应的data值为数字的情况,如果是字符串则没有该问题。
color的field参数对应的data值为数字的情况
将示例中设置color的代码改为:
color
chart .area() .position("time*loadRate") .color("loadRate", () => "l(45) 0:#FBFDFF 1:#0091FF");
这样最后的渲染图为:
上图渲染出了对应的图例设置的HTML元素。
我自己后续经过多次测试,发现只要设置color的field,在源数据的值为数字的情况下这种情况100%出现。
color的field,在源数据的值为数字
在需要使用一个值大于或小于使用其它颜色时,不能直接使用数字类型的field判断后返回颜色,必须要设置单独的字符串字段来判断。
Sorry, something went wrong.
G2 4.x 中已经移除这个 html legend。 这种情况可以在图表外部使用 div 去绘制。然后点击之后调用 chart.filter 去过滤数据即可。
ref: #2954
No branches or pull requests
Reproduction link
Steps to reproduce
按照上述实例中的代码书配置useHtml: true后,无法渲染出html格式的图例
预览图:
上图中并未出现html元素。
The text was updated successfully, but these errors were encountered: