Skip to content

AxisBuilder

ClassChartGuruChartGuru
public class AxisBuilder

Fluent builder for axis titles, domains, ticks, grid lines, formatting, visibility, and scale behavior.

public AxisBuilder()

Creates an Axis Builder backed by the current configuration; fluent changes are accumulated until the configuration is built.

public AxisBuilder(AxisConfig config)

Creates an Axis Builder backed by the supplied config; fluent changes are accumulated until the configuration is built.

Parameters

Name Type
config ChartGuru.AxisConfig

public AxisBuilder Label(string label)

Sets the axis title shown outside its tick labels and returns this builder.

Parameters

Name Type
label System.String

Returns

ChartGuru.AxisBuilder

Label(string, AxisLabelAlignment, AxisLabelPosition, float)

Section titled “Label(string, AxisLabelAlignment, AxisLabelPosition, float)”
public AxisBuilder Label(string label, AxisLabelAlignment alignment = AxisLabelAlignment.Automatic, AxisLabelPosition position = AxisLabelPosition.Automatic, float spacing = 0)

Full Swift-shaped axis label configuration: title text, cross-axis alignment, along-axis position, and extra pixel spacing between plot area and title. Swift Charts equivalent: ChartXAxisLabel(_:alignment:spacing:position:).

Parameters

Name Type
label System.String
alignment ChartGuru.AxisLabelAlignment
position ChartGuru.AxisLabelPosition
spacing System.Single

Returns

ChartGuru.AxisBuilder

public AxisBuilder LabelAlignment(AxisLabelAlignment alignment)

Sets the cross-axis alignment of the axis title (leading/center/trailing relative to the plot area’s edge that holds the title).

Parameters

Name Type
alignment ChartGuru.AxisLabelAlignment

Returns

ChartGuru.AxisBuilder

public AxisBuilder LabelPosition(AxisLabelPosition position)

Sets the along-axis position of the axis title (leading/center/trailing along the axis).

Parameters

Name Type
position ChartGuru.AxisLabelPosition

Returns

ChartGuru.AxisBuilder

public AxisBuilder LabelSpacing(float spacing)

Sets the extra pixel spacing between the plot area and the axis title.

Parameters

Name Type
spacing System.Single

Returns

ChartGuru.AxisBuilder

public AxisBuilder GridLine(bool show = true)

Controls whether major grid lines extend from this axis across the plot area.

Parameters

Name Type
show System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder NoGridLine()

Disables grid lines for this axis while leaving ticks and labels unchanged.

Returns

ChartGuru.AxisBuilder

public AxisBuilder GridLineColor(Color color)

Overrides the theme color used for this axis’s grid lines.

Parameters

Name Type
color UnityEngine.Color

Returns

ChartGuru.AxisBuilder

public AxisBuilder GridLineStroke(StrokeStyle stroke)

Sets the width and dash pattern used to draw this axis’s grid lines.

Parameters

Name Type
stroke ChartGuru.StrokeStyle

Returns

ChartGuru.AxisBuilder

public AxisBuilder IntegerOnlyMajorGrid(Color? minorGridLineColor = null, float? minorGridLineWidth = null)

Restricts major grid lines to integer values, with optional color and width overrides.

Parameters

Name Type
minorGridLineColor System.Nullable{UnityEngine.Color}
minorGridLineWidth System.Nullable{System.Single}

Returns

ChartGuru.AxisBuilder

public AxisBuilder TickStroke(StrokeStyle stroke)

Sets the width and dash pattern used to draw axis ticks.

Parameters

Name Type
stroke ChartGuru.StrokeStyle

Returns

ChartGuru.AxisBuilder

public AxisBuilder Ticks()

Enables axis ticks, optionally requesting an approximate major-tick count.

Returns

ChartGuru.AxisBuilder

public AxisBuilder Tick(bool show = true)

Controls whether tick marks are drawn for this axis.

Parameters

Name Type
show System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder Ticks(int count)

Enables axis ticks, optionally requesting an approximate major-tick count.

Parameters

Name Type
count System.Int32

Returns

ChartGuru.AxisBuilder

public AxisBuilder TickCount(int count)

Requests an approximate number of major ticks; the active scale may adjust the final values for readable intervals.

Parameters

Name Type
count System.Int32

Returns

ChartGuru.AxisBuilder

public AxisBuilder NiceTicks(bool enabled = true)

Controls whether numeric tick intervals and domain edges are rounded to readable values.

Parameters

Name Type
enabled System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder NoTicks()

Hides tick marks without changing axis labels or grid lines.

Returns

ChartGuru.AxisBuilder

public AxisBuilder ShowLabels(bool show = true)

Controls whether formatted tick labels are rendered for this axis.

Parameters

Name Type
show System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder NoLabels()

Hides tick labels without changing the axis line, ticks, or grid lines.

Returns

ChartGuru.AxisBuilder

public AxisBuilder TickFormat(string format)

Sets the numeric format string or formatter callback used to produce tick-label text.

Parameters

Name Type
format System.String

Returns

ChartGuru.AxisBuilder

public AxisBuilder TickFormat(Func<float, string> formatter)

Sets the numeric format string or formatter callback used to produce tick-label text.

Parameters

Name Type
formatter System.Func{System.Single,System.String}

Returns

ChartGuru.AxisBuilder

FormatStyle(AxisFormatStyle, string, CultureInfo)

Section titled “FormatStyle(AxisFormatStyle, string, CultureInfo)”
public AxisBuilder FormatStyle(AxisFormatStyle style, string pattern = null, CultureInfo culture = null)

Selects a high-level ChartGuru.AxisFormatStyle for tick labels (Number / Percent / Currency / DateTime). Pass a pattern to override the default format string (e.g. “F2”, “C2”, “MMM yyyy”) and an optional culture. Swift Charts equivalent: chartXAxis { AxisMarks(format: .number) }.

Parameters

Name Type
style ChartGuru.AxisFormatStyle
pattern System.String
culture System.Globalization.CultureInfo

Returns

ChartGuru.AxisBuilder

public AxisBuilder AbsoluteValueLabels(bool enabled = true)

Controls whether negative tick values are displayed without their sign while retaining their numeric positions.

Parameters

Name Type
enabled System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder Culture(CultureInfo culture)

Overrides the System.Globalization.CultureInfo used when formatting tick labels (affects decimal separators, month names, currency symbols, etc.).

Parameters

Name Type
culture System.Globalization.CultureInfo

Returns

ChartGuru.AxisBuilder

public AxisBuilder Format(string format)

Sets the standard numeric format used for axis values and labels.

Parameters

Name Type
format System.String

Returns

ChartGuru.AxisBuilder

public AxisBuilder Domain(float min, float max)

Sets the numeric input domain sampled by the plot; values outside the interval are not generated.

Parameters

Name Type
min System.Single
max System.Single

Returns

ChartGuru.AxisBuilder

public AxisBuilder AutoDomain(bool includeZero = true)

Controls whether the axis domain is inferred from visible marks instead of using explicit bounds.

Parameters

Name Type
includeZero System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder Visible(bool visible)

Controls whether the axis line, ticks, labels, title, and grid contribution are rendered.

Parameters

Name Type
visible System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder Hide()

Hides this configured element while preserving its settings for later reuse.

Returns

ChartGuru.AxisBuilder

public AxisBuilder Show()

Makes this configured element visible using its existing settings.

Returns

ChartGuru.AxisBuilder

public AxisBuilder AxisLine(bool show = true)

Controls whether the baseline axis line is drawn.

Parameters

Name Type
show System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder AxisColor(Color color)

Overrides the theme color used for the axis line and ticks.

Parameters

Name Type
color UnityEngine.Color

Returns

ChartGuru.AxisBuilder

public AxisBuilder LabelColor(Color color)

Overrides the theme color used for axis tick labels.

Parameters

Name Type
color UnityEngine.Color

Returns

ChartGuru.AxisBuilder

public AxisBuilder LabelFontSize(int size)

Sets the axis tick-label font size in pixels.

Parameters

Name Type
size System.Int32

Returns

ChartGuru.AxisBuilder

public AxisBuilder TitleFontSize(int size)

Sets the axis title font size in pixels.

Parameters

Name Type
size System.Int32

Returns

ChartGuru.AxisBuilder

public AxisBuilder Position(AxisPosition position)

Binds projected values to a chart axis and dimension, controlling where each generated mark is laid out.

Parameters

Name Type
position ChartGuru.AxisPosition

Returns

ChartGuru.AxisBuilder

public AxisBuilder OnRight()

Places the axis on the right side (for Y-axis) or top (for X-axis).

Returns

ChartGuru.AxisBuilder

public AxisBuilder OnLeft()

Places the axis on the left side (for Y-axis) or bottom (for X-axis). This is the default.

Returns

ChartGuru.AxisBuilder

public AxisBuilder Invert(bool inverted = true)

Reverses the axis mapping so larger values are laid out toward the opposite edge.

Parameters

Name Type
inverted System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder LogScale(bool useLog = true, float logBase = 10)

Enables logarithmic projection with the supplied base; nonpositive values cannot be represented.

Parameters

Name Type
useLog System.Boolean
logBase System.Single

Returns

ChartGuru.AxisBuilder

public AxisBuilder IsTimeAxis(bool enabled = true)

Toggles time-axis mode. When enabled, tick values are interpreted as seconds since the Unix epoch (see TimeAxisHelper.AxisSeconds(DateTime)).

Parameters

Name Type
enabled System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder TimeUnit(TimeUnit unit)

Sets the preferred ChartGuru.AxisBuilder.TimeUnit(ChartGuru.TimeUnit) for tick spacing on a time axis. Swift Charts equivalent: .Stride(by: .month)

Parameters

Name Type
unit ChartGuru.TimeUnit

Returns

ChartGuru.AxisBuilder

public AxisBuilder TimeFormat(string format)

Sets the date/time format string used to render tick labels on a time axis (standard or custom .NET DateTime format, e.g. “MMM yyyy” or “dd HH:mm”).

Parameters

Name Type
format System.String

Returns

ChartGuru.AxisBuilder

public AxisBuilder TimeDomain(DateTime min, DateTime max)

Sets an explicit time-axis domain. Overrides the data-derived domain and implicitly disables ChartGuru.AxisConfig.AutoDomain.

Parameters

Name Type
min System.DateTime
max System.DateTime

Returns

ChartGuru.AxisBuilder

public AxisBuilder ShowTicks(bool show = true)

Controls whether tick marks are drawn without changing tick labels.

Parameters

Name Type
show System.Boolean

Returns

ChartGuru.AxisBuilder

public AxisBuilder TickLength(float length)

Sets the tick length in pixels or supplies a semantic automatic, label-relative, or explicit length.

Parameters

Name Type
length System.Single

Returns

ChartGuru.AxisBuilder

public AxisBuilder TickLength(AxisTickLength length)

Sets tick length using a composable ChartGuru.AxisTickLength. Swift Charts equivalent: .tickLength(.label(extendPastBy: 4)).

Parameters

Name Type
length ChartGuru.AxisTickLength

Returns

ChartGuru.AxisBuilder

public AxisBuilder Padding(float padding)

Sets the space in pixels between the axis content and the plot area.

Parameters

Name Type
padding System.Single

Returns

ChartGuru.AxisBuilder

LabelOrientation(AxisValueLabelOrientation)

Section titled “LabelOrientation(AxisValueLabelOrientation)”
public AxisBuilder LabelOrientation(AxisValueLabelOrientation orientation)

Force a specific tick-label rotation. Swift Charts: AxisValueLabelOrientation.

Parameters

Name Type
orientation ChartGuru.AxisValueLabelOrientation

Returns

ChartGuru.AxisBuilder

LabelCollisionResolution(AxisValueLabelCollisionResolution)

Section titled “LabelCollisionResolution(AxisValueLabelCollisionResolution)”
public AxisBuilder LabelCollisionResolution(AxisValueLabelCollisionResolution resolution)

Strategy for resolving overlapping tick labels. Swift Charts: AxisValueLabelCollisionResolution.

Parameters

Name Type
resolution ChartGuru.AxisValueLabelCollisionResolution

Returns

ChartGuru.AxisBuilder

public AxisBuilder LabelStride(TimeUnit unit, int count = 1)

Sets a label stride so only ticks aligned to calendar boundaries show labels, while grid lines and tick marks remain at every position. Convenience for the common “daily grid, monthly labels” pattern — equivalent to a per-value callback that conditionally hides AxisValueLabel().

Parameters

Name Type
unit ChartGuru.TimeUnit
count System.Int32

Returns

ChartGuru.AxisBuilder

public AxisBuilder LabelStride(float by)

Sets a numeric label stride so only ticks at multiples of by from the first tick show labels, while grid lines remain at every position.

Parameters

Name Type
by System.Single

Returns

ChartGuru.AxisBuilder

public AxisBuilder AlignsOrigin(bool aligns = true)

Draw this axis through the data origin (zero) instead of the plot edge when the axis crosses zero. Swift Charts: chartXAxisAlignsOrigin / chartYAxisAlignsOrigin.

Parameters

Name Type
aligns System.Boolean

Returns

ChartGuru.AxisBuilder

ModifyInferredDomain(Func<ClosedRange, ClosedRange>)

Section titled “ModifyInferredDomain(Func<ClosedRange, ClosedRange>)”
public AxisBuilder ModifyInferredDomain(Func<ClosedRange<float>, ClosedRange<float>> modifier)

Installs a callback that can reshape the auto-inferred axis domain before it becomes authoritative. Only fired when the axis was left to auto-infer (i.e. ChartGuru.AxisConfig.HasExplicitDomain is false). Swift Charts equivalent: .modifyInferredDomain { range in … }.

Parameters

Name Type
modifier System.Func{ChartGuru.ClosedRange{System.Single},ChartGuru.ClosedRange{System.Single}}

Returns

ChartGuru.AxisBuilder

public AxisBuilder ScaleTransformer(IScaleTransformer transformer)

Plugs a custom ChartGuru.IScaleTransformer for this axis. Overrides any ChartGuru.AxisConfig.ScaleType set previously. Swift Charts equivalent: ChartXScale(transformer:) / ChartYScale(transformer:).

Parameters

Name Type
transformer ChartGuru.IScaleTransformer

Returns

ChartGuru.AxisBuilder

public AxisBuilder Size(float size)

Sets the reserved axis thickness in pixels.

Parameters

Name Type
size System.Single

Returns

ChartGuru.AxisBuilder

public AxisBuilder AxisMarks(Action<AxisMarksBuilder> configure)

Configures axis marks using a builder pattern. Swift Charts equivalent: .chartXAxis { AxisMarks(…) { } }

Parameters

Name Type
configure System.Action{ChartGuru.AxisMarksBuilder}

Returns

ChartGuru.AxisBuilder

public AxisBuilder AxisMarks(float[] values, Action<AxisMarksBuilder> configure = null)

Configures axis marks with specific values. Swift Charts equivalent: .chartXAxis { AxisMarks(values: […]) { } }

Parameters

Name Type
values System.Single[]
configure System.Action{ChartGuru.AxisMarksBuilder}

Returns

ChartGuru.AxisBuilder

public AxisBuilder AxisMarks(AxisMarkValues values, Action<AxisMarksBuilder> configure = null)

Configures axis marks with automatic values and desired count. Swift Charts equivalent: .chartXAxis { AxisMarks(values: .Automatic(desiredCount: 5)) }

Parameters

Name Type
values ChartGuru.AxisMarkValues
configure System.Action{ChartGuru.AxisMarksBuilder}

Returns

ChartGuru.AxisBuilder

AxisMarks(AxisMarkPosition, AxisMarkValues, Action)

Section titled “AxisMarks(AxisMarkPosition, AxisMarkValues, Action)”
public AxisBuilder AxisMarks(AxisMarkPosition position, AxisMarkValues values = null, Action<AxisMarksBlockBuilder> configure = null)

Adds an AxisMarks block with position and optional values. Swift Charts equivalent: AxisMarks(position: .trailing, values: .Automatic(desiredCount: 14)) { … }

Parameters

Name Type
position ChartGuru.AxisMarkPosition
values ChartGuru.AxisMarkValues
configure System.Action{ChartGuru.AxisMarksBlockBuilder}

Returns

ChartGuru.AxisBuilder

AxisMarks(AxisMarkPreset, AxisMarkPosition, AxisMarkValues, Action)

Section titled “AxisMarks(AxisMarkPreset, AxisMarkPosition, AxisMarkValues, Action)”
public AxisBuilder AxisMarks(AxisMarkPreset preset, AxisMarkPosition position, AxisMarkValues values = null, Action<AxisMarksBlockBuilder> configure = null)

Adds an AxisMarks block with preset, position, and optional values. Swift Charts equivalent: AxisMarks(preset: .inset, position: .leading, values: .Automatic(desiredCount: 14)) { … }

Parameters

Name Type
preset ChartGuru.AxisMarkPreset
position ChartGuru.AxisMarkPosition
values ChartGuru.AxisMarkValues
configure System.Action{ChartGuru.AxisMarksBlockBuilder}

Returns

ChartGuru.AxisBuilder

public AxisBuilder Preset(AxisMarkPreset preset)

Sets the label placement preset for the axis. Automatic = chart-type default. Inset = inside plot area. Aligned/Extended = outside.

Parameters

Name Type
preset ChartGuru.AxisMarkPreset

Returns

ChartGuru.AxisBuilder

public AxisConfig Build()

Returns an independent axis configuration snapshot containing the accumulated settings.

Returns

ChartGuru.AxisConfig