04-25-2014 02:03 PM
I'm using PlotXY(..) to display data on a graph.
I use SetAxisScalingMode(...) to set set VAL_LEFT_YAXIS to VAL_AUTOSCALE.
I use SetAxisScalingMode(...) to set set VAL_TOP_XAXIS scaling to VAL_MANUAL.
I make various calls to SetAxisScalingMode(...) which change the min & max values for the X-Axis.
Everything thing seems to display correctly except that changing min & max values using manual scaling on the x-axis does not seem to change the range of data used to auto-scale the y-axis.
For example say you have a peak in your data that you want to exclude so the auto-scaling on the y-axis will zoom in.
So you change the max, min manual x-axis scaling to leave out the peak but scaling but the y-axis scaling doesn't change.
Is this the way it should work?
Ideas for a work around?
Thanks,
Kirk
04-26-2014 07:29 AM
I can't tell if this is the way it should work...
But you can try the following to cause a recalculated autoscaling: set the scaling to VAL_LOCK and then change it back to VAL_AUTOSCALE
This is what I have learned from NI here
04-28-2014 04:09 PM
Wolfgang,
I'm quite sure my code is causing the plot recalculate the auto-scaling.
Maybe this will help explaing what I mean:
I modified the example graphs.prj that comes with LabWindows/CVI to demonstrate this.
Run the example and click on the the Plot Line button.
Observe that it autoscales the Y axis to 200.0 even though the data point containing 200.0 is not on the plot.
For details look in the function: int CVICALLBACK PlotData(...)
Kirk
04-29-2014 12:59 AM
I'm sorry, I tried your example but did not find a possibility to resolve the issue...
04-29-2014 11:37 AM
OK, Thanks for giving it a try.
I guess that's the "normal" behavior for the manual scaling.
Maybe someone else will have some ideas.
Possibly instead of using manual scaling to restrict the range of the x-axis I'll re-plot plot with a different range of x values.
05-01-2014 02:29 PM - edited 05-01-2014 02:32 PM
Hi Kirk,
As you've noticed, the autoscaling of an axis in the graph is based on the entire data of each plot, not just on the portion of the plot that is within the range of the other axis.
If you use only integer limits for the min and max of the x axis, if you plot only 1D arrays, and if you don't mind re-plotting every time that you want to manually change the x-axis, there's a possible workaround, consisting of replacing PlotY with PlotWaveform, so that you can offset the data to plot.
I've adapted the code that you attached earlier to illustrate this:
int xmin = 40;
int xmax = 90;
SetAxisScalingMode(handle, PANEL_GRAPH, VAL_BOTTOM_XAXIS, VAL_MANUAL, (double)xmin, (double)xmax);
PlotWaveform (handle, PANEL_GRAPH, datapoints + xmin, xmax - xmin, VAL_DOUBLE, 1.0, 0.0, xmin, 1.0,
style, VAL_EMPTY_SQUARE, VAL_SOLID, 1, color);
05-02-2014 12:34 AM
Hi Luis,
would it be possible to add this information to the help? At present it doesn't waste any word on it...
And do you think there are chances that the current behavior could be improved (after filing an idea suggestion, of course)? I think the more natural behavior would be to have autoscaling to the visible data, and now I recall that some time ago I had to implement this sort of autoscaling myself: go through all plots, find their maxima and minima,...
05-02-2014 11:04 AM
I agree. It would be nice to see it improved.
For now I think I'll look into modifying my code to change the range of data that is plotted when the manual scaling is activated.
Thanks again for the insight!
05-02-2014 05:34 PM - edited 05-02-2014 05:34 PM
Fair enough. We'll update the documentation.
Yes, it's reasonable to request that this be improved. But, to clarify, "improvement" cannot mean changing the current auto-scaling behavior, since this would break existing programs -- the new behavior would have to be introduced via a different axis setting, which would not be on by default.
05-02-2014 11:21 PM