d3多个链接的dc.js图表​​的工具提示 [英] d3-tooltips for multiple linked dc.js charts

查看:171
本文介绍了d3多个链接的dc.js图表​​的工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想修改dc.js的开箱即用的工具提示,似乎有一个解决方案使用 d3.js工具提示,例如此问题。但是,我很困惑如何实现这一点,以便为dc.js仪表板中的所有链接图修改工具提示。 GitHub代码中的示例适用于单个图形,但我目前使用六个链接图形,需要修改所有图形上的工具提示。任何帮助将不胜感激。

I'm looking to modify the out-of-the-box tooltips for dc.js, and it seems there is a solution using d3.js tooltips as in this question. However, I'm confused about how to implement this so that the tooltip is modified for all linked graphs in a dc.js dashboard. The examples in the GitHub repo lend themselves well to individual graphs, but I'm currently working with six linked graphs and need to modify tooltips on all graphs. Any help would be appreciated.

推荐答案

这是一个使用d6.tip和dc.js的好例子:

Here is a good example of using d3.tip with dc.js:

http://saraquigley.github.io/uc-trends/

http://saraquigley.github.io/uc-trends/javascript /expenses_all.js

我会做的事情不同的是


  1. chart.renderlet(function(chart){...})中应用提示(在代码末尾)的selectAlls,而不是在顶部
  2. 使用 chart.selectAll 而不是 d3 .selectAll ,以确保您只选择特定图表中的元素,而不是整个页面。
  1. do the selectAlls that apply the tips (at the end of her code) in a chart.renderlet(function(chart) { ... }) instead of at top-level, so that they react to changes in the charts.
  2. use chart.selectAll instead of d3.selectAll, for clarity and to be sure that you are only selecting elements in the particular chart rather than across the page.

希望为web /示例或常见问题解答建立示例,但现在可以使用HTH。

Hope to work up an example for web/examples or the FAQ but HTH for now.

这篇关于d3多个链接的dc.js图表​​的工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆