Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Different Y Axis Range in WaveformGraph

Solved!
Go to solution

I am trying in C# to create a WaveformGraph with 2 y axis with different ranges.

 

On the first  Y Axis I have a range from 0 to 80 and on the second I have a range from -127 to 127.

 

I created the two different Y Axis and set the range accordingly and they show up correctly next to the plot.

 

Then I created two waveformPlots.  One I set the waveformPlot.YAxis.Range to (-127,127) and the other waveformPlot to (0, 80).  The problem is when I draw the plot the total range for the plot gets change to (-127, 127) and my (0, 80) plot gets shifted up to be in the center of the waveform.  I would like this plot to stay down at the bottom of the graph to match the Axis that I created.

 

I can normalize the values but my users use the  Tool tips to get the measurement results and those would no longer be valid if I subtracted 127 from the values in the second waveform.

0 Kudos
Message 1 of 3
(3,845 Views)
Solution
Accepted by topic author UmmGooD

Okay I managed to figure this out for myself.  In error I had the following code:

 

waveformPlot1.Yaxis.Range = new Range(0,  80);

waveformPlot2.Yaxis.Range = new Range(-127, 127);

 

Instead I used the two y axis I already had used.

waveformPlot1.Yaxis = yAxis1

waveformPlot2.Yaxis = yAxis2

0 Kudos
Message 2 of 3
(3,833 Views)

Hi UmmGooD,

 

I was able to build something similar to what you are describing, and I think you just need to make sure you set both of your yaxis objects to have a fixed range.  If this is not set, then the axis will change depending on the data in the graph.   Please see the attached example to look at my implementation.

0 Kudos
Message 3 of 3
(3,831 Views)