I currently have a WaveformGraph that shows temperature (the dependent value) on the y-axis as a function of position on the x-axis. Each "channel" or entry on the legend is a "trace" or data set.
(Graph Legend and graph size edited for clarity in post, note that the trace names (date time tag) is important and is displayed to user). Ignore the gray marker point.)
For two traces, the graph looks like this:
In certain cases, the customer wants this:
1) The Depth plotted on the Y-axis, but flipped (-100 at top, 1200 at bottom)
2) Temperature on x-axis, but x-axis moved to the top of the graph view
3) plot names (legend entries) remain the same
It is easy to flip the data on the axis, just toggled with a boolean property.
It is reasonably easy to move the x-axis to the top, the only trick being that this can't be done at run-time(?) so instead you have to duplicate the x-axis at edit time, "swap sides" on one of them, then at run-time just keep one visible and the other hidden to give the illusion of moving the axis.
The issue I have is of course, that what I need is for the waveform to, on command, treat the x-axis data as the dependent values, and thats were I can't see an easy way to work this. Hey, is it possible to just "rotate" the graph shape? You know, like in Visio or Word, you can grab an image and just rotate it 90 degrees? If so, I could just change axis label orientation, set the flipped boolean and voila! 😛
As much as I hate to do it, it looks like I would need to change to an X-Y Graph instead of a Waveform Graph? Other than the work involved, one of the reasons we did not go with an xy graph to begin with is that you need to carry twice the data in memory compared to a waveform.. I can't remember if there were any other of the GUI/UI/Customer requirements that forced us in the direction of the waveform Graph.. We have a rather long list of advanced functionality pertaining to program auto-adding traces to the bottom, automatically only showing the last 5 traces, EXCEPT any user toggled trace visibility overrides the auto visibility settings. Also, color, size and styles are different for oldest visible and latest data, and the "auto-scale" was replaced with a custom scaling solution to observe certain sensible rules on how and when it should autoscale... I think all of that code carries over realtively easy on an x-y graph..
Any suggestions would be greatly appreciated! -In the mean time, I'll start looking at refactoring for use with Graph XY. 😕
In the mean time, I found the switch to XY Graph gives me all I need, at the cost of some refactoring, though most properties changed automatically when the reference was updated since waveform graph and xy graph are "siblings". The biggest effort (not that it was all that big in the end), turned out to be properly managing "hand-over" of various state information on the iteration where the swaps occur so that customized code that keeps user (override) manual scale changes or overrides auto-scale with a custom auto-scale solution if the user picks "auto-scale".