Skip to content

ChartProxy

ClassChartGuruChartGuru
public class ChartProxy

Coordinate mapping and hit detection for charts. Similar to ChartProxy in Swift Charts, enables interaction between screen coordinates and data space.

Swift Charts equivalent: ChartProxy from .chartOverlay { proxy in … }

public ChartProxy(Chart chart)

Creates an interaction proxy bound to a chart. A null chart is rejected; coordinate bounds are calculated lazily.

Parameters

Name Type
chart ChartGuru.Chart

public void UpdateBarGeometries(IReadOnlyList<BarGeometry> bars)

Updates bar geometries in place from the supplied bars, preserving compatible chart object identity.

Parameters

Name Type
bars System.Collections.Generic.IReadOnlyList{ChartGuru.BarGeometry}
public void UpdateSectorGeometries(IReadOnlyList<SectorGeometry> sectors)

Updates sector geometries in place from the supplied sectors, preserving compatible chart object identity.

Parameters

Name Type
sectors System.Collections.Generic.IReadOnlyList{ChartGuru.SectorGeometry}

UpdateCandlestickGeometries(IReadOnlyList)

Section titled “UpdateCandlestickGeometries(IReadOnlyList)”
public void UpdateCandlestickGeometries(IReadOnlyList<CandleGeometry> candles)

Updates candlestick geometries in place from the supplied candles, preserving compatible chart object identity.

Parameters

Name Type
candles System.Collections.Generic.IReadOnlyList{ChartGuru.CandleGeometry}
public void UpdatePointGeometries(IReadOnlyList<PointGeometry> points)

Updates point geometries in place from the supplied points, preserving compatible chart object identity.

Parameters

Name Type
points System.Collections.Generic.IReadOnlyList{ChartGuru.PointGeometry}
public void UpdateScreenRect(Rect screenRect)

Updates screen rect in place from the supplied screen rect, preserving compatible chart object identity.

Parameters

Name Type
screenRect UnityEngine.Rect
public bool SelectAtPosition(Vector2 screenPosition)

Updates chart selection from a chart-local pointer position using rendered mark geometry.

Parameters

Name Type
screenPosition UnityEngine.Vector2

Returns

System.Boolean

public bool SelectAngleAtPosition(Vector2 screenPosition)

Updates angular selection by hit-testing a chart-local point against rendered sectors.

Parameters

Name Type
screenPosition UnityEngine.Vector2

Returns

System.Boolean

public bool SelectAtX(float screenX)

Updates horizontal selection from the supplied data or chart coordinate.

Parameters

Name Type
screenX System.Single

Returns

System.Boolean

public ClosedRange<float> SelectXRange(float startScreenX, float endScreenX)

Sets the selected horizontal data range and notifies registered selection listeners.

Parameters

Name Type
startScreenX System.Single
endScreenX System.Single

Returns

ChartGuru.ClosedRange{System.Single}

public ClosedRange<float> SelectYRange(float startScreenY, float endScreenY)

Sets the selected vertical data range and notifies registered selection listeners.

Parameters

Name Type
startScreenY System.Single
endScreenY System.Single

Returns

ChartGuru.ClosedRange{System.Single}

public void ClearRanges()

Clears ranges from this Chart Proxy without changing unrelated configuration.

public void ScrollXBy(float delta)

Offsets the visible horizontal domain by the supplied data-space distance.

Parameters

Name Type
delta System.Single
public void ScrollYBy(float delta)

Offsets the visible vertical domain by the supplied data-space distance.

Parameters

Name Type
delta System.Single
public void ScrollToX(float value)

Moves the visible horizontal domain so the requested data value aligns according to the scroll-target behavior.

Parameters

Name Type
value System.Single
public void ScrollToY(float value)

Moves the visible vertical domain so the requested data value aligns according to the scroll-target behavior.

Parameters

Name Type
value System.Single
public void PanByPixels(Vector2 pixelDelta)

Converts a plot-space pixel delta into data-space offsets and pans each enabled scrollable axis.

Parameters

Name Type
pixelDelta UnityEngine.Vector2
public void ZoomX(float zoomFactor, float anchorScreenX)

Scales the visible horizontal domain around the supplied data-space anchor.

Parameters

Name Type
zoomFactor System.Single
anchorScreenX System.Single
public void ZoomY(float zoomFactor, float anchorScreenY)

Scales the visible vertical domain around the supplied data-space anchor.

Parameters

Name Type
zoomFactor System.Single
anchorScreenY System.Single
public void Zoom(float zoomFactorX, float zoomFactorY, Vector2 anchorScreenPosition)

Scales both visible axis domains around the supplied anchor point while respecting configured limits.

Parameters

Name Type
zoomFactorX System.Single
zoomFactorY System.Single
anchorScreenPosition UnityEngine.Vector2
public void ResetXViewport()

Restores the horizontal axis to its configured visible domain.

public void ResetYViewport()

Restores the vertical axis to its configured visible domain.

public void ResetViewport()

Restores both axes to their configured visible domains and clears transient pan and zoom offsets.

public DataPoint? Value(Vector2 location)

Converts a chart-local point into horizontal and vertical values using the active scales and viewport.

Parameters

Name Type
location UnityEngine.Vector2

Returns

System.Nullable{ChartGuru.DataPoint}

public DataPoint? NearestValueAtX(float screenX)

Returns the data value represented by a chart-local X coordinate, or no value when layout is unavailable.

Parameters

Name Type
screenX System.Single

Returns

System.Nullable{ChartGuru.DataPoint}

public float ValueAtX(float screenX)

Converts a chart-local horizontal coordinate back into a data value using the active scale and viewport.

Parameters

Name Type
screenX System.Single

Returns

System.Single

public float ValueAtY(float screenY)

Converts a chart-local vertical coordinate back into a data value using the active scale and viewport.

Parameters

Name Type
screenY System.Single

Returns

System.Single

public float? AngleAt(Vector2 location)

Converts a chart-local point around the plot center into a normalized clockwise sector angle.

Parameters

Name Type
location UnityEngine.Vector2

Returns

System.Nullable{System.Single}

public Vector2 Position(DataPoint dataPoint)

Projects horizontal and vertical data values into chart-local plot coordinates using the active scales and viewport.

Parameters

Name Type
dataPoint ChartGuru.DataPoint

Returns

UnityEngine.Vector2

public float PositionForX(float xValue)

Projects a horizontal data value into chart-local plot coordinates, returning no value when layout is unavailable.

Parameters

Name Type
xValue System.Single

Returns

System.Single

public float PositionForY(float yValue)

Projects a vertical data value into chart-local plot coordinates, returning no value when layout is unavailable.

Parameters

Name Type
yValue System.Single

Returns

System.Single

public Vector2 PositionRangeForX(ClosedRange<float> range)

Projects a horizontal data range into chart-local plot coordinates using the active scale and viewport.

Parameters

Name Type
range ChartGuru.ClosedRange{System.Single}

Returns

UnityEngine.Vector2

public Vector2 PositionRangeForY(ClosedRange<float> range)

Projects a vertical data range into chart-local plot coordinates using the active scale and viewport.

Parameters

Name Type
range ChartGuru.ClosedRange{System.Single}

Returns

UnityEngine.Vector2

public Vector2 PositionRangeForX(float xValue)

Projects a horizontal data range into chart-local plot coordinates using the active scale and viewport.

Parameters

Name Type
xValue System.Single

Returns

UnityEngine.Vector2

public Vector2 PositionRangeForY(float yValue)

Projects a vertical data range into chart-local plot coordinates using the active scale and viewport.

Parameters

Name Type
yValue System.Single

Returns

UnityEngine.Vector2

public Color? ForegroundStyle(object value)

Resolves the color mapped to the supplied foreground-style key, returning no value when the scale has no mapping.

Parameters

Name Type
value System.Object

Returns

System.Nullable{UnityEngine.Color}

public SymbolShape? Symbol(object value)

Resolves the point symbol mapped to the supplied symbol key, returning no value when the scale has no mapping.

Parameters

Name Type
value System.Object

Returns

System.Nullable{ChartGuru.SymbolShape}

public StrokeStyle? LineStyle(object value)

Resolves the stroke mapped to the supplied line-style key, returning no value when the scale has no mapping.

Parameters

Name Type
value System.Object

Returns

System.Nullable{ChartGuru.StrokeStyle}

public float? SymbolSize(object value)

Resolves the point size mapped to the supplied symbol-size key, returning no value when the scale has no mapping.

Parameters

Name Type
value System.Object

Returns

System.Nullable{System.Single}

public IReadOnlyList<object> XDomain()

Returns the horizontal category sequence or numeric lower and upper bounds currently resolved by the chart.

Returns

System.Collections.Generic.IReadOnlyList{System.Object}

public IReadOnlyList<object> YDomain()

Returns the vertical category sequence or numeric lower and upper bounds currently resolved by the chart.

Returns

System.Collections.Generic.IReadOnlyList{System.Object}

public IReadOnlyList<object> ForegroundStyleDomain()

Returns the ordered keys currently present in the chart’s foreground-style scale.

Returns

System.Collections.Generic.IReadOnlyList{System.Object}

public IReadOnlyList<object> SymbolDomain()

Returns the ordered keys currently present in the chart’s symbol scale.

Returns

System.Collections.Generic.IReadOnlyList{System.Object}

public IReadOnlyList<object> LineStyleDomain()

Returns the ordered keys currently present in the chart’s line-style scale.

Returns

System.Collections.Generic.IReadOnlyList{System.Object}

public IReadOnlyList<object> SymbolSizeDomain()

Returns the ordered keys currently present in the chart’s symbol-size scale.

Returns

System.Collections.Generic.IReadOnlyList{System.Object}

public int GetDataPointIndexAt(Vector2 screenPosition)

Hit-tests a screen-space position against cached mark geometry, using shape-aware tests for bars, candles, sectors, and stacked areas before falling back to point proximity. Returns -1 when no rendered mark is hit or layout bounds are unavailable.

Parameters

Name Type
screenPosition UnityEngine.Vector2

Returns

System.Int32

public Vector2 GetPositionFor(DataPoint dataPoint)

Projects a data point’s X and Y values into screen space using current domains, axis transforms, and plot padding.

Parameters

Name Type
dataPoint ChartGuru.DataPoint

Returns

UnityEngine.Vector2

public float GetXValueAt(float screenX)

Maps a screen-space X coordinate into the visible data domain, clamping positions outside the plot area to its bounds.

Parameters

Name Type
screenX System.Single

Returns

System.Single

public float GetYValueAt(float screenY)

Maps a screen-space Y coordinate into raw data space, clamping to the plot bounds and reversing any nonlinear Y-axis transform.

Parameters

Name Type
screenY System.Single

Returns

System.Single

public int GetNearestDataPointIndexAtX(float xValue)

Returns the mark index whose data-domain X value is nearest to the supplied value, or -1 when the chart is empty.

Parameters

Name Type
xValue System.Single

Returns

System.Int32

public int GetDataPointIndexAtX(float screenX)

Converts a screen-space X coordinate to the visible domain and returns the nearest mark index.

Parameters

Name Type
screenX System.Single

Returns

System.Int32

public Chart Chart { get; }

Updates the cached bar geometries for accurate hit detection. Should be called after layout computation.

Returns

ChartGuru.Chart

public Rect PlotAreaFrame { get; }

Enumerates the X-axis domain. For a band axis this returns the configured category strings; otherwise the lower/upper bounds. Swift Charts equivalent: proxy.xDomain

Returns

UnityEngine.Rect

public Rect PlotFrame { get; }

Plot frame matching newer Swift Charts naming. Swift Charts equivalent: proxy.plotFrame

Returns

UnityEngine.Rect

public Vector2 PlotSize { get; }

Plot area size in pixels. Equivalent to PlotFrame.size. Swift Charts equivalent: proxy.plotSize

Returns

UnityEngine.Vector2

public Rect PlotContainerFrame { get; }

The full chart container rect in screen coordinates (plot area plus surrounding axis decorations and labels). Swift Charts equivalent: proxy.plotContainerFrame

Returns

UnityEngine.Rect

public ClosedRange<float> VisibleXDomain { get; }

Current X domain visible in the chart viewport.

Returns

ChartGuru.ClosedRange{System.Single}

public ClosedRange<float> VisibleYDomain { get; }

Current Y domain visible in the chart viewport.

Returns

ChartGuru.ClosedRange{System.Single}

public ClosedRange<float> DataXDomain { get; }

Raw X domain from chart data before viewport clipping.

Returns

ChartGuru.ClosedRange{System.Single}

public ClosedRange<float> DataYDomain { get; }

Raw Y domain from chart data before viewport clipping.

Returns

ChartGuru.ClosedRange{System.Single}

public float ScrollPositionX { get; }

Current X scroll position expressed as the visible domain’s lower bound.

Returns

System.Single

public float ScrollPositionY { get; }

Current Y scroll position expressed as the visible domain’s lower bound.

Returns

System.Single

public bool IsXViewportActive { get; }

Returns true when the X axis is currently showing a clipped viewport rather than the full data domain.

Returns

System.Boolean

public bool IsYViewportActive { get; }

Returns true when the Y axis is currently showing a clipped viewport rather than the full data domain.

Returns

System.Boolean