Table of Contents

Class ChartGeometry

Namespace
TwBlazor.Charting
Assembly
TwBlazor.dll

Geometry helpers shared by the charts.

public static class ChartGeometry
Inheritance
ChartGeometry
Inherited Members

Methods

Circle(double, double, double)

Builds the path of a whole circle. Unlike a 360 degree Sector(ChartSector) it has no seam from the edge to the center, so it can be outlined.

public static string Circle(double centerX, double centerY, double radius)

Parameters

centerX double
centerY double
radius double

Returns

string

Line(IReadOnlyList<(double X, double Y)>, ChartCurve, bool)

Builds the path of a line through points, joined according to curve.

public static string Line(IReadOnlyList<(double X, double Y)> points, ChartCurve curve = ChartCurve.Linear, bool close = false)

Parameters

points IReadOnlyList<(double X, double Y)>
curve ChartCurve
close bool

Returns

string

Percentile(IReadOnlyList<double>, double)

Gets the value at a percentile of a sorted list, interpolating between neighbors.

public static double Percentile(IReadOnlyList<double> sorted, double percentile)

Parameters

sorted IReadOnlyList<double>

The values in ascending order.

percentile double

The percentile, from 0 to 1.

Returns

double

Polar(double, double, double, double)

Gets the point at an angle and distance from a center. Angles are in degrees, clockwise from 12 o'clock.

public static (double X, double Y) Polar(double centerX, double centerY, double radius, double angle)

Parameters

centerX double
centerY double
radius double
angle double

Returns

(double X, double Y)

Sector(double, double, double, double, double, double)

Builds the path of a ring segment (or a pie wedge when innerRadius is zero) between two angles. Angles are in degrees, clockwise from 12 o'clock.

public static string Sector(double centerX, double centerY, double innerRadius, double outerRadius, double startAngle, double endAngle)

Parameters

centerX double
centerY double
innerRadius double
outerRadius double
startAngle double
endAngle double

Returns

string

Sector(ChartSector)

Builds the path of a ChartSector.

public static string Sector(ChartSector sector)

Parameters

sector ChartSector

Returns

string