Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Invert plot on a CNiGraph

I use CNiGraph.PlotY(CNiReal32Vector) to draw a plot. I want to give the user an "Invert" button which would invert the plot (flip it upside down).

Is there a way to do this from the drawn plot, or will I have to store the buffer every time I draw the plot?

Billy H.
0 Kudos
Message 1 of 4
(3,065 Views)
The CNiAxis object has an Inverted property that will invert the axis when it is set to true. So to invert your plot vertically, you could get a reference to the CNiPlot object that you plotted your data on, go to the YAxis property, and set its Inverted property to true.

- Elton
Message 2 of 4
(3,065 Views)
Does CNiAxis::Inverted fit your need?

It should if you just want to change the way the plot displays on the graph. It won't if you need to actually change the data of each point. If that is the case you will need to create another copy of your data and invert it manually. If you want to invert the data around 0, you could use CNiReal64Vector::Scale and pass it -1. If you want to invert the data around some other value, you use the other CNiReal64Vector::Scale overload.

David Rohacek
National Instruments
Message 3 of 4
(3,065 Views)
I was looking for a way to apply a -1 scale as David suggested, but the CNiAxis::Inverted actually works beautifully for what I need (to flip on Y axis).

Thanks Elton and David - The quick and helpful responses on this forum make Measurement Studio just unbeatable!!
(Time difference between US and Ireland is an advantage at times too 🙂

Billy H.
0 Kudos
Message 4 of 4
(3,065 Views)