Skip to content

StrokeStyle

StructChartGuruChartGuru
[Serializable]
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 });

[Tooltip("Stroke width of the line in pixels.")]
[Range(0.1, 30)]
public float LineWidth

The width of the stroked path.

Returns

System.Single — No return description is available.

[Tooltip("How line endpoints are rendered (Butt, Round, or Square).")]
public LineCap LineCap

The endpoint style of a line.

Returns

ChartGuru.LineCap — No return description is available.

[Tooltip("How corners are rendered where two line segments meet.")]
public LineJoin LineJoin

The join type of a line.

Returns

ChartGuru.LineJoin — No return description is available.

[Tooltip("Threshold for switching from a miter to a bevel join at sharp corners. Higher values permit sharper miters.")]
[Range(1, 50)]
public float MiterLimit

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

Returns

System.Single — No return description is available.

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[] — No return description is available.

[Tooltip("Offset in pixels into the dash pattern where drawing begins.")]
public float DashPhase

How far into the dash pattern the line starts.

Returns

System.Single — No return description is available.

public bool IsDashed { get; }

Returns true if this stroke style uses a dash pattern.

Returns

System.Boolean — No return description is available.

public static StrokeStyle Default { get; }

Default solid stroke style with 2px width.

Returns

ChartGuru.StrokeStyle — No return description is available.

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 Description
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 Description
lineWidth System.Single

Returns

ChartGuru.StrokeStyle — No return description is available.

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 Description
lineWidth System.Single
dashLength System.Single
gapLength System.Single

Returns

ChartGuru.StrokeStyle — No return description is available.

public static StrokeStyle Dotted(float lineWidth = 2)

Creates a dotted stroke style with the given line width.

Parameters

Name Type Description
lineWidth System.Single

Returns

ChartGuru.StrokeStyle — No return description is available.

public static StrokeStyle DashDot(float lineWidth = 2)

Creates a dash-dot pattern stroke style.

Parameters

Name Type Description
lineWidth System.Single

Returns

ChartGuru.StrokeStyle — No return description is available.