Skip to content Skip to sidebar Skip to footer

Dynamically New Dimensions With D3 JS Parallel Sets

Hi i'm trying to dynamically change the dimensions of my parallel set chart. http://www.jasondavies.com/parallel-sets/ var chart = d3.parsets() .dimensions(['Survived', 'Sex', 'A

Solution 1:

Your problem is here:

var vis = d3.select("#vis").append("svg")

This appends a new <svg> element. So if you do this every time you change a dimension, you'll get another chart.

Instead, you can move this append outside of your changedimensions function, and simply reference the vis variable when updating the chart:

var vis = d3.select("#vis").append("svg")
// …

function changedimensions() {
  // …
  vis.call(chart);
}

I haven't tested updating a chart in-place very much, but do let me know if you encounter any further issues.


Post a Comment for "Dynamically New Dimensions With D3 JS Parallel Sets"