Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The Highcharts demo you reference is a vertical bar chart of browser marketshare. When you click on one of the browsers a second vertical bar chart is displayed showing marketshare of each version of that browser. Clicking a version returns you to the previous chart.</p> <p>nvd3 models support click and hover listeners using d3's dispatcher that you can read more about on d3's github wiki here [1].</p> <p>If you browse the nvd3 source of the historicalBar chart you can see where the dispatcher is set [2].</p> <p>So you are going to write a function that is called when the 'elementClick' event is fired that accepts as a parameter the series that is being clicked. now that you know the series that is clicked, you can switch the data and have the chart redrawn.</p> <p>I hope this helps, it took me a while to track down how nvd3 uses click and hover listeners.</p> <p>here is an example of the dispatcher being used on the front page of nvd3:</p> <pre><code>chart.stacked.dispatch.on('areaClick.updateExamples', function(e) { setTimeout(function() { mainExample.update(); exampleOne.update(); //exampleTwo.update(); exampleThree.update(); }, 100); }) </code></pre> <p>[1] <a href="https://github.com/mbostock/d3/wiki/Internals#events" rel="noreferrer">https://github.com/mbostock/d3/wiki/Internals#events</a></p> <p>[2] <a href="https://github.com/novus/nvd3/blob/master/src/models/historicalBar.js#L23" rel="noreferrer">https://github.com/novus/nvd3/blob/master/src/models/historicalBar.js#L23</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload