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 212 forks source link

Detect brushed dimension #307

Open iolaizola opened 8 years ago

iolaizola commented 8 years ago

Is it posibble to know which of the axis is the one to trigger the brush event?

Thanks a lot!!

jmgelman commented 8 years ago

Not sure if this will help, but...

On brush or brushend events, you could call brushExtents(). The keys of the returned object should be the axes that have been brushed. This gets updated each time a new axis is brushed (unless brushReset() is called).

parcoords.on("brush", function() {
    console.log(parcoords.brushExtents())
});

Also, earlier this month, I tried to add a brushstart event handler that would return the appropriate dimension object when brushstart fires. See 932f16d. I submitted a pull request for this, but haven't heard anything else back yet. I needed it to be in the brushstart event, but you could probably apply the same idea to brush or brushEnd too.

There might be a simpler way to get the axis being brushed by using d3 selectors, but I'm not really sure.