ChartColorScale
ChartForgeX.Core
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
- Method ChartColorScale.Discrete
- Method ChartColorScale.Diverging
- Method ChartColorScale.Sequential
- Method ChartColorScale.WithCaptions
- Method ChartColorScale.WithLabels
- Method ChartColorScale.WithMidpoint
- Method ChartColorScale.WithNoDataColor
- Method ChartColorScale.WithValueRange
- Property ChartHeatmapOptions.ColorScale
- Property ChartMapOptions.ColorScale
- Property ChartSankeyOptions.ColorScale
- Property ChartSeries.ColorScale
- Property ChartSunburstOptions.ColorScale
- Property ChartTreemapOptions.ColorScale
- Method VisualDesignTokens.ToSequentialColorScale
- Method VisualDivergingRamp.ToColorScale
Accepted by parameters 16
- Method Chart.AddRegionHeatmap
- Method Chart.AddTileHeatmap
- Extension method ChartChordOptions.ColorScale
- Method ChartChordOptionsFluent.ColorScale
- Extension method ChartHeatmapOptions.ColorScale
- Method ChartHeatmapOptionsFluent.ColorScale
- Extension method ChartMapOptions.ColorScale
- Method ChartMapOptionsFluent.ColorScale
- Extension method ChartSankeyOptions.ColorScale
- Method ChartSankeyOptionsFluent.ColorScale
- Extension method ChartSeries.ColorScale
- Method ChartSeriesFluent.ColorScale
- Extension method ChartSunburstOptions.ColorScale
- Method ChartSunburstOptionsFluent.ColorScale
- Extension method ChartTreemapOptions.ColorScale
- Method ChartTreemapOptionsFluent.ColorScale
Methods
public ChartColor ColorFor(double value) #Resolves a finite value using discrete bands or the continuous scale's explicit domain.
Parameters
- value double
- 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) #Resolves a value to a color within this scale.
Parameters
- value double
- The value to color.
- sourceMinimum double
- The minimum source value when the scale has no explicit minimum.
- sourceMaximum double
- 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) #Creates 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.
public static ChartColorScale Diverging(ChartColor lowColor, ChartColor midpointColor, ChartColor highColor, double? midpointValue = null) #Creates 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 double? = null
- An optional midpoint value. When omitted, the midpoint is halfway between the effective minimum and maximum.
public static ChartColorScale Diverging(IEnumerable<ChartColor> lowColors, ChartColor midpointColor, IEnumerable<ChartColor> highColors, double? midpointValue = null) #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>
- 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 double? = null
- An optional midpoint value. When omitted, the midpoint is halfway between the effective minimum and maximum.
public static ChartColorScale Diverging(IEnumerable<ChartColorStop> lowStops, ChartColorStop midpoint, IEnumerable<ChartColorStop> highStops) #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>
- 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.
public double EffectiveMaximum(double sourceMaximum) #Gets the effective maximum value used by this scale.
Parameters
- sourceMaximum double
- 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) #Gets the effective midpoint value used by this scale.
Parameters
- sourceMinimum double
- The source data minimum.
- sourceMaximum double
- The source data maximum.
Returns
double The effective midpoint.public double EffectiveMinimum(double sourceMinimum) #Gets the effective minimum value used by this scale.
Parameters
- sourceMinimum double
- The source data minimum.
Returns
double The fixed minimum or inferred minimum, clamped below a sole fixed maximum.public static ChartColorScale Sequential(ChartColor lowColor, ChartColor highColor) #Creates a two-color sequential scale.
Parameters
- lowColor ChartForgeX.Primitives.ChartColor
- The color for low values.
- highColor ChartForgeX.Primitives.ChartColor
- The color for high values.
public static ChartColorScale Sequential(IEnumerable<ChartColor> colors) #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>
- The colours from the lowest to the highest value; at least two.
public static ChartColorScale Sequential(IEnumerable<ChartColorStop> stops) #Creates 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.
public ChartColorScale WithCaptions(IEnumerable<ChartColorScaleCaption> captions) #Creates a continuous scale with copied captions at absolute measurement values.
Parameters
- captions System.Collections.Generic.IEnumerable<ChartForgeX.Core.ChartColorScaleCaption>
- Non-null captions at distinct finite positions; input order is immaterial.
public ChartColorScale WithLabels(string? lowLabel, string? midpointLabel, string? highLabel) #Creates a copy with custom legend labels.
Parameters
- lowLabel string?
- The low-end legend label.
- midpointLabel string?
- The optional midpoint legend label.
- highLabel string?
- The high-end legend label.
public ChartColorScale WithMidpoint(double midpointValue) #Creates a copy with an explicit diverging midpoint value.
Parameters
- midpointValue double
- The midpoint value used by the color scale.
public ChartColorScale WithNoDataColor(ChartColor noDataColor) #Creates a copy with a custom no-data color.
Parameters
- noDataColor ChartForgeX.Primitives.ChartColor
- The color used for regions without values.
public ChartColorScale WithValueRange(double? minimumValue, double? maximumValue) #Creates a copy with independently fixed or inferred color interpolation bounds.
Parameters
- minimumValue double?
- The fixed minimum, or null to infer it.
- maximumValue double?
- The fixed maximum, or null to infer it.
Inherited Methods
Properties
public IReadOnlyList<ChartColorScaleCaption> Captions { get; } #Gets the immutable numeric caption catalog, sorted by position, or an empty list.
public IReadOnlyList<ChartColorBand> Bands { get; } #Gets the detached read-only discrete bands, or an empty list for continuous scales.
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? MidpointLabel { get; } #Gets the optional midpoint legend label.
public IReadOnlyList<ChartColorStop> Stops { get; } #Gets detached absolute continuous anchors, or an empty list for unpositioned and discrete scales.