Quantitative color scale
ClassesColorScale, ColorClass, ColorLegendOptions, ColorMeasureOptions and 4 more: generated from the source of active-charts.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Types#
A scale of named classes: every value takes the colour of the one class it lies in, and the class legend names them. Boundaries are deterministic: from belongs to its class, to to the next. Classes are read in the order given (low to high); one that overlaps an earlier class is reported, and a value in the overlap belongs to the earlier class. A value that lies in no class (a gap between classes, or beyond a bounded end) is not missing: it is drawn in a neutral paint, named "outside the classes" wherever its class would be named, the legend adds that entry, and it is reported. A missing value belongs to no class.
interface ClassesColorScale {
type: 'classes';
classes: readonly ColorClass[];
}One named class of values: the values from from (inclusive) up to to (exclusive). An absent from reaches every lower value, an absent to every higher one.
interface ColorClass {
from?: number;
to?: number;
name: string;
color: string;
}Where a chart's colour key (its gradient or class legend) sits.
interface ColorLegendOptions {
enabled?: boolean;
position?: 'bottom' | 'right';
}Colour by a measure on a hierarchy (Treemap, Sunburst; T5, ADR-098): each node's color becomes the fill of its data mark through one scale, while value keeps sizing it. Opt-in: without it the chart keeps its branch colours. The scale spans the colour values of the whole tree, so drilling never changes a colour. A node is never coloured from its children: a data mark without its own color is drawn in a neutral "no value" paint and says so in the tooltip and the table. Under a measure, node. no longer paints a data mark (it is reported); a treemap's group headers keep their branch colours.
interface ColorMeasureOptions {
label: string;
scale?: QuantitativeColorScale;
valueSemantics?: ChartValueSemantics;
legend?: boolean | ColorLegendOptions;
}One colour of a continuous scale, at a value of the data.
interface ColorStop {
value: number;
color: string;
}A sequential or diverging scale. Fix min and max to compare charts or hold a business threshold: equal values then get equal colours in every chart with the same scale, whatever each one's data. A value beyond a fixed end takes that end's colour; its own value stays everywhere it is shown, and the scale marks the end ≤ or ≥.
interface LinearColorScale {
type?: 'sequential' | 'diverging';
min?: number;
max?: number;
mid?: number;
colors?: readonly [string, string] | readonly [string, string, string];
}How a measure becomes a colour. One of three forms, chosen by type:
'sequential'(default) and'diverging': two colours frommintomax, or three around a centremid(Linear).Color Scale 'stops': any number of colours at values of the data (Stops).Color Scale 'classes': named ranges of values, each one colour (Classes).Color Scale
The domain is the chart's whole data (every cell, every node of the tree), never a zoomed or drilled part of it. A missing value is never on a scale: it is never 0 and never widens or classifies anything. A value the scale cannot reach keeps its own number everywhere it is shown (tooltip, label, table, announcement, export). A configuration that cannot be drawn as declared is reported once through the chart's diagnostics and drawn as the nearest safe scale.
type QuantitativeColorScale =
LinearColorScale | StopsColorScale | ClassesColorScale;A continuous scale of two or more colours at values of the data: a value between two stops mixes their colours by where it lies between them, so stops may lie irregularly (a business threshold at 100, a reserve target at 125). The first and the last stop are the ends of the scale: a value beyond them takes the end's colour, keeps its own number, and the scale marks that end ≤ or ≥. Stops are read in value order; a stop that is not finite, or repeats a value, is reported and left out. A sequential scale is two stops, a diverging one three.
interface StopsColorScale {
type: 'stops';
stops: readonly ColorStop[];
}