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
tooltip 无法展示 falsy 值(null, undefined, 0)都不显示
至少应该显示 0 值,null, undefined 在数据表中也是有意义的,也应该显示。
G2 V5 版本,官方示例改了一下数据
import { Chart } from '@antv/g2'; const chart = new Chart({ container: 'container', theme: 'classic', autoFit: true, }); const data = [ { city: '杭州', value: 400, }, { city: '上海', value: 200, }, { city: '北京', value: 100, }, { city: '河北', value: 0, }, { city: '苏州', value: 500, }, { city: '海南', value: 200, }, ] chart .line() .data(data) .encode('x', 'city') .encode('y', 'value') .axis('y'); chart.render(); chart.interaction('tooltip', true)
The text was updated successfully, but these errors were encountered:
目前确实过滤了 falsy 的值,的确是不合理的,更好的做法是让用户能显示地指定什么是 falsy 的值。
// 只有 d.value 大于 10 的时候才展示 chart.interaction("tooltip", { defined: d => d.value > 10 });
Sorry, something went wrong.
目前确实过滤了 falsy 的值,的确是不合理的,更好的做法是让用户能显示地指定什么是 falsy 的值。 // 只有 d.value 大于 10 的时候才展示 chart.interaction("tooltip", { defined: d => d.value > 10 });
个人观点,从 tooltip 功能的角度讲,如实显示就行了,如果有定制需求,要么用值函数,要么就直接自定义 render。tooltip 本身配置项简单点更好维护。
pearmini
Successfully merging a pull request may close this issue.
问题描述
tooltip 无法展示 falsy 值(null, undefined, 0)都不显示
期望结果
至少应该显示 0 值,null, undefined 在数据表中也是有意义的,也应该显示。
如何重现
G2 V5 版本,官方示例改了一下数据
额外信息
The text was updated successfully, but these errors were encountered: