Search code examples
javascriptd3.jsparallel-coordinates

Fix YAxis Range in Parcoord.js for all the parallel coordinates


I have a normalized data, but parallel coordinate is giving YAxis range according to individual axis range. I want to fix it all the aixs between 0-1 say. I cannot find where to fix the yscale in parcoord.js function which is autoscale for now I guess.

pc = d3.parcoords()("#example")
      .data(data)
      .bundlingStrength(0) // set bundling strength
      .smoothness(0)
      .showControlPoints(false)
      .mode("queue")         
      .render()
      .color(color) // ENABLE IF YOU WANT TO HAVE COLOR WRT AREA

      .composite("darken")
      .alpha(0.85)
      .brushMode("1D-axes-multi")  // enable brushing
      .interactive() // command line mode
      .reorderable()
      .updateAxes()

Solution

  • You can simply use the function .commonScale() before rendering.. So your code will look like

    pc = d3.parcoords()("#example")
          .data(data)
          .bundlingStrength(0) // set bundling strength
          .smoothness(0)
          .showControlPoints(false)
          .mode("queue")
          .commonScale()
          .render()
          .color(color) // ENABLE IF YOU WANT TO HAVE COLOR WRT AREA
          .composite("darken")
          .alpha(0.85)
          .brushMode("1D-axes-multi")  // enable brushing
          .interactive() // command line mode
          .reorderable()
          .updateAxes()