Skip to content

Sector3DMark

ClassChartGuruChartGuru.3D
public class Sector3DMark : ChartMark3D, IChart3DMark, IChart3DDataMark, IChartMark

Extruded annular sector of 3D pie and donut charts, a Chart Guru extension: Swift Charts 3D has no sector mark. Angles are in degrees from the top of the flat chart, clockwise as 2D pies run, and the pie lies around the plot center, resting on the plot's floor in 3D. Its sizes are shares, so a pie fits any plot as a 2D pie fits its plot area: the outer radius, height and explode distance of the plot's polar radius (Chart3DMeshContext takes half the shorter side of the plot's footprint), and the inner radius of the outer radius, like Swift Charts' innerRadius: .ratio(...).

public const float DefaultOuterRadius = 0.9

The default outer radius: 0.9 of the plot’s polar radius, which leaves room for leader labels.

Returns

System.Single

public const float DefaultHeight = 0.24

The default height of the slab: 0.24 of the plot’s polar radius.

Returns

System.Single

public Sector3DMark(float startAngle, float endAngle, float value)

Creates a slice from startAngle to endAngle, in degrees clockwise from the top of the flat chart, whose tooltip and data label report value. The angles alone set its span, so derive them from each value’s share of the total.

Parameters

NameType
startAngleSystem.Single
endAngleSystem.Single
valueSystem.Single

public Sector3DMark InnerRadius(float ratio)

Sets the hole’s radius as a share of the outer radius, from 0 for a pie slice to 0.99.

Parameters

NameType
ratioSystem.Single

Returns

ChartGuru.Sector3DMark

public Sector3DMark OuterRadius(float ratio)

Sets the outer radius as a share of the plot’s polar radius; 1 reaches the edge of the plot’s footprint.

Parameters

NameType
ratioSystem.Single

Returns

ChartGuru.Sector3DMark

public Sector3DMark Height(float ratio)

Sets the slab’s height as a share of the plot’s polar radius.

Parameters

NameType
ratioSystem.Single

Returns

ChartGuru.Sector3DMark

public Sector3DMark AngularSegments(int s)

Sets how many segments a full turn of the slice’s arcs would use, at least 6 and 48 by default; the slice takes its share of them, at least 2, so higher counts draw smoother arcs with more vertices.

Parameters

NameType
sSystem.Int32

Returns

ChartGuru.Sector3DMark

public Sector3DMark Explode(float share)

Moves the slice out from the pie’s center along its middle angle by share of the plot’s polar radius.

Parameters

NameType
shareSystem.Single

Returns

ChartGuru.Sector3DMark

public override void BuildMesh(Chart3DMeshContext ctx)

Write triangles / instanced draws for this mark into the context registry.

Parameters

NameType
ctxChartGuru.Chart3DMeshContext
public override IChartMark Clone()

Creates an independent copy of this slice with its angles, value, radii, height, segments, explode distance and style; later changes to either mark do not affect the other.

Returns

ChartGuru.IChartMark

protected void CopySector3DStateTo(Sector3DMark target)

Copies what ChartMark3D.CopyCommon3DStateTo(ChartMark3D) copies plus the angles, radii, height, angular segments and explode distance onto target, for ChartMark.Clone() in derived marks.

Parameters

NameType
targetChartGuru.Sector3DMark

public float StartAngle { get; }

Returns

System.Single

public float EndAngle { get; }

Returns

System.Single

public float InnerRadiusValue { get; }

The hole’s radius as a share of the outer radius: 0 for a pie slice, at most 0.99.

Returns

System.Single

public float OuterRadiusValue { get; }

The outer radius as a share of the plot’s polar radius.

Returns

System.Single

public float HeightValue { get; }

The slab’s height as a share of the plot’s polar radius; the slab rests on the plot’s floor.

Returns

System.Single

public float ExplodeValue { get; }

How far the slice moves out from the pie’s center along its middle angle, as a share of the plot’s polar radius.

Returns

System.Single

public override ChartType MarkType { get; }

Returns

ChartGuru.ChartType