oxyplot icon indicating copy to clipboard operation
oxyplot copied to clipboard

Add plot manipulator axis preference

Open carlreinke opened this issue 3 years ago • 2 comments

Checklist

  • [x] I have included examples or tests
  • [x] I have updated the change log
  • [x] I am listed in the CONTRIBUTORS file
  • [x] I have cleaned up the commit history (use rebase and squash)

Changes proposed in this pull request:

  • Add AxisPreference to PlotManipulator. When set, if an action could apply to a preferred axis and also to another axis (such has an action performed in the plot area) then the manipulator operates on only the preferred axis. If an action applies only to a non-preferred axis (such as an action performed in the axis area of a non-preferred axis) then the manipulator operates on that axis, as usual.

@oxyplot/admins

carlreinke avatar Apr 29 '22 21:04 carlreinke

My only reservation here, is that it would be nice if the plot manipulators were not tied to a single X and Y axis; it's common e.g. to want to pan all axes, which have been carefully lined up at the outset (probably keeping the main X and Y axes, which in practise are useful even if you want to operate on many, and would help with backwards compatibility).

If there were a change in future to support this, I would imagine adding All to your enum, and then populating a list of axes instead. None would, then, sound rather like no axes rather than no preference.

Could we change None to Default?

VisualMelon avatar Apr 30 '22 07:04 VisualMelon

If plot manipulators weren't tied to a single X and/or Y axis then you'd have to make a breaking change in PlotManipulator<T> since it exposes XAxis and YAxis properties. If you made that breaking change, redesigning how the axis preference works would be part of that. (Though I think that's out of scope for this PR.)

I did consider Default and also All.

The problem with Default is that it doesn't say much about what the behavior will be -- you get the default preference, but what is the default preference? To a developer who is familiar with OxyPlot, it's probably clear that you get the behavior that you're used to. To a new developer, it's maybe not so clear.

The problem with All is that it's not really a preference. (Compare: All "The manipulator prefers all of the axes." vs None "The manipulator doesn't prefer any one axis over the others."). Then again, it could be thought of as "I'd prefer that all the axes were manipulated." vs "I'd prefer that none of the axes were manipulated." But clearly manipulating none of the axes isn't useful, so you'd probably dismiss that interpretation.

So I ended up with None.

I originally started off with the name AxisBias rather than AxisPreference. In that case the default could be named Unbiased.

Maybe there is a better name that hasn't been considered yet? Let me know what you prefer.

carlreinke avatar Apr 30 '22 23:04 carlreinke