@nova-lab/charts 0.0.0-stage → 1.0.0-dev.32
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/LICENSE +202 -0
- package/README.md +158 -2
- package/dist/GeometryIndex-DDQ34Jf4.js +104 -0
- package/dist/MarkSeries-CQCAnV4s.js +245 -0
- package/dist/aggregation.d.ts +6 -0
- package/dist/aggregation.js +124 -0
- package/dist/annotations.d.ts +34 -0
- package/dist/annotations.js +71 -0
- package/dist/api/camera.d.ts +8 -0
- package/dist/api/cartesian.d.ts +21 -0
- package/dist/api/events.d.ts +13 -0
- package/dist/api/font.d.ts +3 -0
- package/dist/api/handle.d.ts +5 -0
- package/dist/api/host.d.ts +23 -0
- package/dist/api/internal.d.ts +41 -0
- package/dist/api/map-background.d.ts +12 -0
- package/dist/api/mark-paint.d.ts +5 -0
- package/dist/api/mark-style.d.ts +4 -0
- package/dist/api/navigation.d.ts +4 -0
- package/dist/api/overlay.d.ts +7 -0
- package/dist/api/partition.d.ts +11 -0
- package/dist/api/scene.d.ts +42 -0
- package/dist/api/state.d.ts +34 -0
- package/dist/api/types.d.ts +743 -0
- package/dist/area.d.ts +9 -0
- package/dist/area.js +706 -0
- package/dist/bar.d.ts +9 -0
- package/dist/bar.js +554 -0
- package/dist/brush.d.ts +17 -0
- package/dist/brush.js +86 -0
- package/dist/bubble.d.ts +8 -0
- package/dist/bubble.js +434 -0
- package/dist/camera-CUJAMfpx.js +57 -0
- package/dist/candlestick.d.ts +8 -0
- package/dist/candlestick.js +42 -0
- package/dist/cartesian-k_WIYsGp.js +1139 -0
- package/dist/chart-runtime-resolver-DwwXp3X8.js +20 -0
- package/dist/chart-series-runtime-C0P7h8Tl.js +127 -0
- package/dist/charts.js +1 -0
- package/dist/composed.d.ts +2 -0
- package/dist/composed.js +4 -0
- package/dist/crosshair.d.ts +23 -0
- package/dist/crosshair.js +60 -0
- package/dist/donut.d.ts +5 -0
- package/dist/donut.js +7 -0
- package/dist/funnel.d.ts +5 -0
- package/dist/funnel.js +40 -0
- package/dist/graph.d.ts +6 -0
- package/dist/graph.js +260 -0
- package/dist/heatmap.d.ts +8 -0
- package/dist/heatmap.js +37 -0
- package/dist/host-DLDeDU5k.js +4373 -0
- package/dist/index.d.ts +1 -0
- package/dist/internal-I5BDhahD.js +4 -0
- package/dist/layout-donut-BG4ubBtU.js +39 -0
- package/dist/line.d.ts +9 -0
- package/dist/line.js +452 -0
- package/dist/mark-paint-CMHKGegE.js +14 -0
- package/dist/mark-style-Cpl-ARQM.js +10 -0
- package/dist/model/area/create-area-series-layout.d.ts +15 -0
- package/dist/model/area/hit-test-area-layout.d.ts +2 -0
- package/dist/model/axis/ChartAxisModel.d.ts +28 -0
- package/dist/model/bar/create-bar-series-layout.d.ts +19 -0
- package/dist/model/bar/hit-test-bar-layout.d.ts +2 -0
- package/dist/model/bubble/create-bubble-series-layout.d.ts +15 -0
- package/dist/model/bubble/hit-test-bubble-layout.d.ts +2 -0
- package/dist/model/cartesian/append-line-contours.d.ts +4 -0
- package/dist/model/cartesian/axis-line-batch.d.ts +3 -0
- package/dist/model/cartesian/numeric-window.d.ts +7 -0
- package/dist/model/cartesian/point-series.d.ts +54 -0
- package/dist/model/cartesian/sample-extrema.d.ts +7 -0
- package/dist/model/cartesian/smooth-y.d.ts +4 -0
- package/dist/model/cartesian/translation-window.d.ts +17 -0
- package/dist/model/context/nova-chart-runtime.d.ts +54 -0
- package/dist/model/customization/chart-customization.d.ts +47 -0
- package/dist/model/customization/chart-presets.d.ts +6 -0
- package/dist/model/customization/chart-style-sheet.d.ts +9 -0
- package/dist/model/data/ChartDataStore.d.ts +113 -0
- package/dist/model/exploration/create-graph-layout.d.ts +11 -0
- package/dist/model/exploration/exploration-chart.types.d.ts +150 -0
- package/dist/model/exploration/force-layout.d.ts +9 -0
- package/dist/model/exploration/presets/airplane.d.ts +2 -0
- package/dist/model/exploration/presets/apartment.d.ts +2 -0
- package/dist/model/exploration/presets/botanical-park.d.ts +2 -0
- package/dist/model/exploration/presets/ferry.d.ts +2 -0
- package/dist/model/exploration/presets/ice-arena.d.ts +2 -0
- package/dist/model/exploration/presets/planetarium.d.ts +2 -0
- package/dist/model/exploration/presets/science-museum.d.ts +2 -0
- package/dist/model/exploration/presets/train.d.ts +2 -0
- package/dist/model/exploration/route-geometry.d.ts +9 -0
- package/dist/model/exploration/seat-shape.d.ts +7 -0
- package/dist/model/interaction/GeometryIndex.d.ts +14 -0
- package/dist/model/line/create-line-series-layout.d.ts +15 -0
- package/dist/model/line/hit-test-line-layout.d.ts +2 -0
- package/dist/model/novel/create-novel-layout.d.ts +5 -0
- package/dist/model/novel/hit-test-novel-layout.d.ts +3 -0
- package/dist/model/novel/layout-candlestick.d.ts +3 -0
- package/dist/model/novel/layout-donut.d.ts +3 -0
- package/dist/model/novel/layout-funnel.d.ts +3 -0
- package/dist/model/novel/layout-heatmap.d.ts +3 -0
- package/dist/model/novel/layout-input.d.ts +12 -0
- package/dist/model/novel/layout-radar.d.ts +3 -0
- package/dist/model/novel/layout-tree.d.ts +3 -0
- package/dist/model/novel/layout-treemap.d.ts +3 -0
- package/dist/model/novel/layout-values.d.ts +10 -0
- package/dist/model/novel/novel-chart.types.d.ts +140 -0
- package/dist/model/novel/novel-domains.d.ts +5 -0
- package/dist/model/scale/BandScale.d.ts +86 -0
- package/dist/model/scale/ChartScaleRegistry.d.ts +45 -0
- package/dist/model/scale/LinearScale.d.ts +48 -0
- package/dist/model/scale/TimeScale.d.ts +48 -0
- package/dist/model/scale/create-chart-scale.d.ts +3 -0
- package/dist/model/scale/resolve-chart-scale.d.ts +5 -0
- package/dist/model/scatter/create-scatter-series-layout.d.ts +14 -0
- package/dist/model/scatter/hit-test-scatter-layout.d.ts +4 -0
- package/dist/model/time/calendar-time.d.ts +16 -0
- package/dist/model/types/chart-axis.types.d.ts +43 -0
- package/dist/model/types/chart-components.types.d.ts +1393 -0
- package/dist/model/types/chart-scale.types.d.ts +78 -0
- package/dist/model/viewport-controller/viewport-controller.d.ts +5 -0
- package/dist/novel-domains-DBpA_AOT.js +24 -0
- package/dist/partition-D-0LTCr3.js +221 -0
- package/dist/presets/route-map/apartment.d.ts +2 -0
- package/dist/presets/route-map/apartment.js +116 -0
- package/dist/presets/route-map/botanical-park.d.ts +2 -0
- package/dist/presets/route-map/botanical-park.js +116 -0
- package/dist/presets/route-map/science-museum.d.ts +2 -0
- package/dist/presets/route-map/science-museum.js +45 -0
- package/dist/presets/seat-map/airplane.d.ts +2 -0
- package/dist/presets/seat-map/airplane.js +95 -0
- package/dist/presets/seat-map/ferry.d.ts +2 -0
- package/dist/presets/seat-map/ferry.js +54 -0
- package/dist/presets/seat-map/ice-arena.d.ts +2 -0
- package/dist/presets/seat-map/ice-arena.js +67 -0
- package/dist/presets/seat-map/planetarium.d.ts +2 -0
- package/dist/presets/seat-map/planetarium.js +54 -0
- package/dist/presets/seat-map/train.d.ts +2 -0
- package/dist/presets/seat-map/train.js +66 -0
- package/dist/presets.d.ts +78 -0
- package/dist/presets.js +14 -0
- package/dist/public.d.ts +2 -0
- package/dist/radar.d.ts +5 -0
- package/dist/radar.js +47 -0
- package/dist/rose.d.ts +5 -0
- package/dist/rose.js +7 -0
- package/dist/route-map.d.ts +6 -0
- package/dist/route-map.js +200 -0
- package/dist/scatter.d.ts +8 -0
- package/dist/scatter.js +433 -0
- package/dist/scene-CPvPzTaB.js +137 -0
- package/dist/seat-map.d.ts +6 -0
- package/dist/seat-map.js +84 -0
- package/dist/seat-shape--kEFiUXX.js +66 -0
- package/dist/state-C5pICb11.js +134 -0
- package/dist/sync.d.ts +82 -0
- package/dist/sync.js +326 -0
- package/dist/translation-window-Ca_rCenJ.js +57 -0
- package/dist/tree.d.ts +6 -0
- package/dist/tree.js +114 -0
- package/dist/treemap.d.ts +5 -0
- package/dist/treemap.js +85 -0
- package/dist/ui/area-series/AreaSeries.d.ts +44 -0
- package/dist/ui/area-series/area-series.config.d.ts +10 -0
- package/dist/ui/area-series/area-series.registry.d.ts +4 -0
- package/dist/ui/axis/Axis.d.ts +55 -0
- package/dist/ui/axis/axis.config.d.ts +10 -0
- package/dist/ui/axis/axis.registry.d.ts +4 -0
- package/dist/ui/bar-chart/BarChart.d.ts +124 -0
- package/dist/ui/bar-chart/bar-chart.config.d.ts +10 -0
- package/dist/ui/bar-chart/bar-chart.registry.d.ts +2 -0
- package/dist/ui/bar-series/BarSeries.d.ts +102 -0
- package/dist/ui/bar-series/bar-series.config.d.ts +10 -0
- package/dist/ui/bar-series/bar-series.registry.d.ts +4 -0
- package/dist/ui/bubble-series/BubbleSeries.d.ts +33 -0
- package/dist/ui/bubble-series/bubble-series.config.d.ts +10 -0
- package/dist/ui/bubble-series/bubble-series.registry.d.ts +4 -0
- package/dist/ui/composed-chart/ComposedChart.d.ts +41 -0
- package/dist/ui/composed-chart/composed-chart.config.d.ts +10 -0
- package/dist/ui/composed-chart/composed-chart.registry.d.ts +4 -0
- package/dist/ui/exploration-chart/ExplorationChart.d.ts +83 -0
- package/dist/ui/exploration-chart/exploration-chart.config.d.ts +7 -0
- package/dist/ui/exploration-chart/exploration-chart.registry.d.ts +6 -0
- package/dist/ui/grid/Grid.d.ts +35 -0
- package/dist/ui/grid/grid.config.d.ts +10 -0
- package/dist/ui/grid/grid.registry.d.ts +4 -0
- package/dist/ui/interaction/Interaction.d.ts +53 -0
- package/dist/ui/interaction/interaction.config.d.ts +10 -0
- package/dist/ui/interaction/interaction.registry.d.ts +4 -0
- package/dist/ui/legend/Legend.d.ts +38 -0
- package/dist/ui/legend/legend.config.d.ts +10 -0
- package/dist/ui/legend/legend.registry.d.ts +2 -0
- package/dist/ui/line-series/LineSeries.d.ts +67 -0
- package/dist/ui/line-series/line-series.config.d.ts +10 -0
- package/dist/ui/line-series/line-series.registry.d.ts +4 -0
- package/dist/ui/mark-series/MarkSeries.d.ts +55 -0
- package/dist/ui/novel-series/NovelSeries.d.ts +34 -0
- package/dist/ui/novel-series/novel-series.config.d.ts +9 -0
- package/dist/ui/novel-series/novel-series.registry.d.ts +4 -0
- package/dist/ui/partition-chart/PartitionChart.d.ts +24 -0
- package/dist/ui/partition-chart/partition-chart.config.d.ts +7 -0
- package/dist/ui/partition-chart/partition-chart.registry.d.ts +9 -0
- package/dist/ui/plot/Plot.d.ts +64 -0
- package/dist/ui/plot/plot.config.d.ts +10 -0
- package/dist/ui/plot/plot.registry.d.ts +4 -0
- package/dist/ui/root/Root.d.ts +206 -0
- package/dist/ui/root/root.config.d.ts +10 -0
- package/dist/ui/root/root.registry.d.ts +5 -0
- package/dist/ui/scale/Scale.d.ts +55 -0
- package/dist/ui/scale/scale.config.d.ts +10 -0
- package/dist/ui/scale/scale.registry.d.ts +4 -0
- package/dist/ui/scatter-series/ScatterSeries.d.ts +33 -0
- package/dist/ui/scatter-series/scatter-series.config.d.ts +10 -0
- package/dist/ui/scatter-series/scatter-series.registry.d.ts +4 -0
- package/dist/ui/shared/chart-props.d.ts +150 -0
- package/dist/ui/shared/chart-runtime-resolver.d.ts +4 -0
- package/dist/ui/shared/chart-semantic-marks.d.ts +20 -0
- package/dist/ui/shared/chart-series-runtime.d.ts +48 -0
- package/dist/ui/shared/schema-types.d.ts +34 -0
- package/dist/ui/tooltip/Tooltip.d.ts +64 -0
- package/dist/ui/tooltip/tooltip.config.d.ts +10 -0
- package/dist/ui/tooltip/tooltip.registry.d.ts +4 -0
- package/dist/ui/viewport/Viewport.d.ts +81 -0
- package/dist/ui/viewport/viewport.config.d.ts +10 -0
- package/dist/ui/viewport/viewport.registry.d.ts +2 -0
- package/dist/ui/viewport-controller/ViewportController.d.ts +30 -0
- package/dist/ui/viewport-controller/viewport-controller.config.d.ts +10 -0
- package/dist/ui/viewport-controller/viewport-controller.registry.d.ts +2 -0
- package/package.json +179 -4
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
var Q = Object.defineProperty;
|
|
2
|
+
var V = (y, i, p) => i in y ? Q(y, i, { enumerable: !0, configurable: !0, writable: !0, value: p }) : y[i] = p;
|
|
3
|
+
var D = (y, i, p) => V(y, typeof i != "symbol" ? i + "" : i, p);
|
|
4
|
+
import { c as X } from "./host-DLDeDU5k.js";
|
|
5
|
+
import { M as Y, p as Z } from "./seat-shape--kEFiUXX.js";
|
|
6
|
+
import { a as G } from "./mark-style-Cpl-ARQM.js";
|
|
7
|
+
import { k as P, m as U, c as $ } from "./scene-CPvPzTaB.js";
|
|
8
|
+
import { r as R, s as tt } from "./state-C5pICb11.js";
|
|
9
|
+
import { G as et } from "./GeometryIndex-DDQ34Jf4.js";
|
|
10
|
+
class L {
|
|
11
|
+
constructor(i) {
|
|
12
|
+
D(this, "lengths");
|
|
13
|
+
D(this, "length");
|
|
14
|
+
this.points = i, this.lengths = new Float64Array(i.length);
|
|
15
|
+
let p = 0;
|
|
16
|
+
for (let t = 1; t < i.length; t++)
|
|
17
|
+
p += Math.hypot(i[t].x - i[t - 1].x, i[t].y - i[t - 1].y), this.lengths[t] = p;
|
|
18
|
+
this.length = p;
|
|
19
|
+
}
|
|
20
|
+
at(i) {
|
|
21
|
+
if (!this.points.length)
|
|
22
|
+
return { x: 0, y: 0 };
|
|
23
|
+
if (this.length <= 0)
|
|
24
|
+
return { ...this.points[0] };
|
|
25
|
+
const p = Math.max(0, Math.min(this.length, i));
|
|
26
|
+
let t = 1, c = this.points.length - 1;
|
|
27
|
+
for (; t < c; ) {
|
|
28
|
+
const S = t + c >>> 1;
|
|
29
|
+
this.lengths[S] < p ? t = S + 1 : c = S;
|
|
30
|
+
}
|
|
31
|
+
const k = this.points[t - 1], x = this.points[t], f = (p - this.lengths[t - 1]) / Math.max(1e-12, this.lengths[t] - this.lengths[t - 1]);
|
|
32
|
+
return { x: k.x + (x.x - k.x) * f, y: k.y + (x.y - k.y) * f };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const T = X({ rows: (y) => (A(y), y.data.regions), key: () => "key", create: at }), ht = { mount: T.mount, attach: T.attach };
|
|
36
|
+
function A(y) {
|
|
37
|
+
var p;
|
|
38
|
+
const i = P(y.data.routes, "route");
|
|
39
|
+
P(y.data.regions, "region"), P(y.data.walkers, "walker"), U(y.viewBox, 1, 1);
|
|
40
|
+
for (const t of i.values())
|
|
41
|
+
if (t.points.length < 2 || t.points.some((c) => ![c.x, c.y].every(Number.isFinite)))
|
|
42
|
+
throw new Error("[NovaCharts] Route requires at least two finite points");
|
|
43
|
+
for (const t of y.data.regions)
|
|
44
|
+
if (![t.x, t.y, t.width, t.height].every(Number.isFinite) || t.width < 0 || t.height < 0 || (p = t.points) != null && p.some((c) => ![c.x, c.y].every(Number.isFinite)))
|
|
45
|
+
throw new Error("[NovaCharts] Region geometry must be finite");
|
|
46
|
+
for (const t of y.data.walkers)
|
|
47
|
+
if (!i.has(t.routeKey) || t.speed !== void 0 && (!Number.isFinite(t.speed) || t.speed < 0))
|
|
48
|
+
throw new Error("[NovaCharts] Walker requires a known route and nonnegative speed");
|
|
49
|
+
for (const t of i.values())
|
|
50
|
+
if (t.width !== void 0 && (!Number.isFinite(t.width) || t.width <= 0))
|
|
51
|
+
throw new Error("[NovaCharts] Route width must be finite and positive");
|
|
52
|
+
for (const t of y.data.walkers)
|
|
53
|
+
if (t.size !== void 0 && (!Number.isFinite(t.size) || t.size <= 0) || t.startProgress !== void 0 && (!Number.isFinite(t.startProgress) || t.startProgress < 0 || t.startProgress > 1))
|
|
54
|
+
throw new Error("[NovaCharts] Walker size/progress is invalid");
|
|
55
|
+
}
|
|
56
|
+
function at(y, i) {
|
|
57
|
+
const p = y.getNovaChartRuntime().dataStore;
|
|
58
|
+
let t = i, c = P(i.data.routes, "route"), k = P(i.data.walkers, "walker"), x = new Map([...c].map(([e, o]) => [e, new L(o.points)])), f = null, S = () => {
|
|
59
|
+
}, v = null, M = 0, B = !1, I = !1, C = 0;
|
|
60
|
+
const E = new Y(() => {
|
|
61
|
+
v = null, S();
|
|
62
|
+
});
|
|
63
|
+
E.set(i.mapBackground);
|
|
64
|
+
const _ = () => {
|
|
65
|
+
var o;
|
|
66
|
+
if (((o = t.playback) == null ? void 0 : o.duration) !== void 0)
|
|
67
|
+
return t.playback.duration;
|
|
68
|
+
let e = 1e3;
|
|
69
|
+
for (const s of k.values())
|
|
70
|
+
e = Math.max(e, x.get(s.routeKey).length * 2e3 / Math.max(0.01, s.speed ?? 80));
|
|
71
|
+
return e;
|
|
72
|
+
}, K = () => {
|
|
73
|
+
var e, o, s;
|
|
74
|
+
return { status: (e = i.playback) != null && e.autoplay ? "playing" : "paused", position: 0, duration: _(), rate: ((o = i.playback) == null ? void 0 : o.rate) ?? 1, loop: ((s = i.playback) == null ? void 0 : s.loop) ?? !0 };
|
|
75
|
+
}, H = (e) => {
|
|
76
|
+
if (e.viewport || e.navigation || e.detail || e.graph)
|
|
77
|
+
throw new Error("[NovaCharts] Unsupported RouteMap view state");
|
|
78
|
+
const o = e.playback ?? K();
|
|
79
|
+
if (![o.position, o.duration, o.rate].every(Number.isFinite) || o.duration <= 0 || o.rate <= 0 || !["playing", "paused", "ended"].includes(o.status))
|
|
80
|
+
throw new Error("[NovaCharts] Playback requires positive duration/rate and finite position");
|
|
81
|
+
const s = e.selection.filter((l) => l.type === "route" ? c.has(l.key) : l.type === "walker" ? k.has(l.key) : l.type === "region" && !!p.getRow(l.key));
|
|
82
|
+
return { ...e, selection: s, playback: { ...o, position: Math.max(0, Math.min(o.duration, o.position)) } };
|
|
83
|
+
};
|
|
84
|
+
function z() {
|
|
85
|
+
var e;
|
|
86
|
+
B || M || I || ((e = f == null ? void 0 : f.readState().playback) == null ? void 0 : e.status) !== "playing" || (C || (C = performance.now()), M = requestAnimationFrame((o) => {
|
|
87
|
+
if (M = 0, B || !f)
|
|
88
|
+
return;
|
|
89
|
+
const s = f.readState().playback;
|
|
90
|
+
if (s.status !== "playing")
|
|
91
|
+
return;
|
|
92
|
+
const l = Math.max(0, o - C);
|
|
93
|
+
C = o;
|
|
94
|
+
let a = s.position + l * s.rate;
|
|
95
|
+
const r = a >= s.duration && !s.loop ? "ended" : "playing";
|
|
96
|
+
a = s.loop ? a % s.duration : Math.min(a, s.duration), I = !0, Promise.resolve().then(() => f.request("playback", { ...s, position: a, status: r })).then((n) => {
|
|
97
|
+
I = !1, n !== !1 && z();
|
|
98
|
+
}, (n) => {
|
|
99
|
+
I = !1, B || f.reportError(n);
|
|
100
|
+
});
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
const J = () => ({ routes: [...c.values()], regions: p.getSourceData(), walkers: [...k.values()] });
|
|
104
|
+
function O(e) {
|
|
105
|
+
var l;
|
|
106
|
+
if (v)
|
|
107
|
+
return v;
|
|
108
|
+
const o = [...E.schema(0, 0, t.viewBox.width, t.viewBox.height)], s = [];
|
|
109
|
+
for (const a of p.getData()) {
|
|
110
|
+
if (e[R({ type: "region", key: a.key })] === !1)
|
|
111
|
+
continue;
|
|
112
|
+
const r = a.points;
|
|
113
|
+
s.push({ ref: { type: "region", key: a.key }, row: a, label: a.label ?? String(a.key), point: { x: a.x + a.width / 2, y: a.y + a.height / 2 }, bounds: { x: a.x, y: a.y, width: a.width, height: a.height }, ...r ? { contains: (n) => Z(n, r), overlay: (n, g) => [{ type: "polygon", points: r.map(g), styles: { background: n.fill ?? "transparent", stroke: n.stroke ?? "#287bc1", lineWidth: n.strokeWidth ?? 2, opacity: n.opacity ?? 1 } }] } : {} });
|
|
114
|
+
}
|
|
115
|
+
for (const a of c.values()) {
|
|
116
|
+
if (e[R({ type: "route", key: a.key })] === !1)
|
|
117
|
+
continue;
|
|
118
|
+
const r = a.points;
|
|
119
|
+
o.push(...G([{ type: "polygon", points: [...r], closed: !1, styles: { stroke: a.color ?? "#2674b8", lineWidth: a.width ?? 2, opacity: 0.8 } }], (l = t.styles) == null ? void 0 : l.normal));
|
|
120
|
+
const n = [];
|
|
121
|
+
let g = 1 / 0, N = 1 / 0, F = -1 / 0, w = -1 / 0;
|
|
122
|
+
for (let h = 1; h < r.length; h++) {
|
|
123
|
+
const d = r[h - 1], u = r[h];
|
|
124
|
+
n.push({ a: d, b: u, x: Math.min(d.x, u.x), y: Math.min(d.y, u.y), width: Math.abs(d.x - u.x), height: Math.abs(d.y - u.y) }), g = Math.min(g, d.x, u.x), N = Math.min(N, d.y, u.y), F = Math.max(F, d.x, u.x), w = Math.max(w, d.y, u.y);
|
|
125
|
+
}
|
|
126
|
+
const m = new et(n, (h) => h), b = x.get(a.key);
|
|
127
|
+
s.push({ ref: { type: "route", key: a.key }, row: a, label: a.label ?? String(a.key), bounds: { x: g, y: N, width: F - g, height: w - N }, point: b.at(b.length / 2), contains(h, d) {
|
|
128
|
+
return m.query(h.x, h.y, d).some((u) => {
|
|
129
|
+
const W = u.b.x - u.a.x, q = u.b.y - u.a.y, j = Math.max(0, Math.min(1, ((h.x - u.a.x) * W + (h.y - u.a.y) * q) / Math.max(1e-12, W * W + q * q)));
|
|
130
|
+
return Math.hypot(h.x - u.a.x - j * W, h.y - u.a.y - j * q) <= d + (a.width ?? 2) / 2;
|
|
131
|
+
});
|
|
132
|
+
}, overlay: (h, d) => [{ type: "polygon", closed: !1, points: r.map(d), styles: { stroke: h.stroke ?? h.fill ?? "#287bc1", lineWidth: h.strokeWidth ?? 3, opacity: h.opacity ?? 1 } }] });
|
|
133
|
+
}
|
|
134
|
+
return v = { schema: o, items: s };
|
|
135
|
+
}
|
|
136
|
+
return $(y, i, {
|
|
137
|
+
capabilities: { kind: "route-map", rows: !1, scales: !1, viewport: !1, camera: !0, drilldown: !1, expansion: !1, layout: !1, detail: !1, playback: !0, selection: !0, export: { image: ["png", "jpeg", "webp"], data: ["json"] } },
|
|
138
|
+
legend: () => [...c.values()].map((e) => ({ id: R({ type: "route", key: e.key }), label: e.label ?? String(e.key), color: e.color })),
|
|
139
|
+
dynamic: !0,
|
|
140
|
+
defaults: () => ({ playback: K(), camera: { center: { x: t.viewBox.width / 2, y: t.viewBox.height / 2 }, zoom: U(t.viewBox, y.width, y.height).scale } }),
|
|
141
|
+
normalize: H,
|
|
142
|
+
getData: J,
|
|
143
|
+
setData(e) {
|
|
144
|
+
A({ ...t, data: e }), c = P(e.routes, "route"), k = P(e.walkers, "walker"), x = new Map([...c].map(([o, s]) => [o, new L(s.points)])), p.setData([...e.regions]);
|
|
145
|
+
},
|
|
146
|
+
configure(e) {
|
|
147
|
+
A(e), t = e, E.set(e.mapBackground), v = null;
|
|
148
|
+
},
|
|
149
|
+
changed() {
|
|
150
|
+
v = null;
|
|
151
|
+
},
|
|
152
|
+
stateChanged(e, o) {
|
|
153
|
+
var s, l, a;
|
|
154
|
+
tt(e.visibility, o.visibility) || (v = null), ((s = o.playback) == null ? void 0 : s.status) !== "playing" ? (cancelAnimationFrame(M), M = 0, C = 0) : ((((l = e.playback) == null ? void 0 : l.status) !== "playing" || e.playback.rate !== o.playback.rate || Math.abs((o.playback.position ?? 0) - (((a = e.playback) == null ? void 0 : a.position) ?? 0)) > 500) && (C = performance.now()), z());
|
|
155
|
+
},
|
|
156
|
+
plan(e, o) {
|
|
157
|
+
var r;
|
|
158
|
+
const s = O(o.visibility), l = [], a = [];
|
|
159
|
+
for (const n of k.values()) {
|
|
160
|
+
if (o.visibility[R({ type: "walker", key: n.key })] === !1 || o.visibility[R({ type: "route", key: n.routeKey })] === !1)
|
|
161
|
+
continue;
|
|
162
|
+
const g = x.get(n.routeKey);
|
|
163
|
+
if (!g.length)
|
|
164
|
+
continue;
|
|
165
|
+
const N = Math.max(0, Math.min(1, n.startProgress ?? 0)) * g.length, F = ((n.direction === "backward" ? 2 * g.length - N : N) + (n.speed ?? 80) * o.playback.position / 1e3) % (2 * g.length), w = g.at(F <= g.length ? F : 2 * g.length - F), m = n.size ?? 6;
|
|
166
|
+
l.push(...G([{ type: "circle", ...w, radius: m, styles: { background: n.color ?? "#d8664e", border: { color: "#ffffff", width: 1.5 } } }], (r = t.styles) == null ? void 0 : r.normal)), a.push({ ref: { type: "walker", key: n.key }, row: n, label: n.label ?? String(n.key), point: w, bounds: { x: w.x - m, y: w.y - m, width: m * 2, height: m * 2 }, contains: (b, h) => Math.hypot(b.x - w.x, b.y - w.y) <= m + h, overlay: (b, h, d) => [{ type: "circle", ...h(w), radius: (b.radius ?? m) * d, styles: { background: b.fill ?? "transparent", border: { color: b.stroke ?? "#287bc1", width: b.strokeWidth ?? 2 }, opacity: b.opacity ?? 1 } }] });
|
|
167
|
+
}
|
|
168
|
+
return { schema: s.schema, dynamic: l, items: [...a, ...s.items] };
|
|
169
|
+
},
|
|
170
|
+
lookup(e) {
|
|
171
|
+
const o = e.type === "route" ? c.get(e.key) : e.type === "walker" ? k.get(e.key) : e.type === "region" ? p.getRow(e.key) : void 0;
|
|
172
|
+
return o ? { ref: e, row: o, label: o.label ?? String(o.key) } : null;
|
|
173
|
+
},
|
|
174
|
+
extend(e, o) {
|
|
175
|
+
f = e, S = o, z();
|
|
176
|
+
const s = () => e.readState().playback, l = (a, r) => {
|
|
177
|
+
e.request("playback", a, r);
|
|
178
|
+
};
|
|
179
|
+
return {
|
|
180
|
+
getPlayback: () => ({ ...s() }),
|
|
181
|
+
play(a) {
|
|
182
|
+
const r = s();
|
|
183
|
+
l({ ...r, status: "playing", position: r.status === "ended" ? 0 : r.position }, a == null ? void 0 : a.origin);
|
|
184
|
+
},
|
|
185
|
+
pause: (a) => l({ ...s(), status: "paused" }, a == null ? void 0 : a.origin),
|
|
186
|
+
seek: (a, r) => {
|
|
187
|
+
C = performance.now(), l({ ...s(), position: a }, r == null ? void 0 : r.origin);
|
|
188
|
+
},
|
|
189
|
+
setPlaybackRate: (a, r) => l({ ...s(), rate: a }, r == null ? void 0 : r.origin),
|
|
190
|
+
setLoop: (a, r) => l({ ...s(), loop: a }, r == null ? void 0 : r.origin)
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
dispose() {
|
|
194
|
+
B = !0, cancelAnimationFrame(M), M = 0, E.dispose(), x.clear(), c.clear(), k.clear();
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
export {
|
|
199
|
+
ht as RouteMapChart
|
|
200
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const ScatterChart: {
|
|
2
|
+
series: <T = never, const S extends import('./public').SeriesOptions<never> = import('./public').SeriesOptions<T>>(options: S) => Omit<S, "type"> & {
|
|
3
|
+
readonly type: import('./public').CartesianKind;
|
|
4
|
+
};
|
|
5
|
+
mount<T>(target: string | HTMLElement, options: import('./public').CartesianOptions<T>): import('./public').CartesianHandle<T>;
|
|
6
|
+
attach<T>(target: import('./public').ChartAttachTarget, options: import('./public').CartesianOptions<T>): import('./public').CartesianHandle<T>;
|
|
7
|
+
};
|
|
8
|
+
export type { CartesianHandle as ScatterChartHandle, CartesianOptions as ScatterChartOptions, SeriesOptions as ScatterSeriesOptions } from './api/types';
|
package/dist/scatter.js
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
var k = Object.defineProperty;
|
|
2
|
+
var b = (t, s, e) => s in t ? k(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
|
+
var h = (t, s, e) => b(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
+
import { c as w } from "./cartesian-k_WIYsGp.js";
|
|
5
|
+
import { commonMeasureBounds as V, NovaUiComponentNode as v } from "@nova-lab/ui-kit";
|
|
6
|
+
import { a as M, b as R, y, m as T, x as D, p as L, s as E, w as N, r as F, f as A } from "./host-DLDeDU5k.js";
|
|
7
|
+
import { C as B, p as O } from "./chart-series-runtime-C0P7h8Tl.js";
|
|
8
|
+
const $ = "NovaCharts.ScatterSeries";
|
|
9
|
+
function _(t) {
|
|
10
|
+
const s = {
|
|
11
|
+
type: $,
|
|
12
|
+
name: "NovaCharts.ScatterSeries",
|
|
13
|
+
title: "NovaCharts.ScatterSeries",
|
|
14
|
+
version: "0.1.0",
|
|
15
|
+
kind: "node-component",
|
|
16
|
+
dirtyPolicy: R,
|
|
17
|
+
fields: {
|
|
18
|
+
...M,
|
|
19
|
+
chartRef: { type: "string" },
|
|
20
|
+
xScaleId: { type: "string" },
|
|
21
|
+
yScaleId: { type: "string" },
|
|
22
|
+
xField: { type: "field" },
|
|
23
|
+
yField: { type: "field" },
|
|
24
|
+
seriesField: { type: "field" },
|
|
25
|
+
labelField: { type: "field" },
|
|
26
|
+
radius: { type: "record" },
|
|
27
|
+
fill: { type: "record" },
|
|
28
|
+
strokeColor: { type: "record" },
|
|
29
|
+
strokeWidth: { type: "number" },
|
|
30
|
+
opacity: { type: "number" },
|
|
31
|
+
colors: { type: "record" },
|
|
32
|
+
highlight: { type: "record" },
|
|
33
|
+
hitRadiusPx: { type: "number" },
|
|
34
|
+
virtualization: { type: "record" }
|
|
35
|
+
},
|
|
36
|
+
normalize: (e) => y(e.props),
|
|
37
|
+
measureBounds: (e, r) => V(r, y)
|
|
38
|
+
};
|
|
39
|
+
return t && (s.createNode = t), s;
|
|
40
|
+
}
|
|
41
|
+
const z = _();
|
|
42
|
+
function W(t) {
|
|
43
|
+
const s = d(), e = d(), r = t.dataStore.getData(), i = g(t), l = L(i, r), a = d() - e, o = d(), n = E(i, r), { visibleCandidates: c, renderedCandidates: u, mode: p } = N(i, n), m = u.map((P) => Y(t, P)).filter(j), C = d() - o, I = {
|
|
44
|
+
kind: "scatter",
|
|
45
|
+
inputRows: r.length,
|
|
46
|
+
visibleRows: c.length,
|
|
47
|
+
renderedPoints: m.length,
|
|
48
|
+
skippedRows: r.length - n.length,
|
|
49
|
+
seriesCount: l.length,
|
|
50
|
+
mode: p,
|
|
51
|
+
domainMs: a,
|
|
52
|
+
layoutMs: C,
|
|
53
|
+
schemaMs: 0,
|
|
54
|
+
totalMs: d() - s
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
points: m,
|
|
58
|
+
series: l,
|
|
59
|
+
diagnostics: I
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function K(t) {
|
|
63
|
+
return T(g(t));
|
|
64
|
+
}
|
|
65
|
+
function H(t) {
|
|
66
|
+
return D(g(t));
|
|
67
|
+
}
|
|
68
|
+
function g(t) {
|
|
69
|
+
return {
|
|
70
|
+
dataStore: t.dataStore,
|
|
71
|
+
xScale: t.xScale,
|
|
72
|
+
yScale: t.yScale,
|
|
73
|
+
width: t.width,
|
|
74
|
+
height: t.height,
|
|
75
|
+
xScaleId: t.props.xScaleId,
|
|
76
|
+
yScaleId: t.props.yScaleId,
|
|
77
|
+
xField: t.props.xField,
|
|
78
|
+
yField: t.props.yField,
|
|
79
|
+
seriesField: t.props.seriesField,
|
|
80
|
+
labelField: t.props.labelField,
|
|
81
|
+
kind: "scatter",
|
|
82
|
+
fallbackLabel: "Scatter",
|
|
83
|
+
palette: t.props.colors.palette,
|
|
84
|
+
defaultColor: typeof t.props.fill == "string" ? t.props.fill : "#2563eb",
|
|
85
|
+
colorField: t.props.colors.colorField,
|
|
86
|
+
virtualization: t.props.virtualization,
|
|
87
|
+
resolveColor: (s, e) => typeof t.props.fill == "function" ? t.props.fill(s) : typeof t.props.colors.fill == "function" ? t.props.colors.fill(s) : typeof t.props.colors.fill == "string" ? t.props.colors.fill : typeof t.props.fill == "string" ? t.props.fill : e == null ? void 0 : e.color
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function Y(t, s) {
|
|
91
|
+
const e = U(s);
|
|
92
|
+
return {
|
|
93
|
+
key: s.key,
|
|
94
|
+
row: s.row,
|
|
95
|
+
rowIndex: s.rowIndex,
|
|
96
|
+
xValue: s.xValue,
|
|
97
|
+
yValue: s.yValue,
|
|
98
|
+
rawValue: s.rawValue,
|
|
99
|
+
seriesKey: s.seriesKey,
|
|
100
|
+
seriesLabel: s.seriesLabel,
|
|
101
|
+
color: s.color,
|
|
102
|
+
strokeColor: X(t.props.strokeColor, e),
|
|
103
|
+
strokeWidth: t.props.strokeWidth,
|
|
104
|
+
opacity: t.props.opacity,
|
|
105
|
+
x: s.x,
|
|
106
|
+
y: s.y,
|
|
107
|
+
radius: Math.max(0, G(t.props.radius, e, 4))
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function U(t) {
|
|
111
|
+
return {
|
|
112
|
+
row: t.row,
|
|
113
|
+
rowIndex: t.rowIndex,
|
|
114
|
+
key: t.key,
|
|
115
|
+
xValue: t.xValue,
|
|
116
|
+
yValue: t.yValue,
|
|
117
|
+
seriesKey: t.seriesKey,
|
|
118
|
+
seriesLabel: t.seriesLabel
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function X(t, s) {
|
|
122
|
+
return typeof t == "function" ? t(s) : t;
|
|
123
|
+
}
|
|
124
|
+
function G(t, s, e) {
|
|
125
|
+
if (typeof t == "function") {
|
|
126
|
+
const r = Number(t(s));
|
|
127
|
+
return Number.isFinite(r) ? r : e;
|
|
128
|
+
}
|
|
129
|
+
return Number.isFinite(t) ? t : e;
|
|
130
|
+
}
|
|
131
|
+
function j(t) {
|
|
132
|
+
return Number.isFinite(t.x) && Number.isFinite(t.y) && Number.isFinite(t.radius) && t.radius >= 0;
|
|
133
|
+
}
|
|
134
|
+
function d() {
|
|
135
|
+
return typeof performance < "u" ? performance.now() : Date.now();
|
|
136
|
+
}
|
|
137
|
+
function q(t, s, e) {
|
|
138
|
+
return J(t, "scatter", s.points, e, e.maxDistancePx ?? 12);
|
|
139
|
+
}
|
|
140
|
+
function J(t, s, e, r, i) {
|
|
141
|
+
if (e.length === 0)
|
|
142
|
+
return null;
|
|
143
|
+
let l = null;
|
|
144
|
+
for (const a of e) {
|
|
145
|
+
const o = Math.max(i, a.radius), n = Math.hypot(a.x - r.x, a.y - r.y);
|
|
146
|
+
n > o || (!l || n < l.distance) && (l = { point: a, distance: n });
|
|
147
|
+
}
|
|
148
|
+
return l ? Q(t, s, l.point, l.distance) : null;
|
|
149
|
+
}
|
|
150
|
+
function Q(t, s, e, r) {
|
|
151
|
+
return {
|
|
152
|
+
seriesId: t,
|
|
153
|
+
seriesKind: s,
|
|
154
|
+
key: e.key,
|
|
155
|
+
mode: "datum",
|
|
156
|
+
row: e.row,
|
|
157
|
+
value: e.yValue,
|
|
158
|
+
rawValue: e.rawValue,
|
|
159
|
+
xValue: e.xValue,
|
|
160
|
+
yValue: e.yValue,
|
|
161
|
+
label: e.seriesLabel === "__default" ? String(e.xValue) : e.seriesLabel,
|
|
162
|
+
category: typeof e.xValue == "string" ? e.xValue : void 0,
|
|
163
|
+
seriesKey: e.seriesKey,
|
|
164
|
+
seriesLabel: e.seriesLabel,
|
|
165
|
+
color: e.color,
|
|
166
|
+
point: {
|
|
167
|
+
x: e.x,
|
|
168
|
+
y: e.y
|
|
169
|
+
},
|
|
170
|
+
bounds: {
|
|
171
|
+
x: e.x - e.radius,
|
|
172
|
+
y: e.y - e.radius,
|
|
173
|
+
width: e.radius * 2,
|
|
174
|
+
height: e.radius * 2
|
|
175
|
+
},
|
|
176
|
+
distancePx: r
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const Z = {
|
|
180
|
+
kind: "scatter",
|
|
181
|
+
inputRows: 0,
|
|
182
|
+
visibleRows: 0,
|
|
183
|
+
renderedPoints: 0,
|
|
184
|
+
skippedRows: 0,
|
|
185
|
+
seriesCount: 0,
|
|
186
|
+
mode: "direct",
|
|
187
|
+
domainMs: 0,
|
|
188
|
+
layoutMs: 0,
|
|
189
|
+
schemaMs: 0,
|
|
190
|
+
totalMs: 0
|
|
191
|
+
}, S = {
|
|
192
|
+
points: [],
|
|
193
|
+
series: [],
|
|
194
|
+
diagnostics: Z
|
|
195
|
+
};
|
|
196
|
+
class ee extends v {
|
|
197
|
+
constructor(e, r, i, l = {}, a = z) {
|
|
198
|
+
super(e, r, a, i, { componentId: l.componentId });
|
|
199
|
+
h(this, "_layoutPlan", S);
|
|
200
|
+
h(this, "_layoutEpoch", 0);
|
|
201
|
+
h(this, "_computedEpoch", "");
|
|
202
|
+
h(this, "_api");
|
|
203
|
+
h(this, "_runtimeBinding");
|
|
204
|
+
this.options({ zIndex: 14 }), this._api = {
|
|
205
|
+
getLayoutPlan: () => (this._computeLayout(), this._layoutPlan),
|
|
206
|
+
getDiagnostics: () => this._layoutPlan.diagnostics,
|
|
207
|
+
hitTest: (o) => this._hitTestSeries(o),
|
|
208
|
+
refresh: () => this._refresh(),
|
|
209
|
+
setVirtualization: (o) => this.setVirtualization(o)
|
|
210
|
+
}, this._runtimeBinding = new B(this, {
|
|
211
|
+
hitTest: (o) => this._hitTestSeries(o)
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
setProps(e) {
|
|
215
|
+
return super.setProps(y({
|
|
216
|
+
...this.props,
|
|
217
|
+
...e
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
getApi() {
|
|
221
|
+
return this._api;
|
|
222
|
+
}
|
|
223
|
+
update() {
|
|
224
|
+
this._computeLayout();
|
|
225
|
+
}
|
|
226
|
+
render() {
|
|
227
|
+
var l;
|
|
228
|
+
const e = f(), r = this._runtimeBinding.runtime(), i = [];
|
|
229
|
+
for (const a of this._layoutPlan.points) {
|
|
230
|
+
const o = this._createPointStyleContext(a, r), n = this._resolvePointStyle(a, o, r);
|
|
231
|
+
F(
|
|
232
|
+
i,
|
|
233
|
+
(l = this.props.renderers) == null ? void 0 : l.scatterPoint,
|
|
234
|
+
{ ...o, style: n },
|
|
235
|
+
{
|
|
236
|
+
type: "circle",
|
|
237
|
+
x: a.x,
|
|
238
|
+
y: a.y,
|
|
239
|
+
radius: Math.max(0, n.radius ?? a.radius),
|
|
240
|
+
styles: {
|
|
241
|
+
background: n.background ?? n.fill ?? a.color,
|
|
242
|
+
border: {
|
|
243
|
+
color: n.strokeColor ?? n.stroke ?? a.strokeColor,
|
|
244
|
+
width: n.strokeWidth ?? a.strokeWidth
|
|
245
|
+
},
|
|
246
|
+
opacity: n.opacity ?? a.opacity
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
this._publishSchemaDiagnostics(e), i.length > 0 && this.renderer.schema(i);
|
|
252
|
+
}
|
|
253
|
+
setVirtualization(e) {
|
|
254
|
+
this.props.virtualization = {
|
|
255
|
+
...this.props.virtualization,
|
|
256
|
+
...e
|
|
257
|
+
}, this._refresh();
|
|
258
|
+
}
|
|
259
|
+
onMount() {
|
|
260
|
+
super.onMount(), this._runtimeBinding.syncInteractive();
|
|
261
|
+
}
|
|
262
|
+
onUnmount() {
|
|
263
|
+
this._runtimeBinding.cleanup(), super.onUnmount();
|
|
264
|
+
}
|
|
265
|
+
onPropsChanged(e) {
|
|
266
|
+
this.applyCommonPropsChanged(e), e.includes("chartRef") && this._runtimeBinding.syncInteractive(), this._refresh();
|
|
267
|
+
}
|
|
268
|
+
_hitTestSeries(e) {
|
|
269
|
+
return q(this.componentId, this._layoutPlan, {
|
|
270
|
+
...e,
|
|
271
|
+
maxDistancePx: e.maxDistancePx ?? this.props.hitRadiusPx
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
_refresh() {
|
|
275
|
+
this._layoutEpoch++, this._computeLayout(), this.runtime.batch(() => {
|
|
276
|
+
this.invalidate({ update: !0, render: !0 });
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
_computeLayout() {
|
|
280
|
+
const e = this._runtimeBinding.runtime(), r = e == null ? void 0 : e.getScale(this.props.xScaleId), i = e == null ? void 0 : e.getScale(this.props.yScaleId);
|
|
281
|
+
if (!e || !r || !i) {
|
|
282
|
+
this._layoutPlan = S;
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (`${e.dataStore.revision}:${e.scales.revision}:${this._layoutEpoch}:${this.width}:${this.height}` === this._computedEpoch)
|
|
286
|
+
return;
|
|
287
|
+
const a = {
|
|
288
|
+
props: this.props,
|
|
289
|
+
dataStore: e.dataStore,
|
|
290
|
+
xScale: r,
|
|
291
|
+
yScale: i,
|
|
292
|
+
width: this.width,
|
|
293
|
+
height: this.height
|
|
294
|
+
};
|
|
295
|
+
this._runtimeBinding.publishContributions(e, [
|
|
296
|
+
{
|
|
297
|
+
id: `${this.componentId}:x-domain`,
|
|
298
|
+
scaleId: this.props.xScaleId,
|
|
299
|
+
domain: K(a)
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
id: `${this.componentId}:y-domain`,
|
|
303
|
+
scaleId: this.props.yScaleId,
|
|
304
|
+
domain: H(a)
|
|
305
|
+
}
|
|
306
|
+
]), this._layoutPlan = W(a), this._runtimeBinding.publishDiagnostics(e, this._layoutPlan.diagnostics), this._runtimeBinding.publishMetadata(e, this._layoutPlan.series.map((o) => ({
|
|
307
|
+
...o,
|
|
308
|
+
id: o.id === "__default" ? this.componentId : o.id,
|
|
309
|
+
label: o.id === "__default" ? "Scatter" : o.label,
|
|
310
|
+
kind: "scatter",
|
|
311
|
+
sourceSeriesId: this.componentId,
|
|
312
|
+
scaleIds: {
|
|
313
|
+
x: this.props.xScaleId,
|
|
314
|
+
y: this.props.yScaleId
|
|
315
|
+
}
|
|
316
|
+
}))), O(e, `${this.componentId}:marks`, this.componentId, "scatter", this._layoutPlan.points.map((o) => ({
|
|
317
|
+
key: o.key,
|
|
318
|
+
x: o.x,
|
|
319
|
+
y: o.y,
|
|
320
|
+
radius: o.radius,
|
|
321
|
+
value: o.yValue,
|
|
322
|
+
rawValue: o.rawValue,
|
|
323
|
+
xValue: o.xValue,
|
|
324
|
+
yValue: o.yValue,
|
|
325
|
+
seriesKey: o.seriesKey,
|
|
326
|
+
seriesLabel: o.seriesLabel,
|
|
327
|
+
color: o.color
|
|
328
|
+
}))), this._computedEpoch = `${e.dataStore.revision}:${e.scales.revision}:${this._layoutEpoch}:${this.width}:${this.height}`;
|
|
329
|
+
}
|
|
330
|
+
_publishSchemaDiagnostics(e) {
|
|
331
|
+
const r = f() - e;
|
|
332
|
+
this._layoutPlan = {
|
|
333
|
+
...this._layoutPlan,
|
|
334
|
+
diagnostics: {
|
|
335
|
+
...this._layoutPlan.diagnostics,
|
|
336
|
+
schemaMs: r,
|
|
337
|
+
totalMs: this._layoutPlan.diagnostics.domainMs + this._layoutPlan.diagnostics.layoutMs + r
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
const i = this._runtimeBinding.runtime();
|
|
341
|
+
i && this._runtimeBinding.publishDiagnostics(i, this._layoutPlan.diagnostics);
|
|
342
|
+
}
|
|
343
|
+
_isPointHighlighted(e, r) {
|
|
344
|
+
return this.props.highlight.enabled && (r == null ? void 0 : r.seriesId) === this.componentId && r.key === e;
|
|
345
|
+
}
|
|
346
|
+
_createPointStyleContext(e, r) {
|
|
347
|
+
return {
|
|
348
|
+
componentId: this.componentId,
|
|
349
|
+
componentName: "ScatterSeries",
|
|
350
|
+
part: "scatterPoint",
|
|
351
|
+
datum: {
|
|
352
|
+
seriesId: this.componentId,
|
|
353
|
+
seriesKind: "scatter",
|
|
354
|
+
key: e.key,
|
|
355
|
+
mode: "datum",
|
|
356
|
+
row: e.row,
|
|
357
|
+
value: e.yValue,
|
|
358
|
+
rawValue: e.rawValue,
|
|
359
|
+
xValue: e.xValue,
|
|
360
|
+
yValue: e.yValue,
|
|
361
|
+
seriesKey: e.seriesKey,
|
|
362
|
+
seriesLabel: e.seriesLabel,
|
|
363
|
+
color: e.color,
|
|
364
|
+
point: { x: e.x, y: e.y },
|
|
365
|
+
distancePx: 0
|
|
366
|
+
},
|
|
367
|
+
row: e.row,
|
|
368
|
+
rowIndex: e.rowIndex,
|
|
369
|
+
seriesKind: "scatter",
|
|
370
|
+
state: A(this.componentId, e.key, {
|
|
371
|
+
hovered: r == null ? void 0 : r.getInteractionState().hovered,
|
|
372
|
+
attrs: this.props.attrs,
|
|
373
|
+
disabled: this.props.disabled
|
|
374
|
+
}),
|
|
375
|
+
geometry: e,
|
|
376
|
+
tokens: (r == null ? void 0 : r.customization.tokens) ?? {},
|
|
377
|
+
scaleIds: { x: this.props.xScaleId, y: this.props.yScaleId },
|
|
378
|
+
className: this.props.className,
|
|
379
|
+
attrs: this.props.attrs
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
_resolvePointStyle(e, r, i) {
|
|
383
|
+
var n, c, u, p;
|
|
384
|
+
const l = this._isPointHighlighted(e.key, i == null ? void 0 : i.getInteractionState().hovered), a = {
|
|
385
|
+
...((n = this.props.states) == null ? void 0 : n[r.state]) ?? {},
|
|
386
|
+
...l ? {
|
|
387
|
+
background: this.props.highlight.fill,
|
|
388
|
+
fill: this.props.highlight.fill,
|
|
389
|
+
opacity: this.props.highlight.opacity,
|
|
390
|
+
radius: e.radius + this.props.highlight.radiusDelta,
|
|
391
|
+
strokeColor: this.props.highlight.strokeColor,
|
|
392
|
+
strokeWidth: this.props.highlight.strokeWidth
|
|
393
|
+
} : {}
|
|
394
|
+
}, o = (u = (c = this.props.style) == null ? void 0 : c.datum) == null ? void 0 : u.call(c, r);
|
|
395
|
+
return (i == null ? void 0 : i.customization.resolveMarkStyle(r, {
|
|
396
|
+
legacy: {
|
|
397
|
+
background: e.color,
|
|
398
|
+
fill: e.color,
|
|
399
|
+
strokeColor: e.strokeColor,
|
|
400
|
+
strokeWidth: e.strokeWidth,
|
|
401
|
+
opacity: e.opacity,
|
|
402
|
+
radius: e.radius
|
|
403
|
+
},
|
|
404
|
+
series: this.props.style,
|
|
405
|
+
part: (p = this.props.parts) == null ? void 0 : p.scatterPoint,
|
|
406
|
+
state: a,
|
|
407
|
+
datum: o
|
|
408
|
+
})) ?? {
|
|
409
|
+
background: l ? this.props.highlight.fill : e.color,
|
|
410
|
+
strokeColor: l ? this.props.highlight.strokeColor : e.strokeColor,
|
|
411
|
+
strokeWidth: l ? this.props.highlight.strokeWidth : e.strokeWidth,
|
|
412
|
+
opacity: l ? this.props.highlight.opacity : e.opacity,
|
|
413
|
+
radius: l ? e.radius + this.props.highlight.radiusDelta : e.radius
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function f() {
|
|
418
|
+
return typeof performance < "u" ? performance.now() : Date.now();
|
|
419
|
+
}
|
|
420
|
+
const x = _((t, s) => new ee(
|
|
421
|
+
t.app,
|
|
422
|
+
t.surface,
|
|
423
|
+
y(s.props),
|
|
424
|
+
{ componentId: s.id },
|
|
425
|
+
x
|
|
426
|
+
));
|
|
427
|
+
function te(t) {
|
|
428
|
+
t.register(x, { override: !0 });
|
|
429
|
+
}
|
|
430
|
+
const le = w({ kind: "scatter", schemaType: "NovaCharts.ScatterSeries", register: te });
|
|
431
|
+
export {
|
|
432
|
+
le as ScatterChart
|
|
433
|
+
};
|