Skip to content

ChartTheme

ClassChartGuruChartGuru
[CreateAssetMenu(fileName = "ChartTheme", menuName = "ChartGuru/Theme")]
public class ChartTheme : ScriptableObject

Reusable visual defaults for chart backgrounds, axes, grids, labels, marks, and series palettes.

[Tooltip("How the chart background is rendered: solid colour, 2-stop linear gradient, or 4-corner gradient.")]
public ChartBackgroundMode BackgroundMode

Returns

ChartGuru.ChartBackgroundMode

[Tooltip("Solid background colour (used when BackgroundMode = SolidColor).")]
public Color BackgroundColor

Returns

UnityEngine.Color

[Tooltip("Linear gradient for the chart Background (used when BackgroundMode = LinearGradient).")]
public LinearGradientStyle BackgroundGradient

Returns

ChartGuru.LinearGradientStyle

[Tooltip("Four-corner gradient for the chart Background (used when BackgroundMode = FourCornerGradient).")]
public FourCornerGradient BackgroundFourCorner

Returns

ChartGuru.FourCornerGradient

[Tooltip("How the plot area background is rendered: solid colour, 2-stop linear gradient, or 4-corner gradient.")]
public ChartBackgroundMode PlotAreaMode

Returns

ChartGuru.ChartBackgroundMode

[Tooltip("Solid plot area colour (used when PlotAreaMode = SolidColor).")]
public Color PlotAreaColor

Returns

UnityEngine.Color

[Tooltip("Linear gradient for the plot area Background (used when PlotAreaMode = LinearGradient).")]
public LinearGradientStyle PlotAreaGradient

Returns

ChartGuru.LinearGradientStyle

[Tooltip("Four-corner gradient for the plot area Background (used when PlotAreaMode = FourCornerGradient).")]
public FourCornerGradient PlotAreaFourCorner

Returns

ChartGuru.FourCornerGradient

public Color[] SeriesColors

Returns

UnityEngine.Color[]

public Color AxisLineColor

Returns

UnityEngine.Color

public Color GridLineColor

Returns

UnityEngine.Color

public Color TextColor

Returns

UnityEngine.Color

public Font Font

Returns

UnityEngine.Font

[Tooltip("Font size in points for axis tick labels.")]
[Range(6, 48)]
public int LabelFontSize

Returns

System.Int32

[Tooltip("Font size in points for data value labels displayed above bars or at data points.")]
[Range(6, 48)]
public int DataLabelFontSize

Returns

System.Int32

[Tooltip("Font size in points for axis title labels.")]
[Range(6, 72)]
public int TitleFontSize

Returns

System.Int32

[Tooltip("Font size in points for legend text.")]
[Range(6, 48)]
public int LegendFontSize

Returns

System.Int32

public FontStyle LabelFontStyle

Returns

UnityEngine.FontStyle

public FontStyle DataLabelFontStyle

Returns

UnityEngine.FontStyle

public FontStyle TitleFontStyle

Returns

UnityEngine.FontStyle

public FontStyle LegendFontStyle

Returns

UnityEngine.FontStyle

[Tooltip("Font size in points for the chart title.")]
[Range(6, 72)]
public int ChartTitleFontSize

Returns

System.Int32

[Tooltip("Font size in points for the chart subtitle.")]
[Range(6, 48)]
public int ChartSubtitleFontSize

Returns

System.Int32

public FontStyle ChartTitleFontStyle

Returns

UnityEngine.FontStyle

public FontStyle ChartSubtitleFontStyle

Returns

UnityEngine.FontStyle

[Tooltip("Spacing in pixels between legend items.")]
[Range(0, 20)]
public float LegendItemSpacing

Returns

System.Single

[Tooltip("Size of the colour swatch shown next to each legend label.")]
[Range(4, 32)]
public float LegendSymbolSize

Returns

System.Single

[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 MinTextScaleFactor

Returns

System.Single

[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 MaxTextScaleFactor

Returns

System.Single

[Tooltip("Default stroke width for axis lines in pixels.")]
[Range(0.5, 10)]
public float AxisLineWidth

Returns

System.Single

[Tooltip("Default stroke width for grid lines in pixels.")]
[Range(0.5, 10)]
public float GridLineWidth

Returns

System.Single

[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 BarSpacing

Returns

System.Single

public bool EnableShadows

Returns

System.Boolean

public Color ShadowColor

Returns

UnityEngine.Color

[Tooltip("Shadow offset in pixels (X = horizontal, Y = vertical).")]
public Vector2 ShadowOffset

Returns

UnityEngine.Vector2

[Tooltip("Blur radius for drop shadows in pixels.")]
[Range(0, 20)]
public float ShadowBlur

Returns

System.Single

public bool EnableGlow

Returns

System.Boolean

[Tooltip("Intensity of the glow effect around chart elements.")]
[Range(0, 2)]
public float GlowIntensity

Returns

System.Single

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
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

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

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

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

public ChartTheme Clone()

Creates an independent copy of this Chart Theme; later configuration changes do not affect the original instance.

Returns

ChartGuru.ChartTheme

public ChartTheme()

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

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

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

public static event Action<ChartTheme> OnThemeModified

Fired 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}