coder1
coder1

Reputation: 65

How can we filter charts with map hover using dc.js and leaflet maps

I found the flash filter from this

address.If you check this you will see when mouse hover map or other charts every elemnts filtering.I want to do like this with dc.js and leaflet maps.

How can we do this?

Upvotes: 0

Views: 566

Answers (1)

Gordon
Gordon

Reputation: 20120

Here is the start of an answer, completely untested. I guarantee it will need some debugging and modification, but I hope it gives you a start.

chart.renderlet(function(chart) {
  chart.selectAll('rect').on("mouseover", function(d) {
    chart.filter(d.datum.key);
  });
});

Depending on the kind of chart, you will need to change 'rect' to whatever are the elements of the chart you want you want to hover over. You can discover this by inspecting the DOM in the developer tools of your favorite browser. For example, for geoChoropleth it will be 'g.layer0' or 'g.layer1', etc.

Hope this helps!

Upvotes: 1

Related Questions