dc-js / dc.js

Multi-Dimensional charting built to work natively with crossfilter rendered with d3.js
Apache License 2.0
7.42k stars 1.81k forks source link

Filter items in pie chart legend #666

Open vadimzv opened 10 years ago

vadimzv commented 10 years ago

Here is the example http://vzv.ucoz.ru/dc/pietrouble.html There are two pie charts (master-details): categories and products. Each category can have several products. Products pie chart has a legend. When user clicks on some category the products chart shows only products of chosen category. But legend still contains other products which don't belong to this category. The desired behaviour can be achieved by changing _chart.data method inside capMixin, for example you can filter all items with value > 0:

var topRows = group.top(_cap).filter(function(entry) { return entry.value > 0; });
gordonwoodhull commented 9 years ago

Sorry for the slow response. It's a good idea. The link died; if you can create a new example (maybe a jsfiddle?), that would be helpful.

SKisContent commented 9 years ago

Hi, I feel like I'm facing a similar issue, though I'm not sure whether it is the same question. Please take a look at this fiddle: http://jsfiddle.net/savalou/bhLh2nyp/

I want the pie charts without the cities Austin and Wichita listed in the legend, it doesn't seem possible. Also, "Austin: 0" shows up when the mouse is over the labels in the chart, for example over "Indiana".