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
文档不够详细,以前没使用过G2/G6,现在来使用F2看到demo,但是demo里面的看到很多参数去F2的文档里面找不到。 对我来说,初学使用还有些困难。 例如这段 tooltip的使用我在文档上也没有找到。
chart.tooltip({ custom(obj) { const legend = chart.get('legendController').legends.top[0]; const tooltipItems = obj.items; const legendItems = legend.items; const map = {}; legendItems.map(item => { map[item.name] = _.clone(item); }); tooltipItems.map(item => { const { name, value } = item; if (map[name]) { map[name].value = value; } }); legend.setItems(Object.values(map)); }, onHide(tooltip) { const legend = chart.get('legendController').legends.top[0]; legend.setItems(chart.getLegendItems().country); } });
非常感谢! 辛苦了!大牛们!
The text was updated successfully, but these errors were encountered:
感谢建议,这个代码确实比较生涩,我会尽量补全 api 并且优化接口的。很快就会在 AntV https://antv.alipay.com/ 官网上线
这里先给您简单解释下:
chart.tooltip({ custom(obj) { const legend = chart.get('legendController').legends.top[0]; // 获取顶部图例 const tooltipItems = obj.items; // custom 会返回tooltip 的内容项 const legendItems = legend.items; // 获取图例的内容项 const map = {}; // 将 tooltip 和图例结合,name: value legendItems.map(item => { map[item.name] = _.clone(item); }); tooltipItems.map(item => { const { name, value } = item; if (map[name]) { map[name].value = value; } }); legend.setItems(Object.values(map)); }, onHide(tooltip) { const legend = chart.get('legendController').legends.top[0]; // 获取顶部图例 legend.setItems(chart.getLegendItems().country); // tooltip 消失时图例重置 } });
Sorry, something went wrong.
No branches or pull requests
文档不够详细,以前没使用过G2/G6,现在来使用F2看到demo,但是demo里面的看到很多参数去F2的文档里面找不到。
对我来说,初学使用还有些困难。
例如这段 tooltip的使用我在文档上也没有找到。
非常感谢!
辛苦了!大牛们!
The text was updated successfully, but these errors were encountered: