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

Axis metadata #265

Closed BroHammie closed 8 years ago

BroHammie commented 8 years ago

Significant changes for converting the __.dimensions variable to an object that now allows for configuring axis values(orient, ticks, innerTickSize, outerTickSize, tickPadding, scales, titles).

I verified all examples still work and tests passed Also allowed for some backwards compatibility that should perhaps be removed at some point?

I know we want .types to be a part of the .dimensions variable but before I go to much further I wanted to get some feedback.

Clone the branch with "git clone https://github.com/mcwillso/parallel-coordinates --branch Axis-Metadata " and try out the new example "parallel-coordinates/examples/axis-config.html"

julianheinrich commented 8 years ago

I didn't have time to look at the code yet, but the examples looks good! This would be a great improvement to the library!

timelyportfolio commented 8 years ago

@mcwillso, thanks so much for this. I am very busy testing it with the R htmlwidget. Will let you know what I find. I need to dig a little deeper, but it seems there might be a problem with hideAxis and this new code.

timelyportfolio commented 8 years ago

@mcwillso, I just moved hideAxis after I set dimensions and no more problem. I have tested fairly thoroughly, and all seems to work well on my end.

BroHammie commented 8 years ago

Interactive and bundling were broke... Fixed now and added a bundling example.

syntagmatic commented 8 years ago

This looks really great. One question I have-- are dimensions explicitly orderable somehow? I believe by using d3.keys to turn the object into an array, it can end up in a different order depending on the browser and how the object was constructed.

BroHammie commented 8 years ago

They are not currently and I knew that this would need to be addressed as d3.keys may return unordered. I think an index property on the dimensions will solve it. Also before this gets merged I would like to add types (number, date, string, custom) to the dimensions.

BroHammie commented 8 years ago

@syntagmatic @julianheinrich I have updated the documentation reflecting the removal of types and the additional dimension attributes. I will leave it up to one of you to merge it and/or provide feedback.

syntagmatic commented 8 years ago

Sorry for the late response. I do support merging this.

I think we may have to eventually re-touch some of what we've discussed here, but this pull request is major progress in the right direction.

julianheinrich commented 8 years ago

@mcwillso

tl;dr I will merge this soon if I don't get any objections.

I had a look at merging this, as I'm very keen on having these features. I was noting that our history has become somewhat non-linear with a couple of merge commit messages, and there will be some more introduced from this branch. Personally, I'm not keen on cleaning things up and I also don't mind just merging this. So unless anyone wants to do some cleanup I will just merge it tomorrow, hope that's fine for you guys ;-)

EDIT I think commonScale has become obsolete since axes need to be scaled by the user now, is that correct?

Also, what do you think of adding a hidden or visible property to dimensions and deprecate hideAxis?

Any particular reason why the dimensions object is not an array? This breaks all code that uses dimensions.length to get the number of dimensions. Would it be possible to make it an array and by default set the title to what currently is the dimension's key?

BroHammie commented 8 years ago

@julianheinrich

commonScale may still be useful and it is hard to know who is using what.

We need to keep the hideAxis function. If we want to draw all the axis/dimensions except one and use the default types/scales, this will still allow for the cleanest approach.

The main issue that forced me to use an object versus an array was drawing objects where an attribute was an integer(index in an array), ie the 'basic' example. I wasn't able to come up with a better approach that still used an object for the dimensions.

julianheinrich commented 8 years ago

After merging I found some issues that need fixing as they still rely on dimensions as an array. In particular, axisDots and reorder seem to be broken.

BroHammie commented 8 years ago

Sure enough. I will start on these.

julianheinrich commented 8 years ago

ok thanks. Just pushed another commit, make sure that you update. I was trying to fix the shuffle dimensions example in index.html, but somehow failed to set dimension indexes and get the new order reflected in parcoords.

BroHammie commented 8 years ago

So I was not calling applyDimensionDefaults when setting dimensions using .dimensions(dims).

Fixed the reorder(rowdata) function. Which is a pretty cool utility depending on your data.

julianheinrich commented 8 years ago

Thanks!

timelyportfolio commented 8 years ago

@mcwillso, just discovered that flip does not respect custom dimensions. Here is a simple example http://codepen.io/timelyportfolio/pen/WxKjRN. I'll try to look into it, but not nearly as familiar as you with the codebase. I specified 3 ticks for the first dimension, but when I flip the axis gets redrawn with the defaults.

parcoords_flip_bug

BroHammie commented 8 years ago

@timelyportfolio Good catch! Appears to happens with all axis config properties... In the flipAxisAndUpdatePCP function we need to call all the axis attribute functions to reset those properties.