# ChartColorScale

Maps finite numeric values to continuous color stops or discrete bands.

 Class  

`ChartForgeX.Core`

**Namespace**

`ChartForgeX.Core`

**Assembly**

`ChartForgeX`

**Source**

[ChartColorScale.cs:124](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L124)

**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 33 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.

### Returned or exposed by 17

- Property [ChartChordOptions.ColorScale](/api/chartforgex-core-chartchordoptions/#property-colorscale)
- Method [ChartColorScale.Discrete](/api/chartforgex-core-chartcolorscale/#method-discrete-collections-generic-ienumerable-chartforgex-core-chartcolorband)
- Method [ChartColorScale.Diverging](/api/chartforgex-core-chartcolorscale/#method-diverging-chartforgex-primitives-chartcolor-chartforgex-primitives-chartcolor-chartforgex-primitives-chartcolor-nullable-system-double)
- Method [ChartColorScale.Sequential](/api/chartforgex-core-chartcolorscale/#method-sequential-chartforgex-primitives-chartcolor-chartforgex-primitives-chartcolor)
- Method [ChartColorScale.WithCaptions](/api/chartforgex-core-chartcolorscale/#method-withcaptions-collections-generic-ienumerable-chartforgex-core-chartcolorscalecaption)
- Method [ChartColorScale.WithLabels](/api/chartforgex-core-chartcolorscale/#method-withlabels-string-string-string)
- Method [ChartColorScale.WithMidpoint](/api/chartforgex-core-chartcolorscale/#method-withmidpoint-double)
- Method [ChartColorScale.WithNoDataColor](/api/chartforgex-core-chartcolorscale/#method-withnodatacolor-chartforgex-primitives-chartcolor)
- Method [ChartColorScale.WithValueRange](/api/chartforgex-core-chartcolorscale/#method-withvaluerange-nullable-system-double-nullable-system-double)
- Property [ChartHeatmapOptions.ColorScale](/api/chartforgex-core-chartheatmapoptions/#property-colorscale)
- Property [ChartMapOptions.ColorScale](/api/chartforgex-core-chartmapoptions/#property-colorscale)
- Property [ChartSankeyOptions.ColorScale](/api/chartforgex-core-chartsankeyoptions/#property-colorscale)
- Property [ChartSeries.ColorScale](/api/chartforgex-core-chartseries/#property-colorscale)
- Property [ChartSunburstOptions.ColorScale](/api/chartforgex-core-chartsunburstoptions/#property-colorscale)
- Property [ChartTreemapOptions.ColorScale](/api/chartforgex-core-charttreemapoptions/#property-colorscale)
- Method [VisualDesignTokens.ToSequentialColorScale](/api/chartforgex-themes-visualdesigntokens/#method-tosequentialcolorscale)
- Method [VisualDivergingRamp.ToColorScale](/api/chartforgex-themes-visualdivergingramp/#method-tocolorscale-nullable-system-double)

### Accepted by parameters 16

- Method [Chart.AddRegionHeatmap](/api/chartforgex-core-chart/#method-addregionheatmap-string-chartforgex-core-chartmapdefinition-collections-generic-ienumerable-chartforgex-core-chartregionmapitem-chartforgex-core-chartcolorscale-nullable-chartforgex-core-chartseriesid) parameter `scale`
- Method [Chart.AddTileHeatmap](/api/chartforgex-core-chart/#method-addtileheatmap-string-chartforgex-core-charttilemapdefinition-collections-generic-ienumerable-chartforgex-core-chartregionmapitem-chartforgex-core-chartcolorscale-nullable-chartforgex-core-chartseriesid) parameter `scale`
- Extension method [ChartChordOptions.ColorScale](/api/chartforgex-core-chartchordoptions/#extension-colorscale-chartforgex-core-chartchordoptions-chartforgex-core-chartcolorscale) parameter `value`
- Method [ChartChordOptionsFluent.ColorScale](/api/chartforgex-core-chartchordoptionsfluent/#method-colorscale-chartforgex-core-chartchordoptions-chartforgex-core-chartcolorscale) parameter `value`
- Extension method [ChartHeatmapOptions.ColorScale](/api/chartforgex-core-chartheatmapoptions/#extension-colorscale-chartforgex-core-chartheatmapoptions-chartforgex-core-chartcolorscale) parameter `value`
- Method [ChartHeatmapOptionsFluent.ColorScale](/api/chartforgex-core-chartheatmapoptionsfluent/#method-colorscale-chartforgex-core-chartheatmapoptions-chartforgex-core-chartcolorscale) parameter `value`
- Extension method [ChartMapOptions.ColorScale](/api/chartforgex-core-chartmapoptions/#extension-colorscale-chartforgex-core-chartmapoptions-chartforgex-core-chartcolorscale) parameter `value`
- Method [ChartMapOptionsFluent.ColorScale](/api/chartforgex-core-chartmapoptionsfluent/#method-colorscale-chartforgex-core-chartmapoptions-chartforgex-core-chartcolorscale) parameter `value`
- Extension method [ChartSankeyOptions.ColorScale](/api/chartforgex-core-chartsankeyoptions/#extension-colorscale-chartforgex-core-chartsankeyoptions-chartforgex-core-chartcolorscale) parameter `value`
- Method [ChartSankeyOptionsFluent.ColorScale](/api/chartforgex-core-chartsankeyoptionsfluent/#method-colorscale-chartforgex-core-chartsankeyoptions-chartforgex-core-chartcolorscale) parameter `value`
- Extension method [ChartSeries.ColorScale](/api/chartforgex-core-chartseries/#extension-colorscale-chartforgex-core-chartseries-chartforgex-core-chartcolorscale) parameter `value`
- Method [ChartSeriesFluent.ColorScale](/api/chartforgex-core-chartseriesfluent/#method-colorscale-chartforgex-core-chartseries-chartforgex-core-chartcolorscale) parameter `value`
- Extension method [ChartSunburstOptions.ColorScale](/api/chartforgex-core-chartsunburstoptions/#extension-colorscale-chartforgex-core-chartsunburstoptions-chartforgex-core-chartcolorscale) parameter `value`
- Method [ChartSunburstOptionsFluent.ColorScale](/api/chartforgex-core-chartsunburstoptionsfluent/#method-colorscale-chartforgex-core-chartsunburstoptions-chartforgex-core-chartcolorscale) parameter `value`
- Extension method [ChartTreemapOptions.ColorScale](/api/chartforgex-core-charttreemapoptions/#extension-colorscale-chartforgex-core-charttreemapoptions-chartforgex-core-chartcolorscale) parameter `value`
- Method [ChartTreemapOptionsFluent.ColorScale](/api/chartforgex-core-charttreemapoptionsfluent/#method-colorscale-chartforgex-core-charttreemapoptions-chartforgex-core-chartcolorscale) parameter `value`

 Filter members   

    Show inherited   

 

## Methods

 ColorFor 2 overloads 

 `public ChartColor ColorFor(double value)` [#](#method-colorfor-double) 

[ChartColorScale.cs:250](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L250)

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

Parameters

**value double required**

The finite numeric value to color.

Returns

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

 `public ChartColor ColorFor(double value, double sourceMinimum, double sourceMaximum)` [#](#method-colorfor-double-double-double) 

[ChartColorScale.cs:265](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L265)

Resolves a value to a color within this scale.

Parameters

**value double required**

The value to color.

**sourceMinimum double required**

The minimum source value when the scale has no explicit minimum.

**sourceMaximum double required**

The maximum source value when the scale has no explicit maximum.

Returns

 `ChartColor` The selected color. Discrete bands ignore the finite ordered source domain. An automatic constant domain uses the low color; a domain collapsed at its sole fixed endpoint clamps observations to that endpoint's color. 

 `public static ChartColorScale Discrete(IEnumerable<ChartColorBand> bands)` [#](#method-discrete-collections-generic-ienumerable-chartforgex-core-chartcolorband) 

[ChartColorScale.cs:173](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L173)

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

Parameters

**bands System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorBand> required**

Ordered bands. Boundary equality selects the next band; the final upper bound must be null.

Returns

 `ChartColorScale` 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)` [#](#method-diverging-chartforgex-primitives-chartcolor-chartforgex-primitives-chartcolor-chartforgex-primitives-chartcolor-nullable-system-double) 

[ChartColorScale.cs:146](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L146)

Creates a three-color diverging scale.

Parameters

**lowColor ChartForgeX.Primitives.ChartColor required**

The color for low values.

**midpointColor ChartForgeX.Primitives.ChartColor required**

The color for the midpoint value.

**highColor ChartForgeX.Primitives.ChartColor required**

The color for high values.

**midpointValue double? = null optional**

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

Returns

 `ChartColorScale` A color scale. 

 `public static ChartColorScale Diverging(IEnumerable<ChartColor> lowColors, ChartColor midpointColor, IEnumerable<ChartColor> highColors, double? midpointValue = null)` [#](#member-9c1ac5649663246099dc6553) 

[ChartColorScale.cs:158](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L158)

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

The colours below the midpoint, from the lowest value up to the step next to the midpoint; at least one.

**midpointColor ChartForgeX.Primitives.ChartColor required**

The color for the midpoint value.

**highColors System.Collections.Generic.IEnumerable<ChartForgeX.Primitives.ChartColor> required**

The colours above the midpoint, from the step next to the midpoint up to the highest value; at least one.

**midpointValue double? = null optional**

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

Returns

 `ChartColorScale` A color scale. 

 `public static ChartColorScale Diverging(IEnumerable<ChartColorStop> lowStops, ChartColorStop midpoint, IEnumerable<ChartColorStop> highStops)` [#](#method-diverging-collections-generic-ienumerable-chartforgex-core-chartcolorstop-chartforgex-core-chartcolorstop-collections-generic-ienumerable-chartforgex-core-chartcolorstop) 

[ChartColorScale.Positioned.cs:30](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.Positioned.cs#L30)

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

At least one ascending anchor, all below the midpoint.

**midpoint ChartForgeX.Core.ChartColorStop required**

The exact midpoint value and color.

**highStops System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorStop> required**

At least one ascending anchor, all above the midpoint.

Returns

 `ChartColorScale` An immutable continuous color scale with a fixed endpoint domain. 

 `public double EffectiveMaximum(double sourceMaximum)` [#](#method-effectivemaximum-double) 

[ChartColorScale.cs:303](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L303)

Gets the effective maximum value used by this scale.

Parameters

**sourceMaximum double required**

The source data maximum.

Returns

 `double` The fixed maximum or inferred maximum, clamped above a sole fixed minimum. 

 `public double EffectiveMidpoint(double sourceMinimum, double sourceMaximum)` [#](#method-effectivemidpoint-double-double) 

[ChartColorScale.cs:315](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L315)

Gets the effective midpoint value used by this scale.

Parameters

**sourceMinimum double required**

The source data minimum.

**sourceMaximum double required**

The source data maximum.

Returns

 `double` The effective midpoint. 

 `public double EffectiveMinimum(double sourceMinimum)` [#](#method-effectiveminimum-double) 

[ChartColorScale.cs:292](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L292)

Gets the effective minimum value used by this scale.

Parameters

**sourceMinimum double required**

The source data minimum.

Returns

 `double` The fixed minimum or inferred minimum, clamped below a sole fixed maximum. 

 Sequential 3 overloads 

 `public static ChartColorScale Sequential(ChartColor lowColor, ChartColor highColor)` [#](#method-sequential-chartforgex-primitives-chartcolor-chartforgex-primitives-chartcolor) 

[ChartColorScale.cs:124](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L124)

Creates a two-color sequential scale.

Parameters

**lowColor ChartForgeX.Primitives.ChartColor required**

The color for low values.

**highColor ChartForgeX.Primitives.ChartColor required**

The color for high values.

Returns

 `ChartColorScale` A color scale. 

 `public static ChartColorScale Sequential(IEnumerable<ChartColor> colors)` [#](#method-sequential-collections-generic-ienumerable-chartforgex-primitives-chartcolor) 

[ChartColorScale.cs:132](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L132)

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

The colours from the lowest to the highest value; at least two.

Returns

 `ChartColorScale` A color scale. 

 `public static ChartColorScale Sequential(IEnumerable<ChartColorStop> stops)` [#](#method-sequential-collections-generic-ienumerable-chartforgex-core-chartcolorstop) 

[ChartColorScale.Positioned.cs:19](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.Positioned.cs#L19)

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

Parameters

**stops System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorStop> required**

At least two ordered value/color anchors. Values outside the endpoints use their colors.

Returns

 `ChartColorScale` An immutable continuous color scale. 

 `public ChartColorScale WithCaptions(IEnumerable<ChartColorScaleCaption> captions)` [#](#method-withcaptions-collections-generic-ienumerable-chartforgex-core-chartcolorscalecaption) 

[ChartColorScale.Captions.cs:19](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.Captions.cs#L19)

Creates a continuous scale with copied captions at absolute measurement values.

Parameters

**captions System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorScaleCaption> required**

Non-null captions at distinct finite positions; input order is immaterial.

Returns

 `ChartColorScale` An immutable scale retaining the complete caption catalog. 

 `public ChartColorScale WithLabels(string? lowLabel, string? midpointLabel, string? highLabel)` [#](#method-withlabels-string-string-string) 

[ChartColorScale.cs:237](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L237)

Creates a copy with custom legend labels.

Parameters

**lowLabel string? required**

The low-end legend label.

**midpointLabel string? required**

The optional midpoint legend label.

**highLabel string? required**

The high-end legend label.

Returns

 `ChartColorScale` A color scale. 

 `public ChartColorScale WithMidpoint(double midpointValue)` [#](#method-withmidpoint-double) 

[ChartColorScale.cs:215](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L215)

Creates a copy with an explicit diverging midpoint value.

Parameters

**midpointValue double required**

The midpoint value used by the color scale.

Returns

 `ChartColorScale` A color scale. 

 `public ChartColorScale WithNoDataColor(ChartColor noDataColor)` [#](#method-withnodatacolor-chartforgex-primitives-chartcolor) 

[ChartColorScale.cs:227](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L227)

Creates a copy with a custom no-data color.

Parameters

**noDataColor ChartForgeX.Primitives.ChartColor required**

The color used for regions without values.

Returns

 `ChartColorScale` A color scale. 

 `public ChartColorScale WithValueRange(double? minimumValue, double? maximumValue)` [#](#method-withvaluerange-nullable-system-double-nullable-system-double) 

[ChartColorScale.cs:199](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L199)

Creates a copy with independently fixed or inferred color interpolation bounds.

Parameters

**minimumValue double? required**

The fixed minimum, or null to infer it.

**maximumValue double? required**

The fixed maximum, or null to infer it.

Returns

 `ChartColorScale` A color scale. 

## Inherited Methods

 `public virtual bool Equals(object? obj)` [#](#method-equals-object) 

Inherited from object

Parameters

**obj object? required**

Returns

 `bool` 

 `public virtual int GetHashCode()` [#](#method-gethashcode) 

Inherited from object

Returns

 `int` 

 `public Type GetType()` [#](#method-gettype) 

Inherited from object

Returns

 `Type` 

 `public virtual string? ToString()` [#](#method-tostring) 

Inherited from object

Returns

 `string?` 

## Properties

 `public IReadOnlyList<ChartColorScaleCaption> Captions { get; }` [#](#property-captions) 

[ChartColorScale.Captions.cs:8](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.Captions.cs#L8)

Gets the immutable numeric caption catalog, sorted by position, or an empty list.

 `public ChartColorScaleMode Mode { get; }` [#](#property-mode) 

[ChartColorScale.cs:22](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L22)

Gets the color-selection mode.

 `public IReadOnlyList<ChartColorBand> Bands { get; }` [#](#property-bands) 

[ChartColorScale.cs:26](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L26)

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

 `public ChartColor LowColor { get; }` [#](#property-lowcolor) 

[ChartColorScale.cs:31](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L31)

Gets the low-value color: the first stop.

 `public ChartColor? MidpointColor { get; }` [#](#property-midpointcolor) 

[ChartColorScale.cs:36](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L36)

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

 `public ChartColor HighColor { get; }` [#](#property-highcolor) 

[ChartColorScale.cs:41](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L41)

Gets the high-value color: the last stop.

 `public IReadOnlyList<ChartColor> Colors { get; }` [#](#property-colors) 

[ChartColorScale.cs:46](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L46)

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

 `public double? MidpointValue { get; }` [#](#property-midpointvalue) 

[ChartColorScale.cs:51](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L51)

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

 `public double? MinimumValue { get; }` [#](#property-minimumvalue) 

[ChartColorScale.cs:56](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L56)

Gets the optional minimum value used for color interpolation.

 `public double? MaximumValue { get; }` [#](#property-maximumvalue) 

[ChartColorScale.cs:61](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L61)

Gets the optional maximum value used for color interpolation.

 `public ChartColor? NoDataColor { get; }` [#](#property-nodatacolor) 

[ChartColorScale.cs:66](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L66)

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

 `public string? LowLabel { get; }` [#](#property-lowlabel) 

[ChartColorScale.cs:71](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L71)

Gets the optional low-end legend label.

 `public string? MidpointLabel { get; }` [#](#property-midpointlabel) 

[ChartColorScale.cs:76](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L76)

Gets the optional midpoint legend label.

 `public string? HighLabel { get; }` [#](#property-highlabel) 

[ChartColorScale.cs:81](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.cs#L81)

Gets the optional high-end legend label.

 `public IReadOnlyList<ChartColorStop> Stops { get; }` [#](#property-stops) 

[ChartColorScale.Positioned.cs:11](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartColorScale.Positioned.cs#L11)

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

<!-- PowerForge markdown artifact sha256:A22549E3E0324721A0C90AA42BD133FB8FD6F1CD21ABA7DC9F410A20D262CB5F -->
