From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

yAxis.GetBounds returns empty rectangle?

Using a ScatterGraph, I would like to draw the axis scales in my own code inside the Paint event handler. I can use xAxis.GetBounds() to retreive the rectangle to draw in  for the xAxis but yAxis.GetBounds() always seems to return Rectangle(0,0,0,0). Why?
 
Thanks,
Adam
0 Kudos
Message 1 of 6
(3,798 Views)
Hi Adam,

I haven't been able to reproduce your issue yet.  What language are you using?  Can you post a small snippet of your code that demonstrates how you are trying to access the yAxis bounds?
Regards,


Marty H.
National Instruments
0 Kudos
Message 2 of 6
(3,779 Views)
Thanks Marty.
I'm using C# and VS2005. I wrote a little demo that paints the rectangles returned by .GetBounds(). It shows that when the axis has Position=AxisPosition.Right, GetBounds returns an empty rectangle. I didn't notice that it was just right-hand axes the first time around.
 
Adam
 
 
0 Kudos
Message 3 of 6
(3,775 Views)
Not sure that my last post had the attachment.
0 Kudos
Message 4 of 6
(3,770 Views)
YAxis contains additional overloads of GetBounds that requires you to specify the YAxisPosition as an argument. By default, GetBounds will return the position of the y-axis as if it were positioned on the left. If you have the YAxis positioned on the right side of the plot area, then you should call yAxis.GetBounds(YAxisPosition.Right).
Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 5 of 6
(3,767 Views)

Thank you sir. That is correct. Using GetBounds() or GetBounds(YAxisPosition.Left) returns an empty rectangle when the axis is positioned on the right. One must call GetBounds(YAxisPosition.Right) when it is desired to obtain the right hand axis rectangle when position is .Right or .LeftRight.

 

0 Kudos
Message 6 of 6
(3,759 Views)