API Reference
ChartColorScale
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.
Returned or exposed by 14
- Method ChartColorScale.Discrete
- Method ChartColorScale.Diverging
- Method ChartColorScale.Sequential
- Method ChartColorScale.WithLabels
- Method ChartColorScale.WithMidpoint
- Method ChartColorScale.WithNoDataColor
- Method ChartColorScale.WithValueRange
- Property ChartOptions.HeatmapColorScale
- Property ChartOptions.MapColorScale
- Property ChartSeries.ColorScale
- Property ChartSunburstOptions.ColorScale
- Property ChartTreemapOptions.ColorScale
- Method VisualDesignTokens.ToSequentialColorScale
- Method VisualDivergingRamp.ToColorScale
Accepted by parameters 5
- Method Chart.AddRegionHeatmap
- Method Chart.AddTileHeatmap
- Method Chart.WithHeatmapColorScale
- Method Chart.WithMapColorScale
- Method ChartSeries.WithColorScale
Methods
public ChartColor ColorFor(Double value) #ChartColorResolves a finite value using discrete bands or the continuous scale's explicit domain.
Parameters
- value System.Double
- 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) #ChartColorResolves a value to a color within this scale.
Parameters
- value System.Double
- The value to color.
- sourceMinimum System.Double
- The minimum source value when the scale has no explicit minimum.
- sourceMaximum System.Double
- 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) #ChartColorScaleCreates a discrete scale with strictly ascending exclusive upper bounds and one final unbounded band.
Parameters
- bands System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorBand>
- 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.
public static ChartColorScale Diverging(ChartColor lowColor, ChartColor midpointColor, ChartColor highColor, Double? midpointValue = null) #ChartColorScaleCreates a three-color diverging scale.
Parameters
- lowColor ChartForgeX.Primitives.ChartColor
- The color for low values.
- midpointColor ChartForgeX.Primitives.ChartColor
- The color for the midpoint value.
- highColor ChartForgeX.Primitives.ChartColor
- The color for high values.
- midpointValue System.Double? = null
- 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) #ChartColorScaleCreates 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>
- The colours below the midpoint, from the lowest value up to the step next to the midpoint; at least one.
- midpointColor ChartForgeX.Primitives.ChartColor
- The color for the midpoint value.
- highColors System.Collections.Generic.IEnumerable<ChartForgeX.Primitives.ChartColor>
- The colours above the midpoint, from the step next to the midpoint up to the highest value; at least one.
- midpointValue System.Double? = null
- 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) #ChartColorScaleCreates a diverging scale with absolute numeric anchors on both sides of a fixed midpoint anchor.
Parameters
- lowStops System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorStop>
- At least one ascending anchor, all below the midpoint.
- midpoint ChartForgeX.Core.ChartColorStop
- The exact midpoint value and color.
- highStops System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorStop>
- 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) #DoubleGets the effective maximum value used by this scale.
Parameters
- sourceMaximum System.Double
- The source data maximum.
Returns
The effective maximum.
public Double EffectiveMidpoint(Double sourceMinimum, Double sourceMaximum) #DoubleGets the effective midpoint value used by this scale.
Parameters
- sourceMinimum System.Double
- The source data minimum.
- sourceMaximum System.Double
- The source data maximum.
Returns
The effective midpoint.
public Double EffectiveMinimum(Double sourceMinimum) #DoubleGets the effective minimum value used by this scale.
Parameters
- sourceMinimum System.Double
- The source data minimum.
Returns
The effective minimum.
public static ChartColorScale Sequential(ChartColor lowColor, ChartColor highColor) #ChartColorScaleCreates a two-color sequential scale.
Parameters
- lowColor ChartForgeX.Primitives.ChartColor
- The color for low values.
- highColor ChartForgeX.Primitives.ChartColor
- The color for high values.
Returns
A color scale.
public static ChartColorScale Sequential(IEnumerable<ChartColor> colors) #ChartColorScaleCreates 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>
- The colours from the lowest to the highest value; at least two.
Returns
A color scale.
public static ChartColorScale Sequential(IEnumerable<ChartColorStop> stops) #ChartColorScaleCreates a sequential scale with strictly ascending absolute numeric anchors and a fixed endpoint domain.
Parameters
- stops System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorStop>
- 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) #ChartColorScaleCreates a copy with custom legend labels.
Parameters
- lowLabel System.String?
- The low-end legend label.
- midpointLabel System.String?
- The optional midpoint legend label.
- highLabel System.String?
- The high-end legend label.
Returns
A color scale.
public ChartColorScale WithMidpoint(Double midpointValue) #ChartColorScaleCreates a copy with an explicit diverging midpoint value.
Parameters
- midpointValue System.Double
- The midpoint value used by the color scale.
Returns
A color scale.
public ChartColorScale WithNoDataColor(ChartColor noDataColor) #ChartColorScaleCreates a copy with a custom no-data color.
Parameters
- noDataColor ChartForgeX.Primitives.ChartColor
- The color used for regions without values.
Returns
A color scale.
public ChartColorScale WithValueRange(Double minimumValue, Double maximumValue) #ChartColorScaleCreates a copy with explicit color interpolation bounds.
Parameters
- minimumValue System.Double
- The minimum value used by the color scale.
- maximumValue System.Double
- The maximum value used by the color scale.
Returns
A color scale.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
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.