Coordinate System

The Chart control uses a coordinate system to position titles, legends, annotations, and chart areas in the chart picture. To do this, it uses each element's Position property.

The chart coordinate system has the following characteristics:

  • The chart coordinate system has its origin (0,0) in the upper-left corner of the chart picture.

  • In the (X,Y) coordinates, the X value points to the horizontal axis and the Y value points to the vertical axis.

  • The unit of measure is a percentage of the chart picture's width and height. Coordinate values must be between 0 and 100. Relative coordinates ensure that objects remain relative to one another when the chart is resized.

A chart area positions each of its elements using a similar coordinate system. Coordinates (0,0) represent the upper-left corner of the chart area, and coordinates (100,100) represent the lower-right corner of the chart area. When a legend is docked to a chart area, it is positioned using the chart area's coordinate system.

3D Charts

The 3D chart coordinate system has the added Z coordinate (X,Y,Z). It is also a percentage of the chart area's depth. The chart area's back wall has a Z value of 0, and the front end of the chart area has a Z value of 100.

For more information, see 3D Charts.

Custom Drawing

To perform custom drawing using GDI+ functions in your code, you need to convert the relative coordinates to absolute pixel coordinates. The ChartGraphics class contains methods for absolute-to-relative and relative-to-absolute conversion of PointF, RectangleF, and SizeF structures.

See Also

Reference

Chart Elements

System.Windows.Forms.DataVisualization.Charting

System.Web.UI.DataVisualization.Charting