Project

ChartForgeX

Render deterministic charts, dashboards, topology, hierarchy, and report visuals directly from .NET.

Stars 47
Forks 2
NuGet downloads 75,067
Release ChartForgeX-v2.0.0
Language: HTML Updated: 2026-10-12

API Reference

Class

ChartColorScale

Namespace ChartForgeX.Core
Assembly ChartForgeX
Modifiers sealed

Maps finite numeric values to continuous color stops or discrete bands. Continuous scales infer their domain from source values unless fixed bounds are supplied; an inferred constant domain uses the low color.

Inheritance

  • Object
  • ChartColorScale

Usage

Explore 19 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 5

Methods

ColorFor 2 overloads
public ChartColor ColorFor(Double value) #
Returns: ChartColor

Resolves a finite value using discrete bands or the continuous scale's explicit domain.

Parameters

value System.Double requiredposition: 0
The finite numeric value to color.

Returns

The selected color. Continuous scales without fixed bounds require the source-domain overload.

public ChartColor ColorFor(Double value, Double sourceMinimum, Double sourceMaximum) #
Returns: ChartColor

Resolves a value to a color within this scale.

Parameters

value System.Double requiredposition: 0
The value to color.
sourceMinimum System.Double requiredposition: 1
The minimum source value when the scale has no explicit minimum.
sourceMaximum System.Double requiredposition: 2
The maximum source value when the scale has no explicit maximum.

Returns

The selected color. Discrete bands ignore the finite ordered source domain; a constant continuous domain uses the low color.

public static ChartColorScale Discrete(IEnumerable<ChartColorBand> bands) #
Returns: ChartColorScale

Creates a discrete scale with strictly ascending exclusive upper bounds and one final unbounded band.

Parameters

bands System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorBand> requiredposition: 0
Ordered bands. Boundary equality selects the next band; the final upper bound must be null.

Returns

An immutable scale whose colors do not depend on the observed domain.

Diverging 3 overloads
public static ChartColorScale Diverging(ChartColor lowColor, ChartColor midpointColor, ChartColor highColor, Double? midpointValue = null) #
Returns: ChartColorScale

Creates a three-color diverging scale.

Parameters

lowColor ChartForgeX.Primitives.ChartColor requiredposition: 0
The color for low values.
midpointColor ChartForgeX.Primitives.ChartColor requiredposition: 1
The color for the midpoint value.
highColor ChartForgeX.Primitives.ChartColor requiredposition: 2
The color for high values.
midpointValue System.Double? = null optionalposition: 3
An optional midpoint value. When omitted, the midpoint is halfway between the effective minimum and maximum.

Returns

A color scale.

public static ChartColorScale Diverging(IEnumerable<ChartColor> lowColors, ChartColor midpointColor, IEnumerable<ChartColor> highColors, Double? midpointValue = null) #
Returns: ChartColorScale

Creates a diverging scale with any number of steps on each side of the midpoint. The low colours are spread evenly from the minimum to the midpoint value and the high colours from the midpoint value to the maximum.

Parameters

lowColors System.Collections.Generic.IEnumerable<ChartForgeX.Primitives.ChartColor> requiredposition: 0
The colours below the midpoint, from the lowest value up to the step next to the midpoint; at least one.
midpointColor ChartForgeX.Primitives.ChartColor requiredposition: 1
The color for the midpoint value.
highColors System.Collections.Generic.IEnumerable<ChartForgeX.Primitives.ChartColor> requiredposition: 2
The colours above the midpoint, from the step next to the midpoint up to the highest value; at least one.
midpointValue System.Double? = null optionalposition: 3
An optional midpoint value. When omitted, the midpoint is halfway between the effective minimum and maximum.

Returns

A color scale.

public static ChartColorScale Diverging(IEnumerable<ChartColorStop> lowStops, ChartColorStop midpoint, IEnumerable<ChartColorStop> highStops) #
Returns: ChartColorScale

Creates a diverging scale with absolute numeric anchors on both sides of a fixed midpoint anchor.

Parameters

lowStops System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorStop> requiredposition: 0
At least one ascending anchor, all below the midpoint.
midpoint ChartForgeX.Core.ChartColorStop requiredposition: 1
The exact midpoint value and color.
highStops System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorStop> requiredposition: 2
At least one ascending anchor, all above the midpoint.

Returns

An immutable continuous color scale with a fixed endpoint domain.

public Double EffectiveMaximum(Double sourceMaximum) #
Returns: Double

Gets the effective maximum value used by this scale.

Parameters

sourceMaximum System.Double requiredposition: 0
The source data maximum.

Returns

The effective maximum.

public Double EffectiveMidpoint(Double sourceMinimum, Double sourceMaximum) #
Returns: Double

Gets the effective midpoint value used by this scale.

Parameters

sourceMinimum System.Double requiredposition: 0
The source data minimum.
sourceMaximum System.Double requiredposition: 1
The source data maximum.

Returns

The effective midpoint.

public Double EffectiveMinimum(Double sourceMinimum) #
Returns: Double

Gets the effective minimum value used by this scale.

Parameters

sourceMinimum System.Double requiredposition: 0
The source data minimum.

Returns

The effective minimum.

Sequential 3 overloads
public static ChartColorScale Sequential(ChartColor lowColor, ChartColor highColor) #
Returns: ChartColorScale

Creates a two-color sequential scale.

Parameters

lowColor ChartForgeX.Primitives.ChartColor requiredposition: 0
The color for low values.
highColor ChartForgeX.Primitives.ChartColor requiredposition: 1
The color for high values.

Returns

A color scale.

public static ChartColorScale Sequential(IEnumerable<ChartColor> colors) #
Returns: ChartColorScale

Creates a sequential scale with evenly spaced colour stops, for example every step of a design-token ramp.

Parameters

colors System.Collections.Generic.IEnumerable<ChartForgeX.Primitives.ChartColor> requiredposition: 0
The colours from the lowest to the highest value; at least two.

Returns

A color scale.

public static ChartColorScale Sequential(IEnumerable<ChartColorStop> stops) #
Returns: ChartColorScale

Creates a sequential scale with strictly ascending absolute numeric anchors and a fixed endpoint domain.

Parameters

stops System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorStop> requiredposition: 0
At least two ordered value/color anchors. Values outside the endpoints use their colors.

Returns

An immutable continuous color scale.

public ChartColorScale WithLabels(String? lowLabel, String? midpointLabel, String? highLabel) #
Returns: ChartColorScale

Creates a copy with custom legend labels.

Parameters

lowLabel System.String? requiredposition: 0
The low-end legend label.
midpointLabel System.String? requiredposition: 1
The optional midpoint legend label.
highLabel System.String? requiredposition: 2
The high-end legend label.

Returns

A color scale.

public ChartColorScale WithMidpoint(Double midpointValue) #
Returns: ChartColorScale

Creates a copy with an explicit diverging midpoint value.

Parameters

midpointValue System.Double requiredposition: 0
The midpoint value used by the color scale.

Returns

A color scale.

public ChartColorScale WithNoDataColor(ChartColor noDataColor) #
Returns: ChartColorScale

Creates a copy with a custom no-data color.

Parameters

noDataColor ChartForgeX.Primitives.ChartColor requiredposition: 0
The color used for regions without values.

Returns

A color scale.

public ChartColorScale WithValueRange(Double minimumValue, Double maximumValue) #
Returns: ChartColorScale

Creates a copy with explicit color interpolation bounds.

Parameters

minimumValue System.Double requiredposition: 0
The minimum value used by the color scale.
maximumValue System.Double requiredposition: 1
The maximum value used by the color scale.

Returns

A color scale.

Properties

public ChartColorScaleMode Mode { get; } #

Gets the color-selection mode.

public IReadOnlyList<ChartColorBand> Bands { get; } #

Gets the detached read-only discrete bands, or an empty list for continuous scales.

public ChartColor LowColor { get; } #

Gets the low-value color: the first stop.

public ChartColor? MidpointColor { get; } #

Gets the midpoint color of a diverging scale, or null for other modes.

public ChartColor HighColor { get; } #

Gets the high-value color: the last stop.

public IReadOnlyList<ChartColor> Colors { get; } #

Gets every continuous stop or discrete band color, ordered from the lowest to the highest value.

public Double? MidpointValue { get; } #

Gets the optional midpoint value. When omitted, the midpoint is halfway between the effective minimum and maximum.

public Double? MinimumValue { get; } #

Gets the optional minimum value used for color interpolation.

public Double? MaximumValue { get; } #

Gets the optional maximum value used for color interpolation.

public ChartColor? NoDataColor { get; } #

Gets the optional color for missing data. Renderers supply their theme fallback when this is null.

public String? LowLabel { get; } #

Gets the optional low-end legend label.

public String? MidpointLabel { get; } #

Gets the optional midpoint legend label.

public String? HighLabel { get; } #

Gets the optional high-end legend label.

public IReadOnlyList<ChartColorStop> Stops { get; } #

Gets detached absolute continuous anchors, or an empty list for unpositioned and discrete scales.