ParasolJS / parasol-es

ES6 module for interactive visualization of multi-objective optimization problems
https://parasoljs.github.io/
MIT License
26 stars 5 forks source link

Flip axes programmatically and turn off interactive flipping #19

Closed wraseman closed 5 years ago

wraseman commented 5 years ago

@joshhjacobson, do you know how to flip axes in Parcoords without a mouse click? I can't figure out how to do it programmatically, only how to do it by clicking on the axes.

Also, do you know if there is a way to turnoff interactive flipping of axes? I want to put a preferred direction arrow in (and therefore, don't want the user to be able to mess with the axis orientation).

joshhjacobson commented 5 years ago

Looking at the source code from parcoords here, it looks like the syntax should be pc.flip("axes name") or pc.flip(["axis1", "axis2", ...]). This is slightly different from the original syntagmatic syntax which was pc.flipAxes(), more info here. Let me know if this works, I haven't tested it, but it's a feature I plan to create a parasol wrapper for.

I think this functionality is hard-coded in parcoords as an "on-click" event (it's present even in our most basic examples), so I don't know that we actually have the power to disable it right now. This might be a question and potential request for our friends at parcoords.

wraseman commented 5 years ago

Thanks! For some reason pc.flip("axes name") is working for me but not pc.flip(["axis1", "axis2", ...]). I can make the former method work, so that's not too much of a problem but not ideal of course.

It's okay if we can't disable the "on-click" flipping, I doubt many users will even know the flipping feature exists if we don't advertise it.

Agreed though. There could definitely be some improvements on the Parcoords end.

wraseman commented 5 years ago

Welp. It turns out that when I use pc.flip("axis name") brushing stops working... It's always something! Could you put this as a top priority (just below setAxesLayout()? Axis flipping is an essential feature for visualizing the objective space.

joshhjacobson commented 5 years ago

Classic. Does it break all brushes or just linked brushes? In either case, could you provide a brief example?

I'll put this at the top of my list and also reach out to the parcoords team about providing the option to make flipping non-interactive.

wraseman commented 5 years ago

Here ya go:

var ps = Parasol(data)('.parcoords')
ps.charts.forEach(
  (pc) => {
      .flip('rel. (-)')
      .render()
      .updateAxes(0);
  }
)

When I try to brush the flipped axis, all the polylines disappear: image I also get the following error which is associated with implementing the Parcoords methods: image

The weird thing is that when I interactively flip the axis back to its original orientation, the brushing works again. image

joshhjacobson commented 5 years ago

Update: In parcoords, the correct syntax to flip one or more axes is pc.flipAxes(["x", "y"]). The same now holds for the parasol wrapper of the function.

The issue with polylines disappearing on flipped axes is tracked in BigFatDog/parcoords-es#60.

Sometime soon, I'll submit a PR to parcoords making interactive flipping configurable; similar to how rotateLabels works currently.