ChartProxy
public class ChartProxyCoordinate 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 … }
Constructors
Section titled “Constructors”
ChartProxy(Chart)
Section titled “ChartProxy(Chart)”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 |
Methods
Section titled “Methods”
UpdateBarGeometries(IReadOnlyList)
Section titled “UpdateBarGeometries(IReadOnlyList)”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} |
UpdateSectorGeometries(IReadOnlyList)
Section titled “UpdateSectorGeometries(IReadOnlyList)”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} |
UpdatePointGeometries(IReadOnlyList)
Section titled “UpdatePointGeometries(IReadOnlyList)”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} |
UpdateScreenRect(Rect)
Section titled “UpdateScreenRect(Rect)”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 |
SelectAtPosition(Vector2)
Section titled “SelectAtPosition(Vector2)”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
SelectAngleAtPosition(Vector2)
Section titled “SelectAngleAtPosition(Vector2)”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
SelectAtX(float)
Section titled “SelectAtX(float)”public bool SelectAtX(float screenX)Updates horizontal selection from the supplied data or chart coordinate.
Parameters
| Name | Type |
|---|---|
screenX |
System.Single |
Returns
System.Boolean
SelectXRange(float, float)
Section titled “SelectXRange(float, float)”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}
SelectYRange(float, float)
Section titled “SelectYRange(float, float)”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}
ClearRanges()
Section titled “ClearRanges()”public void ClearRanges()Clears ranges from this Chart Proxy without changing unrelated configuration.
ScrollXBy(float)
Section titled “ScrollXBy(float)”public void ScrollXBy(float delta)Offsets the visible horizontal domain by the supplied data-space distance.
Parameters
| Name | Type |
|---|---|
delta |
System.Single |
ScrollYBy(float)
Section titled “ScrollYBy(float)”public void ScrollYBy(float delta)Offsets the visible vertical domain by the supplied data-space distance.
Parameters
| Name | Type |
|---|---|
delta |
System.Single |
ScrollToX(float)
Section titled “ScrollToX(float)”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 |
ScrollToY(float)
Section titled “ScrollToY(float)”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 |
PanByPixels(Vector2)
Section titled “PanByPixels(Vector2)”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 |
ZoomX(float, float)
Section titled “ZoomX(float, float)”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 |
ZoomY(float, float)
Section titled “ZoomY(float, float)”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 |
Zoom(float, float, Vector2)
Section titled “Zoom(float, float, Vector2)”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 |
ResetXViewport()
Section titled “ResetXViewport()”public void ResetXViewport()Restores the horizontal axis to its configured visible domain.
ResetYViewport()
Section titled “ResetYViewport()”public void ResetYViewport()Restores the vertical axis to its configured visible domain.
ResetViewport()
Section titled “ResetViewport()”public void ResetViewport()Restores both axes to their configured visible domains and clears transient pan and zoom offsets.
Value(Vector2)
Section titled “Value(Vector2)”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}
NearestValueAtX(float)
Section titled “NearestValueAtX(float)”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}
ValueAtX(float)
Section titled “ValueAtX(float)”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
ValueAtY(float)
Section titled “ValueAtY(float)”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
AngleAt(Vector2)
Section titled “AngleAt(Vector2)”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}
Position(DataPoint)
Section titled “Position(DataPoint)”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
PositionForX(float)
Section titled “PositionForX(float)”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
PositionForY(float)
Section titled “PositionForY(float)”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
PositionRangeForX(ClosedRange)
Section titled “PositionRangeForX(ClosedRange)”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
PositionRangeForY(ClosedRange)
Section titled “PositionRangeForY(ClosedRange)”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
PositionRangeForX(float)
Section titled “PositionRangeForX(float)”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
PositionRangeForY(float)
Section titled “PositionRangeForY(float)”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
ForegroundStyle(object)
Section titled “ForegroundStyle(object)”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}
Symbol(object)
Section titled “Symbol(object)”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}
LineStyle(object)
Section titled “LineStyle(object)”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}
SymbolSize(object)
Section titled “SymbolSize(object)”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}
XDomain()
Section titled “XDomain()”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}
YDomain()
Section titled “YDomain()”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}
ForegroundStyleDomain()
Section titled “ForegroundStyleDomain()”public IReadOnlyList<object> ForegroundStyleDomain()Returns the ordered keys currently present in the chart’s foreground-style scale.
Returns
System.Collections.Generic.IReadOnlyList{System.Object}
SymbolDomain()
Section titled “SymbolDomain()”public IReadOnlyList<object> SymbolDomain()Returns the ordered keys currently present in the chart’s symbol scale.
Returns
System.Collections.Generic.IReadOnlyList{System.Object}
LineStyleDomain()
Section titled “LineStyleDomain()”public IReadOnlyList<object> LineStyleDomain()Returns the ordered keys currently present in the chart’s line-style scale.
Returns
System.Collections.Generic.IReadOnlyList{System.Object}
SymbolSizeDomain()
Section titled “SymbolSizeDomain()”public IReadOnlyList<object> SymbolSizeDomain()Returns the ordered keys currently present in the chart’s symbol-size scale.
Returns
System.Collections.Generic.IReadOnlyList{System.Object}
GetDataPointIndexAt(Vector2)
Section titled “GetDataPointIndexAt(Vector2)”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
GetPositionFor(DataPoint)
Section titled “GetPositionFor(DataPoint)”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
GetXValueAt(float)
Section titled “GetXValueAt(float)”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
GetYValueAt(float)
Section titled “GetYValueAt(float)”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
GetNearestDataPointIndexAtX(float)
Section titled “GetNearestDataPointIndexAtX(float)”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
GetDataPointIndexAtX(float)
Section titled “GetDataPointIndexAtX(float)”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
Properties
Section titled “Properties”
public Chart Chart { get; }Updates the cached bar geometries for accurate hit detection. Should be called after layout computation.
Returns
ChartGuru.Chart
PlotAreaFrame
Section titled “PlotAreaFrame”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
PlotFrame
Section titled “PlotFrame”public Rect PlotFrame { get; }Plot frame matching newer Swift Charts naming. Swift Charts equivalent: proxy.plotFrame
Returns
UnityEngine.Rect
PlotSize
Section titled “PlotSize”public Vector2 PlotSize { get; }Plot area size in pixels. Equivalent to PlotFrame.size.
Swift Charts equivalent: proxy.plotSize
Returns
UnityEngine.Vector2
PlotContainerFrame
Section titled “PlotContainerFrame”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
VisibleXDomain
Section titled “VisibleXDomain”public ClosedRange<float> VisibleXDomain { get; }Current X domain visible in the chart viewport.
Returns
ChartGuru.ClosedRange{System.Single}
VisibleYDomain
Section titled “VisibleYDomain”public ClosedRange<float> VisibleYDomain { get; }Current Y domain visible in the chart viewport.
Returns
ChartGuru.ClosedRange{System.Single}
DataXDomain
Section titled “DataXDomain”public ClosedRange<float> DataXDomain { get; }Raw X domain from chart data before viewport clipping.
Returns
ChartGuru.ClosedRange{System.Single}
DataYDomain
Section titled “DataYDomain”public ClosedRange<float> DataYDomain { get; }Raw Y domain from chart data before viewport clipping.
Returns
ChartGuru.ClosedRange{System.Single}
ScrollPositionX
Section titled “ScrollPositionX”public float ScrollPositionX { get; }Current X scroll position expressed as the visible domain’s lower bound.
Returns
System.Single
ScrollPositionY
Section titled “ScrollPositionY”public float ScrollPositionY { get; }Current Y scroll position expressed as the visible domain’s lower bound.
Returns
System.Single
IsXViewportActive
Section titled “IsXViewportActive”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
IsYViewportActive
Section titled “IsYViewportActive”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