novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.15k forks source link

How to have single common legend for two Pie Charts? #1779

Open kathir3000 opened 8 years ago

kathir3000 commented 8 years ago

I have two nvd3 pie charts in a page for comparing them. I need to have single common legend for both the charts. So by clicking on that legend both chart's state should be updated. How to implement this?

I have two chart in a view and I have hidden/ disabled legend for right side chart.

When i click on legend Q2, left side chart is getting updated but not right side chart. See image below. piechart2

I want both the chart state need to be changed on that legend click like below image piechart3

Thanks in advance.

brylie commented 8 years ago

Issue #1788 describes an idea that may be useful here, that all NVD3 charts could be built with composable components. E.g. you could create a single chart, add two pie chart elements, and then add a legend displaying details for the chart object.

The NVD3 architecture is currently somewhat component based, but the documentation may be lacking examples of how to compose custom chart types.