Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I change the position of the plot area?

I would like to change the position of the plot area (only the square containing the plot data) regardless of the axes. Reason: I have two plots, one placed over the other, and want to align the plots both in position and width so that I can directly compare signals in the two plots directly and this means I have to have a perfect alignment of the plot area. When having different number of axes, or when numbers are biggers on one axis than the other, the plot areas are not aligned.

 

I am looking for something like WaveformGraph.PlotAreaBounds, but it needs to be writable, that one is read-only...

Thanks a lot for any input!

 

 

0 Kudos
Message 1 of 4
(3,600 Views)

Hello there,

 

In the following picture, because of the range difference in the YAxis, plot areas of the two graphs are not aligned. Is this the scenario you are stuck with?

 

plot area alignment.png

 

If not, please attach an image explaining what you are trying to do.

 

Vijet Patankar

National Instruments

0 Kudos
Message 2 of 4
(3,599 Views)

Yes, this is my case. Also, the disalignment can come from having a different number of axes in the two different plots.

0 Kudos
Message 3 of 4
(3,594 Views)

Hello there,

 

Unfortunately the plot area bounds are read only. Because it depends on the bounds of other elements in the graph i.e. XAxis and YAxis (it adjusts to the remaining area of the graph after X and Y axis are allocated space). So you have to work on making the YAxis width a constant so that the width of the PlotArea becomes constant.

 

How to do this?

Option1)

Set the YAxis.MinimumWidth property to some good value(like 150, so that width of any of the label on the YAxis is not greater than YAxis.MinimumWidth).

 

Option2)

Set the YAxis.MajorDivisions.LabelFormat to a format that displays strings with a fixed width for any value. (Check the scientific notation, or you could use your own custom format)

 

Once you chose the above option, you have two cases.

Case1) Number of YAxes on graphs is different.

This is easy.

Just need to apply the solution (that you chose from above given options) to all YAxes.

 

Case2) Number of YAxes on graphs is different.

This could be a little tricky.

Apply the solution (chosen from above) to YAxes of the graph with more number of YAxes.

Apply the solution (chosen from above) to YAxes of the graph with less number of YAxes, except the YAxes that is at the very left.

Calculate the width difference and set the width to the left most YAxis of the graph with less number of YAxes.

 

Hope this helps.

 

Vijet Patankar

NationalInstruments.

0 Kudos
Message 4 of 4
(3,590 Views)