@nova-lab/charts 0.0.0-stage → 1.0.1-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,20 @@
|
|
|
1
|
+
import { N as e, i as a } from "./host-DLDeDU5k.js";
|
|
2
|
+
function i(r, n) {
|
|
3
|
+
const t = r.injectOptional(e);
|
|
4
|
+
if (t)
|
|
5
|
+
return t;
|
|
6
|
+
if (!n)
|
|
7
|
+
return null;
|
|
8
|
+
const o = r.nova.components.get(n);
|
|
9
|
+
return a(o) ? o.getNovaChartRuntime() : null;
|
|
10
|
+
}
|
|
11
|
+
function s(r, n) {
|
|
12
|
+
const t = i(r, n);
|
|
13
|
+
if (!t)
|
|
14
|
+
throw new Error("[NovaCharts] Chart runtime is not available");
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
s as a,
|
|
19
|
+
i as r
|
|
20
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var b = (i, e, t) => e in i ? h(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var u = (i, e, t) => b(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { r as d } from "./chart-runtime-resolver-DwwXp3X8.js";
|
|
5
|
+
function g(i, e, t, o, s) {
|
|
6
|
+
if (!i)
|
|
7
|
+
return;
|
|
8
|
+
const r = i.props.accessibility;
|
|
9
|
+
if (r === !1 || !r.includeVisibleMarks) {
|
|
10
|
+
i.clearSemanticRegions(e);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const c = r.maxMarks, l = s.slice(0, c).map((n, a) => ({
|
|
14
|
+
id: `${i.id}:${t}:mark:${n.key ?? a}`,
|
|
15
|
+
role: "mark",
|
|
16
|
+
label: y(o, n, a),
|
|
17
|
+
focusable: r.keyboardNavigation,
|
|
18
|
+
order: 1e3 + a,
|
|
19
|
+
bounds: p(n),
|
|
20
|
+
data: {
|
|
21
|
+
seriesId: t,
|
|
22
|
+
seriesKind: o,
|
|
23
|
+
key: n.key,
|
|
24
|
+
value: n.value ?? n.yValue,
|
|
25
|
+
rawValue: n.rawValue,
|
|
26
|
+
xValue: n.xValue,
|
|
27
|
+
yValue: n.yValue,
|
|
28
|
+
category: n.category,
|
|
29
|
+
seriesKey: n.seriesKey,
|
|
30
|
+
seriesLabel: n.seriesLabel,
|
|
31
|
+
color: n.color
|
|
32
|
+
},
|
|
33
|
+
source: {
|
|
34
|
+
type: "synthetic",
|
|
35
|
+
componentId: t,
|
|
36
|
+
part: "mark"
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
i.publishSemanticRegions(e, l);
|
|
40
|
+
}
|
|
41
|
+
function p(i) {
|
|
42
|
+
if (Number.isFinite(i.x) && Number.isFinite(i.y) && Number.isFinite(i.width) && Number.isFinite(i.height))
|
|
43
|
+
return {
|
|
44
|
+
x: Number(i.x),
|
|
45
|
+
y: Number(i.y),
|
|
46
|
+
width: Math.max(0, Number(i.width)),
|
|
47
|
+
height: Math.max(0, Number(i.height))
|
|
48
|
+
};
|
|
49
|
+
if (Number.isFinite(i.x) && Number.isFinite(i.y)) {
|
|
50
|
+
const e = Math.max(4, Number.isFinite(i.radius) ? Number(i.radius) : 6);
|
|
51
|
+
return {
|
|
52
|
+
x: Number(i.x) - e,
|
|
53
|
+
y: Number(i.y) - e,
|
|
54
|
+
width: e * 2,
|
|
55
|
+
height: e * 2
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function y(i, e, t) {
|
|
60
|
+
const o = e.seriesLabel ?? e.seriesKey ?? i, s = e.category ?? e.xValue ?? e.key ?? t + 1, r = e.value ?? e.yValue;
|
|
61
|
+
return `${o}: ${s}${r === void 0 ? "" : ` ${r}`}`;
|
|
62
|
+
}
|
|
63
|
+
class m {
|
|
64
|
+
/**
|
|
65
|
+
* Создает binding для конкретной series node.
|
|
66
|
+
*/
|
|
67
|
+
constructor(e, t) {
|
|
68
|
+
u(this, "_contributionIds", /* @__PURE__ */ new Set());
|
|
69
|
+
this._owner = e, this._api = t;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Возвращает runtime текущего chart root.
|
|
73
|
+
*/
|
|
74
|
+
runtime() {
|
|
75
|
+
return d(this._owner, this._owner.props.chartRef) ?? null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Регистрирует series как interactive provider.
|
|
79
|
+
*/
|
|
80
|
+
syncInteractive() {
|
|
81
|
+
const e = this.runtime();
|
|
82
|
+
e == null || e.registerInteractiveSeries({
|
|
83
|
+
id: this._owner.componentId,
|
|
84
|
+
api: this._api,
|
|
85
|
+
requestRender: () => this._owner.invalidate({ render: !0 })
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Публикует scale domain contributions.
|
|
90
|
+
*/
|
|
91
|
+
publishContributions(e, t) {
|
|
92
|
+
const o = new Set(t.map((s) => s.id));
|
|
93
|
+
for (const s of this._contributionIds)
|
|
94
|
+
o.has(s) || e.removeScaleDomainContribution(s);
|
|
95
|
+
this._contributionIds = o;
|
|
96
|
+
for (const s of t)
|
|
97
|
+
e.setScaleDomainContribution(s);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Публикует generic metadata для legend.
|
|
101
|
+
*/
|
|
102
|
+
publishMetadata(e, t) {
|
|
103
|
+
e.setSeriesMetadata(this._owner.componentId, t);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Публикует diagnostics series.
|
|
107
|
+
*/
|
|
108
|
+
publishDiagnostics(e, t) {
|
|
109
|
+
e.setSeriesDiagnostics(this._owner.componentId, t);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Чистит runtime регистрации на unmount.
|
|
113
|
+
*/
|
|
114
|
+
cleanup() {
|
|
115
|
+
const e = this.runtime();
|
|
116
|
+
if (e) {
|
|
117
|
+
e.unregisterInteractiveSeries(this._owner.componentId);
|
|
118
|
+
for (const t of this._contributionIds)
|
|
119
|
+
e.removeScaleDomainContribution(t);
|
|
120
|
+
this._contributionIds.clear(), e.clearSemanticRegions(`${this._owner.componentId}:marks`), e.removeSeriesMetadata(this._owner.componentId), e.removeSeriesDiagnostics(this._owner.componentId);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
m as C,
|
|
126
|
+
g as p
|
|
127
|
+
};
|
package/dist/charts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/composed.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ChartPlugin, ItemRef } from './api/types';
|
|
2
|
+
export interface CrosshairValue {
|
|
3
|
+
values: Record<string, string | number>;
|
|
4
|
+
item?: ItemRef | null;
|
|
5
|
+
}
|
|
6
|
+
export interface CrosshairOptions {
|
|
7
|
+
id?: string;
|
|
8
|
+
axes?: ReadonlyArray<string>;
|
|
9
|
+
snap?: boolean;
|
|
10
|
+
color?: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
labels?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface CrosshairPlugin extends ChartPlugin {
|
|
15
|
+
getValue: () => CrosshairValue | null;
|
|
16
|
+
setValue: (value: CrosshairValue | null) => void;
|
|
17
|
+
clear: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const Crosshair: {
|
|
20
|
+
create: typeof createCrosshair;
|
|
21
|
+
};
|
|
22
|
+
declare function createCrosshair(options?: CrosshairOptions): CrosshairPlugin;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { s as g } from "./state-C5pICb11.js";
|
|
2
|
+
const S = { create: E };
|
|
3
|
+
function E(o = {}) {
|
|
4
|
+
let h = null, a = null, r = null, f = null;
|
|
5
|
+
const w = o.axes ?? ["x"], p = (e) => e ? { ...e, values: { ...e.values }, ...e.item ? { item: { ...e.item } } : {} } : null, c = (e, m = !0) => {
|
|
6
|
+
if (e && Object.values(e.values).some((y) => typeof y == "number" ? !Number.isFinite(y) : typeof y != "string"))
|
|
7
|
+
throw new Error("[Crosshair] Values must be finite numbers or categories");
|
|
8
|
+
g(e, a) || (a = p(e), a && !r && (r = (f == null ? void 0 : f()) ?? null), r == null || r.invalidate(), m && (h == null || h.notify("cursor")));
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
id: o.id ?? "crosshair",
|
|
12
|
+
getValue: () => p(a),
|
|
13
|
+
setValue: (e) => c(e),
|
|
14
|
+
clear: () => c(null),
|
|
15
|
+
attach(e) {
|
|
16
|
+
if (h)
|
|
17
|
+
throw new Error("[Crosshair] Plugin is already attached");
|
|
18
|
+
if (!e.chart.getCapabilities().scales)
|
|
19
|
+
throw new Error("[Crosshair] Cartesian scales are required");
|
|
20
|
+
h = e;
|
|
21
|
+
const m = () => {
|
|
22
|
+
if (!a)
|
|
23
|
+
return [];
|
|
24
|
+
const t = e.plotBounds(), l = [];
|
|
25
|
+
for (const [i, s] of Object.entries(a.values)) {
|
|
26
|
+
const n = e.map(i, s), u = e.axis(i) === "x", d = { color: o.color ?? "#7893a8", width: o.width ?? 1, dashPattern: [3, 3] };
|
|
27
|
+
l.push(u ? { type: "line", x1: n, y1: t.y, x2: n, y2: t.y + t.height, clip: t, styles: d } : { type: "line", x1: t.x, y1: n, x2: t.x + t.width, y2: n, clip: t, styles: d }), o.labels && l.push({ type: "text", text: String(s), x: u ? n + 4 : t.x + 4, y: u ? t.y + t.height - 18 : n + 4, width: 100, height: 14, clip: t, styles: { color: o.color ?? "#7893a8", font: { size: 11, family: "Arial" } } });
|
|
28
|
+
}
|
|
29
|
+
return l;
|
|
30
|
+
};
|
|
31
|
+
f = () => e.overlay(m), a && (r = f());
|
|
32
|
+
const y = (t, l) => {
|
|
33
|
+
if (t.type === "pointerleave" || t.type === "pointercancel") {
|
|
34
|
+
c(null);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (t.type !== "pointermove")
|
|
38
|
+
return;
|
|
39
|
+
const i = e.plotBounds();
|
|
40
|
+
if (l.x < i.x || l.y < i.y || l.x > i.x + i.width || l.y > i.y + i.height) {
|
|
41
|
+
c(null);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const s = o.snap ? e.chart.hitTest(l) : null, n = Object.fromEntries(w.map((u) => {
|
|
45
|
+
var d, b;
|
|
46
|
+
return [u, e.invert(u, e.axis(u) === "x" ? ((d = s == null ? void 0 : s.point) == null ? void 0 : d.x) ?? l.x : ((b = s == null ? void 0 : s.point) == null ? void 0 : b.y) ?? l.y)];
|
|
47
|
+
}));
|
|
48
|
+
c({ values: n, item: (s == null ? void 0 : s.ref) ?? null });
|
|
49
|
+
}, x = e.pointer(y), C = e.port("cursor", { read: () => p(a), write: (t) => c(t, !1), equals: g, meta: { format: "values", axes: [...w] } }), v = e.chart.on("viewStateChange", () => {
|
|
50
|
+
a && (r == null || r.invalidate());
|
|
51
|
+
});
|
|
52
|
+
return () => {
|
|
53
|
+
x(), v(), C(), r == null || r.dispose(), r = null, f = null, h = null, a = null;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
S as Crosshair
|
|
60
|
+
};
|
package/dist/donut.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DonutChart: {
|
|
2
|
+
mount: <T>(target: string | HTMLElement, options: import('./public').PartitionOptions<T>) => import('./public').PartitionHandle<T>;
|
|
3
|
+
attach: <T>(target: import('./public').ChartAttachTarget, options: import('./public').PartitionOptions<T>) => import('./public').PartitionHandle<T>;
|
|
4
|
+
};
|
|
5
|
+
export type { PartitionHandle as DonutChartHandle, PartitionOptions as DonutChartOptions } from './api/types';
|
package/dist/donut.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a } from "./mark-paint-CMHKGegE.js";
|
|
2
|
+
import { c as o } from "./partition-D-0LTCr3.js";
|
|
3
|
+
import { l as r } from "./layout-donut-BG4ubBtU.js";
|
|
4
|
+
const t = o({ kind: "donut", layout: r, mark: a }), u = { mount: t.mount, attach: t.attach };
|
|
5
|
+
export {
|
|
6
|
+
u as DonutChart
|
|
7
|
+
};
|
package/dist/funnel.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const FunnelChart: {
|
|
2
|
+
mount: <T>(target: string | HTMLElement, options: import('./public').PartitionOptions<T>) => import('./public').PartitionHandle<T>;
|
|
3
|
+
attach: <T>(target: import('./public').ChartAttachTarget, options: import('./public').PartitionOptions<T>) => import('./public').PartitionHandle<T>;
|
|
4
|
+
};
|
|
5
|
+
export type { PartitionHandle as FunnelChartHandle, PartitionOptions as FunnelChartOptions } from './api/types';
|
package/dist/funnel.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { c as v } from "./partition-D-0LTCr3.js";
|
|
2
|
+
import { p as w, c as b } from "./MarkSeries-CQCAnV4s.js";
|
|
3
|
+
function M(r) {
|
|
4
|
+
const { props: a, dataStore: g, width: o, height: p } = r;
|
|
5
|
+
if (!a.categoryField || !a.valueField)
|
|
6
|
+
return [];
|
|
7
|
+
const i = w(r);
|
|
8
|
+
let n = 0;
|
|
9
|
+
for (const t of i)
|
|
10
|
+
n = Math.max(n, t.value);
|
|
11
|
+
if (!n)
|
|
12
|
+
return [];
|
|
13
|
+
const l = Math.max(8, Math.min(o, p) * 0.06), x = (p - l * 2) / i.length;
|
|
14
|
+
return i.map((t, s) => {
|
|
15
|
+
var d;
|
|
16
|
+
const y = ((d = i[s + 1]) == null ? void 0 : d.value) ?? 0, c = (o - l * 2) * t.value / n, u = (o - l * 2) * y / n, e = l + s * x, h = e + Math.max(1, x - a.gap), m = [
|
|
17
|
+
{ x: (o - c) / 2, y: e },
|
|
18
|
+
{ x: (o + c) / 2, y: e },
|
|
19
|
+
{ x: (o + u) / 2, y: h },
|
|
20
|
+
{ x: (o - u) / 2, y: h }
|
|
21
|
+
];
|
|
22
|
+
return {
|
|
23
|
+
kind: "funnel",
|
|
24
|
+
key: String(g.getRowKey(t.row, t.index)),
|
|
25
|
+
row: t.row,
|
|
26
|
+
label: t.label,
|
|
27
|
+
value: t.value,
|
|
28
|
+
color: b(a.palette, s),
|
|
29
|
+
x: Math.min(m[0].x, m[3].x),
|
|
30
|
+
y: e,
|
|
31
|
+
width: Math.max(c, u),
|
|
32
|
+
height: h - e,
|
|
33
|
+
points: m
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const f = v({ kind: "funnel", layout: M, labels: !0, mark: (r, a) => [{ type: "polygon", points: r.points ?? [], styles: { background: a } }] }), C = { mount: f.mount, attach: f.attach };
|
|
38
|
+
export {
|
|
39
|
+
C as FunnelChart
|
|
40
|
+
};
|
package/dist/graph.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GraphHandle, GraphOptions } from './api/types';
|
|
2
|
+
export declare const GraphChart: {
|
|
3
|
+
mount: (target: string | HTMLElement, options: GraphOptions) => GraphHandle;
|
|
4
|
+
attach: (target: import('./api/types').ChartAttachTarget, options: GraphOptions) => GraphHandle;
|
|
5
|
+
};
|
|
6
|
+
export type { GraphHandle as GraphChartHandle, GraphOptions as GraphChartOptions, GraphData, GraphLink, GraphNode } from './api/types';
|
package/dist/graph.js
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { c as X } from "./host-DLDeDU5k.js";
|
|
2
|
+
import { a as Y } from "./mark-style-Cpl-ARQM.js";
|
|
3
|
+
import { k as F, c as Z } from "./scene-CPvPzTaB.js";
|
|
4
|
+
import { r as J, s as W } from "./state-C5pICb11.js";
|
|
5
|
+
async function ee(p, x, r, u, L, R, S) {
|
|
6
|
+
const f = p.map((w) => ({ ...w })), z = new Map(f.map((w, M) => [w.key, M])), q = x.flatMap((w) => {
|
|
7
|
+
const M = z.get(w.source), a = z.get(w.target);
|
|
8
|
+
return M === void 0 || a === void 0 || M === a ? [] : [[M, a]];
|
|
9
|
+
}), D = new Float64Array(f.length), m = new Float64Array(f.length), C = new Float64Array(f.length), v = new Float64Array(f.length);
|
|
10
|
+
let A = performance.now() + 8, j = 0;
|
|
11
|
+
for (let w = 0; w < R; w++) {
|
|
12
|
+
if (S.aborted)
|
|
13
|
+
return null;
|
|
14
|
+
const M = /* @__PURE__ */ new Map();
|
|
15
|
+
for (let a = 0; a < f.length; a++) {
|
|
16
|
+
const h = f[a];
|
|
17
|
+
C[a] = (u / 2 - h.x) * 3e-3, v[a] = (L / 2 - h.y) * 3e-3;
|
|
18
|
+
const e = `${Math.floor(h.x / 80)}:${Math.floor(h.y / 80)}`;
|
|
19
|
+
let s = M.get(e);
|
|
20
|
+
s || (s = [], M.set(e, s)), s.push(a);
|
|
21
|
+
}
|
|
22
|
+
for (let a = 0; a < f.length; a++) {
|
|
23
|
+
const h = f[a], e = Math.floor(h.x / 80), s = Math.floor(h.y / 80);
|
|
24
|
+
for (let d = e - 1; d <= e + 1; d++)
|
|
25
|
+
for (let l = s - 1; l <= s + 1; l++)
|
|
26
|
+
for (const b of M.get(`${d}:${l}`) ?? []) {
|
|
27
|
+
if (b <= a)
|
|
28
|
+
continue;
|
|
29
|
+
if ((++j & 1023) === 0 && performance.now() >= A) {
|
|
30
|
+
if (await new Promise((P) => setTimeout(P, 0)), S.aborted)
|
|
31
|
+
return null;
|
|
32
|
+
A = performance.now() + 8;
|
|
33
|
+
}
|
|
34
|
+
const t = f[b], o = h.x - t.x || (a % 2 ? 0.1 : -0.1), n = h.y - t.y || 0.1, c = Math.max(64, o * o + n * n), N = 1200 / c / Math.sqrt(c);
|
|
35
|
+
C[a] += o * N, v[a] += n * N, C[b] -= o * N, v[b] -= n * N;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (const [a, h] of q) {
|
|
39
|
+
const e = f[h].x - f[a].x, s = f[h].y - f[a].y, d = Math.max(1, Math.hypot(e, s)), l = (d - 70) * 0.025 / d;
|
|
40
|
+
C[a] += e * l, v[a] += s * l, C[h] -= e * l, v[h] -= s * l;
|
|
41
|
+
}
|
|
42
|
+
for (let a = 0; a < f.length; a++) {
|
|
43
|
+
const h = f[a];
|
|
44
|
+
r.has(h.key) || (D[a] = (D[a] + C[a]) * 0.7, m[a] = (m[a] + v[a]) * 0.7, h.x += Math.max(-8, Math.min(8, D[a])), h.y += Math.max(-8, Math.min(8, m[a])));
|
|
45
|
+
}
|
|
46
|
+
w % 8 === 7 && await new Promise((a) => setTimeout(a, 0));
|
|
47
|
+
}
|
|
48
|
+
return S.aborted ? null : f;
|
|
49
|
+
}
|
|
50
|
+
const O = X({ rows: (p) => (Q(p.data), V(p), p.data.nodes), key: () => "key", create: te }), re = { mount: O.mount, attach: O.attach };
|
|
51
|
+
function Q(p) {
|
|
52
|
+
const x = F(p.nodes, "node");
|
|
53
|
+
F(p.links, "link");
|
|
54
|
+
for (const r of p.links)
|
|
55
|
+
if (!x.has(r.source) || !x.has(r.target))
|
|
56
|
+
throw new Error(`[NovaCharts] Link ${String(r.key)} references an unknown node`);
|
|
57
|
+
for (const r of p.links)
|
|
58
|
+
if (r.weight !== void 0 && (!Number.isFinite(r.weight) || r.weight < 0))
|
|
59
|
+
throw new Error("[NovaCharts] Link weight must be finite and nonnegative");
|
|
60
|
+
for (const r of p.nodes)
|
|
61
|
+
if (r.x !== void 0 && !Number.isFinite(r.x) || r.y !== void 0 && !Number.isFinite(r.y) || r.size !== void 0 && (!Number.isFinite(r.size) || r.size <= 0))
|
|
62
|
+
throw new Error("[NovaCharts] Node position and size must be finite");
|
|
63
|
+
}
|
|
64
|
+
function V(p) {
|
|
65
|
+
var r, u;
|
|
66
|
+
if ((r = p.layout) != null && r.type && !["circular", "force"].includes(p.layout.type))
|
|
67
|
+
throw new Error("[NovaCharts] Unknown Graph layout type");
|
|
68
|
+
const x = (u = p.layout) == null ? void 0 : u.iterations;
|
|
69
|
+
if (x !== void 0 && (!Number.isInteger(x) || x < 1 || x > 1e3))
|
|
70
|
+
throw new Error("[NovaCharts] Layout iterations must be between 1 and 1000");
|
|
71
|
+
}
|
|
72
|
+
function te(p, x) {
|
|
73
|
+
const r = p.getNovaChartRuntime().dataStore;
|
|
74
|
+
let u = new Map(F(x.data.links, "link")), L = null, R = null, S = 0, f = !1, z = x, q, D;
|
|
75
|
+
const m = () => r.getSourceData(), C = () => ({ nodes: m(), links: [...u.values()] }), v = () => {
|
|
76
|
+
S++, L == null || L.abort(), L = null, R = null;
|
|
77
|
+
}, A = () => {
|
|
78
|
+
var s;
|
|
79
|
+
if (((s = z.layout) == null ? void 0 : s.type) !== "force")
|
|
80
|
+
return;
|
|
81
|
+
const e = S;
|
|
82
|
+
queueMicrotask(() => {
|
|
83
|
+
!f && e === S && D.runLayout().catch((d) => q.reportError(d));
|
|
84
|
+
});
|
|
85
|
+
}, j = () => m().map((e, s) => {
|
|
86
|
+
const d = s / Math.max(1, m().length) * Math.PI * 2, l = Math.min(p.width, p.height) * 0.36;
|
|
87
|
+
return { key: e.key, x: e.x ?? p.width / 2 + Math.cos(d) * l, y: e.y ?? p.height / 2 + Math.sin(d) * l };
|
|
88
|
+
});
|
|
89
|
+
let w;
|
|
90
|
+
const M = (e) => {
|
|
91
|
+
if (e.viewport || e.navigation || e.detail || e.playback)
|
|
92
|
+
throw new Error("[NovaCharts] Unsupported Graph view state");
|
|
93
|
+
const s = e.graph ?? { positions: j(), pinned: [] }, d = e.selection.filter((t) => t.type === "node" ? !!r.getRow(t.key) : t.type === "edge" && u.has(t.key));
|
|
94
|
+
if ((w == null ? void 0 : w.value) === s && w.revision === r.revision && w.links === u)
|
|
95
|
+
return { ...e, selection: d, graph: s };
|
|
96
|
+
F(s.positions, "position");
|
|
97
|
+
for (const t of s.positions)
|
|
98
|
+
if (![t.x, t.y].every(Number.isFinite))
|
|
99
|
+
throw new Error("[NovaCharts] Position requires finite coordinates");
|
|
100
|
+
const l = new Map(j().map((t) => [t.key, t]));
|
|
101
|
+
for (const t of s.positions)
|
|
102
|
+
r.getRow(t.key) && l.set(t.key, { ...t });
|
|
103
|
+
const b = { positions: [...l.values()], pinned: [...new Set(s.pinned)].filter((t) => !!r.getRow(t)) };
|
|
104
|
+
return w = { value: b, revision: r.revision, links: u }, { ...e, selection: d, graph: b };
|
|
105
|
+
}, a = (e) => {
|
|
106
|
+
Q(e), v(), r.setData([...e.nodes]), u = new Map(F(e.links, "link"));
|
|
107
|
+
}, h = (e) => {
|
|
108
|
+
D.setData(e);
|
|
109
|
+
};
|
|
110
|
+
return Z(p, x, {
|
|
111
|
+
capabilities: { kind: "graph", rows: !1, scales: !1, viewport: !1, camera: !0, drilldown: !1, expansion: !1, layout: !0, detail: !1, playback: !1, selection: !0, export: { image: ["png", "jpeg", "webp"], data: ["json"] } },
|
|
112
|
+
legend: () => [...new Set(m().map((e) => e.group ?? ""))].map((e) => ({ id: e, label: e || "Без группы" })),
|
|
113
|
+
defaults: () => ({ graph: { positions: j(), pinned: [] } }),
|
|
114
|
+
normalize: M,
|
|
115
|
+
getData: C,
|
|
116
|
+
setData: a,
|
|
117
|
+
configure(e) {
|
|
118
|
+
V(e);
|
|
119
|
+
const s = !W(z.layout, e.layout);
|
|
120
|
+
z = e, s && (v(), A());
|
|
121
|
+
},
|
|
122
|
+
changed() {
|
|
123
|
+
v(), A();
|
|
124
|
+
},
|
|
125
|
+
stateChanged(e, s) {
|
|
126
|
+
!W(e.graph, s.graph) && !W(R, s.graph) && v();
|
|
127
|
+
},
|
|
128
|
+
plan(e, s) {
|
|
129
|
+
var n, c, N, P, U, $, B, G, T, _;
|
|
130
|
+
const d = new Map(j().map((i) => [i.key, i]));
|
|
131
|
+
for (const i of s.graph.positions)
|
|
132
|
+
d.set(i.key, i);
|
|
133
|
+
const l = [], b = [], t = new Map([...new Set(m().map((i) => i.group ?? ""))].map((i, y) => [i, y])), o = e.palette ?? ["#2674b8", "#e68a42", "#69a84f"];
|
|
134
|
+
for (const i of u.values()) {
|
|
135
|
+
const y = d.get(i.source), g = d.get(i.target);
|
|
136
|
+
!y || !g || s.visibility[r.getRow(i.source).group ?? ""] === !1 || s.visibility[r.getRow(i.target).group ?? ""] === !1 || s.visibility[J({ type: "edge", key: i.key })] === !1 || (l.push({ type: "line", x1: y.x, y1: y.y, x2: g.x, y2: g.y, styles: { color: e.theme === "dark" ? "#536476" : "#a8b6c5", width: 1, opacity: 0.7 } }), b.push({ ref: { type: "edge", key: i.key }, row: i, label: i.label ?? `${String(i.source)} → ${String(i.target)}`, point: { x: (y.x + g.x) / 2, y: (y.y + g.y) / 2 }, bounds: { x: Math.min(y.x, g.x), y: Math.min(y.y, g.y), width: Math.abs(y.x - g.x), height: Math.abs(y.y - g.y) }, contains(k, E) {
|
|
137
|
+
const I = g.x - y.x, K = g.y - y.y, H = Math.max(0, Math.min(1, ((k.x - y.x) * I + (k.y - y.y) * K) / Math.max(1e-12, I * I + K * K)));
|
|
138
|
+
return Math.hypot(k.x - y.x - H * I, k.y - y.y - H * K) <= Math.min(E, 5);
|
|
139
|
+
} }));
|
|
140
|
+
}
|
|
141
|
+
for (const i of m()) {
|
|
142
|
+
if (s.visibility[i.group ?? ""] === !1 || s.visibility[J({ type: "node", key: i.key })] === !1)
|
|
143
|
+
continue;
|
|
144
|
+
const y = d.get(i.key), g = i.size ?? 6;
|
|
145
|
+
if (l.push(...Y([{ type: "circle", ...y, radius: g, styles: { background: o[(t.get(i.group ?? "") ?? 0) % o.length] ?? "#2674b8" } }], (n = e.styles) == null ? void 0 : n.normal)), (c = e.labels) != null && c.visible) {
|
|
146
|
+
const k = { ref: { type: "node", key: i.key }, row: i, label: i.label ?? String(i.key), point: y }, E = Math.ceil((((N = e.font) == null ? void 0 : N.size) ?? 12) * 1.3);
|
|
147
|
+
l.push({ type: "text", text: ((U = (P = e.labels).format) == null ? void 0 : U.call(P, k)) ?? ((B = ($ = e.formatters) == null ? void 0 : $.label) == null ? void 0 : B.call($, k)) ?? k.label, x: y.x + g + 3, y: y.y - E / 2, width: 120, height: E, styles: { align: { vertical: "middle" }, color: e.theme === "dark" ? "#c6d0dc" : "#475569", font: { size: ((G = e.font) == null ? void 0 : G.size) ?? 12, family: ((T = e.font) == null ? void 0 : T.family) ?? "Arial", weight: (_ = e.font) == null ? void 0 : _.weight } } });
|
|
148
|
+
}
|
|
149
|
+
b.push({ ref: { type: "node", key: i.key }, row: i, label: i.label ?? String(i.key), point: y, bounds: { x: y.x - g, y: y.y - g, width: g * 2, height: g * 2 }, contains: (k, E) => Math.hypot(k.x - y.x, k.y - y.y) <= g + E, overlay: (k, E, I) => [{ type: "circle", ...E(y), radius: (k.radius ?? g) * I, styles: { background: k.fill ?? "transparent", border: { color: k.stroke ?? "#287bc1", width: k.strokeWidth ?? 2 }, opacity: k.opacity ?? 1 } }] });
|
|
150
|
+
}
|
|
151
|
+
return { schema: l, items: b.reverse() };
|
|
152
|
+
},
|
|
153
|
+
lookup(e) {
|
|
154
|
+
const s = e.type === "node" ? r.getRow(e.key) : e.type === "edge" ? u.get(e.key) : void 0;
|
|
155
|
+
return s ? { ref: e, row: s, label: s.label ?? String(s.key) } : null;
|
|
156
|
+
},
|
|
157
|
+
extend(e, s, d) {
|
|
158
|
+
q = e, D = d, A();
|
|
159
|
+
const l = () => q.readState().graph, b = (t, o) => {
|
|
160
|
+
v(), q.request("graph", t, o);
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
getNode: (t) => r.getRow(t),
|
|
164
|
+
getLink: (t) => u.get(t),
|
|
165
|
+
upsertNodes(t) {
|
|
166
|
+
F(t, "node");
|
|
167
|
+
const o = new Map(m().map((n) => [n.key, n]));
|
|
168
|
+
for (const n of t)
|
|
169
|
+
o.set(n.key, n);
|
|
170
|
+
h({ nodes: [...o.values()], links: [...u.values()] });
|
|
171
|
+
},
|
|
172
|
+
patchNodes(t) {
|
|
173
|
+
const o = new Map(m().map((n) => [n.key, n]));
|
|
174
|
+
for (const n of t) {
|
|
175
|
+
const c = o.get(n.key);
|
|
176
|
+
if (!c || n.changes.key !== void 0 && n.changes.key !== n.key)
|
|
177
|
+
throw new Error("[NovaCharts] patchNodes requires an existing immutable key");
|
|
178
|
+
o.set(n.key, { ...c, ...n.changes });
|
|
179
|
+
}
|
|
180
|
+
h({ nodes: [...o.values()], links: [...u.values()] });
|
|
181
|
+
},
|
|
182
|
+
removeNodes(t) {
|
|
183
|
+
const o = new Set(t);
|
|
184
|
+
h({ nodes: m().filter((n) => !o.has(n.key)), links: [...u.values()].filter((n) => !o.has(n.source) && !o.has(n.target)) });
|
|
185
|
+
},
|
|
186
|
+
upsertLinks(t) {
|
|
187
|
+
F(t, "link");
|
|
188
|
+
const o = new Map(u);
|
|
189
|
+
for (const n of t)
|
|
190
|
+
o.set(n.key, n);
|
|
191
|
+
h({ nodes: m(), links: [...o.values()] });
|
|
192
|
+
},
|
|
193
|
+
patchLinks(t) {
|
|
194
|
+
const o = new Map(u);
|
|
195
|
+
for (const n of t) {
|
|
196
|
+
const c = o.get(n.key);
|
|
197
|
+
if (!c || n.changes.key !== void 0 && n.changes.key !== n.key)
|
|
198
|
+
throw new Error("[NovaCharts] patchLinks requires an existing immutable key");
|
|
199
|
+
o.set(n.key, { ...c, ...n.changes });
|
|
200
|
+
}
|
|
201
|
+
h({ nodes: m(), links: [...o.values()] });
|
|
202
|
+
},
|
|
203
|
+
removeLinks(t) {
|
|
204
|
+
const o = new Set(t);
|
|
205
|
+
h({ nodes: m(), links: [...u.values()].filter((n) => !o.has(n.key)) });
|
|
206
|
+
},
|
|
207
|
+
getPositions: () => l().positions.map((t) => ({ ...t })),
|
|
208
|
+
setPositions(t, o) {
|
|
209
|
+
const n = new Map(l().positions.map((c) => [c.key, c]));
|
|
210
|
+
F(t, "position");
|
|
211
|
+
for (const c of t) {
|
|
212
|
+
if (!r.getRow(c.key))
|
|
213
|
+
throw new Error("[NovaCharts] Unknown node position");
|
|
214
|
+
n.set(c.key, c);
|
|
215
|
+
}
|
|
216
|
+
b({ ...l(), positions: [...n.values()] }, o == null ? void 0 : o.origin);
|
|
217
|
+
},
|
|
218
|
+
pin(t, o) {
|
|
219
|
+
for (const n of t)
|
|
220
|
+
if (!r.getRow(n))
|
|
221
|
+
throw new Error("[NovaCharts] Unknown pinned node");
|
|
222
|
+
b({ ...l(), pinned: [.../* @__PURE__ */ new Set([...l().pinned, ...t])] }, o == null ? void 0 : o.origin);
|
|
223
|
+
},
|
|
224
|
+
unpin(t, o) {
|
|
225
|
+
const n = new Set(t);
|
|
226
|
+
b({ ...l(), pinned: l().pinned.filter((c) => !n.has(c)) }, o == null ? void 0 : o.origin);
|
|
227
|
+
},
|
|
228
|
+
getPinned: () => [...l().pinned],
|
|
229
|
+
async runLayout(t = {}) {
|
|
230
|
+
var P, U, $, B;
|
|
231
|
+
const o = t.iterations ?? ((P = z.layout) == null ? void 0 : P.iterations) ?? 120;
|
|
232
|
+
if (!Number.isInteger(o) || o < 1 || o > 1e3)
|
|
233
|
+
throw new Error("[NovaCharts] Layout iterations must be between 1 and 1000");
|
|
234
|
+
v();
|
|
235
|
+
const n = S, c = new AbortController();
|
|
236
|
+
L = c;
|
|
237
|
+
const N = () => c.abort();
|
|
238
|
+
(U = t.signal) == null || U.addEventListener("abort", N, { once: !0 }), ($ = t.signal) != null && $.aborted && N();
|
|
239
|
+
try {
|
|
240
|
+
const G = await ee(l().positions, [...u.values()], new Set(l().pinned), p.width, p.height, o, c.signal);
|
|
241
|
+
if (!G || n !== S || c.signal.aborted)
|
|
242
|
+
return "cancelled";
|
|
243
|
+
R = { ...l(), positions: G };
|
|
244
|
+
const T = await q.request("graph", R, "api", void 0, c.signal);
|
|
245
|
+
return c.signal.aborted || n !== S ? "cancelled" : T === !1 ? "rejected" : "applied";
|
|
246
|
+
} finally {
|
|
247
|
+
(B = t.signal) == null || B.removeEventListener("abort", N), L === c && (L = null, R = null);
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
stopLayout: v
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
dispose() {
|
|
254
|
+
f = !0, v();
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
export {
|
|
259
|
+
re as GraphChart
|
|
260
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const HeatmapChart: {
|
|
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 HeatmapChartHandle, CartesianOptions as HeatmapChartOptions } from './api/types';
|
package/dist/heatmap.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { c as y } from "./cartesian-k_WIYsGp.js";
|
|
2
|
+
import { r as x } from "./mark-paint-CMHKGegE.js";
|
|
3
|
+
import { B as f } from "./host-DLDeDU5k.js";
|
|
4
|
+
import { e as k, c as v, r as M } from "./MarkSeries-CQCAnV4s.js";
|
|
5
|
+
import { r as N } from "./novel-domains-DBpA_AOT.js";
|
|
6
|
+
function S(s) {
|
|
7
|
+
const { props: e, dataStore: a, xScale: i, yScale: n } = s;
|
|
8
|
+
if (!e.xField || !e.yField || !e.valueField || !(i instanceof f) || !(n instanceof f))
|
|
9
|
+
return [];
|
|
10
|
+
const p = a.getData(), b = p.map((t, r) => Number(a.readField(t, r, e.valueField))).filter(Number.isFinite), [l, h] = k(b), o = Math.min(e.gap, i.bandwidth() / 4, n.bandwidth() / 4);
|
|
11
|
+
return p.flatMap((t, r) => {
|
|
12
|
+
const m = String(a.readField(t, r, e.xField) ?? ""), d = String(a.readField(t, r, e.yField) ?? ""), c = Number(a.readField(t, r, e.valueField)), u = i.toPx(m), F = n.toPx(d);
|
|
13
|
+
if (!Number.isFinite(c) || !Number.isFinite(u) || !Number.isFinite(F))
|
|
14
|
+
return [];
|
|
15
|
+
const g = h === l ? 0.5 : (c - l) / (h - l);
|
|
16
|
+
return [{
|
|
17
|
+
kind: "heatmap",
|
|
18
|
+
key: String(a.getRowKey(t, r)),
|
|
19
|
+
row: t,
|
|
20
|
+
label: `${d} · ${m}`,
|
|
21
|
+
value: c,
|
|
22
|
+
color: v(e.palette, Math.round(g * (e.palette.length - 1))),
|
|
23
|
+
x: u + o,
|
|
24
|
+
y: F + o,
|
|
25
|
+
width: Math.max(0, i.bandwidth() - o * 2),
|
|
26
|
+
height: Math.max(0, n.bandwidth() - o * 2),
|
|
27
|
+
xValue: m,
|
|
28
|
+
yValue: d
|
|
29
|
+
}];
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const C = { kind: "heatmap", layout: S, domains: N, mark: x }, V = y({ kind: "heatmap", schemaType: "NovaCharts.heatmap.Marks", register: (s) => {
|
|
33
|
+
M(s, C);
|
|
34
|
+
}, props: () => ({ kind: "heatmap" }) });
|
|
35
|
+
export {
|
|
36
|
+
V as HeatmapChart
|
|
37
|
+
};
|