ChartGraphics Class

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Provides numerous conversion functions and exposes a GDI+ Graphics object.

Namespace:   System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)


public ref class ChartGraphics : ChartElement


Gets or sets a GDI+ Graphics object that can be used for drawing purposes.


Gets or sets an object associated with this chart element.(Inherited from ChartElement.)


Releases the resources used by the ChartElement.(Inherited from ChartElement.)


Releases unmanaged and, optionally, managed resources.(Overrides ChartElement::Dispose(Boolean).)


Determines whether the specified Object is equal to the current ChartElement.(Inherited from ChartElement.)


Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)


Takes a PointF object and converts its relative coordinates to absolute coordinates.


Takes a RectangleF object and converts its relative coordinates to absolute coordinates.


Takes a SizeF object that uses relative coordinates and returns a SizeF object that uses absolute coordinates.


Returns a hash function for a particular type.(Inherited from ChartElement.)

System_CAPS_pubmethodGetPositionFromAxis(String^, AxisName, Double)

Takes a given axis value for a specified axis and returns the relative pixel value.


Takes a PointF object that uses absolute coordinates and returns a PointF object that uses relative coordinates.


Takes a RectangleF structure that is using absolute coordinates and returns a RectangleF object that uses relative coordinates.


Takes a SizeF object in absolute coordinates and returns a SizeF object that uses relative coordinates.


Gets the Type of the current instance.(Inherited from Object.)


Creates a shallow copy of the current Object.(Inherited from Object.)


Returns a string that represents the current Object.(Inherited from ChartElement.)

This class provides numerous conversion functions and also exposes a GDI+ Graphics object. Note that when rendering as Scalable Vector Graphics (SVG), use of the Graphics object for custom drawing will not be included as part of the SVG document.

Note also that, by default, Graphics functions usually take absolute coordinates. Therefore the conversion methods of this class should be useful if you perform drawing operations.

A ChartGraphics object is exposed in the ChartGraphics property of the T:System.Web.UI.DataVisualization.Charting.ChartPaintEventArgs class, which makes it easy to perform custom drawing in the PrePaint and PostPaint events.


If significant changes are made to the default behavior of the Graphics object, the chart image and its associated elements may be drawn erratically. For example, positioning may be altered. It is highly recommended that you become well acquainted with GDI+ before you make any significant changes to the properties of the Graphics object.

.NET Framework
Available since 4.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top