SarahBenjamin Posted October 22, 2007 Report Share Posted October 22, 2007 I want to get the size of the plot area. How can I get it in a chart? Thanks -Sarah Quote Link to comment Share on other sites More sharing options...
maximop Posted October 22, 2007 Report Share Posted October 22, 2007 You need to access the left, top, bottom, and right properties of the PlotAreaMargin of the chart. You can do the following: To retrieve its values: int x1 = Chart1.PlotAreaMargin.Left; int y1 = Chart1.PlotAreaMargin.Top; int x2 = Chart1.PlotAreaMargin.Right; int y2 = Chart1.PlotAreaMargin.Bottom; Then to calculate the height and width, you can do the following: width = right - left, if right > left height = bottom - top, if bottom > top Quote Link to comment Share on other sites More sharing options...
SarahBenjamin Posted October 22, 2007 Author Report Share Posted October 22, 2007 What if all the following variables int x1 = Chart1.PlotAreaMargin.Left; int y1 = Chart1.PlotAreaMargin.Top; int x2 = Chart1.PlotAreaMargin.Right; int y2 = Chart1.PlotAreaMargin.Bottom; are set to Zero, then how can I find the plot area? Thanks -Sarah Quote Link to comment Share on other sites More sharing options...
maximop Posted October 23, 2007 Report Share Posted October 23, 2007 If those variables were set to zero, then you wouldn't have a plot area. Note that the plot area is an actual rectangle that is composed of a set of points within the chart control. Quote Link to comment Share on other sites More sharing options...
maximop Posted October 23, 2007 Report Share Posted October 23, 2007 Also, you can access the bounding rectangle of the pane (plotted area) and retrieve its left, top, right, and bottom values respectively, as well as the height and width of the rectangle. You can access this rectangle by calling: chart1.Panes[0].BoundingRectangle.Height; chart1.Panes[0].BoundingRectangle.Width; Quote Link to comment Share on other sites More sharing options...
SarahBenjamin Posted October 23, 2007 Author Report Share Posted October 23, 2007 Thanks a bunch, that helped -Sarah Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.