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
510 stars 211 forks source link

Setting brushing extents? #107

Open jmgelman opened 9 years ago

jmgelman commented 9 years ago

Is there a way via the d3.parcoords.js API to get/set the brushing extents (i.e., the range of values that can be brushed for a particular axis)?

bbroeksema commented 9 years ago

Note we have multiple brushing types. For brushing on the axes you can get the extents but not set them currently. More generally, we want to get/restore brushing state functionality (also for strum or pinch brushes). This however requires a non-trivial amount of work. It's on my wish list, but I don't know if and/or when I find some time to work on this.

sbryfcz commented 9 years ago

I'd love this enhancement! I have a great use case for it. I really am focused on 1D axis brushing. I might try to tinker with the code this weekend.

sbryfcz commented 9 years ago

I think I got a working solution (for 1D axises). I'll try to submit a pull request later tonight. Unless you have a better solution/idea.

sbryfcz commented 9 years ago

Alright. So I think I got a pull request put in place for 1D setting of extents: https://github.com/syntagmatic/parallel-coordinates/pull/126

Let me know if this worked....sorry but its my first pull request.

Git-me-outta-here commented 8 years ago

I have made a few changes to the brush setter. (only the 1D-axes brush mode so far) https://github.com/Git-me-outta-here/parallel-coordinates/commit/3ad20881d2e2fd400a023b103b68e5e62586a35f

What do you think about these changes? If you like it, I can extend it to 1D-multi.

Here's a few code related questions I have

@sbryfcz @mcwillso @syntagmatic @bbroeksema

BroHammie commented 8 years ago

When calling brushExtents() with no params we definitely want to return the current extents, but when extents is passed brushExtents(extents) I could see that returning pc would be fine, but somewhat unnecessary because setting extents would be something you would do last in the chain of functions.

Renaming the brushReset function might not be the best option but I think using your code under the same function brushReset could be appropriate.

brushState() depends on which brush mode you are in. The render.isBrushed() function might be able to include your change as I am seeing it return true when it shouldn't on 2d-strums. But would need thoroughly tested.

Git-me-outta-here commented 8 years ago

Ah, apparently this has also been done with other functions, e.g. brushMode("1D-axes") returns pc, but brushMode() returns a string. brushExtents(extents) and brushExtents() now work the same way.

Changed names back to brushReset() and brushReset(dimension).

Should I keep updateBrush(dimension, extent, duration) or incorporate that into brushExtents(extents)? https://github.com/Git-me-outta-here/parallel-coordinates/commit/b038b9b856365dcef9f229760d9652bead6e476b

TorbenOestergaard commented 8 years ago

This sound very interesting. Is it possible to see a working example of setting and retrieving the filter values?

Git-me-outta-here commented 8 years ago

Hi Torben, just look at my last commit [https://github.com/Git-me-outta-here/parallel-coordinates/commit/b038b9b856365dcef9f229760d9652bead6e476b] This is what we will call the functions. If no one objects. In the 'setterForBrushes.html' example you can see how to use them.

TorbenOestergaard commented 8 years ago

@Git-me-outta-here I tried you 'setterForBrushes.html' example. Though, I get this error in Chrome: Uncaught TypeError: pc.updateBrush is not a function

I followed you link to Git-me-outta-here@b038b9b and used your versions of the files: 1D.js, render.js and setterForBrushes.html. Did I do something wrong her? I can see you have added a function "install" which sets pc.updateBrush = updateBrush but I cannot see it being called anywhere. Maybe that's the reason?

Small question: is there a reason you've omitted at couple of values in data:

   .data([
     [0,-0,0,0,0,1],
     [1,-1,1,2,1,1],
     [2,,4,4,0.5,1],
     [3,,9,6,,],
     [4,-4,16,8,0.25,1]
   ])
Git-me-outta-here commented 8 years ago

sorry about that, updateBrush() has now been retired in favour of brushExtents(). https://github.com/syntagmatic/parallel-coordinates/pull/279

about the omitted data: there is no reason why I have null values here. Please participate in this discussion: https://github.com/syntagmatic/parallel-coordinates/issues/40 and https://github.com/syntagmatic/parallel-coordinates/pull/73 and [https://github.com/syntagmatic/parallel-coordinates/pull/128](finally here)

@TorbenOestergaard

jkollat commented 8 years ago

@jmgelman It doesn't look like brushExtents() has been implemented for 1D-axes-multi brush mode like it has for 1D-axes mode. Care to implement it? Are there any special issues we need to consider implementing it for 1D-axes-multi mode?