@perspective-dev/viewer-charts 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +193 -0
- package/dist/cdn/perspective-viewer-charts.js +3 -0
- package/dist/cdn/perspective-viewer-charts.js.map +7 -0
- package/dist/esm/axis/axis-primitives.d.ts +24 -0
- package/dist/esm/axis/bar-axis.d.ts +51 -0
- package/dist/esm/axis/canvas.d.ts +24 -0
- package/dist/esm/axis/categorical-axis-core.d.ts +42 -0
- package/dist/esm/axis/categorical-axis.d.ts +27 -0
- package/dist/esm/axis/facet-chrome.d.ts +13 -0
- package/dist/esm/axis/label-geometry.d.ts +41 -0
- package/dist/esm/axis/legend.d.ts +44 -0
- package/dist/esm/axis/numeric-axis.d.ts +20 -0
- package/dist/esm/charts/candlestick/candlestick-build.d.ts +129 -0
- package/dist/esm/charts/candlestick/candlestick-interact.d.ts +10 -0
- package/dist/esm/charts/candlestick/candlestick-render.d.ts +24 -0
- package/dist/esm/charts/candlestick/candlestick.d.ts +144 -0
- package/dist/esm/charts/candlestick/glyphs/draw-candlesticks.d.ts +36 -0
- package/dist/esm/charts/candlestick/glyphs/draw-ohlc.d.ts +33 -0
- package/dist/esm/charts/canvas-types.d.ts +15 -0
- package/dist/esm/charts/cartesian/cartesian-build.d.ts +14 -0
- package/dist/esm/charts/cartesian/cartesian-interact.d.ts +20 -0
- package/dist/esm/charts/cartesian/cartesian-render.d.ts +26 -0
- package/dist/esm/charts/cartesian/cartesian.d.ts +239 -0
- package/dist/esm/charts/cartesian/glyph.d.ts +53 -0
- package/dist/esm/charts/cartesian/glyphs/density.d.ts +142 -0
- package/dist/esm/charts/cartesian/glyphs/lines.d.ts +23 -0
- package/dist/esm/charts/cartesian/glyphs/points.d.ts +24 -0
- package/dist/esm/charts/cartesian/label-interner.d.ts +21 -0
- package/dist/esm/charts/cartesian/tooltip-lines.d.ts +11 -0
- package/dist/esm/charts/chart-base.d.ts +402 -0
- package/dist/esm/charts/chart.d.ts +338 -0
- package/dist/esm/charts/common/band-layout.d.ts +32 -0
- package/dist/esm/charts/common/categorical-y-chart.d.ts +53 -0
- package/dist/esm/charts/common/category-axis-resolver.d.ts +90 -0
- package/dist/esm/charts/common/chrome-cache.d.ts +18 -0
- package/dist/esm/charts/common/draw-tooltip-box.d.ts +9 -0
- package/dist/esm/charts/common/leaf-color.d.ts +33 -0
- package/dist/esm/charts/common/node-store.d.ts +81 -0
- package/dist/esm/charts/common/tree-chart.d.ts +48 -0
- package/dist/esm/charts/common/tree-chrome.d.ts +31 -0
- package/dist/esm/charts/common/tree-data.d.ts +54 -0
- package/dist/esm/charts/common/visible-extent.d.ts +51 -0
- package/dist/esm/charts/heatmap/heatmap-build.d.ts +86 -0
- package/dist/esm/charts/heatmap/heatmap-interact.d.ts +19 -0
- package/dist/esm/charts/heatmap/heatmap-render.d.ts +19 -0
- package/dist/esm/charts/heatmap/heatmap-y-axis.d.ts +46 -0
- package/dist/esm/charts/heatmap/heatmap.d.ts +117 -0
- package/dist/esm/charts/map/map.d.ts +67 -0
- package/dist/esm/charts/registry.d.ts +14 -0
- package/dist/esm/charts/series/glyphs/draw-areas.d.ts +30 -0
- package/dist/esm/charts/series/glyphs/draw-bars.d.ts +15 -0
- package/dist/esm/charts/series/glyphs/draw-lines.d.ts +34 -0
- package/dist/esm/charts/series/glyphs/draw-scatter.d.ts +33 -0
- package/dist/esm/charts/series/series-build.d.ts +228 -0
- package/dist/esm/charts/series/series-interact.d.ts +35 -0
- package/dist/esm/charts/series/series-render.d.ts +41 -0
- package/dist/esm/charts/series/series-type.d.ts +49 -0
- package/dist/esm/charts/series/series.d.ts +317 -0
- package/dist/esm/charts/sunburst/sunburst-interact.d.ts +7 -0
- package/dist/esm/charts/sunburst/sunburst-layout.d.ts +33 -0
- package/dist/esm/charts/sunburst/sunburst-render.d.ts +22 -0
- package/dist/esm/charts/sunburst/sunburst.d.ts +85 -0
- package/dist/esm/charts/treemap/treemap-interact.d.ts +12 -0
- package/dist/esm/charts/treemap/treemap-layout.d.ts +28 -0
- package/dist/esm/charts/treemap/treemap-render.d.ts +18 -0
- package/dist/esm/charts/treemap/treemap.d.ts +74 -0
- package/dist/esm/config.d.ts +27 -0
- package/dist/esm/data/lazy-row.d.ts +32 -0
- package/dist/esm/data/split-groups.d.ts +20 -0
- package/dist/esm/data/view-reader.d.ts +35 -0
- package/dist/esm/event-detail.d.ts +28 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/interaction/hit-test.d.ts +30 -0
- package/dist/esm/interaction/host-sink-dom.d.ts +19 -0
- package/dist/esm/interaction/host-sink-message.d.ts +46 -0
- package/dist/esm/interaction/lazy-tooltip.d.ts +61 -0
- package/dist/esm/interaction/raw-event-forwarder.d.ts +27 -0
- package/dist/esm/interaction/spatial-grid.d.ts +15 -0
- package/dist/esm/interaction/tooltip-controller.d.ts +193 -0
- package/dist/esm/interaction/zoom-controller.d.ts +106 -0
- package/dist/esm/interaction/zoom-router.d.ts +48 -0
- package/dist/esm/layout/facet-grid.d.ts +126 -0
- package/dist/esm/layout/plot-layout.d.ts +104 -0
- package/dist/esm/layout/ticks.d.ts +17 -0
- package/dist/esm/map/mercator.d.ts +102 -0
- package/dist/esm/map/tile-cache.d.ts +38 -0
- package/dist/esm/map/tile-layer.d.ts +66 -0
- package/dist/esm/map/tile-loader.d.ts +52 -0
- package/dist/esm/map/tile-source.d.ts +66 -0
- package/dist/esm/perspective-viewer-charts.js +3 -0
- package/dist/esm/perspective-viewer-charts.js.map +7 -0
- package/dist/esm/plugin/charts.d.ts +40 -0
- package/dist/esm/plugin/plugin.d.ts +95 -0
- package/dist/esm/render/scheduler.d.ts +41 -0
- package/dist/esm/theme/gradient.d.ts +48 -0
- package/dist/esm/theme/palette.d.ts +13 -0
- package/dist/esm/theme/theme-snapshot.d.ts +7 -0
- package/dist/esm/theme/theme.d.ts +53 -0
- package/dist/esm/transport/protocol.d.ts +430 -0
- package/dist/esm/transport/renderer-transport.d.ts +201 -0
- package/dist/esm/utils/css.d.ts +1 -0
- package/dist/esm/utils/font-snapshot.d.ts +50 -0
- package/dist/esm/webgl/buffer-pool.d.ts +62 -0
- package/dist/esm/webgl/context-manager.d.ts +184 -0
- package/dist/esm/webgl/gradient-texture.d.ts +17 -0
- package/dist/esm/webgl/instanced-attrs.d.ts +44 -0
- package/dist/esm/webgl/plot-frame.d.ts +39 -0
- package/dist/esm/webgl/program-cache.d.ts +13 -0
- package/dist/esm/webgl/shader-manifest.d.ts +53 -0
- package/dist/esm/webgl/shader-registry.d.ts +22 -0
- package/dist/esm/worker/boot.d.ts +0 -0
- package/dist/esm/worker/dispatch.d.ts +9 -0
- package/dist/esm/worker/font-loader.d.ts +2 -0
- package/dist/esm/worker/renderer.worker.d.ts +115 -0
- package/dist/esm/worker/session-host.d.ts +26 -0
- package/package.json +47 -0
- package/src/css/perspective-viewer-charts.css +95 -0
- package/src/ts/axis/axis-primitives.ts +125 -0
- package/src/ts/axis/bar-axis.ts +345 -0
- package/src/ts/axis/canvas.ts +64 -0
- package/src/ts/axis/categorical-axis-core.ts +125 -0
- package/src/ts/axis/categorical-axis.ts +716 -0
- package/src/ts/axis/facet-chrome.ts +42 -0
- package/src/ts/axis/label-geometry.ts +188 -0
- package/src/ts/axis/legend.ts +218 -0
- package/src/ts/axis/numeric-axis.ts +353 -0
- package/src/ts/charts/candlestick/candlestick-build.ts +516 -0
- package/src/ts/charts/candlestick/candlestick-interact.ts +256 -0
- package/src/ts/charts/candlestick/candlestick-render.ts +387 -0
- package/src/ts/charts/candlestick/candlestick.ts +367 -0
- package/src/ts/charts/candlestick/glyphs/draw-candlesticks.ts +432 -0
- package/src/ts/charts/candlestick/glyphs/draw-ohlc.ts +317 -0
- package/src/ts/charts/canvas-types.ts +30 -0
- package/src/ts/charts/cartesian/cartesian-build.ts +616 -0
- package/src/ts/charts/cartesian/cartesian-interact.ts +355 -0
- package/src/ts/charts/cartesian/cartesian-render.ts +948 -0
- package/src/ts/charts/cartesian/cartesian.ts +469 -0
- package/src/ts/charts/cartesian/glyph.ts +81 -0
- package/src/ts/charts/cartesian/glyphs/density.ts +1263 -0
- package/src/ts/charts/cartesian/glyphs/lines.ts +320 -0
- package/src/ts/charts/cartesian/glyphs/points.ts +239 -0
- package/src/ts/charts/cartesian/label-interner.ts +56 -0
- package/src/ts/charts/cartesian/tooltip-lines.ts +80 -0
- package/src/ts/charts/chart-base.ts +840 -0
- package/src/ts/charts/chart.ts +427 -0
- package/src/ts/charts/common/band-layout.ts +63 -0
- package/src/ts/charts/common/categorical-y-chart.ts +81 -0
- package/src/ts/charts/common/category-axis-resolver.ts +314 -0
- package/src/ts/charts/common/chrome-cache.ts +79 -0
- package/src/ts/charts/common/draw-tooltip-box.ts +84 -0
- package/src/ts/charts/common/leaf-color.ts +92 -0
- package/src/ts/charts/common/node-store.ts +235 -0
- package/src/ts/charts/common/tree-chart.ts +76 -0
- package/src/ts/charts/common/tree-chrome.ts +123 -0
- package/src/ts/charts/common/tree-data.ts +623 -0
- package/src/ts/charts/common/visible-extent.ts +112 -0
- package/src/ts/charts/heatmap/heatmap-build.ts +426 -0
- package/src/ts/charts/heatmap/heatmap-interact.ts +274 -0
- package/src/ts/charts/heatmap/heatmap-render.ts +815 -0
- package/src/ts/charts/heatmap/heatmap-y-axis.ts +351 -0
- package/src/ts/charts/heatmap/heatmap.ts +368 -0
- package/src/ts/charts/map/map.ts +201 -0
- package/src/ts/charts/registry.ts +65 -0
- package/src/ts/charts/series/glyphs/draw-areas.ts +331 -0
- package/src/ts/charts/series/glyphs/draw-bars.ts +113 -0
- package/src/ts/charts/series/glyphs/draw-lines.ts +320 -0
- package/src/ts/charts/series/glyphs/draw-scatter.ts +328 -0
- package/src/ts/charts/series/series-build.ts +848 -0
- package/src/ts/charts/series/series-interact.ts +604 -0
- package/src/ts/charts/series/series-render.ts +1109 -0
- package/src/ts/charts/series/series-type.ts +99 -0
- package/src/ts/charts/series/series.ts +794 -0
- package/src/ts/charts/sunburst/sunburst-interact.ts +460 -0
- package/src/ts/charts/sunburst/sunburst-layout.ts +238 -0
- package/src/ts/charts/sunburst/sunburst-render.ts +887 -0
- package/src/ts/charts/sunburst/sunburst.ts +248 -0
- package/src/ts/charts/treemap/treemap-interact.ts +445 -0
- package/src/ts/charts/treemap/treemap-layout.ts +328 -0
- package/src/ts/charts/treemap/treemap-render.ts +886 -0
- package/src/ts/charts/treemap/treemap.ts +247 -0
- package/src/ts/config.ts +41 -0
- package/src/ts/data/lazy-row.ts +140 -0
- package/src/ts/data/split-groups.ts +97 -0
- package/src/ts/data/view-reader.ts +107 -0
- package/src/ts/event-detail.ts +44 -0
- package/src/ts/index.ts +53 -0
- package/src/ts/interaction/hit-test.ts +106 -0
- package/src/ts/interaction/host-sink-dom.ts +85 -0
- package/src/ts/interaction/host-sink-message.ts +75 -0
- package/src/ts/interaction/lazy-tooltip.ts +102 -0
- package/src/ts/interaction/raw-event-forwarder.ts +175 -0
- package/src/ts/interaction/spatial-grid.ts +100 -0
- package/src/ts/interaction/tooltip-controller.ts +407 -0
- package/src/ts/interaction/zoom-controller.ts +468 -0
- package/src/ts/interaction/zoom-router.ts +230 -0
- package/src/ts/layout/facet-grid.ts +346 -0
- package/src/ts/layout/plot-layout.ts +277 -0
- package/src/ts/layout/ticks.ts +168 -0
- package/src/ts/map/mercator.ts +204 -0
- package/src/ts/map/tile-cache.ts +96 -0
- package/src/ts/map/tile-layer.ts +382 -0
- package/src/ts/map/tile-loader.ts +143 -0
- package/src/ts/map/tile-source.ts +156 -0
- package/src/ts/plugin/charts.ts +286 -0
- package/src/ts/plugin/plugin.ts +668 -0
- package/src/ts/render/scheduler.ts +339 -0
- package/src/ts/shaders/area.frag.glsl +20 -0
- package/src/ts/shaders/area.vert.glsl +19 -0
- package/src/ts/shaders/bar.frag.glsl +25 -0
- package/src/ts/shaders/bar.vert.glsl +60 -0
- package/src/ts/shaders/candlestick-body.frag.glsl +19 -0
- package/src/ts/shaders/candlestick-body.vert.glsl +34 -0
- package/src/ts/shaders/density-extreme.frag.glsl +30 -0
- package/src/ts/shaders/density-mrt.frag.glsl +44 -0
- package/src/ts/shaders/density-mrt.vert.glsl +48 -0
- package/src/ts/shaders/density-resolve.frag.glsl +89 -0
- package/src/ts/shaders/density-resolve.vert.glsl +23 -0
- package/src/ts/shaders/density-splat.frag.glsl +34 -0
- package/src/ts/shaders/density-splat.vert.glsl +52 -0
- package/src/ts/shaders/gridline.frag.glsl +18 -0
- package/src/ts/shaders/gridline.vert.glsl +18 -0
- package/src/ts/shaders/heatmap.frag.glsl +23 -0
- package/src/ts/shaders/heatmap.vert.glsl +42 -0
- package/src/ts/shaders/line-uniform.frag.glsl +26 -0
- package/src/ts/shaders/line-uniform.vert.glsl +54 -0
- package/src/ts/shaders/line.frag.glsl +28 -0
- package/src/ts/shaders/line.vert.glsl +87 -0
- package/src/ts/shaders/scatter.frag.glsl +39 -0
- package/src/ts/shaders/scatter.vert.glsl +67 -0
- package/src/ts/shaders/sunburst-arc.frag.glsl +19 -0
- package/src/ts/shaders/sunburst-arc.vert.glsl +79 -0
- package/src/ts/shaders/tile.frag.glsl +27 -0
- package/src/ts/shaders/tile.vert.glsl +35 -0
- package/src/ts/shaders/treemap.frag.glsl +19 -0
- package/src/ts/shaders/treemap.vert.glsl +25 -0
- package/src/ts/shaders/y-scatter.frag.glsl +30 -0
- package/src/ts/shaders/y-scatter.vert.glsl +31 -0
- package/src/ts/theme/gradient.ts +312 -0
- package/src/ts/theme/palette.ts +64 -0
- package/src/ts/theme/theme-snapshot.ts +66 -0
- package/src/ts/theme/theme.ts +166 -0
- package/src/ts/transport/protocol.ts +497 -0
- package/src/ts/transport/renderer-transport.ts +788 -0
- package/src/ts/utils/css.ts +36 -0
- package/src/ts/utils/font-snapshot.ts +159 -0
- package/src/ts/webgl/buffer-pool.ts +163 -0
- package/src/ts/webgl/context-manager.ts +414 -0
- package/src/ts/webgl/gradient-texture.ts +84 -0
- package/src/ts/webgl/instanced-attrs.ts +139 -0
- package/src/ts/webgl/plot-frame.ts +91 -0
- package/src/ts/webgl/program-cache.ts +46 -0
- package/src/ts/webgl/shader-manifest.ts +148 -0
- package/src/ts/webgl/shader-registry.ts +97 -0
- package/src/ts/worker/boot.ts +22 -0
- package/src/ts/worker/dispatch.ts +99 -0
- package/src/ts/worker/font-loader.ts +89 -0
- package/src/ts/worker/renderer.worker.ts +734 -0
- package/src/ts/worker/session-host.ts +118 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import type { ColumnDataMap } from "../../data/view-reader";
|
|
2
|
+
import type { WebGLContextManager } from "../../webgl/context-manager";
|
|
3
|
+
import type { ZoomConfig } from "../../interaction/zoom-controller";
|
|
4
|
+
import { CategoricalYChart } from "../common/categorical-y-chart";
|
|
5
|
+
import { type PlotRect } from "../../layout/plot-layout";
|
|
6
|
+
import { type AxisDomain } from "../../axis/numeric-axis";
|
|
7
|
+
import { type SeriesChartRecord, type NumericCategoryDomain, type SeriesInfo, type BarColumns } from "./series-build";
|
|
8
|
+
import { LineGlyph } from "./glyphs/draw-lines";
|
|
9
|
+
import { ScatterGlyph } from "./glyphs/draw-scatter";
|
|
10
|
+
import { AreaGlyph } from "./glyphs/draw-areas";
|
|
11
|
+
/**
|
|
12
|
+
* Per-frame memo of the auto-fit value extent for a {@link SeriesChart},
|
|
13
|
+
* keyed on the visible categorical window. Two axis slots (`left*` /
|
|
14
|
+
* `right*`) because dual-axis bar charts refit independently.
|
|
15
|
+
*/
|
|
16
|
+
export interface SeriesAutoFitCache {
|
|
17
|
+
catMin: number;
|
|
18
|
+
catMax: number;
|
|
19
|
+
hidden: Set<number>;
|
|
20
|
+
leftMin: number;
|
|
21
|
+
leftMax: number;
|
|
22
|
+
hasLeft: boolean;
|
|
23
|
+
rightMin: number;
|
|
24
|
+
rightMax: number;
|
|
25
|
+
hasRight: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface CachedLocations {
|
|
28
|
+
u_proj_left: WebGLUniformLocation | null;
|
|
29
|
+
u_proj_right: WebGLUniformLocation | null;
|
|
30
|
+
u_hover_series: WebGLUniformLocation | null;
|
|
31
|
+
u_horizontal: WebGLUniformLocation | null;
|
|
32
|
+
a_corner: number;
|
|
33
|
+
a_x_center: number;
|
|
34
|
+
a_half_width: number;
|
|
35
|
+
a_y0: number;
|
|
36
|
+
a_y1: number;
|
|
37
|
+
a_color: number;
|
|
38
|
+
a_series_id: number;
|
|
39
|
+
a_axis: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Bar chart. Fields are package-internal (no `private`) so helper modules
|
|
43
|
+
* in this folder can read/write them.
|
|
44
|
+
*
|
|
45
|
+
* Orientation: vertical (Y Bar) is the default — categorical X, numeric
|
|
46
|
+
* Y. When `_isHorizontal` is true (X Bar) the roles swap: numeric X,
|
|
47
|
+
* categorical Y reading top-to-bottom. The data pipeline + instance
|
|
48
|
+
* attributes stay in *logical* coordinates (xCenter = category center,
|
|
49
|
+
* y0/y1 = value extent); the swap happens in three places only:
|
|
50
|
+
* 1. Projection matrix (`bar-render.ts`) — args reordered, Y flipped.
|
|
51
|
+
* 2. Vertex shader — `u_horizontal` uniform transposes position.
|
|
52
|
+
* 3. Chrome (`bar-axis.ts`) — categorical axis moves from bottom to
|
|
53
|
+
* left; numeric axis from left to bottom.
|
|
54
|
+
* Hit-testing reads the swapped pixel→data mapping via the projected
|
|
55
|
+
* `PlotLayout`, so its logical comparisons don't need changes.
|
|
56
|
+
*/
|
|
57
|
+
export declare class SeriesChart extends CategoricalYChart {
|
|
58
|
+
readonly _isHorizontal: boolean;
|
|
59
|
+
constructor(orientation?: "vertical" | "horizontal");
|
|
60
|
+
/**
|
|
61
|
+
* Lock the categorical axis — scrolling through category indices
|
|
62
|
+
* isn't meaningful, and the layout code assumes all categories are
|
|
63
|
+
* always present. The value axis stays freely zoomable.
|
|
64
|
+
*/
|
|
65
|
+
protected getZoomConfig(): ZoomConfig;
|
|
66
|
+
_locations: CachedLocations | null;
|
|
67
|
+
_aggregates: string[];
|
|
68
|
+
_splitPrefixes: string[];
|
|
69
|
+
_series: SeriesInfo[];
|
|
70
|
+
/**
|
|
71
|
+
* Columnar bar/area record storage. Indexed by bar slot in
|
|
72
|
+
* `[0, _bars.count)`. Replaces the legacy `SeriesChartRecord[]` to
|
|
73
|
+
* avoid per-record POJO allocation on data load.
|
|
74
|
+
*/
|
|
75
|
+
_bars: BarColumns;
|
|
76
|
+
/**
|
|
77
|
+
* Pre-partitioned series indices by glyph type — populated at the end
|
|
78
|
+
* of `uploadAndRender` and reused across frames. Eliminates per-glyph
|
|
79
|
+
* `chart._series.filter(...)` allocations in the render loop. Each
|
|
80
|
+
* holds the full list of that type (including hidden series); the
|
|
81
|
+
* draw paths still skip hidden via `_hiddenSeries` lookup.
|
|
82
|
+
*/
|
|
83
|
+
_barSeries: SeriesInfo[];
|
|
84
|
+
_lineSeries: SeriesInfo[];
|
|
85
|
+
_scatterSeries: SeriesInfo[];
|
|
86
|
+
_areaSeries: SeriesInfo[];
|
|
87
|
+
/**
|
|
88
|
+
* Cached primary / secondary axis labels — `_series.filter().map().
|
|
89
|
+
* dedupe().join()` per axis, recomputed only on series-set change.
|
|
90
|
+
*/
|
|
91
|
+
_primaryValueLabel: string;
|
|
92
|
+
_altValueLabel: string;
|
|
93
|
+
/**
|
|
94
|
+
* (seriesId * 1e9 + catIdx) → bar-record index in `_bars`. Built once
|
|
95
|
+
* per pipeline run for area-strip lookups; rebuilt on hidden-toggle
|
|
96
|
+
* is unnecessary because the index keys don't depend on hidden state.
|
|
97
|
+
*/
|
|
98
|
+
_areaBarIndex: Map<number, number> | null;
|
|
99
|
+
/**
|
|
100
|
+
* Cached Y-color buffer state for `uploadBarColors` short-circuit.
|
|
101
|
+
* `_lastUploadedColors` mirrors the bytes last shipped to the GPU;
|
|
102
|
+
* `uploadBarColors` skips when the new buffer matches byte-for-byte.
|
|
103
|
+
* Reset (set to `null`) on data load or palette change.
|
|
104
|
+
*/
|
|
105
|
+
_lastUploadedColors: Float32Array | null;
|
|
106
|
+
/**
|
|
107
|
+
* Cached palette + identity-keys for short-circuiting per-frame
|
|
108
|
+
* resolution. Inputs (`seriesPalette` ref, `gradientStops` ref,
|
|
109
|
+
* `series.length`) only change on data load or `restyle()`.
|
|
110
|
+
*/
|
|
111
|
+
_paletteCache: [number, number, number][] | null;
|
|
112
|
+
_paletteCacheKey: {
|
|
113
|
+
seriesPalette: [number, number, number][] | null;
|
|
114
|
+
gradientStops: unknown;
|
|
115
|
+
seriesLength: number;
|
|
116
|
+
} | null;
|
|
117
|
+
/**
|
|
118
|
+
* Reusable scratch for the build pipeline — keeps the stack ladder
|
|
119
|
+
* `Float64Array(N*M)` capacity hot across data reloads. The pipeline
|
|
120
|
+
* resizes if the new build's footprint exceeds capacity.
|
|
121
|
+
*/
|
|
122
|
+
_posStackScratch: Float64Array | null;
|
|
123
|
+
_negStackScratch: Float64Array | null;
|
|
124
|
+
_leftDomain: {
|
|
125
|
+
min: number;
|
|
126
|
+
max: number;
|
|
127
|
+
};
|
|
128
|
+
_rightDomain: {
|
|
129
|
+
min: number;
|
|
130
|
+
max: number;
|
|
131
|
+
} | null;
|
|
132
|
+
_hasRightAxis: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* `domain_mode: "expand"` accumulators. Hold the running union of
|
|
135
|
+
* every prior build's value-axis (and, in numeric-category mode,
|
|
136
|
+
* category-axis) extent for as long as the option is active.
|
|
137
|
+
* Cleared in `resetExpandedDomain` — wired from the worker's
|
|
138
|
+
* `resetAllZooms` and from view-config mutations on the base
|
|
139
|
+
* class. `null` whenever the option is `"fit"` or the accumulator
|
|
140
|
+
* has just been cleared; the next build re-seeds.
|
|
141
|
+
*/
|
|
142
|
+
_expandedLeftDomain: {
|
|
143
|
+
min: number;
|
|
144
|
+
max: number;
|
|
145
|
+
} | null;
|
|
146
|
+
_expandedRightDomain: {
|
|
147
|
+
min: number;
|
|
148
|
+
max: number;
|
|
149
|
+
} | null;
|
|
150
|
+
_expandedCategoryDomain: {
|
|
151
|
+
min: number;
|
|
152
|
+
max: number;
|
|
153
|
+
} | null;
|
|
154
|
+
/**
|
|
155
|
+
* Numeric category-axis state. Populated only when `group_by` has
|
|
156
|
+
* exactly one level and that level is `date | datetime | integer |
|
|
157
|
+
* float` (boolean → category). When set, `_bars[].xCenter` lives in
|
|
158
|
+
* real data units (not logical category indices), and the
|
|
159
|
+
* categorical-side axis renders as a numeric axis instead of the
|
|
160
|
+
* stringified-category one.
|
|
161
|
+
*/
|
|
162
|
+
_categoryAxisMode: "category" | "numeric";
|
|
163
|
+
_numericCategoryDomain: NumericCategoryDomain | null;
|
|
164
|
+
/**
|
|
165
|
+
* Origin used to rebase category positions before f32 narrowing.
|
|
166
|
+
* Datetime numeric category axes carry ~1.7e12-magnitude values
|
|
167
|
+
* which f32 cannot represent below ~256ms; the GPU buffers store
|
|
168
|
+
* `(xCenter - _categoryOrigin)` and the projection matrix is built
|
|
169
|
+
* with the same origin so its `tx` term stays small. Leftover
|
|
170
|
+
* absolute coords are still available via `_numericCategoryDomain`
|
|
171
|
+
* for axis-tick formatting and `dataToPixel`. `0` in category mode
|
|
172
|
+
* (where positions are small integer indices) and in non-datetime
|
|
173
|
+
* numeric modes (integer / float categories also fit in f32).
|
|
174
|
+
*/
|
|
175
|
+
_categoryOrigin: number;
|
|
176
|
+
/**
|
|
177
|
+
* Cached numeric category-axis ticks for the last frame.
|
|
178
|
+
*/
|
|
179
|
+
_lastCatTicks: number[] | null;
|
|
180
|
+
/**
|
|
181
|
+
* Per-category X coordinate in real data units (numeric axis mode
|
|
182
|
+
* only). `null` in category mode — line/scatter/area glyphs fall
|
|
183
|
+
* back to using `catIdx` directly as the X coordinate.
|
|
184
|
+
*/
|
|
185
|
+
_categoryPositions: Float64Array | null;
|
|
186
|
+
_hiddenSeries: Set<number>;
|
|
187
|
+
_hoveredBarIdx: number;
|
|
188
|
+
_pinnedBarIdx: number;
|
|
189
|
+
/**
|
|
190
|
+
* Synthetic bar record for hover hits on line / scatter glyphs that
|
|
191
|
+
* don't have a real `BarRecord` in `_bars`. At most one of
|
|
192
|
+
* `_hoveredBarIdx` and `_hoveredSample` is populated per frame; see
|
|
193
|
+
* {@link ./bar-interact.getHoveredBar}.
|
|
194
|
+
*/
|
|
195
|
+
_hoveredSample: SeriesChartRecord | null;
|
|
196
|
+
_samples: Float32Array;
|
|
197
|
+
_sampleValid: Uint8Array;
|
|
198
|
+
/**
|
|
199
|
+
* Typed glyph composition. Each glyph (line / scatter / area) owns
|
|
200
|
+
* its program cache and persistent vertex buffers privately; the
|
|
201
|
+
* chart routes draw / rebuild / invalidate via `_glyphs`. Bar
|
|
202
|
+
* glyph state lives on the chart directly (shared bar program +
|
|
203
|
+
* `_locations` + buffer pool), so it's a free function rather than
|
|
204
|
+
* a class.
|
|
205
|
+
*/
|
|
206
|
+
readonly _glyphs: {
|
|
207
|
+
readonly lines: LineGlyph;
|
|
208
|
+
readonly scatter: ScatterGlyph;
|
|
209
|
+
readonly areas: AreaGlyph;
|
|
210
|
+
};
|
|
211
|
+
_lastAltYDomain: AxisDomain | null;
|
|
212
|
+
_lastAltYTicks: number[] | null;
|
|
213
|
+
_uploadedBars: number;
|
|
214
|
+
/**
|
|
215
|
+
* Bar-record indices uploaded to the instance buffers, in dispatch
|
|
216
|
+
* order. `_uploadedBars` is the active prefix length; the trailing
|
|
217
|
+
* capacity is reused across data reloads / legend toggles.
|
|
218
|
+
*/
|
|
219
|
+
_visibleBarIndices: Int32Array;
|
|
220
|
+
_legendRects: {
|
|
221
|
+
seriesId: number;
|
|
222
|
+
rect: PlotRect;
|
|
223
|
+
}[];
|
|
224
|
+
/**
|
|
225
|
+
* Cached legend layout — recomputed only on series-set / palette /
|
|
226
|
+
* hidden-set / theme change. Frame-rate redraws read from this
|
|
227
|
+
* directly; otherwise `ctx.measureText` would run per series each
|
|
228
|
+
* frame. `null` flags an invalidation; `_legendRects` is rebuilt
|
|
229
|
+
* lazily on the next chrome pass.
|
|
230
|
+
*/
|
|
231
|
+
_legendCacheValid: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Per-frame memo of the auto-fit value extent keyed on the visible
|
|
234
|
+
* categorical window. Two comparisons per hit → no walk. Reset to
|
|
235
|
+
* null on any mutation that would change the outcome (data reload,
|
|
236
|
+
* legend toggle).
|
|
237
|
+
*
|
|
238
|
+
* Two axis slots because dual-axis bar charts refit left and right
|
|
239
|
+
* independently.
|
|
240
|
+
*
|
|
241
|
+
* TODO(perf): when the visible window shrinks from a large N, the
|
|
242
|
+
* linear walk over `_bars` dominates for N > ~100K. `_bars` is
|
|
243
|
+
* already ordered by `catIdx`, so a binary-search pair to find the
|
|
244
|
+
* visible slice drops this to O(log N + K_visible). Deferred until
|
|
245
|
+
* profiling shows the walk in the hot path — current scale caps
|
|
246
|
+
* keep it below 1% of frame time.
|
|
247
|
+
*/
|
|
248
|
+
_autoFitCache: SeriesAutoFitCache | null;
|
|
249
|
+
/**
|
|
250
|
+
* Per-category extent buckets. Built once per data load (and
|
|
251
|
+
* rebuilt when `_hiddenSeries` changes), then read per-frame by
|
|
252
|
+
* `computeVisibleValueExtent` to compute the auto-fit window over
|
|
253
|
+
* the visible cat range in O(visibleCats) instead of
|
|
254
|
+
* O(`bars.count`). Capacity reused across builds via
|
|
255
|
+
* length-checked grow.
|
|
256
|
+
*
|
|
257
|
+
* Memory: 4 × Float64 + 2 × Uint8 = 34 bytes per category. For
|
|
258
|
+
* typical N (≤ 1000 cats) this is < 35 KB; for high-cardinality
|
|
259
|
+
* N = 100k it's 3.4 MB. Acceptable trade for eliminating the
|
|
260
|
+
* O(N×M×P) per-frame walk during pan/zoom animations.
|
|
261
|
+
*/
|
|
262
|
+
_catExtents: {
|
|
263
|
+
leftMin: Float64Array;
|
|
264
|
+
leftMax: Float64Array;
|
|
265
|
+
rightMin: Float64Array;
|
|
266
|
+
rightMax: Float64Array;
|
|
267
|
+
hasLeft: Uint8Array;
|
|
268
|
+
hasRight: Uint8Array;
|
|
269
|
+
n: number;
|
|
270
|
+
} | null;
|
|
271
|
+
/**
|
|
272
|
+
* Identity of the `_hiddenSeries` set baked into `_catExtents`.
|
|
273
|
+
* Pointer-compares to detect legend-toggle invalidations.
|
|
274
|
+
*/
|
|
275
|
+
_catExtentsHidden: Set<number> | null;
|
|
276
|
+
protected tooltipCallbacks(): {
|
|
277
|
+
onHover: (mx: number, my: number) => void;
|
|
278
|
+
onLeave: () => void;
|
|
279
|
+
onClickPre: (mx: number, my: number) => boolean;
|
|
280
|
+
onPin: (mx: number, my: number) => void;
|
|
281
|
+
onUnpin: () => void;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Resolve a clicked bar / point into a `PerspectiveClickDetail`
|
|
285
|
+
* (via `buildClickDetail`) and emit both
|
|
286
|
+
* `perspective-click` and `perspective-global-filter` to the host.
|
|
287
|
+
*
|
|
288
|
+
* `rowIdx` derivation: the series pipeline emits one record per
|
|
289
|
+
* (catIdx, agg, split) tuple, and a pivoted view has one view row
|
|
290
|
+
* per category — so `catIdx + _rowOffset` is the source-view row.
|
|
291
|
+
* `_aggregates[aggIdx]` is the *base* column name (no split
|
|
292
|
+
* prefix). Group-by values come from per-level `_rowPaths`, split-by
|
|
293
|
+
* values are recovered by splitting `_splitPrefixes[splitIdx]` on
|
|
294
|
+
* the `|` delimiter the engine uses for pivoted column names.
|
|
295
|
+
*/
|
|
296
|
+
private _emitSeriesClickSelect;
|
|
297
|
+
uploadAndRender(glManager: WebGLContextManager, columns: ColumnDataMap, startRow: number, endRow: number): Promise<void>;
|
|
298
|
+
_fullRender(glManager: WebGLContextManager): void;
|
|
299
|
+
resetExpandedDomain(): void;
|
|
300
|
+
protected destroyInternal(): void;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Resolve the per-series palette and stamp it onto `_series[i].color`.
|
|
304
|
+
* Cached on `_paletteCache` keyed by reference identity of the theme
|
|
305
|
+
* inputs + series count — only `restyle()` (which clears `_paletteCache`
|
|
306
|
+
* via `invalidateTheme`) or a data load (which clears it explicitly)
|
|
307
|
+
* forces re-resolution.
|
|
308
|
+
*
|
|
309
|
+
* Returns true when the cache changed (caller invalidates color upload).
|
|
310
|
+
*/
|
|
311
|
+
export declare function ensurePalette(chart: SeriesChart): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Horizontal bar chart — numeric X, categorical Y.
|
|
314
|
+
*/
|
|
315
|
+
export declare class XBarChart extends SeriesChart {
|
|
316
|
+
constructor();
|
|
317
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SunburstChart } from "./sunburst";
|
|
2
|
+
export type { BreadcrumbRegion as SunburstBreadcrumbRegion } from "../common/tree-chrome";
|
|
3
|
+
export declare function handleSunburstHover(chart: SunburstChart, mx: number, my: number): void;
|
|
4
|
+
export declare function handleSunburstClick(chart: SunburstChart, mx: number, my: number): void;
|
|
5
|
+
export declare function showSunburstPinnedTooltip(chart: SunburstChart, nodeId: number): void;
|
|
6
|
+
export declare function dismissSunburstPinnedTooltip(chart: SunburstChart): void;
|
|
7
|
+
export declare function buildSunburstTooltipLines(chart: SunburstChart, nodeId: number): Promise<string[]>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SunburstChart } from "./sunburst";
|
|
2
|
+
import { type NodeStore } from "../common/node-store";
|
|
3
|
+
/**
|
|
4
|
+
* Minimum arc area (in pixels²) below which a subtree stops being
|
|
5
|
+
* subdivided. Keeps the visible count bounded independent of tree
|
|
6
|
+
* size — the core mechanism that lets sunburst scale to 2M nodes.
|
|
7
|
+
*/
|
|
8
|
+
declare const MIN_VISIBLE_ARC_AREA = 4;
|
|
9
|
+
/**
|
|
10
|
+
* Inner radius: reserved for the current-root drill-up target.
|
|
11
|
+
*/
|
|
12
|
+
declare const INNER_RING_PX = 30;
|
|
13
|
+
/**
|
|
14
|
+
* Recursive polar partition writing `(a0, a1, r0, r1)` into the store.
|
|
15
|
+
* The root node's own ring is reserved (inner radius = 0, outer =
|
|
16
|
+
* `INNER_RING_PX`) for the drill-up click target; descendants start at
|
|
17
|
+
* `INNER_RING_PX` and extend out.
|
|
18
|
+
*/
|
|
19
|
+
export declare function partitionSunburst(store: NodeStore, currentRootId: number, maxRadius: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Walk from `startId` depth-first, emitting every descendant whose
|
|
22
|
+
* arc area exceeds `MIN_VISIBLE_ARC_AREA`.
|
|
23
|
+
*
|
|
24
|
+
* The single-facet entry point; faceted rendering uses
|
|
25
|
+
* {@link collectVisibleArcsAppend} to concatenate across facets.
|
|
26
|
+
*/
|
|
27
|
+
export declare function collectVisibleArcs(chart: SunburstChart, startId: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Append visible arcs under `startId` to `_visibleNodeIds` starting at
|
|
30
|
+
* `startOffset`, returning the new length.
|
|
31
|
+
*/
|
|
32
|
+
export declare function collectVisibleArcsAppend(chart: SunburstChart, startId: number, startOffset: number): number;
|
|
33
|
+
export { INNER_RING_PX, MIN_VISIBLE_ARC_AREA };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { WebGLContextManager } from "../../webgl/context-manager";
|
|
2
|
+
import type { SunburstChart } from "./sunburst";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the `(centerX, centerY)` of the facet that owns `nodeId`.
|
|
5
|
+
* Walks the ancestor chain and matches against each facet's
|
|
6
|
+
* `drillRoot`; returns `chart._centerX/_centerY` in non-faceted mode
|
|
7
|
+
* or as a defensive fallback. Used by every chrome path that needs to
|
|
8
|
+
* place geometry around an arc — labels, hover highlight, hover
|
|
9
|
+
* tooltip, pinned tooltip — so all four agree on which facet owns the
|
|
10
|
+
* node. The chart-wide `_centerX/_centerY` fields are
|
|
11
|
+
* `layoutFacetedSunburst`'s legacy first-facet publication and are
|
|
12
|
+
* not safe for these calls.
|
|
13
|
+
*/
|
|
14
|
+
export declare function facetCenterForNode(chart: SunburstChart, nodeId: number): {
|
|
15
|
+
centerX: number;
|
|
16
|
+
centerY: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Full-frame render: layout → WebGL arcs → chrome overlay.
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderSunburstFrame(chart: SunburstChart, glManager: WebGLContextManager): void;
|
|
22
|
+
export declare function renderSunburstChromeOverlay(chart: SunburstChart): void;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ColumnDataMap } from "../../data/view-reader";
|
|
2
|
+
import type { WebGLContextManager } from "../../webgl/context-manager";
|
|
3
|
+
import { TreeChartBase } from "../common/tree-chart";
|
|
4
|
+
import { type SunburstBreadcrumbRegion } from "./sunburst-interact";
|
|
5
|
+
export interface SunburstLocations {
|
|
6
|
+
u_center: WebGLUniformLocation | null;
|
|
7
|
+
u_resolution: WebGLUniformLocation | null;
|
|
8
|
+
u_border_px: WebGLUniformLocation | null;
|
|
9
|
+
a_strip_t: number;
|
|
10
|
+
a_side: number;
|
|
11
|
+
a_angles: number;
|
|
12
|
+
a_radii: number;
|
|
13
|
+
a_color: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Sunburst chart. Shares tree storage + streaming pipeline + color
|
|
17
|
+
* mode with `TreeChartBase`; adds polar layout + instanced-arc WebGL
|
|
18
|
+
* rendering + drill / tooltip interactions.
|
|
19
|
+
*
|
|
20
|
+
* Internal option: `_labelRotation` — `"upright"` keeps labels on the
|
|
21
|
+
* left half flipped 180° so they read upright (d3fc behavior);
|
|
22
|
+
* `"radial"` leaves them purely tangent to the arc. Defaults to
|
|
23
|
+
* `"upright"`; toggle here if a call site wants flat radial labels.
|
|
24
|
+
*/
|
|
25
|
+
export declare class SunburstChart extends TreeChartBase {
|
|
26
|
+
_program: WebGLProgram | null;
|
|
27
|
+
_locations: SunburstLocations | null;
|
|
28
|
+
_stripBuffer: WebGLBuffer | null;
|
|
29
|
+
_instanceBuffer: WebGLBuffer | null;
|
|
30
|
+
_instanceCount: number;
|
|
31
|
+
/**
|
|
32
|
+
* Label orientation mode — see class docstring.
|
|
33
|
+
*/
|
|
34
|
+
_labelRotation: "upright" | "radial";
|
|
35
|
+
_centerX: number;
|
|
36
|
+
_centerY: number;
|
|
37
|
+
_maxRadius: number;
|
|
38
|
+
_hoveredNodeId: number;
|
|
39
|
+
_pinnedNodeId: number;
|
|
40
|
+
_breadcrumbRegions: SunburstBreadcrumbRegion[];
|
|
41
|
+
_chromeCache: ImageBitmap | null;
|
|
42
|
+
_chromeCacheDirty: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* See `TreemapChart._chromeCacheGen` — same race, same fix.
|
|
45
|
+
*/
|
|
46
|
+
_chromeCacheGen: number;
|
|
47
|
+
_facetGrid: import("../../layout/facet-grid").FacetGrid | null;
|
|
48
|
+
/**
|
|
49
|
+
* Per-facet drill roots — mirrors `TreemapChart._facetDrillRoots`.
|
|
50
|
+
*/
|
|
51
|
+
_facetDrillRoots: Map<string, number>;
|
|
52
|
+
/**
|
|
53
|
+
* Per-facet rendering state. `index` matches the facet grid cell;
|
|
54
|
+
* `centerX`, `centerY`, `maxRadius` are used for layout + hit test;
|
|
55
|
+
* `drillRoot` is the sub-root the facet is currently showing;
|
|
56
|
+
* `instanceStart`, `instanceCount` index into the shared GPU
|
|
57
|
+
* instance buffer for draw dispatch (these are post-skip values,
|
|
58
|
+
* rewritten by `uploadArcInstances` after zero-width arcs and the
|
|
59
|
+
* drill root are filtered out). `nodeStart`, `nodeCount` are the
|
|
60
|
+
* pre-skip range over `_visibleNodeIds` and are *not* rewritten —
|
|
61
|
+
* canvas chrome (arc-label translate origin) walks this range so
|
|
62
|
+
* each label can be placed around its own facet's center instead
|
|
63
|
+
* of the chart-wide `_centerX/_centerY` (which always point at the
|
|
64
|
+
* first facet).
|
|
65
|
+
*/
|
|
66
|
+
_facets: {
|
|
67
|
+
label: string;
|
|
68
|
+
centerX: number;
|
|
69
|
+
centerY: number;
|
|
70
|
+
maxRadius: number;
|
|
71
|
+
drillRoot: number;
|
|
72
|
+
instanceStart: number;
|
|
73
|
+
instanceCount: number;
|
|
74
|
+
nodeStart: number;
|
|
75
|
+
nodeCount: number;
|
|
76
|
+
}[];
|
|
77
|
+
protected tooltipCallbacks(): {
|
|
78
|
+
onHover: (mx: number, my: number) => void;
|
|
79
|
+
onLeave: () => void;
|
|
80
|
+
onClickPre: (mx: number, my: number) => boolean;
|
|
81
|
+
};
|
|
82
|
+
uploadAndRender(glManager: WebGLContextManager, columns: ColumnDataMap, startRow: number, _endRow: number): Promise<void>;
|
|
83
|
+
_fullRender(glManager: WebGLContextManager): void;
|
|
84
|
+
protected destroyInternal(): void;
|
|
85
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TreemapChart } from "./treemap";
|
|
2
|
+
export declare function handleTreemapHover(chart: TreemapChart, mx: number, my: number): void;
|
|
3
|
+
export declare function handleTreemapClick(chart: TreemapChart, mx: number, my: number): void;
|
|
4
|
+
export declare function handleTreemapDblClick(chart: TreemapChart, mx: number, my: number): void;
|
|
5
|
+
export declare function showTreemapPinnedTooltip(chart: TreemapChart, nodeId: number): void;
|
|
6
|
+
export declare function dismissTreemapPinnedTooltip(chart: TreemapChart): void;
|
|
7
|
+
/**
|
|
8
|
+
* Build the tooltip for `nodeId`. The node's own name path + aggregate
|
|
9
|
+
* value are derived from the tree; per-row tooltip columns come from
|
|
10
|
+
* the `leafRowIdx` → column-buffer lookup (no per-node `Map`).
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildTreemapTooltipLines(chart: TreemapChart, nodeId: number): Promise<string[]>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TreemapChart } from "./treemap";
|
|
2
|
+
import { NodeStore } from "../common/node-store";
|
|
3
|
+
export type { BreadcrumbRegion } from "../common/tree-chrome";
|
|
4
|
+
export declare const PADDING_OUTER = 1;
|
|
5
|
+
export declare const PADDING_LABEL = 14;
|
|
6
|
+
export declare const PADDING_INNER = 1;
|
|
7
|
+
export { resetTreeState as resetTreemapState, processTreeChunk as processTreemapChunk, finalizeTree as finalizeTreemap, rebuildBreadcrumbs, } from "../common/tree-data";
|
|
8
|
+
/**
|
|
9
|
+
* Order-preserving treemap layout. Walks the linked-list child graph
|
|
10
|
+
* and writes `x0/y0/x1/y1` in place into the node store.
|
|
11
|
+
*/
|
|
12
|
+
export declare function squarify(store: NodeStore, id: number, x0: number, y0: number, x1: number, y1: number, baseDepth: number, scratch: Int32Array, showBranchHeader: boolean): void;
|
|
13
|
+
/**
|
|
14
|
+
* Walk from `startId` depth-first, emitting every descendant whose rect
|
|
15
|
+
* area is above `MIN_VISIBLE_AREA`. O(visible), not O(total).
|
|
16
|
+
*
|
|
17
|
+
* Faceted render paths call {@link collectVisibleAppend} once per facet
|
|
18
|
+
* and do the final `_visibleNodeCount` bookkeeping themselves; this
|
|
19
|
+
* single-facet entry point wraps that for non-split trees.
|
|
20
|
+
*/
|
|
21
|
+
export declare function collectVisible(chart: TreemapChart, startId: number, maxDepth: number, baseDepth: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* Append the visible-node IDs below `startId` into `_visibleNodeIds`
|
|
24
|
+
* starting at `startOffset`. Returns the new length. Used by faceted
|
|
25
|
+
* treemap rendering to concatenate per-facet visibility without doing
|
|
26
|
+
* a second pass.
|
|
27
|
+
*/
|
|
28
|
+
export declare function collectVisibleAppend(chart: TreemapChart, startId: number, maxDepth: number, baseDepth: number, startOffset: number): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WebGLContextManager } from "../../webgl/context-manager";
|
|
2
|
+
import type { TreemapChart } from "./treemap";
|
|
3
|
+
/**
|
|
4
|
+
* Full-frame treemap render: layout → WebGL rects → chrome overlay.
|
|
5
|
+
*
|
|
6
|
+
* When `_splitBy` is populated the top-level children of `_rootId`
|
|
7
|
+
* become facet roots; each is squarified into its own cell rect via
|
|
8
|
+
* {@link buildFacetGrid}. The visible-node list is concatenated across
|
|
9
|
+
* facets so a single vertex buffer + draw call covers the whole scene.
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderTreemapFrame(chart: TreemapChart, glManager: WebGLContextManager): void;
|
|
12
|
+
/**
|
|
13
|
+
* Render the chrome overlay. On layout changes, draws static content
|
|
14
|
+
* (labels, breadcrumbs, legend) directly and snapshots it into a cached
|
|
15
|
+
* bitmap. On hover-only updates, blits the cache and draws only the
|
|
16
|
+
* tooltip + highlight on top.
|
|
17
|
+
*/
|
|
18
|
+
export declare function renderTreemapChromeOverlay(chart: TreemapChart): void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ColumnDataMap } from "../../data/view-reader";
|
|
2
|
+
import type { WebGLContextManager } from "../../webgl/context-manager";
|
|
3
|
+
import { TreeChartBase } from "../common/tree-chart";
|
|
4
|
+
import { type BreadcrumbRegion } from "./treemap-layout";
|
|
5
|
+
export interface TreemapLocations {
|
|
6
|
+
u_resolution: WebGLUniformLocation | null;
|
|
7
|
+
a_position: number;
|
|
8
|
+
a_color: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Treemap chart. Shares tree storage + streaming-pipeline + color-mode
|
|
12
|
+
* state with `TreeChartBase`; adds rectangular layout + WebGL quad
|
|
13
|
+
* rendering + drill / tooltip interactions.
|
|
14
|
+
*/
|
|
15
|
+
export declare class TreemapChart extends TreeChartBase {
|
|
16
|
+
_program: WebGLProgram | null;
|
|
17
|
+
_locations: TreemapLocations | null;
|
|
18
|
+
_positionBuffer: WebGLBuffer | null;
|
|
19
|
+
_colorBuffer: WebGLBuffer | null;
|
|
20
|
+
_vertexCount: number;
|
|
21
|
+
_hoveredNodeId: number;
|
|
22
|
+
_pinnedNodeId: number;
|
|
23
|
+
_breadcrumbRegions: BreadcrumbRegion[];
|
|
24
|
+
_chromeCache: ImageBitmap | null;
|
|
25
|
+
_chromeCacheDirty: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Monotonic generation counter bumped every time the static chrome
|
|
28
|
+
* content changes (a new `drawStaticChrome` call). The async
|
|
29
|
+
* `createImageBitmap` callback captures the current gen at kickoff
|
|
30
|
+
* and only installs the resulting bitmap if its gen is still the
|
|
31
|
+
* most-recent one. Without this, out-of-order bitmap resolutions
|
|
32
|
+
* can store a stale bitmap in `_chromeCache` — any subsequent
|
|
33
|
+
* hover-only overlay call then blits that stale snapshot over the
|
|
34
|
+
* fresh chart, producing "leftover labels / cells" artefacts.
|
|
35
|
+
*/
|
|
36
|
+
_chromeCacheGen: number;
|
|
37
|
+
/**
|
|
38
|
+
* Per-facet drill roots in split_by mode. Key is the facet label
|
|
39
|
+
* (the top-level child of `_rootId`); value is the currently drilled
|
|
40
|
+
* node inside that facet's subtree. Missing keys mean the facet
|
|
41
|
+
* shows its full subtree.
|
|
42
|
+
*/
|
|
43
|
+
_facetDrillRoots: Map<string, number>;
|
|
44
|
+
_facetGrid: import("../../layout/facet-grid").FacetGrid | null;
|
|
45
|
+
/** When `false`, branch nodes at relDepth=1 render as a centered
|
|
46
|
+
* overlay (same style as relDepth=2) and no top-of-rect label
|
|
47
|
+
* reservation is made in `squarify`. Default `true` preserves the
|
|
48
|
+
* legacy title-bar look. */
|
|
49
|
+
_showBranchHeader: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Parallel to `_visibleNodeIds`. Each entry stores the depth of the
|
|
52
|
+
* drill root that owns the corresponding visible node, so render
|
|
53
|
+
* paths can compute `relDepth` uniformly without knowing whether
|
|
54
|
+
* faceting is active. Populated in `renderTreemapFrame` during
|
|
55
|
+
* layout.
|
|
56
|
+
*/
|
|
57
|
+
_visibleBaseDepths: Int32Array | null;
|
|
58
|
+
/**
|
|
59
|
+
* Parallel to `_visibleNodeIds`. The drill-root node id that owns
|
|
60
|
+
* each visible node (= `_currentRootId` in non-facet mode, per-
|
|
61
|
+
* facet drill root in facet mode). Used by hit-testing and chrome
|
|
62
|
+
* to skip the drill-root itself without a separate equality check.
|
|
63
|
+
*/
|
|
64
|
+
_visibleRootIds: Int32Array | null;
|
|
65
|
+
protected tooltipCallbacks(): {
|
|
66
|
+
onHover: (mx: number, my: number) => void;
|
|
67
|
+
onLeave: () => void;
|
|
68
|
+
onClickPre: (mx: number, my: number) => boolean;
|
|
69
|
+
onDblClick: (mx: number, my: number) => void;
|
|
70
|
+
};
|
|
71
|
+
uploadAndRender(glManager: WebGLContextManager, columns: ColumnDataMap, startRow: number, _endRow: number): Promise<void>;
|
|
72
|
+
_fullRender(glManager: WebGLContextManager): void;
|
|
73
|
+
protected destroyInternal(): void;
|
|
74
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renderer mode. `"worker"` runs the chart code in a Web Worker (off
|
|
3
|
+
* the main thread, gets parallelism but pays a postMessage hop on
|
|
4
|
+
* every interaction). `"inprocess"` dynamic-imports the same worker
|
|
5
|
+
* module on the main thread so the bundle stays single-copy without
|
|
6
|
+
* the worker boundary. The two paths share a `MessageChannel`-shaped
|
|
7
|
+
* control protocol — only the handle around it differs.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RUNTIME_MODE: "worker" | "inprocess";
|
|
10
|
+
/**
|
|
11
|
+
* Build-time toggle between the two GL-canvas display strategies.
|
|
12
|
+
*
|
|
13
|
+
* - `"direct"` — host transfers `.webgl-canvas` to the renderer via
|
|
14
|
+
* `transferControlToOffscreen`. The renderer's GL context renders
|
|
15
|
+
* straight into the visible drawing buffer.
|
|
16
|
+
*
|
|
17
|
+
* - `"blit"` — host keeps the visible canvas main-thread with a 2D
|
|
18
|
+
* context. The renderer creates its own internal `OffscreenCanvas`
|
|
19
|
+
* for GL rendering and emits each completed frame as an
|
|
20
|
+
* `ImageBitmap` over the control channel; the host blits the bitmap
|
|
21
|
+
* into the visible canvas via `drawImage`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const RENDER_BLIT_MODE: "direct" | "blit";
|
|
24
|
+
/**
|
|
25
|
+
* Strict-mode validation for `BufferPool.upload`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const BUFFER_POOL_STRICT: boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { View } from "@perspective-dev/client";
|
|
2
|
+
/**
|
|
3
|
+
* A single row's column values, keyed by column name. Numeric columns
|
|
4
|
+
* yield a `number`; string (dictionary) columns yield the decoded
|
|
5
|
+
* `string`; invalid (null) cells yield `null`.
|
|
6
|
+
*/
|
|
7
|
+
export type LazyRow = Map<string, string | number | null>;
|
|
8
|
+
/**
|
|
9
|
+
* On-demand single-row fetcher backing lazy tooltip lookups. Given a
|
|
10
|
+
* view row index, performs `view.with_typed_arrays({start_row, end_row:
|
|
11
|
+
* start_row+1})` and projects the result into a plain `Map`. Concurrent
|
|
12
|
+
* fetches for the same index are deduped into one Promise; resolved
|
|
13
|
+
* rows are cached in a bounded LRU keyed by rowIdx.
|
|
14
|
+
*
|
|
15
|
+
* Invalidation is lifecycle-driven: the owning chart disposes and
|
|
16
|
+
* constructs a new fetcher whenever its underlying view changes (i.e.
|
|
17
|
+
* on each `draw`). In-flight fetches from the prior fetcher still
|
|
18
|
+
* resolve, but callers stamp each fetch with a serial and discard
|
|
19
|
+
* results whose serial no longer matches — so stale rows never reach
|
|
20
|
+
* the tooltip. See the per-chart hover/pin paths for that plumbing.
|
|
21
|
+
*/
|
|
22
|
+
export declare class LazyRowFetcher {
|
|
23
|
+
private _view;
|
|
24
|
+
private _cache;
|
|
25
|
+
private _inFlight;
|
|
26
|
+
private readonly _maxCacheSize;
|
|
27
|
+
constructor(view: View, maxCacheSize?: number);
|
|
28
|
+
fetchRow(rowIdx: number): Promise<LazyRow>;
|
|
29
|
+
private _fetch;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
get isDisposed(): boolean;
|
|
32
|
+
}
|