@fundar/data-chart-telling 1.18.0 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/README.md +2 -1
- package/dist/configuration/config.svelte.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/layout/coordinates/CoordinatesLayout.svelte +3 -1
- package/dist/layout/facet/FacetLayout.svelte +54 -41
- package/dist/layout/geometry/GeometryLayout.svelte +57 -22
- package/dist/layout/geometry/ScaleFreeContext.d.ts +31 -0
- package/dist/layout/geometry/ScaleFreeContext.js +65 -0
- package/dist/layout/geometry/ScaleFreeMarks.svelte +14 -0
- package/dist/layout/geometry/ScaleFreeMarks.svelte.d.ts +7 -0
- package/dist/layout/geometry/ScaleGate.svelte.d.ts +8 -0
- package/dist/layout/geometry/ScaleGate.svelte.js +95 -0
- package/dist/layout/geometry/ScaleGateMarks.svelte +15 -0
- package/dist/layout/geometry/ScaleGateMarks.svelte.d.ts +7 -0
- package/dist/layout/hover/HoverShapes.d.ts +20 -8
- package/dist/layout/hover/HoverShapes.js +119 -59
- package/dist/layout/legend/ContinuousSection.svelte +10 -0
- package/dist/layout/legend/LegendState.svelte.d.ts +13 -1
- package/dist/layout/legend/LegendState.svelte.js +32 -0
- package/dist/layout/margins/Box.d.ts +4 -0
- package/dist/layout/margins/Box.js +14 -0
- package/dist/layout/margins/PlotMargins.svelte.js +26 -1
- package/dist/layout/plot/{Plot.svelte → AbstractPlot.svelte} +83 -6
- package/dist/layout/plot/{Plot.svelte.d.ts → AbstractPlot.svelte.d.ts} +4 -4
- package/dist/layout/plot/PublicPlotContext.d.ts +5 -0
- package/dist/layout/plot/PublicPlotContext.js +7 -0
- package/dist/layout/styles/ValueLabels.d.ts +109 -58
- package/dist/layout/styles/ValueLabels.js +299 -141
- package/dist/markers/MarkerKinds.d.ts +79 -1
- package/dist/markers/MarkerKinds.js +149 -23
- package/dist/markers/area/AreaMarker.svelte +1 -1
- package/dist/markers/band/BandMarker.svelte +2 -1
- package/dist/markers/bar/BarMarker.svelte +8 -6
- package/dist/markers/bollinger/BollingerMarker.svelte +1 -1
- package/dist/markers/box/BoxMarker.svelte +1 -1
- package/dist/markers/dot/DotRadius.d.ts +11 -0
- package/dist/markers/dot/DotRadius.js +21 -0
- package/dist/markers/geo/GeoHoverMarker.svelte +14 -11
- package/dist/markers/labels/CurveLabel.svelte +56 -0
- package/dist/markers/labels/CurveLabel.svelte.d.ts +9 -0
- package/dist/markers/labels/LabelMerge.d.ts +11 -0
- package/dist/markers/labels/LabelMerge.js +87 -0
- package/dist/markers/labels/MarkerLabel.svelte +36 -0
- package/dist/markers/labels/MarkerLabel.svelte.d.ts +10 -0
- package/dist/markers/labels/MarkerLabels.d.ts +52 -0
- package/dist/markers/labels/MarkerLabels.js +97 -0
- package/dist/markers/labels/geometry/BoxGeometry.d.ts +8 -0
- package/dist/markers/labels/geometry/BoxGeometry.js +101 -0
- package/dist/markers/labels/geometry/CurveGeometry.d.ts +34 -0
- package/dist/markers/labels/geometry/CurveGeometry.js +193 -0
- package/dist/markers/labels/geometry/PointGeometry.d.ts +9 -0
- package/dist/markers/labels/geometry/PointGeometry.js +22 -0
- package/dist/markers/labels/layouts/BoxLayout.d.ts +10 -0
- package/dist/markers/labels/layouts/BoxLayout.js +49 -0
- package/dist/markers/labels/layouts/PathLayout.d.ts +11 -0
- package/dist/markers/labels/layouts/PathLayout.js +91 -0
- package/dist/markers/labels/layouts/PointLayout.d.ts +19 -0
- package/dist/markers/labels/layouts/PointLayout.js +94 -0
- package/dist/markers/regression/RegressionMarker.svelte +1 -1
- package/dist/markers/text/Covering.d.ts +13 -0
- package/dist/markers/text/Covering.js +29 -0
- package/dist/markers/text/Declutter.d.ts +24 -3
- package/dist/markers/text/Declutter.js +46 -3
- package/dist/markers/text/TextMarker.svelte +90 -17
- package/dist/markers/text/TextMarker.svelte.d.ts +1 -1
- package/dist/markers/tick/TickMarker.svelte +1 -1
- package/dist/markers/utils/MarkerChannels.d.ts +1 -1
- package/dist/markers/utils/MarkerChannels.js +3 -2
- package/dist/markers/violin/ViolinMarker.svelte +1 -1
- package/dist/markers/waffle/WaffleMarker.svelte +1 -1
- package/dist/phases/context/RowContext.d.ts +2 -0
- package/dist/phases/context/RowContext.js +4 -2
- package/dist/phases/context/rowContextKey.d.ts +2 -0
- package/dist/phases/context/rowContextKey.js +2 -0
- package/dist/phases/markers/MarkerStyles.js +14 -11
- package/dist/phases/markers/MarkersPhase.d.ts +2 -3
- package/dist/phases/markers/MarkersPhase.js +17 -11
- package/dist/phases/sharedScales/SharedStepScales.d.ts +10 -0
- package/dist/phases/sharedScales/SharedStepScales.js +43 -0
- package/dist/phases/statistics/MarkerGrouping.js +5 -32
- package/dist/phases/statistics/MarkerInheritance.d.ts +11 -0
- package/dist/phases/statistics/MarkerInheritance.js +25 -0
- package/dist/phases/statistics/MarkerOrientation.d.ts +26 -0
- package/dist/phases/statistics/MarkerOrientation.js +29 -0
- package/dist/phases/statistics/StatisticsPhase.js +15 -15
- package/dist/phases/transforms/TransformsPhase.js +5 -3
- package/dist/plots/correlation/heatmap/Plot.svelte +2 -2
- package/dist/plots/correlation/heatmap/Plot.svelte.d.ts +0 -1
- package/dist/plots/correlation/heatmap/defaults.js +14 -1
- package/dist/plots/correlation/heatmap/markers.d.ts +0 -6
- package/dist/plots/correlation/heatmap/markers.js +5 -9
- package/dist/plots/correlation/scatter/Plot.svelte +2 -2
- package/dist/plots/correlation/scatter/Plot.svelte.d.ts +0 -1
- package/dist/plots/correlation/scatter/defaults.js +9 -3
- package/dist/plots/correlation/scatter/markers.d.ts +0 -9
- package/dist/plots/correlation/scatter/markers.js +21 -28
- package/dist/plots/distribution/box/BoxSummaries.d.ts +5 -0
- package/dist/plots/distribution/box/BoxSummaries.js +9 -0
- package/dist/plots/distribution/box/Plot.svelte +2 -2
- package/dist/plots/distribution/box/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/box/defaults.js +11 -0
- package/dist/plots/distribution/box/markers.js +10 -1
- package/dist/plots/distribution/density/Plot.svelte +2 -2
- package/dist/plots/distribution/density/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/density/defaults.js +16 -0
- package/dist/plots/distribution/density/markers.js +5 -1
- package/dist/plots/distribution/histogram/Plot.svelte +2 -2
- package/dist/plots/distribution/histogram/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/histogram/defaults.js +16 -11
- package/dist/plots/distribution/histogram/markers.js +3 -3
- package/dist/plots/distribution/pyramid/Plot.svelte +2 -2
- package/dist/plots/distribution/pyramid/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/pyramid/defaults.js +9 -2
- package/dist/plots/distribution/pyramid/markers.d.ts +0 -8
- package/dist/plots/distribution/pyramid/markers.js +6 -16
- package/dist/plots/distribution/violin/Plot.svelte +2 -2
- package/dist/plots/distribution/violin/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/violin/defaults.js +11 -0
- package/dist/plots/distribution/violin/markers.js +27 -3
- package/dist/plots/evolution/area/Plot.svelte +2 -2
- package/dist/plots/evolution/area/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/area/defaults.js +4 -7
- package/dist/plots/evolution/area/markers.js +3 -1
- package/dist/plots/evolution/line/Plot.svelte +2 -2
- package/dist/plots/evolution/line/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/line/defaults.js +4 -6
- package/dist/plots/evolution/line/markers.js +3 -1
- package/dist/plots/evolution/slope/Plot.svelte +2 -2
- package/dist/plots/evolution/slope/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/slope/defaults.js +4 -3
- package/dist/plots/evolution/slope/markers.d.ts +4 -3
- package/dist/plots/evolution/slope/markers.js +16 -9
- package/dist/plots/evolution/sparkline/Plot.svelte +2 -2
- package/dist/plots/evolution/sparkline/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/sparkline/defaults.js +1 -1
- package/dist/plots/evolution/sparkline/markers.js +3 -1
- package/dist/plots/generic/Plot.svelte +42 -0
- package/dist/plots/generic/Plot.svelte.d.ts +25 -0
- package/dist/plots/generic/defaults.d.ts +4 -0
- package/dist/plots/generic/defaults.js +7 -0
- package/dist/plots/map/geo/Core.svelte +29 -6
- package/dist/plots/map/geo/Plot.svelte +40 -12
- package/dist/plots/map/geo/Plot.svelte.d.ts +0 -1
- package/dist/plots/map/geo/phases/data.d.ts +2 -1
- package/dist/plots/map/geo/phases/data.js +8 -2
- package/dist/plots/map/geo/phases/scales.js +6 -2
- package/dist/plots/map/geo/slices.d.ts +27 -3
- package/dist/plots/map/geo/slices.js +58 -5
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte +2 -2
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +0 -1
- package/dist/plots/part-of-a-whole/treemap/defaults.js +2 -2
- package/dist/plots/ranking/bar/Plot.svelte +2 -2
- package/dist/plots/ranking/bar/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/bar/defaults.js +13 -3
- package/dist/plots/ranking/bar/markers.js +12 -29
- package/dist/plots/ranking/bullet/Plot.svelte +2 -2
- package/dist/plots/ranking/bullet/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/bullet/defaults.js +20 -0
- package/dist/plots/ranking/bullet/markers.js +7 -1
- package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +2 -9
- package/dist/plots/ranking/cleveland/ClevelandMarkers.js +65 -47
- package/dist/plots/ranking/cleveland/Plot.svelte +2 -2
- package/dist/plots/ranking/cleveland/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/cleveland/defaults.js +33 -2
- package/dist/plots/ranking/dumbbell/Plot.svelte +2 -2
- package/dist/plots/ranking/dumbbell/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/forest/Plot.svelte +2 -2
- package/dist/plots/ranking/forest/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/lollipop/Plot.svelte +2 -2
- package/dist/plots/ranking/lollipop/Plot.svelte.d.ts +0 -1
- package/dist/types/layout/context.d.ts +2 -0
- package/dist/types/layout/plot.d.ts +2 -0
- package/dist/types/layout/styles/bullet.d.ts +4 -1
- package/dist/types/layout/styles/geo.d.ts +3 -3
- package/dist/types/layout/styles/values.d.ts +51 -11
- package/dist/types/markers/axis/area.d.ts +5 -1
- package/dist/types/markers/axis/bar.d.ts +5 -2
- package/dist/types/markers/axis/bollinger.d.ts +2 -1
- package/dist/types/markers/axis/box.d.ts +2 -1
- package/dist/types/markers/axis/cell.d.ts +4 -1
- package/dist/types/markers/axis/line.d.ts +4 -1
- package/dist/types/markers/axis/rect.d.ts +4 -1
- package/dist/types/markers/axis/regression.d.ts +2 -1
- package/dist/types/markers/axis/tick.d.ts +2 -1
- package/dist/types/markers/axis/trail.d.ts +4 -1
- package/dist/types/markers/axis/violin.d.ts +2 -1
- package/dist/types/markers/axis/waffle.d.ts +5 -1
- package/dist/types/markers/basic/dot.d.ts +4 -1
- package/dist/types/markers/basic/text.d.ts +25 -21
- package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +5 -9
- package/dist/types/markers/channels/commonMarkerConfigWithOrientation.d.ts +5 -0
- package/dist/types/markers/channels/commonMarkerConfigWithOrientation.js +1 -0
- package/dist/types/markers/labels/box.d.ts +57 -0
- package/dist/types/markers/labels/box.js +1 -0
- package/dist/types/markers/labels/common.d.ts +15 -0
- package/dist/types/markers/labels/common.js +1 -0
- package/dist/types/markers/labels/path.d.ts +52 -0
- package/dist/types/markers/labels/path.js +1 -0
- package/dist/types/markers/labels/point.d.ts +40 -0
- package/dist/types/markers/labels/point.js +1 -0
- package/dist/types/markers/traits.d.ts +10 -0
- package/dist/types/phases/markers/phase.d.ts +1 -8
- package/dist/types/phases/statistics/phase.d.ts +8 -3
- package/dist/types/phases/styles/phase.d.ts +15 -3
- package/dist/types/phases/transforms/phase.d.ts +2 -0
- package/dist/types/plots/constants.d.ts +0 -12
- package/dist/types/plots/correlation/heatmap/props.d.ts +3 -2
- package/dist/types/plots/correlation/scatter/props.d.ts +3 -2
- package/dist/types/plots/data/geo.d.ts +19 -5
- package/dist/types/plots/distribution/box/props.d.ts +6 -2
- package/dist/types/plots/distribution/density/props.d.ts +2 -1
- package/dist/types/plots/distribution/histogram/props.d.ts +3 -2
- package/dist/types/plots/distribution/pyramid/props.d.ts +3 -2
- package/dist/types/plots/distribution/violin/props.d.ts +4 -1
- package/dist/types/plots/evolution/area/props.d.ts +3 -2
- package/dist/types/plots/evolution/line/props.d.ts +3 -2
- package/dist/types/plots/generic/props.d.ts +16 -0
- package/dist/types/plots/generic/props.js +1 -0
- package/dist/types/plots/generic/state.d.ts +4 -0
- package/dist/types/plots/generic/state.js +1 -0
- package/dist/types/plots/map/geo/props.d.ts +9 -3
- package/dist/types/plots/map/geo/state.d.ts +3 -1
- package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +4 -2
- package/dist/types/plots/ranking/bar/props.d.ts +3 -2
- package/dist/types/plots/ranking/cleveland/props.d.ts +3 -2
- package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -2
- package/dist/types/plots/ranking/forest/props.d.ts +5 -2
- package/dist/types/plots/ranking/lollipop/props.d.ts +3 -2
- package/dist/utils/ConfigEquality.d.ts +11 -0
- package/dist/utils/ConfigEquality.js +37 -0
- package/docs/architecture.md +9 -9
- package/docs/facets.md +12 -0
- package/docs/geo.md +35 -7
- package/docs/legend.md +6 -0
- package/docs/markers.md +2 -4
- package/docs/plots/ranking/bar.md +1 -1
- package/docs/plots/ranking/cleveland.md +1 -1
- package/docs/state.md +1 -1
- package/docs/styles-and-segments.md +1 -14
- package/docs/timeline.md +1 -1
- package/docs/transforms-and-statistics.md +1 -1
- package/docs/value-labels.md +159 -0
- package/examples/BarValues.svelte +1 -1
- package/llms-full.txt +5 -5
- package/llms.txt +1 -0
- package/package.json +3 -1
- package/dist/markers/utils/BoxLabel.d.ts +0 -58
- package/dist/markers/utils/BoxLabel.js +0 -175
- package/dist/markers/utils/MarkerLabel.svelte +0 -33
- package/dist/markers/utils/MarkerLabel.svelte.d.ts +0 -10
|
@@ -2,16 +2,22 @@ import { Box } from '../margins/Box';
|
|
|
2
2
|
import { PlotAxes } from '../../phases/data/PlotAxes';
|
|
3
3
|
import type { PlotRowContext } from '../../types/layout/context';
|
|
4
4
|
import type { PlotStylesConfig } from '../../types/configuration/styling';
|
|
5
|
-
import type { ValuesStyle } from '../../types/layout/styles';
|
|
5
|
+
import type { ValuesFontStyle, ValuesStyle } from '../../types/layout/styles';
|
|
6
6
|
import type { ValueLabelsOptions } from '../../types/phases/styles/phase';
|
|
7
7
|
import type { Series } from '../../types/plots/data/common';
|
|
8
8
|
import type { FontStyle, StrokeStyle } from '../../types/plots/styling';
|
|
9
|
-
import type { LabelAnchor, TextAnchor, ValueAnchor } from '../../types/plots/constants';
|
|
10
9
|
import type { BoxAnchors, EdgeBox } from '../../types/layout/box';
|
|
11
10
|
import type { MarginSide } from '../../types/plots/props';
|
|
12
11
|
import type { AxisPlotEnv, AxisPlotState, ProcessedData, ProcessedRow } from '../../types/phases';
|
|
13
12
|
import type { TextMarkerConfig } from '../../types/markers/common';
|
|
14
|
-
import type {
|
|
13
|
+
import type { LabelLayout, MarkerLabelConfig } from '../../types/markers/labels/common';
|
|
14
|
+
import type { PointGeometryOf, PointLabelConfig, PointSide } from '../../types/markers/labels/point';
|
|
15
|
+
/** One part of each row a plot labels, with where its label sits and how it writes it. */
|
|
16
|
+
type ValuePart = {
|
|
17
|
+
name: string;
|
|
18
|
+
placement: Record<string, unknown>;
|
|
19
|
+
format: (value: number, row?: object, series?: string, part?: string) => string;
|
|
20
|
+
};
|
|
15
21
|
/**
|
|
16
22
|
* A plot's value labels: the author's `styles.values` over the plot kind's
|
|
17
23
|
* own defaults, how their text measures, where they are expected to sit
|
|
@@ -21,15 +27,24 @@ import type { TextLabelConfig } from '../../types/markers/basic/text';
|
|
|
21
27
|
export declare class ValueLabels {
|
|
22
28
|
#private;
|
|
23
29
|
readonly show: boolean;
|
|
24
|
-
|
|
30
|
+
/** How the labels are laid out on their shapes: the author's `layout`, else the kind's. */
|
|
31
|
+
readonly layout: LabelLayout;
|
|
32
|
+
/** The options that place a label in its {@link layout}: the author's over the kind's own for it. */
|
|
33
|
+
readonly placement: Record<string, unknown>;
|
|
34
|
+
/** The parts of each row labelled - a simple plot's one `value`, a box's `median`... - each with its own options. */
|
|
35
|
+
readonly parts: ValuePart[];
|
|
36
|
+
/** The series whose rows are labelled, when `styles.values.series` names some; every series else. */
|
|
37
|
+
readonly series: string[] | undefined;
|
|
38
|
+
/** Whether the author gave the labels a text of their own, beyond the value. */
|
|
39
|
+
readonly formatted: boolean;
|
|
25
40
|
/**
|
|
26
41
|
* A label's text for `value`: the author's `format`, else the kind's, else the value as the display fields ask.
|
|
27
42
|
* `row` is the row it labels, whose context the format reads; `series` names its series where there is no row
|
|
28
|
-
* (a label measured ahead of the rows).
|
|
43
|
+
* (a label measured ahead of the rows); `part`, which of the row's values it writes.
|
|
29
44
|
*/
|
|
30
|
-
readonly format: (value: number, row?: object, series?: string) => string;
|
|
45
|
+
readonly format: (value: number, row?: object, series?: string, part?: string) => string;
|
|
31
46
|
readonly hoverIsolate: boolean;
|
|
32
|
-
readonly font:
|
|
47
|
+
readonly font: ValuesFontStyle | undefined;
|
|
33
48
|
readonly fontSize: number;
|
|
34
49
|
/** The connectors of labels that had to move apart. */
|
|
35
50
|
readonly strokeStyle: StrokeStyle | undefined;
|
|
@@ -39,11 +54,45 @@ export declare class ValueLabels {
|
|
|
39
54
|
readonly declutter: PlotStylesConfig['text']['declutter'];
|
|
40
55
|
/** Where the labels are expected to sit: boxes around their points, on the edges those can reach. */
|
|
41
56
|
readonly reach: EdgeBox[];
|
|
42
|
-
constructor(values: ValuesStyle | undefined, cfg: PlotStylesConfig, options?: Omit<ValueLabelsOptions<never>, 'reach'
|
|
57
|
+
constructor(values: ValuesStyle | undefined, cfg: PlotStylesConfig, options?: Omit<ValueLabelsOptions<never>, 'reach' | 'layout' | 'layouts' | 'parts' | 'formatFor'> & {
|
|
58
|
+
layout?: LabelLayout;
|
|
59
|
+
layouts?: Partial<Record<LabelLayout, Record<string, unknown>>>;
|
|
60
|
+
parts?: {
|
|
61
|
+
placements: Record<string, Record<string, unknown>>;
|
|
62
|
+
default: string[];
|
|
63
|
+
};
|
|
64
|
+
}, reach?: (labels: ValueLabels) => EdgeBox[]);
|
|
65
|
+
/** Whether the part named `name` is labelled: a plot writing its `value` on its own shapes asks first. */
|
|
66
|
+
writes(name: string): boolean;
|
|
67
|
+
/** Whether the labels draw: `show` as set, else when any other option of them is set, else the kind's default. */
|
|
68
|
+
static shows(values: ValuesStyle | undefined, fallback?: boolean): boolean;
|
|
43
69
|
/** The context a label's `format` reads: its row's, with `series` when the row gives none. */
|
|
44
70
|
static contextOf(row: object | undefined, series?: string): PlotRowContext;
|
|
71
|
+
/**
|
|
72
|
+
* The value a label writes for `row`, read off its context: its `value`, or one `part` of it on a plot whose rows
|
|
73
|
+
* have several. `undefined` when it is not a number.
|
|
74
|
+
*/
|
|
75
|
+
static valueIn(row: object | undefined, part?: string): number | undefined;
|
|
76
|
+
/** A label's text for `row`: its context's `part` (its `value` by default), as that part's format writes it. */
|
|
77
|
+
text(row: object, part?: string): string;
|
|
45
78
|
/** A plot's value labels: `values` over `options`, the kind's own defaults, their reach read off `state`. */
|
|
46
79
|
static build<TState>(values: ValuesStyle | undefined, cfg: PlotStylesConfig, options: ValueLabelsOptions<TState>, state: TState): ValueLabels;
|
|
80
|
+
/** Whether the labels sit past the tip of their shapes, where the plot's margins keep room for them. */
|
|
81
|
+
get pastTip(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The `label` a plot kind's shapes write their value in, in this plot's {@link layout}: `text`, over what every
|
|
84
|
+
* label shares ({@link hooks}). Inside its shape a label takes no `fill` of its own, so it is written in the color
|
|
85
|
+
* that reads best on the shape; past it, the plot's `fill`.
|
|
86
|
+
*/
|
|
87
|
+
label<TLabel extends MarkerLabelConfig = MarkerLabelConfig>(env: AxisPlotEnv, text: (row: ProcessedRow) => string, defaults?: {
|
|
88
|
+
fill?: string;
|
|
89
|
+
fontSize?: number;
|
|
90
|
+
fontWeight?: FontStyle['fontWeight'];
|
|
91
|
+
/** The rows `styles.values.select` picks: a `'point'` label writes only theirs. */
|
|
92
|
+
labelled?: readonly ProcessedRow[];
|
|
93
|
+
/** A row's series color, which `color: 'series'` writes a label off its shape in. */
|
|
94
|
+
seriesColor?: (row: ProcessedRow) => string | undefined;
|
|
95
|
+
}): TLabel;
|
|
47
96
|
/** The configuration the labels were built under, for a plot kind's own label defaults. */
|
|
48
97
|
get config(): PlotStylesConfig;
|
|
49
98
|
/**
|
|
@@ -56,8 +105,8 @@ export declare class ValueLabels {
|
|
|
56
105
|
get lineHeight(): number;
|
|
57
106
|
/** The box one label's `text` takes. */
|
|
58
107
|
textBox(text: string): Box;
|
|
59
|
-
/** The labels' gap (px) from their mark
|
|
60
|
-
offset(
|
|
108
|
+
/** The labels' gap (px) from their mark: the layout's `gap`, else `fallback`. */
|
|
109
|
+
offset(fallback?: number): number;
|
|
61
110
|
/**
|
|
62
111
|
* Where a label reading `text` sits around its point: anchored `at` that
|
|
63
112
|
* offset from it (its `dx`/`dy`), on `side` of that anchor per axis - the
|
|
@@ -76,48 +125,12 @@ export declare class ValueLabels {
|
|
|
76
125
|
series: S;
|
|
77
126
|
value: number;
|
|
78
127
|
}[];
|
|
79
|
-
/**
|
|
80
|
-
* The author's own `textAnchor`, if any. `'outside'` is a hover marker's
|
|
81
|
-
* per-point anchor; a label's own `anchor` already places it, so here it
|
|
82
|
-
* counts as unset.
|
|
83
|
-
*/
|
|
84
|
-
get textAnchor(): Exclude<TextAnchor, 'outside'> | undefined;
|
|
85
128
|
/**
|
|
86
129
|
* What every label marker shares: the plot's margins grow to fit it, it
|
|
87
130
|
* dims with its row's series, and with `hoverIsolate`, hovering it
|
|
88
131
|
* isolates that series. A row without a series gets the margins only.
|
|
89
132
|
*/
|
|
90
133
|
hooks(env: AxisPlotEnv): Pick<TextMarkerConfig, 'fitMargins' | 'onpointerenter' | 'onpointerleave' | 'styles'>;
|
|
91
|
-
/**
|
|
92
|
-
* Where in a bar a label goes, from the `anchor` of `styles.values`: its `label` anchor, and whether it is beyond
|
|
93
|
-
* the bar. `negative` tells a bar that runs to the left (or down) from its base from one that runs right (or up),
|
|
94
|
-
* which `'tip'`, `'base'` and `'outside'` follow; the others are the edges of the page. A `stacked` bar's label is
|
|
95
|
-
* always in the middle. An anchor the shapes do not read (`'start'`, `'end'`) is taken for `'outside'`, the default.
|
|
96
|
-
*/
|
|
97
|
-
static boxAnchor(anchor: ValueAnchor, shape: {
|
|
98
|
-
isHorizontal: boolean;
|
|
99
|
-
negative?: boolean;
|
|
100
|
-
stacked?: boolean;
|
|
101
|
-
}): {
|
|
102
|
-
anchor: LabelAnchor;
|
|
103
|
-
outside?: boolean;
|
|
104
|
-
};
|
|
105
|
-
/** Whether a label at `anchor` goes to one side or the other of a bar with the sign of its value. */
|
|
106
|
-
static followsSign(anchor: ValueAnchor): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* The `label` the shapes of a plot kind write their value in: this plot's `styles.values` over the `defaults` the kind
|
|
109
|
-
* sets, with what every label shares ({@link hooks}) - its dimming and isolating of a series. A label inside its shape
|
|
110
|
-
* never reaches out of the plot, so only one `outside` has the margins grow to hold it; and it takes the default
|
|
111
|
-
* `fill` only `outside`, for inside it is written in the color that contrasts with its shape.
|
|
112
|
-
*/
|
|
113
|
-
shapeLabel(env: AxisPlotEnv, text: (row: ProcessedRow) => string, defaults?: {
|
|
114
|
-
fill?: string;
|
|
115
|
-
fontSize?: number;
|
|
116
|
-
fontWeight?: FontStyle['fontWeight'];
|
|
117
|
-
anchor?: LabelAnchor;
|
|
118
|
-
outside?: boolean;
|
|
119
|
-
gap?: number;
|
|
120
|
-
}): TextLabelConfig;
|
|
121
134
|
/**
|
|
122
135
|
* A processed row's own value, read through its series' own value channel
|
|
123
136
|
* (`y`, or `x` on a horizontal plot) - what a label shows, even where a
|
|
@@ -129,24 +142,61 @@ export declare class ValueLabels {
|
|
|
129
142
|
axes?: PlotAxes;
|
|
130
143
|
}): (d: ProcessedRow) => unknown;
|
|
131
144
|
/**
|
|
132
|
-
* A series-over-`x` plot's (line, area) labels:
|
|
133
|
-
* the
|
|
134
|
-
*
|
|
135
|
-
* `
|
|
136
|
-
* would overlap fan out into a shared column (`declutter`), colored by the
|
|
137
|
-
* segment the row falls in. A plot that labels each end of its series apart
|
|
138
|
-
* passes the `rows` and `anchor` of one end, and `lane` to route its labels
|
|
139
|
-
* out to a lane whether or not they overlap (`flip: false` keeps one on the
|
|
140
|
-
* left in the margin instead of flipping it over its points).
|
|
145
|
+
* A series-over-`x` plot's (line, area) labels, for its line or area markers: each labelled row (by default its
|
|
146
|
+
* series' last) with its own value, on the `side` of it its placement asks, colored by the segment it falls in.
|
|
147
|
+
* Labels that would overlap fan out into a shared column. A plot that labels each end of its series apart passes
|
|
148
|
+
* the `rows` and `side` of one end, and `lane` to route them out to a lane whether or not they overlap.
|
|
141
149
|
*/
|
|
142
|
-
atSeriesEnds<TData extends Record<string, unknown>>(state: AxisPlotState<TData, object>, end?: {
|
|
150
|
+
atSeriesEnds<TData extends Record<string, unknown>>(state: AxisPlotState<TData, object>, env: AxisPlotEnv, end?: {
|
|
143
151
|
rows?: ProcessedRow[];
|
|
144
|
-
|
|
152
|
+
side?: PointSide;
|
|
145
153
|
lane?: boolean | {
|
|
146
154
|
elbowGap: number;
|
|
147
155
|
};
|
|
148
156
|
flip?: boolean;
|
|
157
|
+
}): PointLabelConfig[];
|
|
158
|
+
/**
|
|
159
|
+
* The labels of a plot whose rows have several values (a box's quartiles, a bullet's target): one `text` marker per
|
|
160
|
+
* part labelled, each of `rows` written at that part's value in its context - one label per value, for a part
|
|
161
|
+
* holding several (a box's outliers). `at` places a label at a value: its point, and the shape around it its
|
|
162
|
+
* `anchor` reads.
|
|
163
|
+
*/
|
|
164
|
+
partMarkers(env: AxisPlotEnv, rows: readonly ProcessedRow[], at: (value: symbol) => PointGeometryOf, defaults?: {
|
|
165
|
+
seriesColor?: (row: ProcessedRow) => string | undefined;
|
|
166
|
+
/** The parts the kind writes on its own shapes, left out here: a bar's `value`. */
|
|
167
|
+
skip?: string[];
|
|
149
168
|
}): TextMarkerConfig[];
|
|
169
|
+
/**
|
|
170
|
+
* Where a part label of a row sits on a plot of categories: at the row's `category` (a field or a function of
|
|
171
|
+
* it), level with the part's value, across the category's band - which an `anchor` reads, to write it beside.
|
|
172
|
+
*/
|
|
173
|
+
static bandPoint(state: {
|
|
174
|
+
axes?: PlotAxes;
|
|
175
|
+
}, category: unknown,
|
|
176
|
+
/** How wide the shape is across its band, in pixels, when it does not fill it: a violin's inner box. */
|
|
177
|
+
across?: number,
|
|
178
|
+
/** A row's slot of its band, when its series share it side by side. */
|
|
179
|
+
slot?: (row: ProcessedRow) => {
|
|
180
|
+
index: number;
|
|
181
|
+
count: number;
|
|
182
|
+
} | undefined): (value: symbol) => PointGeometryOf;
|
|
183
|
+
/** The placement that writes each of `parts` beside its category's band: to its right, or above sideways bands. */
|
|
184
|
+
static besideBand(state: {
|
|
185
|
+
axes?: PlotAxes;
|
|
186
|
+
}, parts: string[]): Record<string, Record<string, unknown>>;
|
|
187
|
+
/** A series-over-`x` plot's labels in its {@link layout}: at its series' ends, or along its lines. */
|
|
188
|
+
forSeries<TData extends Record<string, unknown>>(state: AxisPlotState<TData, object>, env: AxisPlotEnv): MarkerLabelConfig[];
|
|
189
|
+
/** The side of its point a `'point'` label is written on: its placement's, else after it. */
|
|
190
|
+
get side(): PointSide;
|
|
191
|
+
/**
|
|
192
|
+
* A series-over-`x` plot's `'path'` labels, for its line or area markers: each series' name - or, with a `format`,
|
|
193
|
+
* the text it writes for the series' first row - along its line, colored by the series.
|
|
194
|
+
*/
|
|
195
|
+
alongSeries<TData extends Record<string, unknown>>(state: AxisPlotState<TData, object>, env: AxisPlotEnv): MarkerLabelConfig[];
|
|
196
|
+
/** `markers` with `labels` on each one of `type`: the shapes of a series carry its labels. */
|
|
197
|
+
static onMarkers<T extends {
|
|
198
|
+
type: string;
|
|
199
|
+
}>(markers: T[], type: string, labels: MarkerLabelConfig[] | undefined): T[];
|
|
150
200
|
/** How far (px) a lane takes the label of a series' first point from it - clear of the line that leaves it. */
|
|
151
201
|
static readonly FIRST_LANE_GAP = 28;
|
|
152
202
|
/** The rows of a series-over-`x` plot that cannot be labelled: a gap, or a stack with no top. For the "transforms" phase's `labels.skip`. */
|
|
@@ -163,5 +213,6 @@ export declare class ValueLabels {
|
|
|
163
213
|
* domain when the scales set one, so it holds across a timeline; else off
|
|
164
214
|
* every value.
|
|
165
215
|
*/
|
|
166
|
-
reachAtSeriesEnds<TData extends Record<string, unknown>>(state: AxisPlotState<TData, object>,
|
|
216
|
+
reachAtSeriesEnds<TData extends Record<string, unknown>>(state: AxisPlotState<TData, object>, pointSide?: PointSide): EdgeBox[];
|
|
167
217
|
}
|
|
218
|
+
export {};
|