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

NameType
chartChartGuru.Chart

public void UpdateBarGeometries(IReadOnlyList<BarGeometry> bars)

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

Parameters

NameType
barsSystem.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

NameType
sectorsSystem.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

NameType
candlesSystem.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

NameType
pointsSystem.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

NameType
screenRectUnityEngine.Rect
public bool SelectAtPosition(Vector2 screenPosition)

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

Parameters

NameType
screenPositionUnityEngine.Vector2

Returns

System.Boolean

public bool SelectAngleAtPosition(Vector2 screenPosition)

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

Parameters

NameType
screenPositionUnityEngine.Vector2

Returns

System.Boolean

public bool SelectAtX(float screenX)

Updates horizontal selection from the supplied data or chart coordinate.

Parameters

NameType
screenXSystem.Single

Returns

System.Boolean

public bool SelectXValueAt(float chartLocalX)

Selects a raw horizontal axis value at a chart-local X coordinate. Categorical axes resolve the category slot; no mark is selected.

Parameters

NameType
chartLocalXSystem.Single

Returns

System.Boolean

Remarks

Unlike ChartProxy.SelectAtX(float), continuous values are not snapped to a datum. Coordinates outside the plot clear only X selection.

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

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

Parameters

NameType
startScreenXSystem.Single
endScreenXSystem.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

NameType
startScreenYSystem.Single
endScreenYSystem.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

NameType
deltaSystem.Single
public void ScrollYBy(float delta)

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

Parameters

NameType
deltaSystem.Single
public void ScrollToX(float value)

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

Parameters

NameType
valueSystem.Single
public void ScrollToY(float value)

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

Parameters

NameType
valueSystem.Single
public void PanByPixels(Vector2 pixelDelta)

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

Parameters

NameType
pixelDeltaUnityEngine.Vector2
public void ZoomX(float zoomFactor, float anchorScreenX)

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

Parameters

NameType
zoomFactorSystem.Single
anchorScreenXSystem.Single
public void ZoomY(float zoomFactor, float anchorScreenY)

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

Parameters

NameType
zoomFactorSystem.Single
anchorScreenYSystem.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

NameType
zoomFactorXSystem.Single
zoomFactorYSystem.Single
anchorScreenPositionUnityEngine.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

NameType
locationUnityEngine.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

NameType
screenXSystem.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

NameType
screenXSystem.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

NameType
screenYSystem.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

NameType
locationUnityEngine.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

NameType
dataPointChartGuru.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

NameType
xValueSystem.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

NameType
yValueSystem.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

NameType
rangeChartGuru.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

NameType
rangeChartGuru.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

NameType
xValueSystem.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

NameType
yValueSystem.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

NameType
valueSystem.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

NameType
valueSystem.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

NameType
valueSystem.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

NameType
valueSystem.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

NameType
screenPositionUnityEngine.Vector2

Returns

System.Int32

public bool TryGetHit(Vector2 screenPosition, out ChartHitResult hit)

Hit-tests a chart-space position and returns the rendered mark geometry, anchor, bounds, and color. This is the preferred interaction API for overlays that need more than a mark index.

Parameters

NameType
screenPositionUnityEngine.Vector2
hitChartGuru.ChartHitResult

Returns

System.Boolean

public bool TryGetHitForMark(int markIndex, out ChartHitResult hit)

Returns the best retained geometry and anchor for a known mark index.

Parameters

NameType
markIndexSystem.Int32
hitChartGuru.ChartHitResult

Returns

System.Boolean

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

NameType
dataPointChartGuru.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

NameType
screenXSystem.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

NameType
screenYSystem.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

NameType
xValueSystem.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

NameType
screenXSystem.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