ChartTheme
[CreateAssetMenu(fileName = "ChartTheme", menuName = "ChartGuru/Theme")]public class ChartTheme : ScriptableObjectReusable visual defaults for chart backgrounds, axes, grids, labels, marks, and series palettes.
Fields
Section titled “Fields”
BackgroundMode
Section titled “BackgroundMode”[Tooltip("How the chart background is rendered: solid colour, 2-stop linear gradient, or 4-corner gradient.")]public ChartBackgroundMode BackgroundModeReturns
ChartGuru.ChartBackgroundMode
BackgroundColor
Section titled “BackgroundColor”[Tooltip("Solid background colour (used when BackgroundMode = SolidColor).")]public Color BackgroundColorReturns
UnityEngine.Color
BackgroundGradient
Section titled “BackgroundGradient”[Tooltip("Linear gradient for the chart Background (used when BackgroundMode = LinearGradient).")]public LinearGradientStyle BackgroundGradientReturns
ChartGuru.LinearGradientStyle
BackgroundFourCorner
Section titled “BackgroundFourCorner”[Tooltip("Four-corner gradient for the chart Background (used when BackgroundMode = FourCornerGradient).")]public FourCornerGradient BackgroundFourCornerReturns
ChartGuru.FourCornerGradient
PlotAreaMode
Section titled “PlotAreaMode”[Tooltip("How the plot area background is rendered: solid colour, 2-stop linear gradient, or 4-corner gradient.")]public ChartBackgroundMode PlotAreaModeReturns
ChartGuru.ChartBackgroundMode
PlotAreaColor
Section titled “PlotAreaColor”[Tooltip("Solid plot area colour (used when PlotAreaMode = SolidColor).")]public Color PlotAreaColorReturns
UnityEngine.Color
PlotAreaGradient
Section titled “PlotAreaGradient”[Tooltip("Linear gradient for the plot area Background (used when PlotAreaMode = LinearGradient).")]public LinearGradientStyle PlotAreaGradientReturns
ChartGuru.LinearGradientStyle
PlotAreaFourCorner
Section titled “PlotAreaFourCorner”[Tooltip("Four-corner gradient for the plot area Background (used when PlotAreaMode = FourCornerGradient).")]public FourCornerGradient PlotAreaFourCornerReturns
ChartGuru.FourCornerGradient
SeriesColors
Section titled “SeriesColors”public Color[] SeriesColorsReturns
UnityEngine.Color[]
AxisLineColor
Section titled “AxisLineColor”public Color AxisLineColorReturns
UnityEngine.Color
GridLineColor
Section titled “GridLineColor”public Color GridLineColorReturns
UnityEngine.Color
TextColor
Section titled “TextColor”public Color TextColorReturns
UnityEngine.Color
public Font FontReturns
UnityEngine.Font
LabelFontSize
Section titled “LabelFontSize”[Tooltip("Font size in points for axis tick labels.")][Range(6, 48)]public int LabelFontSizeReturns
System.Int32
DataLabelFontSize
Section titled “DataLabelFontSize”[Tooltip("Font size in points for data value labels displayed above bars or at data points.")][Range(6, 48)]public int DataLabelFontSizeReturns
System.Int32
TitleFontSize
Section titled “TitleFontSize”[Tooltip("Font size in points for axis title labels.")][Range(6, 72)]public int TitleFontSizeReturns
System.Int32
LegendFontSize
Section titled “LegendFontSize”[Tooltip("Font size in points for legend text.")][Range(6, 48)]public int LegendFontSizeReturns
System.Int32
LabelFontStyle
Section titled “LabelFontStyle”public FontStyle LabelFontStyleReturns
UnityEngine.FontStyle
DataLabelFontStyle
Section titled “DataLabelFontStyle”public FontStyle DataLabelFontStyleReturns
UnityEngine.FontStyle
TitleFontStyle
Section titled “TitleFontStyle”public FontStyle TitleFontStyleReturns
UnityEngine.FontStyle
LegendFontStyle
Section titled “LegendFontStyle”public FontStyle LegendFontStyleReturns
UnityEngine.FontStyle
ChartTitleFontSize
Section titled “ChartTitleFontSize”[Tooltip("Font size in points for the chart title.")][Range(6, 72)]public int ChartTitleFontSizeReturns
System.Int32
ChartSubtitleFontSize
Section titled “ChartSubtitleFontSize”[Tooltip("Font size in points for the chart subtitle.")][Range(6, 48)]public int ChartSubtitleFontSizeReturns
System.Int32
ChartTitleFontStyle
Section titled “ChartTitleFontStyle”public FontStyle ChartTitleFontStyleReturns
UnityEngine.FontStyle
ChartSubtitleFontStyle
Section titled “ChartSubtitleFontStyle”public FontStyle ChartSubtitleFontStyleReturns
UnityEngine.FontStyle
LegendItemSpacing
Section titled “LegendItemSpacing”[Tooltip("Spacing in pixels between legend items.")][Range(0, 20)]public float LegendItemSpacingReturns
System.Single
LegendSymbolSize
Section titled “LegendSymbolSize”[Tooltip("Size of the colour swatch shown next to each legend label.")][Range(4, 32)]public float LegendSymbolSizeReturns
System.Single
MinTextScaleFactor
Section titled “MinTextScaleFactor”[Tooltip("Minimum text scale factor. Use 0 for default (0.25). Use -1 for no minimum limit. Positive value sets explicit minimum.")][Range(-1, 2)]public float MinTextScaleFactorReturns
System.Single
MaxTextScaleFactor
Section titled “MaxTextScaleFactor”[Tooltip("Maximum text scale factor. Use 0 for default (2.5). Use -1 for no maximum limit. Positive value sets explicit maximum.")][Range(-1, 5)]public float MaxTextScaleFactorReturns
System.Single
AxisLineWidth
Section titled “AxisLineWidth”[Tooltip("Default stroke width for axis lines in pixels.")][Range(0.5, 10)]public float AxisLineWidthReturns
System.Single
GridLineWidth
Section titled “GridLineWidth”[Tooltip("Default stroke width for grid lines in pixels.")][Range(0.5, 10)]public float GridLineWidthReturns
System.Single
BarSpacing
Section titled “BarSpacing”[Tooltip("Gap between neighbouring bar groups as a multiple of bar width. 0 = bars touch, 0.1 = gap is 10% of bar width, 1 = gap equals bar width.")][Range(0, 2)]public float BarSpacingReturns
System.Single
EnableShadows
Section titled “EnableShadows”public bool EnableShadowsReturns
System.Boolean
ShadowColor
Section titled “ShadowColor”public Color ShadowColorReturns
UnityEngine.Color
ShadowOffset
Section titled “ShadowOffset”[Tooltip("Shadow offset in pixels (X = horizontal, Y = vertical).")]public Vector2 ShadowOffsetReturns
UnityEngine.Vector2
ShadowBlur
Section titled “ShadowBlur”[Tooltip("Blur radius for drop shadows in pixels.")][Range(0, 20)]public float ShadowBlurReturns
System.Single
EnableGlow
Section titled “EnableGlow”public bool EnableGlowReturns
System.Boolean
GlowIntensity
Section titled “GlowIntensity”[Tooltip("Intensity of the glow effect around chart elements.")][Range(0, 2)]public float GlowIntensityReturns
System.Single
Methods
Section titled “Methods”
RaiseOnThemeModified(ChartTheme)
Section titled “RaiseOnThemeModified(ChartTheme)”public static void RaiseOnThemeModified(ChartTheme theme)Raises ChartGuru.ChartTheme.OnThemeModified for the given theme.
Call this from editor code that modifies a theme outside of OnValidate.
Parameters
| Name | Type |
|---|---|
theme |
ChartGuru.ChartTheme |
GetTextScaleFactor(Vector2)
Section titled “GetTextScaleFactor(Vector2)”public float GetTextScaleFactor(Vector2 chartSize)Calculates the text scale factor for a given chart size using this theme’s scale limits.
Parameters
| Name | Type |
|---|---|
chartSize |
UnityEngine.Vector2 |
Returns
System.Single
GetContentScaleFactor(Vector2, LegendPosition)
Section titled “GetContentScaleFactor(Vector2, LegendPosition)”public float GetContentScaleFactor(Vector2 chartSize, LegendPosition position)Calculates a content scale factor for a given chart size and legend position using this theme’s scale limits. For top/bottom legends, only width matters; for leading/trailing, only height. Used for legend, symbols, and other content.
Parameters
| Name | Type |
|---|---|
chartSize |
UnityEngine.Vector2 |
position |
ChartGuru.LegendPosition |
Returns
System.Single
GetSeriesColor(int)
Section titled “GetSeriesColor(int)”public Color GetSeriesColor(int index)Returns the palette color at a wrapping series index, or generates a distinct HSV color when the palette is empty.
Parameters
| Name | Type |
|---|---|
index |
System.Int32 |
Returns
UnityEngine.Color
GetSeriesColorVariant(int, float)
Section titled “GetSeriesColorVariant(int, float)”public Color GetSeriesColorVariant(int index, float brightness)Returns a palette color with its HSV brightness multiplied and clamped, preserving hue and saturation.
Parameters
| Name | Type |
|---|---|
index |
System.Int32 |
brightness |
System.Single |
Returns
UnityEngine.Color
GetAreaFillColor(int)
Section titled “GetAreaFillColor(int)”public Color GetAreaFillColor(int seriesIndex)Returns the resolved series color with alpha set to 0.3 for an area fill.
Parameters
| Name | Type |
|---|---|
seriesIndex |
System.Int32 |
Returns
UnityEngine.Color
Clone()
Section titled “Clone()”public ChartTheme Clone()Creates an independent copy of this Chart Theme; later configuration changes do not affect the original instance.
Returns
ChartGuru.ChartTheme
Constructors
Section titled “Constructors”
ChartTheme()
Section titled “ChartTheme()”public ChartTheme()Properties
Section titled “Properties”
EffectiveMinTextScaleFactor
Section titled “EffectiveMinTextScaleFactor”public float EffectiveMinTextScaleFactor { get; }Gets the effective minimum text scale factor. Negative values = no limit (returns 0). Zero = use default. Positive = use that value.
Returns
System.Single
EffectiveMaxTextScaleFactor
Section titled “EffectiveMaxTextScaleFactor”public float EffectiveMaxTextScaleFactor { get; }Gets the effective maximum text scale factor. Negative values = no limit (returns very large value). Zero = use default. Positive = use that value.
Returns
System.Single
Default
Section titled “Default”public static ChartTheme Default { get; }Returns
ChartGuru.ChartTheme
public static ChartTheme Dark { get; }Dark theme inspired by Apple’s Swift Charts dark-mode palette. Near-black backgrounds, light text, muted axis/grid lines, and a lightened series palette tuned for legibility on dark backgrounds.
Returns
ChartGuru.ChartTheme
Events
Section titled “Events”
OnThemeModified
Section titled “OnThemeModified”public static event Action<ChartTheme> OnThemeModifiedFired in the Editor (edit mode and play mode) whenever any ChartTheme asset is modified via the Inspector. The argument is the theme that changed. Subscribe to this event to automatically refresh any chart that uses the theme.
Returns
System.Action{ChartGuru.ChartTheme}