Skip to content

BarMark

ClassChartGuruChartGuru
public class BarMark : ChartMark, IChartMark

Encodes one rectangular value or interval, with support for vertical or horizontal layout, grouping, stacking, sizing, and rounded corners.

public BarMark()

public BarMark(float x, float y)

Creates a scalar vertical bar at the supplied X position and Y value.

Parameters

NameType
xSystem.Single
ySystem.Single
public BarMark(DataPoint point)

Creates a bar from an existing point, preserving range endpoints and grouping metadata.

Parameters

NameType
pointChartGuru.DataPoint
public BarMark(PlottableValueRef x)

1D horizontal bar constructor. Mirrors Swift Charts: BarMark(x: .Value(“Size”, size)) All marks share y=0 and stack horizontally via their series. The numeric value is stored on DataPoint.Y for renderer compatibility; BarMark.Layout is set to BarLayout.Horizontal.

Parameters

NameType
xChartGuru.PlottableValueRef

BarMark(PlottableValueRef, PlottableValueRef, int)

Section titled “BarMark(PlottableValueRef, PlottableValueRef, int)”
public BarMark(PlottableValueRef x, PlottableValueRef y, int index = 0)

Swift-style semantic constructor. Orientation is inferred directly from the PlottableValueRef bindings: when y is categorical (a string/enum/categorical PlottableValue), the mark is configured as a horizontal bar with BarMark.Layout = BarLayout.Horizontal and the category label sourced from y. Mirrors Swift Charts: BarMark(x: .Value(“Sales”, n), y: .Value(“Name”, name)) renders horizontally purely because of the binding direction.

Parameters

NameType
xChartGuru.PlottableValueRef
yChartGuru.PlottableValueRef
indexSystem.Int32

Remarks

To preserve compatibility with the existing renderer/layout pipeline (which assumes “value lives on DataPoint.Y”), the categorical-Y case transposes storage at construction: the numeric x value is stored on DataPoint.Y, and the category index is stored on DataPoint.X. The BarMark.Layout hint plus ChartMark.CategoryLabel let ChartBuilder.Build() promote orientation to horizontal (mark-derived Chart.IsHorizontalBar) and configure the Y axis as a band axis without the user having to specify either explicitly.

BarMark(PlottableValueRef, PlottableValueRef, PlottableValueRef, int)

Section titled “BarMark(PlottableValueRef, PlottableValueRef, PlottableValueRef, int)”
public BarMark(PlottableValueRef x, PlottableValueRef yStart, PlottableValueRef yEnd, int index = 0)

Creates an unstacked vertical range bar whose lower and upper Y boundaries come from semantic plottable values.

Parameters

NameType
xChartGuru.PlottableValueRef
yStartChartGuru.PlottableValueRef
yEndChartGuru.PlottableValueRef
indexSystem.Int32

public static BarMark YOnly(PlottableValueRef y)

1D vertical bar constructor. Mirrors Swift Charts: BarMark(y: .Value(“Size”, size)) All marks share x=0 and stack vertically via their series.

Parameters

NameType
yChartGuru.PlottableValueRef

Returns

ChartGuru.BarMark

XRange(PlottableValueRef, PlottableValueRef, PlottableValueRef, int)

Section titled “XRange(PlottableValueRef, PlottableValueRef, PlottableValueRef, int)”
public static BarMark XRange(PlottableValueRef xStart, PlottableValueRef xEnd, PlottableValueRef y, int index = 0)

Swift-style horizontal range bar (Gantt / pyramid). Mirrors Swift Charts: BarMark(xStart: .Value(“Start”, a), xEnd: .Value(“End”, b), y: .Value(“Job”, name)). When y is categorical, the resulting mark is automatically flagged horizontal and its category label propagates to the Y band axis at ChartBuilder.Build() time; no orientation modifier needed.

Parameters

NameType
xStartChartGuru.PlottableValueRef
xEndChartGuru.PlottableValueRef
yChartGuru.PlottableValueRef
indexSystem.Int32

Returns

ChartGuru.BarMark

Remarks

Exposed as a static factory rather than a constructor because the (PlottableValueRef, PlottableValueRef, PlottableValueRef, int) signature is already taken by the vertical range constructor; Swift disambiguates by argument label, but C# matches by position only. Call sites read identically: BarMark.XRange(xStart, xEnd, y).

YRange(float, float, float, MarkDimension)

Section titled “YRange(float, float, float, MarkDimension)”
public static BarMark YRange(float x, float yStart, float yEnd, MarkDimension width = default)

Creates a vertical range bar (for candlestick, range charts). Matches Swift Charts: BarMark(x:yStart:yEnd:width:)

Parameters

NameType
xSystem.Single
yStartSystem.Single
yEndSystem.Single
widthChartGuru.MarkDimension

Returns

ChartGuru.BarMark

XRange(float, float, float, MarkDimension)

Section titled “XRange(float, float, float, MarkDimension)”
public static BarMark XRange(float xStart, float xEnd, float y, MarkDimension height = default)

Creates a horizontal range bar (for pyramid charts, Gantt charts). Matches Swift Charts: BarMark(xStart:xEnd:y:height:)

Parameters

NameType
xStartSystem.Single
xEndSystem.Single
ySystem.Single
heightChartGuru.MarkDimension

Returns

ChartGuru.BarMark

public BarMark Stacking(MarkStackingMethod method)

Sets the stacking method for this bar. Swift Charts equivalent: BarMark(…, stacking: .standard)

Parameters

NameType
methodChartGuru.MarkStackingMethod

Returns

ChartGuru.BarMark

public BarMark CornerRadius(float radius)

Sets the corner radius for this bar. Swift Charts equivalent: .ClipShape(.rect(cornerRadius:))

Parameters

NameType
radiusSystem.Single

Returns

ChartGuru.BarMark

public BarMark ClipInset(float inset)

Insets an explicit rounded-rectangle clip in logical pixels, like RoundedRectangle(…).inset(by:).

Parameters

NameType
insetSystem.Single

Returns

ChartGuru.BarMark

public BarMark Width(MarkDimension dimension)

Sets the bar width using a Swift Charts MarkDimension. Equivalent to BarMark(… width: .ratio(0.8)) / .fixed(20) / .inset(2) / .automatic.

Parameters

NameType
dimensionChartGuru.MarkDimension

Returns

ChartGuru.BarMark

public BarMark Height(MarkDimension dimension)

Sets the bar height using a Swift Charts MarkDimension. Equivalent to BarMark(… height: .ratio(0.8)) on horizontal / 1-D bars.

Parameters

NameType
dimensionChartGuru.MarkDimension

Returns

ChartGuru.BarMark

public override (Vector2 source, Vector2 target) GetMorphTargets(ChartType targetType, Rect plotArea)

Projects this mark into plot-space geometry that the morph renderer can interpolate toward the requested chart type.

Parameters

NameType
targetTypeChartGuru.ChartType
plotAreaUnityEngine.Rect

Returns

System.ValueTuple{UnityEngine.Vector2,UnityEngine.Vector2}

public override IChartMark Clone()

Creates an independent copy of this Bar Mark; later configuration changes do not affect the original instance.

Returns

ChartGuru.IChartMark

public override ChartType MarkType { get; }

Returns

ChartGuru.ChartType

public BarLayout Layout { get; set; }

Returns

ChartGuru.BarLayout

public MarkStackingMethod StackingMethod { get; set; }

Returns

ChartGuru.MarkStackingMethod

public float CornerRadiusValue { get; set; }

Returns

System.Single

public float ClipInsetValue { get; set; }

Insets the painted rounded-rectangle clip in logical pixels without changing the bar’s data or hit geometry. Zero preserves the full bar. The corner radius decreases by the same inset.

Returns

System.Single

public MarkDimension WidthDimension { get; set; }

Bar width as a Swift Charts MarkDimension (.automatic, .fixed(N), .ratio(R), .inset(I)). For vertical bars this sizes the bar across the band (X) axis; for horizontal bars (range/Gantt) this sizes the bar thickness across the value axis. Defaults to .automatic.

Returns

ChartGuru.MarkDimension

public MarkDimension HeightDimension { get; set; }

Bar height as a Swift Charts MarkDimension. For horizontal bars this sizes the bar across the band (Y) axis; for vertical range bars this sizes the bar thickness across the value axis. Defaults to .automatic.

Returns

ChartGuru.MarkDimension

public float Baseline { get; set; }

Returns

System.Single

public Color StrokeColor { get; set; }

Returns

UnityEngine.Color

public float StrokeWidth { get; set; }

Returns

System.Single

public float? YStart { get; set; }

Optional Y range start for range bars (candlestick, range charts). When set, the bar spans from YStart to YEnd instead of baseline to Y.

Returns

System.Nullable{System.Single}

public float? YEnd { get; set; }

Optional Y range end for range bars.

Returns

System.Nullable{System.Single}

public float? XStart { get; set; }

Optional X range start for horizontal range bars (pyramid charts). When set, the bar spans from XStart to XEnd.

Returns

System.Nullable{System.Single}

public float? XEnd { get; set; }

Optional X range end for horizontal range bars.

Returns

System.Nullable{System.Single}

public bool IsYRangeBar { get; }

Whether this bar uses Y-range mode (yStart/yEnd defined).

Returns

System.Boolean

public bool IsXRangeBar { get; }

Whether this bar uses X-range mode (xStart/xEnd defined).

Returns

System.Boolean