Skip to content

StrokeStyle

StructChartGuruChartGuru
public struct StrokeStyle

The characteristics of a stroke that traces a path. Swift Charts equivalent: StrokeStyle

Usage:

// Solid 2px line
var solid = new StrokeStyle(lineWidth: 2f);

// Dashed line with 5px dash, 3px gap
var dashed = new StrokeStyle(lineWidth: 1f, dash: new float[] { 5, 3 });

// Dotted line
var dotted = new StrokeStyle(lineWidth: 2f, dash: new float[] { 2, 4 });

public float LineWidth

The width of the stroked path.

Returns

System.Single

public LineCap LineCap

The endpoint style of a line.

Returns

ChartGuru.LineCap

public LineJoin LineJoin

The join type of a line.

Returns

ChartGuru.LineJoin

public float MiterLimit

A threshold used to determine whether to use a bevel instead of a miter at a join.

Returns

System.Single

public float[] Dash

The lengths of painted and unpainted segments used to make a dashed line. Empty or null for solid lines. Example: [5, 3] = 5px dash, 3px gap, repeating. Example: [10, 5, 2, 5] = 10px dash, 5px gap, 2px dash, 5px gap, repeating.

Returns

System.Single[]

public float DashPhase

How far into the dash pattern the line starts.

Returns

System.Single

StrokeStyle(float, LineCap, LineJoin, float, float[], float)

Section titled “StrokeStyle(float, LineCap, LineJoin, float, float[], float)”
public StrokeStyle(float lineWidth = 2, LineCap lineCap = LineCap.Round, LineJoin lineJoin = LineJoin.Round, float miterLimit = 10, float[] dash = null, float dashPhase = 0)

Creates a new stroke style with the given components. Swift Charts equivalent: StrokeStyle(lineWidth:lineCap:lineJoin:miterLimit:dash:dashPhase:)

Parameters

Name Type
lineWidth System.Single
lineCap ChartGuru.LineCap
lineJoin ChartGuru.LineJoin
miterLimit System.Single
dash System.Single[]
dashPhase System.Single

public static StrokeStyle Solid(float lineWidth = 2)

Creates a solid stroke style with the given line width.

Parameters

Name Type
lineWidth System.Single

Returns

ChartGuru.StrokeStyle

public static StrokeStyle Dashed(float lineWidth = 2, float dashLength = 5, float gapLength = 3)

Creates a dashed stroke style with the given line width and dash pattern.

Parameters

Name Type
lineWidth System.Single
dashLength System.Single
gapLength System.Single

Returns

ChartGuru.StrokeStyle

public static StrokeStyle Dotted(float lineWidth = 2)

Creates a dotted stroke style with the given line width.

Parameters

Name Type
lineWidth System.Single

Returns

ChartGuru.StrokeStyle

public static StrokeStyle DashDot(float lineWidth = 2)

Creates a dash-dot pattern stroke style.

Parameters

Name Type
lineWidth System.Single

Returns

ChartGuru.StrokeStyle

public bool IsDashed { get; }

Returns true if this stroke style uses a dash pattern.

Returns

System.Boolean

public static StrokeStyle Default { get; }

Default solid stroke style with 2px width.

Returns

ChartGuru.StrokeStyle