New to Telerik UI for WinFormsStart a free 30-day trial

Provides the base implementation for chart rendering functionality, handling drawing operations and text measurement for chart elements.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.ChartView.dll

Syntax:

C#
public class ChartRenderer : IChartRenderer

Inheritance: objectChartRenderer

Derived Classes: CartesianRendererFunnelRendererPieRendererPolarRenderer

Implements: IChartRenderer

Constructors

Initializes a new instance of the ChartRenderer class with the specified chart area.

C#
public ChartRenderer(ChartArea area)
Parameters:areaChartArea

The chart area that this renderer will be associated with.

Properties

Gets the Graphics object from the current rendering surface.

C#
public Graphics Graphics { get; }

Gets or sets the rendering surface used for drawing operations.

C#
public object Surface { get; }

Implements: IChartRenderer.Surface

Methods

Draws the chart using the specified rendering context.

C#
public virtual void Draw(object context)
Parameters:contextobject

The graphics context used for rendering operations.

Implements: IChartRenderer.Draw(object)

Calculates the Euclidean distance between two points.

C#
public float GetDistanceBetweenPoints(PointF start, PointF end)
Parameters:startPointF

The starting point.

endPointF

The ending point.

Returns:

float

The distance between the two points as a float value.

Performs hit testing to find the data point at the specified coordinates.

C#
public virtual DataPoint HitTest(int x, int y)
Parameters:xint

The x-coordinate for hit testing.

yint

The y-coordinate for hit testing.

Returns:

DataPoint

The DataPoint at the specified coordinates, or null if no data point is found.

Implements: IChartRenderer.HitTest(int, int)

Initializes the renderer by setting up smart labels controller and calculating label positions if available.

C#
protected virtual void Initialize()

Invalidates the specified model to trigger a redraw operation.

C#
public virtual void Invalidate(object model)
Parameters:modelobject

The model object to invalidate.

Implements: IChartRenderer.Invalidate(object)

Measures the size of rotated text labels considering the rotation angle.

C#
public virtual RadSize MeasureRotatedLabels(string text, object context, double rotationAngle)
Parameters:textstring

The text to measure.

contextobject

The font context used for measurement.

rotationAngledouble

The rotation angle in degrees.

Returns:

RadSize

A RadSize representing the measured dimensions of the rotated text.

Implements: IChartRenderer.MeasureRotatedLabels(string, object, double)

Measures the size of the specified text using the provided font context.

C#
public virtual RadSize MeasureText(string text, object context)
Parameters:textstring

The text to measure.

contextobject

The font context used for measurement.

Returns:

RadSize

A RadSize representing the measured dimensions of the text.

Implements: IChartRenderer.MeasureText(string, object)

Converts a RadPoint to a Point with rounded coordinates.

C#
public static Point ToPoint(RadPoint point)
Parameters:pointRadPoint

The RadPoint to convert.

Returns:

Point

A Point with rounded integer coordinates.

Converts a RadPoint to a PointF.

C#
public static PointF ToPointF(RadPoint point)
Parameters:pointRadPoint

The RadPoint to convert.

Returns:

PointF

A PointF with equivalent coordinates.

Converts a RadRect to a Rectangle with rounded coordinates.

C#
public static Rectangle ToRectangle(RadRect rect)
Parameters:rectRadRect

The RadRect to convert.

Returns:

Rectangle

A Rectangle with rounded integer coordinates.

Converts a RadRect to a RectangleF.

C#
public static RectangleF ToRectangleF(RadRect rect)
Parameters:rectRadRect

The RadRect to convert.

Returns:

RectangleF

A RectangleF with equivalent dimensions.

Converts a RadSize to a Size with rounded coordinates.

C#
public static Size ToSize(RadSize size)
Parameters:sizeRadSize

The RadSize to convert.

Returns:

Size

A Size with rounded integer dimensions.

Converts a RadSize to a SizeF.

C#
public static SizeF ToSizeF(RadSize size)
Parameters:sizeRadSize

The RadSize to convert.

Returns:

SizeF

A SizeF with equivalent dimensions.