@fundar/data-chart-telling 1.18.0 → 1.19.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 +35 -0
- package/README.md +2 -1
- package/dist/configuration/config.svelte.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/layout/coordinates/CoordinatesLayout.svelte +3 -1
- 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/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.d.ts → AbstractPlot.svelte.d.ts} +3 -3
- 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/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/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 +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/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/Plot.svelte +2 -2
- package/dist/plots/map/geo/Plot.svelte.d.ts +0 -1
- 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 +10 -27
- 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/styles/bullet.d.ts +4 -1
- 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/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/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/docs/architecture.md +9 -9
- package/docs/markers.md +2 -4
- package/docs/plots/ranking/cleveland.md +1 -1
- package/docs/styles-and-segments.md +1 -14
- package/docs/value-labels.md +159 -0
- package/examples/BarValues.svelte +1 -1
- package/llms-full.txt +2 -2
- 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
- /package/dist/layout/plot/{Plot.svelte → AbstractPlot.svelte} +0 -0
|
@@ -1,16 +1,23 @@
|
|
|
1
|
+
import type { CoveringShape } from '../labels/point';
|
|
1
2
|
import type { FontStyle, StrokeStyle, PerRow } from '../../plots/styling';
|
|
2
3
|
import type { CommonMarkerConfig } from '../channels/commonMarkerConfig';
|
|
3
4
|
import type { CommonMarkerConfigWithRowOffset } from '../channels/commonMarkerConfigWithRowOffset';
|
|
4
5
|
import type { Margins } from '../../../layout/margins/Margins';
|
|
5
6
|
import type { BandSlice } from '../../layout/hover';
|
|
6
|
-
import type { LabelAnchor, TextAnchor } from '../../plots/constants';
|
|
7
|
+
import type { LabelAnchor, LineAnchor, TextAnchor } from '../../plots/constants';
|
|
7
8
|
import type { NumberDisplay } from '../../layout/numbers';
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
* shared column, each routed back to its
|
|
11
|
-
*
|
|
10
|
+
* How labels that would overlap are laid out. `'lanes'` spreads them apart
|
|
11
|
+
* vertically, all reaching out to one shared column, each routed back to its
|
|
12
|
+
* own point by an elbow connector; `'around'` puts each one on a free spot
|
|
13
|
+
* around its point (its own side first, then on clockwise),
|
|
14
|
+
* clear of the other labels and points, and leaves out one with no room.
|
|
12
15
|
*/
|
|
16
|
+
export type TextDeclutterMode = 'lanes' | 'around';
|
|
17
|
+
/** {@link TextDeclutterMode}'s options. Unset geometry falls back to the configuration's `text.declutter`. */
|
|
13
18
|
export type TextDeclutterConfig = {
|
|
19
|
+
/** Defaults to `'lanes'`. */
|
|
20
|
+
mode?: TextDeclutterMode;
|
|
14
21
|
/** Shortest lane's distance (px) from the point before a connector bends. */
|
|
15
22
|
elbowGap?: number;
|
|
16
23
|
/** Extra distance (px) each further lane sits out from the last. */
|
|
@@ -68,8 +75,10 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
|
|
|
68
75
|
styles?: PerRow<TextRowStyle> & Omit<FontStyle, TextRowStyleKey>;
|
|
69
76
|
/** Which side of its point the text sits on: a value, or a function of the row. Wins over `styles.textAnchor`. */
|
|
70
77
|
textAnchor?: TextAnchor | ((d: any) => TextAnchor);
|
|
71
|
-
/**
|
|
72
|
-
|
|
78
|
+
/** Which side of its point the text sits on vertically: a value, or a function of the row. Wins over `styles.lineAnchor`. */
|
|
79
|
+
lineAnchor?: LineAnchor | ((d: any) => LineAnchor);
|
|
80
|
+
/** Lays out overlapping labels - see {@link TextDeclutterConfig}. `true` is `'lanes'` with every default. */
|
|
81
|
+
declutter?: boolean | TextDeclutterMode | TextDeclutterConfig;
|
|
73
82
|
/** Writes each label to fit its box - see {@link TextFitConfig}. `true` takes every default. */
|
|
74
83
|
fit?: boolean | TextFitConfig;
|
|
75
84
|
/**
|
|
@@ -80,6 +89,16 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
|
|
|
80
89
|
edgeAware?: boolean;
|
|
81
90
|
/** The slice of its category band each label sits in (a grouped bar's series); it is drawn off the band's middle, whatever the band's width. */
|
|
82
91
|
bandSlice?: BandSlice;
|
|
92
|
+
/**
|
|
93
|
+
* The shape each row's point sits in: a label is left out where the shape of a row drawn after its own covers it,
|
|
94
|
+
* as a dot drawn over another hides that one's label.
|
|
95
|
+
*/
|
|
96
|
+
covers?: (d: any, scales: any) => CoveringShape | undefined;
|
|
97
|
+
/** How far each row's point sits off its `x`/`y`, in pixels: labels, connectors and lanes start there. */
|
|
98
|
+
origin?: (d: any, scales: any) => {
|
|
99
|
+
dx: number;
|
|
100
|
+
dy: number;
|
|
101
|
+
} | undefined;
|
|
83
102
|
/** Where, in the plot's frame, a label sits on an axis it sets no position for: `{ type: 'text', x: 5, frameAnchor: 'top' }` is at the frame's top edge. */
|
|
84
103
|
frameAnchor?: LabelAnchor;
|
|
85
104
|
/** Grows the plot's margins, on every side the author left open, so the labels fit. */
|
|
@@ -87,21 +106,6 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
|
|
|
87
106
|
/** Reports how far the rendered labels reach past the plot's content box, in pixels, on each side. */
|
|
88
107
|
onoverflow?: (overflow: Margins) => void;
|
|
89
108
|
} & NumberDisplay & CommonMarkerConfig>;
|
|
90
|
-
/** A `text` marker as a shape's `label`: all of it but what the shape sets - its `type`, its rows and the label's position. */
|
|
91
|
-
export type TextLabelConfig = Omit<TextMarkerConfig, 'type' | 'data' | 'x' | 'y' | 'frameAnchor'> & {
|
|
92
|
-
/**
|
|
93
|
-
* Where in its shape the label sits: its `'middle'` (the default), against one of its edges (`'top'`, `'bottom'`,
|
|
94
|
-
* `'left'`, `'right'`) or in one of its corners (`'top-left'`...). The label's `dx` and `dy` move it from there.
|
|
95
|
-
*/
|
|
96
|
-
anchor?: LabelAnchor;
|
|
97
|
-
/**
|
|
98
|
-
* Puts a label anchored to an edge beyond that edge, outside the shape, instead of inside it. A label out there is not
|
|
99
|
-
* fitted to the shape, and with `fitMargins` the plot's margins grow to hold it.
|
|
100
|
-
*/
|
|
101
|
-
outside?: boolean;
|
|
102
|
-
/** Pixels between the label and the edge it is anchored to. Defaults to the configuration's `text.label.gap`, `4`. */
|
|
103
|
-
gap?: number;
|
|
104
|
-
};
|
|
105
109
|
export type { LabelAnchor };
|
|
106
110
|
/** Where one decluttered label goes - see `Declutter.buildLanes`. */
|
|
107
111
|
export type LabelLane = {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
export type CommonMarkerConfigWithLabel = {
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
* which the shape sets. The label is centred on its shape, and fitted to it unless `fit` is `false` - see
|
|
7
|
-
* {@link TextFitConfig}. It never takes the pointer from the shape under it.
|
|
8
|
-
*/
|
|
9
|
-
label?: TextLabelConfig;
|
|
1
|
+
import type { MarkerLabelConfig, MarkerLabels } from '../labels/common';
|
|
2
|
+
/** `TLabel` names the layouts the marker kind supports. */
|
|
3
|
+
export type CommonMarkerConfigWithLabel<TLabel extends MarkerLabelConfig> = {
|
|
4
|
+
/** One label per shape, or a list of them. `layout` defaults to the marker kind's. */
|
|
5
|
+
label?: MarkerLabels<TLabel>;
|
|
10
6
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { LabelBaseConfig } from './common';
|
|
2
|
+
import type { TextMarkerConfig } from '../basic/text';
|
|
3
|
+
import type { LabelAnchor } from '../../plots/constants';
|
|
4
|
+
/** A label written in the box of each shape, fitted to it unless `fit` is `false`. */
|
|
5
|
+
export type BoxLabelConfig = LabelBaseConfig & {
|
|
6
|
+
layout?: 'box';
|
|
7
|
+
anchor?: LabelAnchor;
|
|
8
|
+
/** Defaults to the configuration's `text.label.gap`. */
|
|
9
|
+
gap?: number;
|
|
10
|
+
};
|
|
11
|
+
export type BoxShape = 'edges' | 'cell' | 'band';
|
|
12
|
+
/** A field, a symbol, a function of the row or a literal. */
|
|
13
|
+
export type BoxEdge = unknown;
|
|
14
|
+
export type BoxChannels = {
|
|
15
|
+
x1: BoxEdge;
|
|
16
|
+
x2: BoxEdge;
|
|
17
|
+
y1: BoxEdge;
|
|
18
|
+
y2: BoxEdge;
|
|
19
|
+
};
|
|
20
|
+
export type BoxScales = Record<string, {
|
|
21
|
+
type?: string;
|
|
22
|
+
fn: any;
|
|
23
|
+
} | undefined>;
|
|
24
|
+
export type BoxSizer = (row: unknown, scales: BoxScales) => {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
} | undefined;
|
|
28
|
+
export type BoxGeometryOf = {
|
|
29
|
+
x: unknown;
|
|
30
|
+
y: unknown;
|
|
31
|
+
box: BoxChannels | BoxSizer;
|
|
32
|
+
size?: BoxSizer;
|
|
33
|
+
/** For a shape that runs along a value: the axis it runs on, and where each row starts (its base) and ends (its tip). */
|
|
34
|
+
ends?: {
|
|
35
|
+
axis: 'x' | 'y';
|
|
36
|
+
from: (row: unknown) => unknown;
|
|
37
|
+
to: (row: unknown) => unknown;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type BoxLabelMarker = {
|
|
41
|
+
marker: TextMarkerConfig;
|
|
42
|
+
box: BoxChannels | BoxSizer;
|
|
43
|
+
};
|
|
44
|
+
export type BoxedMarker = {
|
|
45
|
+
type?: string;
|
|
46
|
+
data?: unknown[];
|
|
47
|
+
x?: BoxEdge;
|
|
48
|
+
y?: BoxEdge;
|
|
49
|
+
x1?: BoxEdge;
|
|
50
|
+
x2?: BoxEdge;
|
|
51
|
+
y1?: BoxEdge;
|
|
52
|
+
y2?: BoxEdge;
|
|
53
|
+
isHorizontal?: boolean;
|
|
54
|
+
role?: string;
|
|
55
|
+
thickness?: number;
|
|
56
|
+
styles?: object;
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TextMarkerConfig } from '../basic/text';
|
|
2
|
+
import type { BoxLabelConfig, BoxShape } from './box';
|
|
3
|
+
import type { PointLabelConfig, PointShape } from './point';
|
|
4
|
+
import type { PathLabelConfig, PathShape } from './path';
|
|
5
|
+
export type LabelLayout = 'box' | 'path' | 'point';
|
|
6
|
+
export type LabelBaseConfig = Omit<TextMarkerConfig, 'type' | 'data' | 'x' | 'y' | 'frameAnchor' | 'origin'>;
|
|
7
|
+
export type MarkerLabelConfig = BoxLabelConfig | PathLabelConfig<string, string> | PointLabelConfig;
|
|
8
|
+
export type MarkerLabels<TLabel extends MarkerLabelConfig = MarkerLabelConfig> = TLabel | TLabel[];
|
|
9
|
+
/** The layout a label takes by default, and the geometry the kind gives each layout it supports. */
|
|
10
|
+
export type MarkerLabelTraits = {
|
|
11
|
+
default: LabelLayout;
|
|
12
|
+
box?: BoxShape;
|
|
13
|
+
path?: PathShape;
|
|
14
|
+
point?: PointShape;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { LabelAnchor } from '../../plots/constants';
|
|
2
|
+
import type { LabelBaseConfig } from './common';
|
|
3
|
+
/** An edge of a shape as it is drawn on the page. */
|
|
4
|
+
export type PageEdge = 'top' | 'bottom' | 'left' | 'right';
|
|
5
|
+
/** An edge of a shape that runs along a value: the end away from zero, `'tip'`, or the one at zero, `'base'`. */
|
|
6
|
+
export type ValueEdge = 'tip' | 'base';
|
|
7
|
+
/** Where a label sits off a closed shape's edge: beyond it, against it within the shape, or centred on it. */
|
|
8
|
+
export type ShapeSide = 'outside' | 'inside' | 'on';
|
|
9
|
+
/** Where a label sits off an open stroke, as its text reads: above it, below it, or centred on it. */
|
|
10
|
+
export type StrokeSide = 'above' | 'below' | 'on';
|
|
11
|
+
/** A label written along an edge of its shape, read per row: a `'tip'` follows the sign of the row's value. */
|
|
12
|
+
export type PathLabelConfig<TEdge extends string = PageEdge | ValueEdge, TSide extends string = ShapeSide> = LabelBaseConfig & {
|
|
13
|
+
layout: 'path';
|
|
14
|
+
/** `'tip'` on a shape that runs along a value, else `'top'`. */
|
|
15
|
+
edge?: TEdge;
|
|
16
|
+
/** Defaults to `'outside'` on a shape, `'above'` on a stroke. */
|
|
17
|
+
side?: TSide;
|
|
18
|
+
/**
|
|
19
|
+
* Where along the edge, from its left or top end. On a line or an area, `'max'` and `'min'` are the point of each
|
|
20
|
+
* one with its highest or lowest value - its peak, its trough. Defaults to `'middle'`.
|
|
21
|
+
*/
|
|
22
|
+
offset?: 'start' | 'middle' | 'end' | 'max' | 'min' | `${number}%`;
|
|
23
|
+
/** Defaults to the configuration's `text.label.gap`. */
|
|
24
|
+
gap?: number;
|
|
25
|
+
};
|
|
26
|
+
/** A label written along each line a marker draws, curving with it. */
|
|
27
|
+
export type StrokeLabelConfig = Omit<PathLabelConfig<never, StrokeSide>, 'edge'>;
|
|
28
|
+
/** A label written along the top (`y2`) or bottom (`y1`) edge of each area, curving with it. */
|
|
29
|
+
export type AreaEdgeLabelConfig = PathLabelConfig<'top' | 'bottom', StrokeSide>;
|
|
30
|
+
/** A label written along the rim of each dot, from its left over its top. */
|
|
31
|
+
export type RimLabelConfig = Omit<PathLabelConfig<never, ShapeSide>, 'edge'>;
|
|
32
|
+
/**
|
|
33
|
+
* Where a kind writes `'path'` labels: `'box'` along the edges of each row's box, `'stroke'` along each line it
|
|
34
|
+
* draws, `'area'` along the top or bottom edge of each area, `'rim'` around each dot.
|
|
35
|
+
*/
|
|
36
|
+
export type PathShape = 'box' | 'stroke' | 'area' | 'rim';
|
|
37
|
+
/** Where a plot's value label goes on its shape: in its box at an `anchor`, or along one of its edges. */
|
|
38
|
+
export type ShapePlacement = {
|
|
39
|
+
anchor: LabelAnchor;
|
|
40
|
+
} | Required<Pick<PathLabelConfig, 'layout' | 'edge' | 'side'>>;
|
|
41
|
+
/** One label along a curve, in pixels: the path its text follows and where on it the text sits. */
|
|
42
|
+
export type CurvedLabel = {
|
|
43
|
+
d: string;
|
|
44
|
+
text: string;
|
|
45
|
+
/** A row it labels: the row of a dot, the first of a line. */
|
|
46
|
+
row: unknown;
|
|
47
|
+
startOffset: string;
|
|
48
|
+
textAnchor: 'start' | 'middle' | 'end';
|
|
49
|
+
dy: number;
|
|
50
|
+
baseline: 'auto' | 'hanging' | 'central';
|
|
51
|
+
fill?: string;
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { LabelBaseConfig } from './common';
|
|
2
|
+
import type { ValueSelect } from '../../layout/styles';
|
|
3
|
+
import type { LabelAnchor } from '../../plots/constants';
|
|
4
|
+
import type { BoxScales, BoxSizer } from './box';
|
|
5
|
+
/** A label written beside a point of its shape, spread apart from the others with `declutter`. */
|
|
6
|
+
export type PointLabelConfig = LabelBaseConfig & {
|
|
7
|
+
layout?: 'point';
|
|
8
|
+
/** The rows labelled, of each `grouping` of the marker. Every row by default. */
|
|
9
|
+
select?: ValueSelect | ValueSelect[] | ((row: any) => boolean);
|
|
10
|
+
/** On a shape with a box (a bar, a cell): the point of its box the label starts at, `'middle'` by default. */
|
|
11
|
+
anchor?: LabelAnchor;
|
|
12
|
+
/** Which side of its point the text is written on, as it reads: after it (to its right), before it, above, below or on it. */
|
|
13
|
+
side?: PointSide;
|
|
14
|
+
/** The gap from its point. Defaults to the configuration's `text.label.gap` on a box, else 6px across and 8px up or down. */
|
|
15
|
+
gap?: number;
|
|
16
|
+
};
|
|
17
|
+
export type PointSide = 'after' | 'before' | 'above' | 'below' | 'on';
|
|
18
|
+
/**
|
|
19
|
+
* `'row'` labels each row at its `x`/`y`; `'top'` at its `x`/`y2` (a stacked area); `'box'` at a point of its box;
|
|
20
|
+
* `'dot'` at its center, in a round shape of its radius.
|
|
21
|
+
*/
|
|
22
|
+
export type PointShape = 'row' | 'top' | 'box' | 'dot';
|
|
23
|
+
/** Where a marker's rows are labelled; `size` is the shape around each point, when it has one, `round` a circle in it. */
|
|
24
|
+
export type PointGeometryOf = {
|
|
25
|
+
x: unknown;
|
|
26
|
+
y: unknown;
|
|
27
|
+
size?: BoxSizer;
|
|
28
|
+
round?: boolean;
|
|
29
|
+
/** How far each row's point sits off its `x`/`y`, in pixels: a series' own slot of its category's band. */
|
|
30
|
+
shift?: (row: unknown, scales: BoxScales) => {
|
|
31
|
+
dx: number;
|
|
32
|
+
dy: number;
|
|
33
|
+
} | undefined;
|
|
34
|
+
};
|
|
35
|
+
/** The shape a row's point sits in, in pixels around it: a box, or the circle in it. */
|
|
36
|
+
export type CoveringShape = {
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
round?: boolean;
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { ChannelName } from '../layout/mapping';
|
|
1
2
|
import type { LegendMark } from '../layout/legend';
|
|
3
|
+
import type { MarkerLabelTraits } from './labels/common';
|
|
4
|
+
/** A plot channel a marker can take from its plot; `x`/`y` are each taken only by a marker setting no position on that axis. */
|
|
5
|
+
export type InheritedChannel = Exclude<ChannelName, 'value'>;
|
|
2
6
|
/** What the rest of the system needs to know about a marker kind, declared once per kind in `MarkerKinds`. */
|
|
3
7
|
export type MarkerTraits = {
|
|
4
8
|
/**
|
|
@@ -19,4 +23,10 @@ export type MarkerTraits = {
|
|
|
19
23
|
* dot, an area, a bar... A marker without one shows as a plain swatch.
|
|
20
24
|
*/
|
|
21
25
|
legendSymbol?: LegendMark;
|
|
26
|
+
/** The plot's channels the marker takes in place of those it leaves unset, with the plot's scales for those that have one. */
|
|
27
|
+
inherits?: InheritedChannel[];
|
|
28
|
+
/** Whether it runs one way or the other (svelteplot's `*X`/`*Y` pair): the plot's way, else its own channels'. */
|
|
29
|
+
oriented?: boolean;
|
|
30
|
+
/** The labels the marker can write over its shapes; none without it. */
|
|
31
|
+
labels?: MarkerLabelTraits;
|
|
22
32
|
};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AxisBasedMarkersConfig, TextMarkerConfig } from '../../markers/common';
|
|
1
|
+
import type { AxisBasedMarkersConfig } from '../../markers/common';
|
|
3
2
|
/** What a plot kind adds to the shared "markers" stage. */
|
|
4
3
|
export type MarkersStageOptions<TState, TEnv> = {
|
|
5
4
|
/** The plot's own marks - its bars, lines, dots... - drawn under every other marker. */
|
|
6
5
|
marks: (state: TState, env: TEnv) => AxisBasedMarkersConfig[];
|
|
7
|
-
/**
|
|
8
|
-
* Its value labels, once they show: `text` markers drawn over everything.
|
|
9
|
-
* The stage adds what every label shares - see {@link ValueLabels.hooks}.
|
|
10
|
-
* Without it, the plot draws none.
|
|
11
|
-
*/
|
|
12
|
-
valueLabels?: (labels: ValueLabels, state: TState, env: TEnv) => TextMarkerConfig[];
|
|
13
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScopedMarkerGroup } from '../../layout/geometry';
|
|
2
2
|
import type { Accessor, Series } from '../../plots/data/common';
|
|
3
|
-
import type { AxisValue } from '../../layout/mapping';
|
|
3
|
+
import type { AxisChannelName, AxisValue } from '../../layout/mapping';
|
|
4
4
|
import type { StatisticConfig } from '../../layout/statistics';
|
|
5
5
|
import type { AxisBasedMarkersConfig } from '../../markers/common';
|
|
6
6
|
import type { ProcessedData, TransformsStageState } from '../transforms/phase';
|
|
@@ -16,10 +16,17 @@ export type StatisticsStageState = Pick<FacetStageState, 'panels'> & {
|
|
|
16
16
|
/** The key the "data" phase split the rows into series by, which an author marker inherits. */
|
|
17
17
|
seriesGrouping?: Accessor<any, unknown>;
|
|
18
18
|
color?: Accessor<any, unknown>;
|
|
19
|
+
opacity?: Accessor<any, unknown>;
|
|
20
|
+
symbol?: Accessor<any, unknown>;
|
|
21
|
+
r?: number | Accessor<any, number>;
|
|
22
|
+
length?: number | Accessor<any, number>;
|
|
19
23
|
statistics?: StatisticConfig[];
|
|
20
24
|
authorMarkers?: AxisBasedMarkersConfig[];
|
|
21
25
|
resolvedSeries?: Series<any>[];
|
|
22
26
|
axes?: PlotAxes;
|
|
27
|
+
scales?: Partial<Record<AxisChannelName, {
|
|
28
|
+
type?: string;
|
|
29
|
+
}>>;
|
|
23
30
|
flat?: any[];
|
|
24
31
|
colorForSeries?: (name: string) => string;
|
|
25
32
|
/** Each series' segments, which a `scope: 'segment'` author marker splits by. */
|
|
@@ -39,6 +46,4 @@ export type StatisticsStageOptions<TState extends StatisticsStageState> = {
|
|
|
39
46
|
* default; off for a plot whose `color` is a value channel, not a group.
|
|
40
47
|
*/
|
|
41
48
|
inheritGrouping?: boolean;
|
|
42
|
-
/** Whether a line/area/dot author marker with no `x`/`y` takes the plot's own. */
|
|
43
|
-
inheritPositions?: boolean;
|
|
44
49
|
};
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import type { PlotRowContext } from '../../layout/context';
|
|
2
2
|
import type { EdgeBox } from '../../layout/box';
|
|
3
3
|
import type { ValueLabels } from '../../../layout/styles/ValueLabels';
|
|
4
|
-
import type {
|
|
4
|
+
import type { LabelLayout } from '../../markers/labels/common';
|
|
5
5
|
/** A plot kind's own defaults for its value labels, under the author's `styles.values`. */
|
|
6
6
|
export type ValueLabelsOptions<TState> = {
|
|
7
7
|
/** Whether the labels draw when `styles.values.show` is unset. Defaults to `false`. */
|
|
8
8
|
show?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/** The layout the labels take when `styles.values.layout` is unset. Defaults to `'point'`. */
|
|
10
|
+
layout?: LabelLayout | ((state: TState) => LabelLayout);
|
|
11
|
+
/** The kind's own options for each layout it takes, under the author's: a bar's `path` at its `tip`, say. */
|
|
12
|
+
/**
|
|
13
|
+
* On a kind whose rows have several values, the parts it can label: each one's own placement, over the layout's,
|
|
14
|
+
* and those it labels when `styles.values.parts` is unset.
|
|
15
|
+
*/
|
|
16
|
+
parts?: {
|
|
17
|
+
placements: Record<string, Record<string, unknown>> | ((state: TState) => Record<string, Record<string, unknown>>);
|
|
18
|
+
default: string[];
|
|
19
|
+
};
|
|
20
|
+
layouts?: Partial<Record<LabelLayout, Record<string, unknown>>> | ((state: TState) => Partial<Record<LabelLayout, Record<string, unknown>>>);
|
|
11
21
|
/** A label's text when `styles.values.format` is unset. Defaults to the bare value. `number` writes a value as the plot's `styles.values` display fields (`decimals`, `prefix`, `suffix`, `signDisplay`) ask, and `context` is what the plot knows of the labelled row. */
|
|
12
22
|
format?: (value: number, number: (value: number) => string, context: PlotRowContext) => string;
|
|
23
|
+
/** `format`, chosen off the plot's state: a curve named when there are several, its peak's position when alone. */
|
|
24
|
+
formatFor?: (state: TState) => (value: number, number: (value: number) => string, context: PlotRowContext) => string;
|
|
13
25
|
/**
|
|
14
26
|
* Where the labels are expected to sit, from the whole data: boxes around
|
|
15
27
|
* the points they label, on the plot edges those points can reach (see
|
|
@@ -77,6 +77,8 @@ export type TransformsStageOptions<TState extends TransformsStageState, TEnv> =
|
|
|
77
77
|
show?: boolean;
|
|
78
78
|
/** The rows picked when `styles.values.select` is unset. Defaults to every row. */
|
|
79
79
|
select?: ValueSelect | ValueSelect[];
|
|
80
|
+
/** What `'min'` and `'max'` compare: the plot's value axis by default, or this (a heatmap's `color`). */
|
|
81
|
+
measure?: (state: TransformsStageState) => ((row: ProcessedRow) => unknown) | undefined;
|
|
80
82
|
/** What a selector picks among: each series (the default), or each category. */
|
|
81
83
|
group?: 'series' | 'category';
|
|
82
84
|
/** A test for the rows that cannot be labelled (a gap), read off the state once. */
|
|
@@ -3,18 +3,6 @@
|
|
|
3
3
|
* the page, or in one of its corners. The anchors of a text marker's `frameAnchor`, and of a shape's `label`.
|
|
4
4
|
*/
|
|
5
5
|
export type LabelAnchor = 'middle' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
6
|
-
/**
|
|
7
|
-
* Where a value label sits on its mark. Two vocabularies share the type, one per family of plots:
|
|
8
|
-
*
|
|
9
|
-
* - The plots that label a point or the end of a line (`LinePlot`, `AreaPlot`, `SlopePlot`, `ScatterPlot`...) read
|
|
10
|
-
* the side of the point its text is written on: `'start'` after it (right of a line's last point), `'end'` before
|
|
11
|
-
* it, `'middle'` on it and `'outside'` beyond it.
|
|
12
|
-
* - The plots that label a shape (`BarPlot`, `BulletPlot`, `PyramidPlot`, `HistogramPlot`) read where in it the
|
|
13
|
-
* label is. Inside the shape: a {@link LabelAnchor} - its `'middle'`, an edge as it is drawn on the page
|
|
14
|
-
* (`'top'`, `'left'`...) or a corner (`'top-left'`...) - or, whichever side of zero the value is, the end of the bar
|
|
15
|
-
* away from zero, `'tip'`, or the one at zero, `'base'`. Beyond the tip, outside the shape: `'outside'`.
|
|
16
|
-
*/
|
|
17
|
-
export type ValueAnchor = LabelAnchor | 'outside' | 'start' | 'end' | 'tip' | 'base';
|
|
18
6
|
/**
|
|
19
7
|
* Shared by two unrelated renderers: a `dot` mark's own point shape
|
|
20
8
|
* (delegated to svelteplot/d3-shape) and a discrete legend item's own icon
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WithValues, CellValueLabel } from '../../../layout/styles';
|
|
1
2
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
2
3
|
import type { AxisBasedScalesConfig } from '../../../layout/scales';
|
|
3
4
|
import type { AxisBasedMarkersConfig } from '../../../markers/common';
|
|
@@ -5,6 +6,6 @@ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
|
|
|
5
6
|
import type { AxisBasedStylesConfig } from '../../../layout/styles';
|
|
6
7
|
import type { CellSegmentStyle } from '../../segments/common';
|
|
7
8
|
/** `HeatmapPlot`'s public props. */
|
|
8
|
-
export type HeatmapPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
|
+
export type HeatmapPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, CellValueLabel>, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
10
|
/** What `HeatmapPlot`'s core draws from. */
|
|
10
|
-
export type HeatmapPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
11
|
+
export type HeatmapPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, CellValueLabel>, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WithValues, DotValueLabel } from '../../../layout/styles';
|
|
1
2
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
2
3
|
import type { AxisBasedScalesConfig } from '../../../layout/scales';
|
|
3
4
|
import type { AxisBasedMarkersConfig } from '../../../markers/common';
|
|
@@ -5,6 +6,6 @@ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
|
|
|
5
6
|
import type { AxisBasedStylesConfig } from '../../../layout/styles';
|
|
6
7
|
import type { ScatterSegmentStyle } from '../../segments/common';
|
|
7
8
|
/** `ScatterPlot`'s public props. */
|
|
8
|
-
export type ScatterPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
|
+
export type ScatterPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, DotValueLabel>, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
10
|
/** What `ScatterPlot`'s core draws from. */
|
|
10
|
-
export type ScatterPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
11
|
+
export type ScatterPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, DotValueLabel>, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { WithValues } from '../../../layout/styles';
|
|
2
|
+
import type { PointLabelConfig } from '../../../markers/labels/point';
|
|
1
3
|
import type { KindRowContext } from '../../../layout/context';
|
|
2
4
|
import type { AxisValue } from '../../../layout/mapping';
|
|
3
5
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
@@ -26,7 +28,9 @@ export type BoxSummary = {
|
|
|
26
28
|
* hovered box's is its median.
|
|
27
29
|
*/
|
|
28
30
|
export type BoxRowContext = KindRowContext<BoxSummary>;
|
|
31
|
+
/** The values of a box its value labels can write: its quartiles, its whiskers' ends and the values past them. */
|
|
32
|
+
export type BoxValuePart = Exclude<keyof BoxSummary, 'category' | 'count'>;
|
|
29
33
|
/** `BoxPlot`'s public props. */
|
|
30
|
-
export type BoxPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>, undefined, BoxRowContext>;
|
|
34
|
+
export type BoxPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, PointLabelConfig, BoxValuePart>, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>, undefined, BoxRowContext>;
|
|
31
35
|
/** What `BoxPlot`'s core draws from. */
|
|
32
|
-
export type BoxPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
36
|
+
export type BoxPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, PointLabelConfig, BoxValuePart>, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AreaValueLabel, LineValueLabel, WithValues } from '../../../layout/styles';
|
|
1
2
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
2
3
|
import type { AxisBasedScalesConfig } from '../../../layout/scales';
|
|
3
4
|
import type { AxisBasedMarkersConfig } from '../../../markers/common';
|
|
@@ -5,7 +6,7 @@ import type { SeriesProps, SingleAxisDataProps } from '../../data/common';
|
|
|
5
6
|
import type { CurveAwarePlotStylesConfig } from '../../../layout/styles';
|
|
6
7
|
import type { AreaStyle } from '../../styling';
|
|
7
8
|
/** `styles` of `DensityPlot`: the curve of the estimate, and the mark that draws it. */
|
|
8
|
-
export type DensityPlotStylesConfig = CurveAwarePlotStylesConfig & {
|
|
9
|
+
export type DensityPlotStylesConfig = WithValues<CurveAwarePlotStylesConfig, AreaValueLabel | LineValueLabel> & {
|
|
9
10
|
/** The mark drawing each estimate: a filled `'area'` or a `'line'`. Defaults to `'area'`. */
|
|
10
11
|
mark?: 'area' | 'line';
|
|
11
12
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WithValues, CellValueLabel } from '../../../layout/styles';
|
|
1
2
|
import type { KindRowContext } from '../../../layout/context';
|
|
2
3
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
3
4
|
import type { AxisBasedScalesConfig } from '../../../layout/scales';
|
|
@@ -18,6 +19,6 @@ export type HistogramRowContext = KindRowContext<{
|
|
|
18
19
|
to: number;
|
|
19
20
|
}>;
|
|
20
21
|
/** `HistogramPlot`'s public props. */
|
|
21
|
-
export type HistogramPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>, undefined, HistogramRowContext>;
|
|
22
|
+
export type HistogramPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, CellValueLabel>, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>, undefined, HistogramRowContext>;
|
|
22
23
|
/** What `HistogramPlot`'s core draws from. */
|
|
23
|
-
export type HistogramPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
24
|
+
export type HistogramPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, CellValueLabel>, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WithValues, BarValueLabel } from '../../../layout/styles';
|
|
1
2
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
2
3
|
import type { AxisBasedScalesConfig } from '../../../layout/scales';
|
|
3
4
|
import type { AxisBasedMarkersConfig } from '../../../markers/common';
|
|
@@ -5,6 +6,6 @@ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
|
|
|
5
6
|
import type { GapsAwarePlotStylesConfig } from '../../../layout/styles';
|
|
6
7
|
import type { BarSegmentStyle } from '../../segments/common';
|
|
7
8
|
/** `PyramidPlot`'s public props. */
|
|
8
|
-
export type PyramidPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
|
+
export type PyramidPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<GapsAwarePlotStylesConfig<BarSegmentStyle>, BarValueLabel>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
10
|
/** What `PyramidPlot`'s core draws from. */
|
|
10
|
-
export type PyramidPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
11
|
+
export type PyramidPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<GapsAwarePlotStylesConfig<BarSegmentStyle>, BarValueLabel>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { WithValues } from '../../../layout/styles';
|
|
2
|
+
import type { PointLabelConfig } from '../../../markers/labels/point';
|
|
3
|
+
import type { BoxValuePart } from '../box/props';
|
|
1
4
|
import type { BoxRowContext } from '../box/props';
|
|
2
5
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
3
6
|
import type { AxisBasedScalesConfig } from '../../../layout/scales';
|
|
@@ -7,7 +10,7 @@ import type { AxisBasedStylesConfig } from '../../../layout/styles';
|
|
|
7
10
|
import type { AreaStyle } from '../../styling';
|
|
8
11
|
import type { DensityKernel } from '../../../transforms/density';
|
|
9
12
|
/** `styles` of `ViolinPlot`: how each category's density is estimated and drawn. */
|
|
10
|
-
export type ViolinPlotStylesConfig = AxisBasedStylesConfig & {
|
|
13
|
+
export type ViolinPlotStylesConfig = WithValues<AxisBasedStylesConfig, PointLabelConfig, BoxValuePart> & {
|
|
11
14
|
kernel?: DensityKernel;
|
|
12
15
|
/** Kernel bandwidth in data units; Silverman's rule picks one per violin when unset. */
|
|
13
16
|
bandwidth?: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WithValues, AreaValueLabel } from '../../../layout/styles';
|
|
1
2
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
2
3
|
import type { AxisBasedScalesConfig } from '../../../layout/scales';
|
|
3
4
|
import type { AxisBasedMarkersConfig } from '../../../markers/common';
|
|
@@ -5,6 +6,6 @@ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
|
|
|
5
6
|
import type { AxisBasedStylesConfig } from '../../../layout/styles';
|
|
6
7
|
import type { AreaStyle } from '../../styling';
|
|
7
8
|
/** `AreaPlot`'s public props. */
|
|
8
|
-
export type AreaPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
|
+
export type AreaPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, AreaValueLabel>, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
10
|
/** What `AreaPlot`'s core draws from. */
|
|
10
|
-
export type AreaPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
11
|
+
export type AreaPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<AxisBasedStylesConfig, AreaValueLabel>, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WithValues, LineValueLabel } from '../../../layout/styles';
|
|
1
2
|
import type { BasePlotProps, PlotCoreProps } from '../../props';
|
|
2
3
|
import type { AxisBasedScalesConfig } from '../../../layout/scales';
|
|
3
4
|
import type { AxisBasedMarkersConfig } from '../../../markers/common';
|
|
@@ -5,6 +6,6 @@ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
|
|
|
5
6
|
import type { CurveAwarePlotStylesConfig, GapsAwarePlotStylesConfig } from '../../../layout/styles';
|
|
6
7
|
import type { LineSegmentStyle } from '../../segments/common';
|
|
7
8
|
/** `LinePlot`'s public props. */
|
|
8
|
-
export type LinePlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
|
+
export type LinePlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineValueLabel>, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
9
10
|
/** What `LinePlot`'s core draws from. */
|
|
10
|
-
export type LinePlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
11
|
+
export type LinePlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, WithValues<GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineValueLabel>, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BasePlotProps, PlotCoreProps } from '../props';
|
|
2
|
+
import type { AxisBasedScalesConfig } from '../../layout/scales';
|
|
3
|
+
import type { AxisBasedMarkersConfig } from '../../markers/common';
|
|
4
|
+
import type { ChannelAccessors } from '../../layout/mapping';
|
|
5
|
+
import type { Series } from '../data/common';
|
|
6
|
+
import type { AxisBasedStylesConfig } from '../../layout/styles';
|
|
7
|
+
import type { AreaStyle } from '../styling';
|
|
8
|
+
/** Rows, series or neither, and every channel optional: what markers without their own take. */
|
|
9
|
+
export type GenericDataProps<TData extends Record<string, unknown>> = {
|
|
10
|
+
data?: TData[];
|
|
11
|
+
series?: Series<TData>[];
|
|
12
|
+
} & ChannelAccessors<TData>;
|
|
13
|
+
/** `Plot`'s public props. */
|
|
14
|
+
export type GenericPlotProps<TData extends Record<string, unknown>> = BasePlotProps<GenericDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
15
|
+
/** What `Plot`'s core draws from. */
|
|
16
|
+
export type GenericPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<GenericDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|