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

Name Type
x System.Single
y System.Single
public BarMark(DataPoint point)

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

Parameters

Name Type
point ChartGuru.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 ChartGuru.DataPoint.Y for renderer compatibility; ChartGuru.BarMark.Layout is set to ChartGuru.BarLayout.Horizontal.

Parameters

Name Type
x ChartGuru.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 ChartGuru.PlottableValueRef bindings — when y is categorical (a string/enum/categorical PlottableValue), the mark is configured as a horizontal bar with ChartGuru.BarMark.Layout = ChartGuru.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

Name Type
x ChartGuru.PlottableValueRef
y ChartGuru.PlottableValueRef
index System.Int32

Remarks

To preserve compatibility with the existing renderer/layout pipeline (which assumes “value lives on ChartGuru.DataPoint.Y”), the categorical-Y case transposes storage at construction: the numeric x value is stored on ChartGuru.DataPoint.Y, and the category index is stored on ChartGuru.DataPoint.X. The ChartGuru.BarMark.Layout hint plus ChartGuru.ChartMark.CategoryLabel let ChartGuru.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

Name Type
x ChartGuru.PlottableValueRef
yStart ChartGuru.PlottableValueRef
yEnd ChartGuru.PlottableValueRef
index System.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

Name Type
y ChartGuru.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 ChartGuru.ChartBuilder.Build time — no orientation modifier needed.

Parameters

Name Type
xStart ChartGuru.PlottableValueRef
xEnd ChartGuru.PlottableValueRef
y ChartGuru.PlottableValueRef
index System.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

Name Type
x System.Single
yStart System.Single
yEnd System.Single
width ChartGuru.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

Name Type
xStart System.Single
xEnd System.Single
y System.Single
height ChartGuru.MarkDimension

Returns

ChartGuru.BarMark

public BarMark Stacking(MarkStackingMethod method)

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

Parameters

Name Type
method ChartGuru.MarkStackingMethod

Returns

ChartGuru.BarMark

public BarMark CornerRadius(float radius)

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

Parameters

Name Type
radius System.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

Name Type
dimension ChartGuru.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

Name Type
dimension ChartGuru.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

Name Type
targetType ChartGuru.ChartType
plotArea UnityEngine.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 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