syntagmatic / parallel-coordinates

A d3-based parallel coordinates plot in canvas. This library is no longer actively developed.
http://syntagmatic.github.com/parallel-coordinates/
Other
511 stars 211 forks source link

Dimension label positions #298

Closed jmgelman closed 8 years ago

jmgelman commented 8 years ago

It seems like the dimension title positions are hard-coded to be at the top of the axes:

// Add an axis and title.
  g.append("svg:g")
      .attr("class", "axis")
      .attr("transform", "translate(0,0)")
      .each(function(d) { d3.select(this).call( pc.applyAxisConfig(axis, __.dimensions[d]) )
      })
    .append("svg:text")
      .attr({
        "text-anchor": "middle",
        "y": 0,
        "transform": "translate(0,-5) rotate(" + __.dimensionTitleRotation + ")",
        "x": 0,
        "class": "label"
      })

In my case, I need the dimension titles to be at the bottom of the parallel axes, not the top. So to do this, I changed the value of the "y" position to be what I need it to be (it gets adjusted dynamically if the element that holds my plot is resized).

But obviously, "hacking" the library to do this is undesired. It'd be much nicer to set this as part of the dimension object. To either have the titles appear at the top or bottom of the axes.

I just want to make sure this isn't already do-able somehow though, and perhaps I missed it?

Thanks!

syntagmatic commented 8 years ago

You could re-position the labels after the axes have been created. Something like this:

d3.selectAll(".parcoords .label").attr("y", chartHeight)
jmgelman commented 8 years ago

Nice! Thanks for the advice.