@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,78 @@
|
|
|
1
|
+
export type ChartScaleType = 'linear' | 'time' | 'band';
|
|
2
|
+
export type ChartContinuousScaleType = 'linear' | 'time';
|
|
3
|
+
export type ChartScaleRange = readonly [number, number];
|
|
4
|
+
export type ChartNumericDomain = readonly [number, number];
|
|
5
|
+
export type ChartBandDomain = ReadonlyArray<string>;
|
|
6
|
+
export type ChartScaleDomain = ChartNumericDomain | ChartBandDomain;
|
|
7
|
+
export type ChartScaleValue = number | string;
|
|
8
|
+
export interface ChartScaleTick<TValue extends ChartScaleValue = ChartScaleValue> {
|
|
9
|
+
value: TValue;
|
|
10
|
+
position: number;
|
|
11
|
+
label: string;
|
|
12
|
+
major: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ChartScaleExplicitTick<TValue extends ChartScaleValue = ChartScaleValue> {
|
|
15
|
+
value: TValue;
|
|
16
|
+
label?: string;
|
|
17
|
+
major?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export type ChartScaleExplicitTickInput<TValue extends ChartScaleValue = ChartScaleValue> = TValue | ChartScaleExplicitTick<TValue>;
|
|
20
|
+
export interface ChartScaleTickOptions {
|
|
21
|
+
minStepPx?: number;
|
|
22
|
+
maxCount?: number;
|
|
23
|
+
categoryStep?: number;
|
|
24
|
+
values?: ReadonlyArray<ChartScaleExplicitTickInput>;
|
|
25
|
+
labels?: Record<string, string>;
|
|
26
|
+
formatter?: (value: ChartScaleValue) => string;
|
|
27
|
+
}
|
|
28
|
+
export interface ChartScale<TValue extends ChartScaleValue = ChartScaleValue> {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly type: ChartScaleType;
|
|
31
|
+
getDomain(): ChartScaleDomain;
|
|
32
|
+
getRange(): ChartScaleRange;
|
|
33
|
+
setDomain(domain: ChartScaleDomain): void;
|
|
34
|
+
setRange(range: ChartScaleRange): void;
|
|
35
|
+
toPx(value: TValue): number;
|
|
36
|
+
fromPx(px: number): TValue;
|
|
37
|
+
ticks(options?: ChartScaleTickOptions): Array<ChartScaleTick<TValue>>;
|
|
38
|
+
}
|
|
39
|
+
export interface ChartLinearScaleOptions {
|
|
40
|
+
id: string;
|
|
41
|
+
type: 'linear';
|
|
42
|
+
domain: ChartNumericDomain;
|
|
43
|
+
range?: ChartScaleRange;
|
|
44
|
+
clamp?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ChartTimeScaleOptions {
|
|
47
|
+
id: string;
|
|
48
|
+
type: 'time';
|
|
49
|
+
domain: ChartNumericDomain;
|
|
50
|
+
range?: ChartScaleRange;
|
|
51
|
+
clamp?: boolean;
|
|
52
|
+
timezone?: string;
|
|
53
|
+
locale?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface ChartBandScaleOptions {
|
|
56
|
+
id: string;
|
|
57
|
+
type: 'band';
|
|
58
|
+
domain: ChartBandDomain;
|
|
59
|
+
range?: ChartScaleRange;
|
|
60
|
+
paddingInner?: number;
|
|
61
|
+
paddingOuter?: number;
|
|
62
|
+
}
|
|
63
|
+
export type ChartScaleOptions = ChartLinearScaleOptions | ChartTimeScaleOptions | ChartBandScaleOptions;
|
|
64
|
+
export type ChartTimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
65
|
+
export interface ChartTimeTickOptions extends ChartScaleTickOptions {
|
|
66
|
+
strategy?: 'auto' | 'fixed' | 'calendar';
|
|
67
|
+
unit?: ChartTimeUnit | 'auto';
|
|
68
|
+
step?: number;
|
|
69
|
+
majorUnit?: ChartTimeUnit;
|
|
70
|
+
locale?: string;
|
|
71
|
+
timezone?: string;
|
|
72
|
+
format?: Intl.DateTimeFormatOptions | ((value: number) => string);
|
|
73
|
+
majorFormat?: Intl.DateTimeFormatOptions | ((value: number) => string);
|
|
74
|
+
}
|
|
75
|
+
export interface ChartBandVisibleRange {
|
|
76
|
+
startIndex: number;
|
|
77
|
+
endIndex: number;
|
|
78
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NovaChartViewportControllerContext, NovaChartViewportControllerOptions, NovaChartViewportControllerResolvedOptions, NovaChartViewportControllerWheelIntent } from '../types/chart-components.types';
|
|
2
|
+
export declare function normalizeChartViewportControllerOptions(options: false | NovaChartViewportControllerOptions | undefined): false | NovaChartViewportControllerResolvedOptions;
|
|
3
|
+
export declare function resolveChartViewportWheelIntent(event: WheelEvent, context: NovaChartViewportControllerContext, options: NovaChartViewportControllerResolvedOptions): NovaChartViewportControllerWheelIntent | null;
|
|
4
|
+
export declare function chartViewportDeltaToSteps(intent: NovaChartViewportControllerWheelIntent, options: NovaChartViewportControllerResolvedOptions): number;
|
|
5
|
+
export declare function shouldPreventChartViewportWheelDefault(consumed: boolean, options: NovaChartViewportControllerResolvedOptions): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { e as n, t as s } from "./MarkSeries-CQCAnV4s.js";
|
|
2
|
+
function p(r) {
|
|
3
|
+
const { props: e, dataStore: a, xScale: l } = r;
|
|
4
|
+
if (!e.xScaleId || !e.yScaleId)
|
|
5
|
+
return [];
|
|
6
|
+
if (e.kind === "heatmap" && e.xField && e.yField)
|
|
7
|
+
return [
|
|
8
|
+
{ scaleId: e.xScaleId, domain: [...a.categoryDomain(e.xField)] },
|
|
9
|
+
{ scaleId: e.yScaleId, domain: [...a.categoryDomain(e.yField)] }
|
|
10
|
+
];
|
|
11
|
+
if (e.kind !== "candlestick" || !e.xField || !e.lowField || !e.highField)
|
|
12
|
+
return [];
|
|
13
|
+
const t = a.getData(), o = t.map((d, i) => a.readField(d, i, e.xField)), c = (l == null ? void 0 : l.type) === "band" ? [...new Set(o.map((d) => String(d ?? "")))] : n(o.map(s)), m = n(t.flatMap((d, i) => [
|
|
14
|
+
Number(a.readField(d, i, e.lowField)),
|
|
15
|
+
Number(a.readField(d, i, e.highField))
|
|
16
|
+
]));
|
|
17
|
+
return [
|
|
18
|
+
{ scaleId: e.xScaleId, domain: c },
|
|
19
|
+
{ scaleId: e.yScaleId, domain: m }
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
p as r
|
|
24
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { r as J } from "./MarkSeries-CQCAnV4s.js";
|
|
2
|
+
import { c as K, n as L } from "./camera-CUJAMfpx.js";
|
|
3
|
+
import { c as _ } from "./host-DLDeDU5k.js";
|
|
4
|
+
import { s as V, r as G } from "./state-C5pICb11.js";
|
|
5
|
+
function Q(o, p) {
|
|
6
|
+
const a = () => o.readState().navigation, r = (n) => {
|
|
7
|
+
for (const d of n)
|
|
8
|
+
if (!o.store.getRow(d))
|
|
9
|
+
throw new Error(`[NovaCharts] Unknown navigation key: ${String(d)}`);
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
getDrilldown: () => [...a().drilldown],
|
|
13
|
+
drillTo(n, d) {
|
|
14
|
+
r([n]);
|
|
15
|
+
const u = [n];
|
|
16
|
+
let y = p == null ? void 0 : p(n);
|
|
17
|
+
for (; y != null; ) {
|
|
18
|
+
if (u.includes(y))
|
|
19
|
+
throw new Error("[NovaCharts] Hierarchy contains a cycle");
|
|
20
|
+
u.unshift(y), y = p == null ? void 0 : p(y);
|
|
21
|
+
}
|
|
22
|
+
o.request("navigation", { ...a(), drilldown: u }, d == null ? void 0 : d.origin);
|
|
23
|
+
},
|
|
24
|
+
drillUp(n) {
|
|
25
|
+
o.request("navigation", { ...a(), drilldown: a().drilldown.slice(0, -1) }, n == null ? void 0 : n.origin);
|
|
26
|
+
},
|
|
27
|
+
resetDrilldown(n) {
|
|
28
|
+
o.request("navigation", { ...a(), drilldown: [] }, n == null ? void 0 : n.origin);
|
|
29
|
+
},
|
|
30
|
+
getExpanded: () => [...a().expanded],
|
|
31
|
+
expand(n, d) {
|
|
32
|
+
r(n), o.request("navigation", { ...a(), expanded: [.../* @__PURE__ */ new Set([...a().expanded, ...n])] }, d == null ? void 0 : d.origin);
|
|
33
|
+
},
|
|
34
|
+
collapse(n, d) {
|
|
35
|
+
r(n);
|
|
36
|
+
const u = new Set(n);
|
|
37
|
+
o.request("navigation", { ...a(), expanded: a().expanded.filter((y) => !u.has(y)) }, d == null ? void 0 : d.origin);
|
|
38
|
+
},
|
|
39
|
+
expandAll(n) {
|
|
40
|
+
o.request("navigation", { ...a(), expanded: o.store.getSourceData().map(o.keyOf) }, n == null ? void 0 : n.origin);
|
|
41
|
+
},
|
|
42
|
+
collapseAll(n) {
|
|
43
|
+
o.request("navigation", { ...a(), expanded: [] }, n == null ? void 0 : n.origin);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function te(o) {
|
|
48
|
+
function p() {
|
|
49
|
+
return _({ rows: (a) => a.data, key: (a) => a.key, create: (a, r) => X(a, r, o) });
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
mount(a, r) {
|
|
53
|
+
return p().mount(a, r);
|
|
54
|
+
},
|
|
55
|
+
attach(a, r) {
|
|
56
|
+
return p().attach(a, r);
|
|
57
|
+
},
|
|
58
|
+
mountTree(a, r) {
|
|
59
|
+
return p().mount(a, r);
|
|
60
|
+
},
|
|
61
|
+
attachTree(a, r) {
|
|
62
|
+
return p().attach(a, r);
|
|
63
|
+
},
|
|
64
|
+
mountTreemap(a, r) {
|
|
65
|
+
return p().mount(a, r);
|
|
66
|
+
},
|
|
67
|
+
attachTreemap(a, r) {
|
|
68
|
+
return p().attach(a, r);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function X(o, p, a) {
|
|
73
|
+
const r = o.getNovaChartRuntime().dataStore;
|
|
74
|
+
let n = p;
|
|
75
|
+
const d = a.kind === "tree" || a.kind === "treemap", u = a.kind === "tree", y = `${o.componentId}:series:main`, U = J(o.nova.schema, a);
|
|
76
|
+
let c = null, I, f = null, b = /* @__PURE__ */ new Map();
|
|
77
|
+
const A = (e, t) => typeof t == "function" ? t(e) : e[t], w = (e) => A(e, n.key), $ = (e) => {
|
|
78
|
+
const t = r.getRow(e);
|
|
79
|
+
return t && n.parent ? A(t, n.parent) : null;
|
|
80
|
+
}, k = () => o.nova.components.get(y), W = (e) => JSON.stringify([typeof e, e]);
|
|
81
|
+
function z(e) {
|
|
82
|
+
if (!d || !n.parent)
|
|
83
|
+
return;
|
|
84
|
+
const t = new Map(e.map((s) => [w(s), A(s, n.parent)])), i = /* @__PURE__ */ new Set();
|
|
85
|
+
for (const s of t.keys()) {
|
|
86
|
+
const g = /* @__PURE__ */ new Set();
|
|
87
|
+
let h = s;
|
|
88
|
+
for (; h != null && t.has(h) && !i.has(h); ) {
|
|
89
|
+
if (g.has(h))
|
|
90
|
+
throw new Error(`[NovaCharts] Hierarchy cycle at ${String(h)}`);
|
|
91
|
+
g.add(h);
|
|
92
|
+
const l = t.get(h);
|
|
93
|
+
if (l != null && typeof l != "string" && typeof l != "number")
|
|
94
|
+
throw new Error("[NovaCharts] Parent requires a stable key or null");
|
|
95
|
+
h = l;
|
|
96
|
+
}
|
|
97
|
+
for (const l of g)
|
|
98
|
+
i.add(l);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function N() {
|
|
102
|
+
var t;
|
|
103
|
+
const e = ((t = k()) == null ? void 0 : t.getApi().getLayoutPlan().marks) ?? [];
|
|
104
|
+
e !== f && (f = e, b = new Map(e.map((i) => [w(i.row), i])));
|
|
105
|
+
}
|
|
106
|
+
function T(e) {
|
|
107
|
+
const t = c == null ? void 0 : c.camera;
|
|
108
|
+
return t ? { x: o.width / 2 + (e.x - t.center.x) * t.zoom, y: o.height / 2 + (e.y - t.center.y) * t.zoom } : e;
|
|
109
|
+
}
|
|
110
|
+
function E(e) {
|
|
111
|
+
var D, C;
|
|
112
|
+
const t = r.getRow(e);
|
|
113
|
+
if (!t)
|
|
114
|
+
return null;
|
|
115
|
+
N();
|
|
116
|
+
const i = b.get(e), s = u ? { type: "node", key: e } : { type: "datum", seriesId: "main", key: e }, g = (u ? i == null ? void 0 : i.labelBounds : void 0) ?? (i ? { x: i.x, y: i.y, width: i.width, height: i.height } : void 0), h = g ? T(g) : void 0, l = (i == null ? void 0 : i.startAngle) !== void 0 ? { x: i.x + i.width / 2 + Math.cos((i.startAngle + i.endAngle) / 2) * i.radius, y: i.y + i.height / 2 + Math.sin((i.startAngle + i.endAngle) / 2) * i.radius } : i ? { x: i.x + i.width / 2, y: i.y + i.height / 2 } : void 0;
|
|
117
|
+
return { ref: s, row: t, label: String(A(t, n.category)), value: n.value ? Number(A(t, n.value)) : void 0, point: l ? T(l) : void 0, bounds: h && g ? { ...h, width: g.width * (((D = c == null ? void 0 : c.camera) == null ? void 0 : D.zoom) ?? 1), height: g.height * (((C = c == null ? void 0 : c.camera) == null ? void 0 : C.zoom) ?? 1) } : void 0 };
|
|
118
|
+
}
|
|
119
|
+
function B(e) {
|
|
120
|
+
var t;
|
|
121
|
+
n = e, z(r.getSourceData()), o.setChildren([{ type: U, id: y, props: {
|
|
122
|
+
kind: a.kind,
|
|
123
|
+
categoryField: n.category,
|
|
124
|
+
valueField: n.value,
|
|
125
|
+
parentField: n.parent ?? (u ? () => null : void 0),
|
|
126
|
+
palette: n.palette ? [...n.palette] : void 0,
|
|
127
|
+
innerRadiusRatio: n.innerRadiusRatio,
|
|
128
|
+
gap: n.gap,
|
|
129
|
+
maxValue: n.maxValue,
|
|
130
|
+
styleSheet: n.styleSheet,
|
|
131
|
+
width: o.width,
|
|
132
|
+
height: o.height
|
|
133
|
+
} }]), (t = k()) == null || t.setPresentation(n), f = null, c && F(c, c, !0);
|
|
134
|
+
}
|
|
135
|
+
function F(e, t, i = !1) {
|
|
136
|
+
var s, g, h, l, D, C;
|
|
137
|
+
if (c = t, i || !V(e.visibility, t.visibility) || !V((s = e.navigation) == null ? void 0 : s.drilldown, (g = t.navigation) == null ? void 0 : g.drilldown)) {
|
|
138
|
+
const S = (h = t.navigation) == null ? void 0 : h.drilldown.at(-1), v = /* @__PURE__ */ new Set();
|
|
139
|
+
if (S !== void 0) {
|
|
140
|
+
v.add(S);
|
|
141
|
+
const m = /* @__PURE__ */ new Map();
|
|
142
|
+
for (const R of r.getSourceData()) {
|
|
143
|
+
const x = w(R), M = $(x);
|
|
144
|
+
if (M != null) {
|
|
145
|
+
let q = m.get(M);
|
|
146
|
+
q || (q = [], m.set(M, q)), q.push(x);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const j = [S];
|
|
150
|
+
for (let R = 0; R < j.length; R++)
|
|
151
|
+
for (const x of m.get(j[R]) ?? [])
|
|
152
|
+
v.has(x) || (v.add(x), j.push(x));
|
|
153
|
+
}
|
|
154
|
+
r.setFilters([(m) => t.visibility[G(u ? { type: "node", key: w(m) } : { type: "datum", seriesId: "main", key: w(m) })] !== !1 && (S === void 0 || v.has(w(m)))], "navigation"), o.getApi().refresh();
|
|
155
|
+
}
|
|
156
|
+
if (t.camera && ((l = k()) == null || l.setCamera(t.camera)), t.navigation && d && (i || !V((D = e.navigation) == null ? void 0 : D.expanded, t.navigation.expanded))) {
|
|
157
|
+
const S = new Set(t.navigation.expanded);
|
|
158
|
+
(C = k()) == null || C.setCollapsed(new Map(r.getSourceData().map((v) => [W(w(v)), !S.has(w(v))])));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
B(p), d && r.setValidator(z);
|
|
162
|
+
const P = () => ({ selection: [], visibility: {}, ...d ? { camera: { center: { x: o.width / 2, y: o.height / 2 }, zoom: 1 }, navigation: { expanded: r.getSourceData().map(w), drilldown: [] } } : {} }), H = {
|
|
163
|
+
capabilities: { kind: a.kind, rows: !0, scales: !1, viewport: !1, camera: d, drilldown: d, expansion: d, layout: !1, detail: !1, playback: !1, selection: !0, export: { image: ["png", "jpeg", "webp"], data: ["json", "csv"] } },
|
|
164
|
+
defaults: P,
|
|
165
|
+
configure: B,
|
|
166
|
+
applyState: F,
|
|
167
|
+
normalize(e) {
|
|
168
|
+
var t, i;
|
|
169
|
+
if (e.viewport || e.playback || e.detail || !d && (e.camera || e.navigation))
|
|
170
|
+
throw new Error(`[NovaCharts] Unsupported view state for ${a.kind}`);
|
|
171
|
+
return { selection: e.selection.filter((s) => u ? s.type === "node" && r.getRow(s.key) !== void 0 : s.type === "datum" && s.seriesId === "main" && r.getRow(s.key) !== void 0), visibility: { ...e.visibility }, ...d ? { camera: L(e.camera ?? P().camera), navigation: { expanded: (((t = e.navigation) == null ? void 0 : t.expanded) ?? P().navigation.expanded).filter((s) => r.getRow(s) !== void 0), drilldown: (((i = e.navigation) == null ? void 0 : i.drilldown) ?? []).filter((s) => r.getRow(s) !== void 0) } } : {} };
|
|
172
|
+
},
|
|
173
|
+
getData: () => r.getSourceData(),
|
|
174
|
+
setData(e) {
|
|
175
|
+
z(e), r.setData([...e]), f = null;
|
|
176
|
+
},
|
|
177
|
+
dataChanged() {
|
|
178
|
+
z(r.getSourceData()), f = null, c && F(c, c, !0);
|
|
179
|
+
},
|
|
180
|
+
getItem(e) {
|
|
181
|
+
return (u ? e.type !== "node" : e.type !== "datum" || e.seriesId !== "main") ? null : E(e.key);
|
|
182
|
+
},
|
|
183
|
+
getVisibleItems() {
|
|
184
|
+
return N(), [...b.keys()].map((e) => E(e)).filter((e) => !!(e != null && e.point && e.point.x >= 0 && e.point.x <= o.width && e.point.y >= 0 && e.point.y <= o.height));
|
|
185
|
+
},
|
|
186
|
+
hitTest(e, t) {
|
|
187
|
+
var s;
|
|
188
|
+
const i = (s = k()) == null ? void 0 : s.getApi().hitTest({ ...e, maxDistancePx: t });
|
|
189
|
+
return i != null && i.row ? E(w(i.row)) : null;
|
|
190
|
+
},
|
|
191
|
+
overlay(e, t) {
|
|
192
|
+
var h;
|
|
193
|
+
N();
|
|
194
|
+
const i = b.get(e.key);
|
|
195
|
+
if (!i)
|
|
196
|
+
return [];
|
|
197
|
+
const s = ((h = c == null ? void 0 : c.camera) == null ? void 0 : h.zoom) ?? 1, g = { ...i, ...T(i), width: i.width * s, height: i.height * s, radius: (i.radius ?? 0) * s, ringWidth: (i.ringWidth ?? 0) * s };
|
|
198
|
+
return a.mark(g, t.fill ?? t.stroke ?? "#287bc1").map((l) => l.type === "arc" ? { ...l, styles: { ...l.styles, ...t.fill ? {} : { width: t.strokeWidth ?? 2 }, opacity: t.opacity ?? 0.8 } } : l.type === "rect" ? { ...l, styles: { ...l.styles, opacity: t.opacity ?? 0.8 } } : l.type === "circle" ? { ...l, styles: { ...l.styles, opacity: t.opacity ?? 0.8 } } : l);
|
|
199
|
+
},
|
|
200
|
+
resize() {
|
|
201
|
+
f = null, o.getApi().refresh();
|
|
202
|
+
},
|
|
203
|
+
refresh() {
|
|
204
|
+
var e;
|
|
205
|
+
f = null, (e = k()) == null || e.getApi().refresh();
|
|
206
|
+
},
|
|
207
|
+
dispose() {
|
|
208
|
+
b.clear(), f = null;
|
|
209
|
+
},
|
|
210
|
+
extend(e, t) {
|
|
211
|
+
if (I = t, !d)
|
|
212
|
+
return {};
|
|
213
|
+
const i = Q(I, $);
|
|
214
|
+
return { ...K(I, () => ({ width: o.width, height: o.height }), (s) => s.map((g) => H.getItem(g)).filter((g) => g !== null)), ...i };
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
return H;
|
|
218
|
+
}
|
|
219
|
+
export {
|
|
220
|
+
te as c
|
|
221
|
+
};
|