02-02-2011 04:12 AM
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!
02-02-2011 04:22 AM
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?
If not, please attach an image explaining what you are trying to do.
Vijet Patankar
National Instruments
02-02-2011 04:27 AM
Yes, this is my case. Also, the disalignment can come from having a different number of axes in the two different plots.
02-02-2011 05:02 AM
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.