ChartLayoutEngine
public class ChartLayoutEngineRenderer-agnostic layout engine for charts. Computes all positions, sizes, and layout data needed for rendering. This is the single source of truth for chart geometry.
All internal calculations are done in Cartesian coordinates (Y=0 at bottom). Use ProjectToGUI() methods or set TargetCoordinateSystem to GUI to get positions suitable for Unity Editor GUI rendering.
Methods
Section titled “Methods”
GetSeriesColorIndex(IChartMark)
Section titled “GetSeriesColorIndex(IChartMark)”public int GetSeriesColorIndex(IChartMark mark)Gets the color index for a mark based on its series key. All marks with the same SeriesKey get the same color.
Parameters
| Name | Type | Description |
|---|---|---|
mark |
ChartGuru.IChartMark |
Returns
System.Int32 — No return description is available.
GetMarkColor(IChartMark, int, int, int)
Section titled “GetMarkColor(IChartMark, int, int, int)”public Color GetMarkColor(IChartMark mark, int fallbackIndex = 0, int dataPointIndex = -1, int stripEndIndex = -1)Gets the color for a mark. Priority: explicit ForegroundColor → ColorScale (numeric key) → theme color by SeriesKey → fallback Applies hover/selection effects based on dataPointIndex. When stripEndIndex >= 0, used for area strips: don’t dim if either dataPointIndex or stripEndIndex is selected.
Parameters
| Name | Type | Description |
|---|---|---|
mark |
ChartGuru.IChartMark | |
fallbackIndex |
System.Int32 | |
dataPointIndex |
System.Int32 | |
stripEndIndex |
System.Int32 |
Returns
UnityEngine.Color — No return description is available.
GetThemeColor(int)
Section titled “GetThemeColor(int)”public Color GetThemeColor(int seriesIndex)Gets the theme color for a given series index, ignoring any mark overrides. Used for legend swatches which should always show the base theme color.
Parameters
| Name | Type | Description |
|---|---|---|
seriesIndex |
System.Int32 |
Returns
UnityEngine.Color — No return description is available.
DetermineTrendLabelPosition(float, float?, float?)
Section titled “DetermineTrendLabelPosition(float, float?, float?)”public static DataLabelPosition DetermineTrendLabelPosition(float currentValue, float? previousValue, float? nextValue)No description is available for this member.
Parameters
| Name | Type | Description |
|---|---|---|
currentValue |
System.Single | |
previousValue |
System.Nullable{System.Single} | |
nextValue |
System.Nullable{System.Single} |
Returns
ChartGuru.DataLabelPosition — No return description is available.
DetermineRadialLabelPosition(Vector2, bool)
Section titled “DetermineRadialLabelPosition(Vector2, bool)”public static DataLabelPosition DetermineRadialLabelPosition(Vector2 direction, bool yIncreasesDownward = false)No description is available for this member.
Parameters
| Name | Type | Description |
|---|---|---|
direction |
UnityEngine.Vector2 | |
yIncreasesDownward |
System.Boolean |
Returns
ChartGuru.DataLabelPosition — No return description is available.
GetGridRenderData()
Section titled “GetGridRenderData()”public GridRenderData GetGridRenderData()Generates grid render data for the current layout.
Returns
ChartGuru.GridRenderData — No return description is available.
GetAnimatedGridRenderData(Vector2, Vector2, float)
Section titled “GetAnimatedGridRenderData(Vector2, Vector2, float)”public GridRenderData GetAnimatedGridRenderData(Vector2 sourceXDomain, Vector2 sourceYDomain, float progress)Returns grid render data with positions interpolated between source and target domains. Used during data-change animations to smoothly slide grid lines alongside mark animations. Positions outside the plot area are excluded to prevent grid lines from bleeding outside the chart bounds when the domain expands or contracts.
Source X Domain (x=min, y=max) before data change. Source Y Domain (x=min, y=max) before data change. Eased animation progress in [0,1].Parameters
| Name | Type | Description |
|---|---|---|
sourceXDomain |
UnityEngine.Vector2 | |
sourceYDomain |
UnityEngine.Vector2 | |
progress |
System.Single |
Returns
ChartGuru.GridRenderData — No return description is available.
FillAnimatedYAxisLabels(Vector2, float, List)
Section titled “FillAnimatedYAxisLabels(Vector2, float, List)”public void FillAnimatedYAxisLabels(Vector2 sourceDomain, float progress, List<AxisLabelInfo> result)Fills Y-axis labels with screen positions interpolated between source and target domains. Label texts remain at their final (target) values; only screen positions are animated. Labels whose animated screen positions fall outside the plot area are excluded so they don’t bleed outside the chart bounds during expansion/contraction animations.
Parameters
| Name | Type | Description |
|---|---|---|
sourceDomain |
UnityEngine.Vector2 | |
progress |
System.Single | |
result |
System.Collections.Generic.List{ChartGuru.AxisLabelInfo} | |
FillAnimatedXAxisLabels(Vector2, float, List)
Section titled “FillAnimatedXAxisLabels(Vector2, float, List)”public void FillAnimatedXAxisLabels(Vector2 sourceDomain, float progress, List<AxisLabelInfo> result)Fills X-axis labels with screen positions interpolated between source and target domains. Label texts remain at their final (target) values; only screen positions are animated. Labels whose animated screen positions fall outside the plot area are excluded so they don’t bleed outside the chart bounds during expansion/contraction animations.
Parameters
| Name | Type | Description |
|---|---|---|
sourceDomain |
UnityEngine.Vector2 | |
progress |
System.Single | |
result |
System.Collections.Generic.List{ChartGuru.AxisLabelInfo} | |
GetAxesRenderData()
Section titled “GetAxesRenderData()”public AxesRenderData GetAxesRenderData()Generates axes render data for the current layout.
Returns
ChartGuru.AxesRenderData — No return description is available.
GetBarsRenderData()
Section titled “GetBarsRenderData()”public BarsRenderData GetBarsRenderData()Generates bars render data from the pre-computed bar geometries. Use this for static rendering without animation.
Returns
ChartGuru.BarsRenderData — No return description is available.
GetSectorsRenderData()
Section titled “GetSectorsRenderData()”public SectorsRenderData GetSectorsRenderData()Generates sectors render data from the pre-computed sector geometries. Use this for static rendering without animation.
Returns
ChartGuru.SectorsRenderData — No return description is available.
GetPointsRenderData()
Section titled “GetPointsRenderData()”public PointsRenderData GetPointsRenderData()Generates points render data from the pre-computed point geometries. Use this for static rendering without animation.
Returns
ChartGuru.PointsRenderData — No return description is available.
ComputeBaselineY()
Section titled “ComputeBaselineY()”public float ComputeBaselineY()Screen-space Y coordinate where value 0 sits inside the plot area. Used by every renderer that needs a zero Baseline (bars, area fills, axis lines) so the position is computed once, in one place.
Returns
System.Single — No return description is available.
ComputeBaselineY(Vector2)
Section titled “ComputeBaselineY(Vector2)”public float ComputeBaselineY(Vector2 yDomain)Overload that accepts an explicit Y domain — use this during animations so the baseline interpolates in lockstep with the grid lines.
Parameters
| Name | Type | Description |
|---|---|---|
yDomain |
UnityEngine.Vector2 |
Returns
System.Single — No return description is available.
ComputeBaselineX()
Section titled “ComputeBaselineX()”public float ComputeBaselineX()Screen-space X coordinate where value 0 sits inside the plot area.
Horizontal-bar counterpart of ChartGuru.ChartLayoutEngine.ComputeBaselineY.
Returns
System.Single — No return description is available.
ComputeBaselineX(Vector2)
Section titled “ComputeBaselineX(Vector2)”public float ComputeBaselineX(Vector2 xDomain)Overload that accepts an explicit X domain — use this during animations so the baseline interpolates in lockstep with the grid lines.
Parameters
| Name | Type | Description |
|---|---|---|
xDomain |
UnityEngine.Vector2 |
Returns
System.Single — No return description is available.
SetTheme(ChartTheme)
Section titled “SetTheme(ChartTheme)”public void SetTheme(ChartTheme theme)Updates the theme used for layout calculations.
Parameters
| Name | Type | Description |
|---|---|---|
theme |
ChartGuru.ChartTheme | |
ComputeLayout(Rect, float)
Section titled “ComputeLayout(Rect, float)”public void ComputeLayout(Rect screenRect, float containerHeight = -1)Compute all layout data for the given screen rect. Call this before rendering to update all cached positions.
Parameters
| Name | Type | Description |
|---|---|---|
screenRect |
UnityEngine.Rect | The screen rectangle to compute layout within. |
containerHeight |
System.Single | Optional container height for GUI coordinate conversion. If not specified, uses screenRect.height. |
InvalidateColorCache()
Section titled “InvalidateColorCache()”public void InvalidateColorCache()Invalidates the series color cache. Call when marks change.
ProjectY(float)
Section titled “ProjectY(float)”public float ProjectY(float cartesianY)Projects a Y coordinate from Cartesian to GUI coordinate system. In GUI coords: Y=0 is at top, Y increases downward.
Parameters
| Name | Type | Description |
|---|---|---|
cartesianY |
System.Single |
Returns
System.Single — No return description is available.
ProjectPosition(Vector2)
Section titled “ProjectPosition(Vector2)”public Vector2 ProjectPosition(Vector2 cartesianPos)Projects a position from Cartesian to the target coordinate system.
Parameters
| Name | Type | Description |
|---|---|---|
cartesianPos |
UnityEngine.Vector2 |
Returns
UnityEngine.Vector2 — No return description is available.
ProjectRect(Rect)
Section titled “ProjectRect(Rect)”public Rect ProjectRect(Rect cartesianRect)Projects a rect from Cartesian to the target coordinate system.
Parameters
| Name | Type | Description |
|---|---|---|
cartesianRect |
UnityEngine.Rect |
Returns
UnityEngine.Rect — No return description is available.
GetLayoutInCoordinateSystem(CoordinateSystem)
Section titled “GetLayoutInCoordinateSystem(CoordinateSystem)”public LayoutSnapshot GetLayoutInCoordinateSystem(CoordinateSystem coordSystem)Gets all layout data in the specified coordinate system without changing the default target coordinate system.
Parameters
| Name | Type | Description |
|---|---|---|
coordSystem |
ChartGuru.CoordinateSystem |
Returns
ChartGuru.LayoutSnapshot — No return description is available.
GetLayoutForGUI()
Section titled “GetLayoutForGUI()”public LayoutSnapshot GetLayoutForGUI()Gets layout data projected to GUI coordinates (Y=0 at top). Convenience method for Editor GUI rendering.
Returns
ChartGuru.LayoutSnapshot — No return description is available.
GetLayoutForCartesian()
Section titled “GetLayoutForCartesian()”public LayoutSnapshot GetLayoutForCartesian()Gets layout data in Cartesian coordinates (Y=0 at bottom). Convenience method for GL/runtime rendering.
Returns
ChartGuru.LayoutSnapshot — No return description is available.
DataToScreenX(float)
Section titled “DataToScreenX(float)”public float DataToScreenX(float dataX)Convert a data value to screen X coordinate.
Parameters
| Name | Type | Description |
|---|---|---|
dataX |
System.Single |
Returns
System.Single — No return description is available.
DataToScreenY(float)
Section titled “DataToScreenY(float)”public float DataToScreenY(float dataY)Convert a data value to screen Y coordinate.
Parameters
| Name | Type | Description |
|---|---|---|
dataY |
System.Single |
Returns
System.Single — No return description is available.
ScreenToData(Vector2)
Section titled “ScreenToData(Vector2)”public Vector2 ScreenToData(Vector2 screenPos)Convert a screen position to data coordinates.
Parameters
| Name | Type | Description |
|---|---|---|
screenPos |
UnityEngine.Vector2 |
Returns
UnityEngine.Vector2 — No return description is available.
GetPointLabelOffset(IChartMark)
Section titled “GetPointLabelOffset(IChartMark)”public static float GetPointLabelOffset(IChartMark mark)No description is available for this member.
Parameters
| Name | Type | Description |
|---|---|---|
mark |
ChartGuru.IChartMark |
Returns
System.Single — No return description is available.
Properties
Section titled “Properties”
HasNegativeYValues
Section titled “HasNegativeYValues”public bool HasNegativeYValues { get; }True when the effective Y domain extends below zero.
Returns
System.Boolean — No return description is available.
HasNegativeXValues
Section titled “HasNegativeXValues”public bool HasNegativeXValues { get; }True when the effective X domain extends below zero.
Returns
System.Boolean — No return description is available.
TargetCoordinateSystem
Section titled “TargetCoordinateSystem”public CoordinateSystem TargetCoordinateSystem { get; set; }Gets or sets the target coordinate system for output positions. Default is Cartesian. Set to GUI for Unity Editor IMGUI rendering.
Returns
ChartGuru.CoordinateSystem — No return description is available.
MarkAlphaMultiplier
Section titled “MarkAlphaMultiplier”public float MarkAlphaMultiplier { get; set; }Global alpha multiplier applied to every mark color returned by
ChartGuru.ChartLayoutEngine.GetMarkColor(ChartGuru.IChartMark%2cSystem.Int32%2cSystem.Int32%2cSystem.Int32). The renderer uses this to cross-fade the source and
target chart type while a chart-type morph is in progress. Default is 1.
Returns
System.Single — No return description is available.
PlotArea
Section titled “PlotArea”public Rect PlotArea { get; }Gets the computed plot area in the target coordinate system.
Returns
UnityEngine.Rect — No return description is available.
PlotAreaCartesian
Section titled “PlotAreaCartesian”public Rect PlotAreaCartesian { get; }Gets the computed plot area in Cartesian coordinates (always). Use this when you need the raw Cartesian plot area regardless of target system.
Returns
UnityEngine.Rect — No return description is available.
XAxisLabels
Section titled “XAxisLabels”public IReadOnlyList<AxisLabelInfo> XAxisLabels { get; }Gets the cached X-axis labels in the target coordinate system.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.AxisLabelInfo} — No return description is available.
XAxisComputedAsBand
Section titled “XAxisComputedAsBand”public bool XAxisComputedAsBand { get; }True when X-axis labels were placed at slot centers (band/categorical mode). Grid lines and ticks should use band boundaries in this case.
Returns
System.Boolean — No return description is available.
YAxisLabels
Section titled “YAxisLabels”public IReadOnlyList<AxisLabelInfo> YAxisLabels { get; }Gets the cached Y-axis labels in the target coordinate system.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.AxisLabelInfo} — No return description is available.
DataLabels
Section titled “DataLabels”public IReadOnlyList<DataLabelInfo> DataLabels { get; }Gets the cached data labels in the target coordinate system.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.DataLabelInfo} — No return description is available.
LegendLabels
Section titled “LegendLabels”public IReadOnlyList<LegendLabelInfo> LegendLabels { get; }Gets the cached legend labels in the target coordinate system.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.LegendLabelInfo} — No return description is available.
ResolvedLegendPosition
Section titled “ResolvedLegendPosition”public LegendPosition ResolvedLegendPosition { get; }Legend position resolved after Automatic evaluation. When the configured position is Automatic, this returns Bottom if the chart has multiple series, or Hidden otherwise.
Returns
ChartGuru.LegendPosition — No return description is available.
ColorScaleLegend
Section titled “ColorScaleLegend”public ColorScaleLegendInfo ColorScaleLegend { get; }Gets the color scale legend info for heatmap charts.
Returns
ChartGuru.ColorScaleLegendInfo — No return description is available.
XAxisTitle
Section titled “XAxisTitle”public AxisTitleInfo XAxisTitle { get; }Gets the cached X-axis title info in the target coordinate system.
Returns
ChartGuru.AxisTitleInfo — No return description is available.
YAxisTitle
Section titled “YAxisTitle”public AxisTitleInfo YAxisTitle { get; }Gets the cached Y-axis title info in the target coordinate system.
Returns
ChartGuru.AxisTitleInfo — No return description is available.
BarLayout
Section titled “BarLayout”public BarLayoutParams BarLayout { get; }Gets the bar layout parameters.
Returns
ChartGuru.BarLayoutParams — No return description is available.
StackingMethod
Section titled “StackingMethod”public MarkStackingMethod StackingMethod { get; }Gets the detected stacking method for bars (set during geometry computation).
Returns
ChartGuru.MarkStackingMethod — No return description is available.
ResolvedXLabelRotation
Section titled “ResolvedXLabelRotation”public LabelRotation ResolvedXLabelRotation { get; }Gets the X-axis label rotation resolved by the layout engine for the
most recently computed labels. Mirrors the auto-mode threshold logic in
ChartGuru.ChartLabelBuilder.DetermineXAxisRotation(System.Collections.Generic.IReadOnlyList%7bChartGuru.TickLabel%7d%2cSystem.Single%2cSystem.Int32%2cSystem.Single) plus a
diagonal-overhang fallback that downgrades Right45 to Right90 when the
chart frame can’t accommodate the diagonal extent of the rightmost
label. Consumers that need to render labels (runtime UGUI, editor IMGUI
preview) should read this instead of recomputing, so the inset offsets
baked into ChartGuru.ChartLayoutEngine.XAxisLabels match the actual rendered rotation.
Returns ChartGuru.LabelRotation.Auto when no labels are present
(callers should treat that as “fall back to your own auto logic”).
Returns
ChartGuru.LabelRotation — No return description is available.
public IReadOnlyList<BarGeometry> Bars { get; }Gets the cached bar geometries in the target coordinate system.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.BarGeometry} — No return description is available.
PieLayout
Section titled “PieLayout”public PieLayoutParams PieLayout { get; }Gets the pie layout parameters.
Returns
ChartGuru.PieLayoutParams — No return description is available.
Sectors
Section titled “Sectors”public IReadOnlyList<SectorGeometry> Sectors { get; }Gets the cached sector geometries in the target coordinate system.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.SectorGeometry} — No return description is available.
LineLayout
Section titled “LineLayout”public LineLayoutParams LineLayout { get; }Gets the line layout parameters.
Returns
ChartGuru.LineLayoutParams — No return description is available.
Points
Section titled “Points”public IReadOnlyList<PointGeometry> Points { get; }Gets the cached point geometries in the target coordinate system.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.PointGeometry} — No return description is available.
Candles
Section titled “Candles”public IReadOnlyList<CandleGeometry> Candles { get; }Gets the cached candlestick geometries in the target coordinate system.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.CandleGeometry} — No return description is available.
StackedShadowExtents
Section titled “StackedShadowExtents”public IReadOnlyList<StackedShadowExtent> StackedShadowExtents { get; }Per-category stacked shadow/glow extents computed during bar geometry. Empty when bars are not stacked.
Returns
System.Collections.Generic.IReadOnlyList{ChartGuru.StackedShadowExtent} — No return description is available.
AnimatedValues
Section titled “AnimatedValues”public NativeArray<float> AnimatedValues { set; }Sets the animated values array for the current frame. When set, bar/point geometry will read interpolated values instead of raw mark data. Pass default (non-created) to clear.
Returns
Unity.Collections.NativeArray{System.Single} — No return description is available.
AnimatedValuesAreEntryAnimation
Section titled “AnimatedValuesAreEntryAnimation”public bool AnimatedValuesAreEntryAnimation { set; }True when ChartGuru.ChartLayoutEngine.AnimatedValues represent an entry replay from zero to final values.
Returns
System.Boolean — No return description is available.
XDomain
Section titled “XDomain”public Vector2 XDomain { get; }Gets the computed X Domain (min, max).
Returns
UnityEngine.Vector2 — No return description is available.
YDomain
Section titled “YDomain”public Vector2 YDomain { get; }Gets the computed Y Domain (min, max).
Returns
UnityEngine.Vector2 — No return description is available.
LastScreenRect
Section titled “LastScreenRect”public Rect LastScreenRect { get; }Gets the last screen rect used for layout computation.
Returns
UnityEngine.Rect — No return description is available.
ContainerHeight
Section titled “ContainerHeight”public float ContainerHeight { get; }Gets the container height used for GUI coordinate conversion.
Returns
System.Single — No return description is available.
Constructors
Section titled “Constructors”
ChartLayoutEngine(Chart, ChartTheme)
Section titled “ChartLayoutEngine(Chart, ChartTheme)”public ChartLayoutEngine(Chart chart, ChartTheme theme = null)No description is available for this member.
Parameters
| Name | Type | Description |
|---|---|---|
chart |
ChartGuru.Chart | |
theme |
ChartGuru.ChartTheme |