@rokkit/chart 1.7.0 → 1.8.1
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/README.md +13 -0
- package/dist/Plot/DataTable.svelte +54 -0
- package/dist/Plot/DataTable.svelte.d.ts +12 -0
- package/dist/Plot/SpecGeoms.svelte +78 -0
- package/dist/Plot/SpecGeoms.svelte.d.ts +11 -0
- package/dist/Plot.svelte +47 -151
- package/dist/Plot.svelte.d.ts +5 -0
- package/dist/PlotState.svelte.d.ts +115 -71
- package/dist/PlotState.svelte.js +174 -547
- package/dist/SparkState.svelte.d.ts +3 -1
- package/dist/SparkState.svelte.js +11 -41
- package/dist/geoms/Arc.svelte +1 -1
- package/dist/geoms/Bar.svelte +23 -32
- package/dist/geoms/Contour.svelte +88 -0
- package/dist/geoms/Contour.svelte.d.ts +19 -0
- package/dist/geoms/Hull.svelte +89 -0
- package/dist/geoms/Hull.svelte.d.ts +17 -0
- package/dist/geoms/Region.svelte +107 -0
- package/dist/geoms/Region.svelte.d.ts +27 -0
- package/dist/geoms/Rule.svelte +88 -26
- package/dist/geoms/Rule.svelte.d.ts +8 -0
- package/dist/geoms/lib/PlotAreaClip.svelte +18 -0
- package/dist/geoms/lib/PlotAreaClip.svelte.d.ts +6 -0
- package/dist/geoms/lib/bars.js +13 -20
- package/dist/geoms/lib/grouping.d.ts +35 -0
- package/dist/geoms/lib/grouping.js +59 -0
- package/dist/geoms/lib/marks/arc.d.ts +1 -0
- package/dist/geoms/lib/marks/contour.d.ts +26 -0
- package/dist/geoms/lib/marks/contour.js +67 -0
- package/dist/geoms/lib/marks/hull.d.ts +26 -0
- package/dist/geoms/lib/marks/hull.js +36 -0
- package/dist/geoms/lib/marks/waterfall.js +15 -20
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/lib/abline.d.ts +41 -0
- package/dist/lib/abline.js +51 -0
- package/dist/lib/brewing/marks/arcs.d.ts +6 -1
- package/dist/lib/brewing/marks/arcs.js +9 -1
- package/dist/lib/brewing/polar.js +8 -3
- package/dist/lib/hull.d.ts +18 -0
- package/dist/lib/hull.js +64 -0
- package/dist/lib/plot/domains.d.ts +61 -0
- package/dist/lib/plot/domains.js +130 -0
- package/dist/lib/plot/running.d.ts +23 -0
- package/dist/lib/plot/running.js +32 -0
- package/dist/lib/plot/spec.d.ts +59 -0
- package/dist/lib/plot/spec.js +131 -0
- package/dist/lib/plot/stacking.d.ts +32 -0
- package/dist/lib/plot/stacking.js +34 -0
- package/dist/lib/plot/types.d.ts +8 -1
- package/dist/lib/plot/types.js +5 -1
- package/dist/lib/preset.d.ts +2 -0
- package/dist/lib/preset.js +76 -41
- package/dist/lib/region.d.ts +63 -0
- package/dist/lib/region.js +127 -0
- package/dist/state/AestheticState.svelte.d.ts +43 -0
- package/dist/state/AestheticState.svelte.js +84 -0
- package/dist/state/AxisState.svelte.d.ts +26 -0
- package/dist/state/AxisState.svelte.js +56 -0
- package/dist/state/ChannelState.svelte.d.ts +34 -0
- package/dist/state/ChannelState.svelte.js +67 -0
- package/dist/state/GeomRegistry.svelte.d.ts +44 -0
- package/dist/state/GeomRegistry.svelte.js +86 -0
- package/dist/state/InteractionState.svelte.d.ts +30 -0
- package/dist/state/InteractionState.svelte.js +69 -0
- package/dist/state/OrientationState.svelte.d.ts +34 -0
- package/dist/state/OrientationState.svelte.js +64 -0
- package/dist/state/PlotConfig.svelte.d.ts +179 -0
- package/dist/state/PlotConfig.svelte.js +195 -0
- package/dist/state/PlotFrame.svelte.d.ts +17 -0
- package/dist/state/PlotFrame.svelte.js +18 -0
- package/dist/state/ScaleState.svelte.d.ts +36 -0
- package/dist/state/ScaleState.svelte.js +121 -0
- package/package.json +5 -3
|
@@ -1,73 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The state a `PlotChart` publishes on the `'plot-state'` context — a COMPOSITION of job
|
|
3
|
+
* classes (`./state/`), each owning one concern and reading only the ones built before it:
|
|
4
|
+
*
|
|
5
|
+
* config → geoms → frame → channels → orientation → interaction → scales → aesthetics → axes
|
|
6
|
+
*
|
|
7
|
+
* It derives nothing itself. Everything below the constructor is the contract geoms, axes, the
|
|
8
|
+
* legend and the tooltip read (`GEOM_CONTRACT` in SparkState.svelte.js is the geom-facing part),
|
|
9
|
+
* kept as one-line delegations so no consumer changed when the monolith was taken apart. New
|
|
10
|
+
* code can depend on a job directly — `plotState.scales`, `plotState.interactionState` — instead.
|
|
11
|
+
*/
|
|
1
12
|
export class PlotState {
|
|
2
13
|
constructor(config?: {});
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
symbols: Map<unknown, string> | SvelteMap<any, any>;
|
|
23
|
-
colorField: any;
|
|
24
|
-
fillField: any;
|
|
25
|
-
patternField: any;
|
|
26
|
-
symbolField: any;
|
|
27
|
-
geomTypes: SvelteSet<any>;
|
|
28
|
-
xAxisY: any;
|
|
29
|
-
yAxisX: any;
|
|
14
|
+
/** The plot's inputs — the only thing `update()` writes. */
|
|
15
|
+
config: PlotConfig;
|
|
16
|
+
/** The mounted geoms and the rows each draws. */
|
|
17
|
+
geoms: GeomRegistry;
|
|
18
|
+
/** The drawing area: size less margin. */
|
|
19
|
+
frame: PlotFrame;
|
|
20
|
+
/** Which field feeds each aesthetic. Suffixed: `channels` is the contract's raw map. */
|
|
21
|
+
channelState: ChannelState;
|
|
22
|
+
/** Which way the chart reads. Suffixed: `orientation` is the contract's string. */
|
|
23
|
+
orientationState: OrientationState;
|
|
24
|
+
/** Hover, selection, zoom. */
|
|
25
|
+
interactionState: InteractionState;
|
|
26
|
+
/** The x / y position scales. */
|
|
27
|
+
scales: ScaleState;
|
|
28
|
+
/** Palette, patterns, symbols, continuous colour. */
|
|
29
|
+
aesthetics: AestheticState;
|
|
30
|
+
/** Where the axes cross. */
|
|
31
|
+
axes: AxisState;
|
|
32
|
+
/** Re-apply inputs. Which omitted fields keep and which reset: `CONFIG_FIELDS`. */
|
|
30
33
|
update(config: any): void;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
format(field: any): any;
|
|
37
|
-
tooltip(): any;
|
|
38
|
-
geomComponent(type: any): any;
|
|
39
|
-
preset(): {
|
|
40
|
-
colors: any;
|
|
41
|
-
patterns: any;
|
|
42
|
-
symbols: any;
|
|
43
|
-
};
|
|
44
|
-
get data(): any[];
|
|
45
|
-
/** @returns {{ x?: string, y?: string, color?: string, fill?: string, pattern?: string, symbol?: string }} */
|
|
46
|
-
get channels(): {
|
|
47
|
-
x?: string;
|
|
48
|
-
y?: string;
|
|
49
|
-
color?: string;
|
|
50
|
-
fill?: string;
|
|
51
|
-
pattern?: string;
|
|
52
|
-
symbol?: string;
|
|
53
|
-
};
|
|
54
|
-
get isFlipped(): boolean;
|
|
55
|
-
get continuousCategory(): boolean;
|
|
56
|
-
place(u: any, v: any): {
|
|
57
|
-
x: any;
|
|
58
|
-
y: any;
|
|
59
|
-
};
|
|
60
|
-
get bandScale(): any;
|
|
61
|
-
get valueScale(): any;
|
|
62
|
-
get margin(): {
|
|
63
|
-
top: number;
|
|
64
|
-
right: number;
|
|
65
|
-
bottom: number;
|
|
66
|
-
left: number;
|
|
67
|
-
};
|
|
68
|
-
get innerWidth(): number;
|
|
69
|
-
get innerHeight(): number;
|
|
70
|
-
get mode(): string;
|
|
34
|
+
/** The rows — the same objects every identity geom is handed, so `indexOf(row)` works. */
|
|
35
|
+
get data(): import("./state/PlotConfig.svelte.js").Row[];
|
|
36
|
+
/** The caller's channel map, unmerged. `channelState.effective` is the merged one. */
|
|
37
|
+
get channels(): import("./state/PlotConfig.svelte.js").Channels;
|
|
38
|
+
get mode(): "light" | "dark";
|
|
71
39
|
get chartPreset(): {
|
|
72
40
|
colors: string[];
|
|
73
41
|
shades: {
|
|
@@ -95,15 +63,85 @@ export class PlotState {
|
|
|
95
63
|
ribbon: number;
|
|
96
64
|
waterfall: number;
|
|
97
65
|
rule: number;
|
|
66
|
+
hull: number;
|
|
67
|
+
contour: number;
|
|
98
68
|
radar: number;
|
|
99
69
|
};
|
|
100
70
|
patterns: string[];
|
|
101
71
|
symbols: string[];
|
|
102
72
|
};
|
|
73
|
+
/** A continuous category axis (a bar race's tweened rank) rather than a band. */
|
|
74
|
+
get continuousCategory(): boolean;
|
|
75
|
+
set axisOrigin(value: [number | undefined, number | undefined]);
|
|
76
|
+
/** Pin the axis crossing directly — also reachable through `update({ axisOrigin })`. */
|
|
77
|
+
get axisOrigin(): [number | undefined, number | undefined];
|
|
78
|
+
label(field: any): string;
|
|
79
|
+
format(field: any): any;
|
|
80
|
+
tooltip(): any;
|
|
81
|
+
geomComponent(type: any): any;
|
|
82
|
+
preset(): {
|
|
83
|
+
colors: any;
|
|
84
|
+
patterns: any;
|
|
85
|
+
symbols: any;
|
|
86
|
+
};
|
|
87
|
+
registerGeom(config: any): string;
|
|
88
|
+
updateGeom(id: any, config: any): void;
|
|
89
|
+
unregisterGeom(id: any): void;
|
|
90
|
+
geomData(id: any): Object[];
|
|
91
|
+
/** The legend picks a swatch style from these. */
|
|
92
|
+
get geomTypes(): import("svelte/reactivity").SvelteSet<any>;
|
|
93
|
+
get margin(): Readonly<{
|
|
94
|
+
top: 20;
|
|
95
|
+
right: 20;
|
|
96
|
+
bottom: 40;
|
|
97
|
+
left: 50;
|
|
98
|
+
}> | import("./state/PlotConfig.svelte.js").Margin;
|
|
99
|
+
get innerWidth(): number;
|
|
100
|
+
get innerHeight(): number;
|
|
101
|
+
/** Null for a literal CSS colour — it maps to no field. */
|
|
102
|
+
get colorField(): any;
|
|
103
|
+
get fillField(): any;
|
|
104
|
+
get patternField(): any;
|
|
105
|
+
get symbolField(): any;
|
|
106
|
+
get orientation(): string;
|
|
107
|
+
/** Rendered horizontally: the band axis stands up the screen. Channels are unchanged. */
|
|
108
|
+
get isFlipped(): boolean;
|
|
109
|
+
/** Channel space to screen: `const { x, y } = plotState.place(xScale(d[x]), yScale(d[y]))`. */
|
|
110
|
+
place(u: any, v: any): {
|
|
111
|
+
x: any;
|
|
112
|
+
y: any;
|
|
113
|
+
};
|
|
114
|
+
get xScale(): any;
|
|
115
|
+
get yScale(): any;
|
|
116
|
+
/** The categorical scale, whichever screen axis it is on. */
|
|
117
|
+
get bandScale(): any;
|
|
118
|
+
/** The value scale, whichever screen axis it is on. */
|
|
119
|
+
get valueScale(): any;
|
|
120
|
+
get colors(): Map<unknown, {
|
|
121
|
+
fill: string;
|
|
122
|
+
stroke: string;
|
|
123
|
+
}> | Map<null, {
|
|
124
|
+
fill: any;
|
|
125
|
+
stroke: any;
|
|
126
|
+
}>;
|
|
127
|
+
get patterns(): Map<unknown, string> | import("svelte/reactivity").SvelteMap<any, any>;
|
|
128
|
+
get symbols(): Map<unknown, string> | import("svelte/reactivity").SvelteMap<any, any>;
|
|
129
|
+
get colorScaleType(): any;
|
|
130
|
+
get continuousColorScale(): {
|
|
131
|
+
scale: (v: number) => string;
|
|
132
|
+
domain: [number, number];
|
|
133
|
+
type: "sequential";
|
|
134
|
+
} | {
|
|
135
|
+
scale: (v: number) => string;
|
|
136
|
+
domain: [number, number, number];
|
|
137
|
+
type: "diverging";
|
|
138
|
+
} | null;
|
|
139
|
+
get xAxisY(): any;
|
|
140
|
+
get yAxisX(): any;
|
|
103
141
|
get hovered(): null;
|
|
104
142
|
get interactive(): boolean;
|
|
105
143
|
get selectedRows(): any[];
|
|
106
|
-
setHovered(
|
|
144
|
+
setHovered(row: any): void;
|
|
107
145
|
clearHovered(): void;
|
|
108
146
|
isSelected(row: any): boolean;
|
|
109
147
|
setSelected(rows: any): void;
|
|
@@ -111,7 +149,13 @@ export class PlotState {
|
|
|
111
149
|
handleSelect(detail: any): void;
|
|
112
150
|
applyZoom(transform: any): void;
|
|
113
151
|
resetZoom(): void;
|
|
114
|
-
#private;
|
|
115
152
|
}
|
|
116
|
-
import {
|
|
117
|
-
import {
|
|
153
|
+
import { PlotConfig } from './state/PlotConfig.svelte.js';
|
|
154
|
+
import { GeomRegistry } from './state/GeomRegistry.svelte.js';
|
|
155
|
+
import { PlotFrame } from './state/PlotFrame.svelte.js';
|
|
156
|
+
import { ChannelState } from './state/ChannelState.svelte.js';
|
|
157
|
+
import { OrientationState } from './state/OrientationState.svelte.js';
|
|
158
|
+
import { InteractionState } from './state/InteractionState.svelte.js';
|
|
159
|
+
import { ScaleState } from './state/ScaleState.svelte.js';
|
|
160
|
+
import { AestheticState } from './state/AestheticState.svelte.js';
|
|
161
|
+
import { AxisState } from './state/AxisState.svelte.js';
|