@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.
Files changed (258) hide show
  1. package/LICENSE.md +193 -0
  2. package/dist/cdn/perspective-viewer-charts.js +3 -0
  3. package/dist/cdn/perspective-viewer-charts.js.map +7 -0
  4. package/dist/esm/axis/axis-primitives.d.ts +24 -0
  5. package/dist/esm/axis/bar-axis.d.ts +51 -0
  6. package/dist/esm/axis/canvas.d.ts +24 -0
  7. package/dist/esm/axis/categorical-axis-core.d.ts +42 -0
  8. package/dist/esm/axis/categorical-axis.d.ts +27 -0
  9. package/dist/esm/axis/facet-chrome.d.ts +13 -0
  10. package/dist/esm/axis/label-geometry.d.ts +41 -0
  11. package/dist/esm/axis/legend.d.ts +44 -0
  12. package/dist/esm/axis/numeric-axis.d.ts +20 -0
  13. package/dist/esm/charts/candlestick/candlestick-build.d.ts +129 -0
  14. package/dist/esm/charts/candlestick/candlestick-interact.d.ts +10 -0
  15. package/dist/esm/charts/candlestick/candlestick-render.d.ts +24 -0
  16. package/dist/esm/charts/candlestick/candlestick.d.ts +144 -0
  17. package/dist/esm/charts/candlestick/glyphs/draw-candlesticks.d.ts +36 -0
  18. package/dist/esm/charts/candlestick/glyphs/draw-ohlc.d.ts +33 -0
  19. package/dist/esm/charts/canvas-types.d.ts +15 -0
  20. package/dist/esm/charts/cartesian/cartesian-build.d.ts +14 -0
  21. package/dist/esm/charts/cartesian/cartesian-interact.d.ts +20 -0
  22. package/dist/esm/charts/cartesian/cartesian-render.d.ts +26 -0
  23. package/dist/esm/charts/cartesian/cartesian.d.ts +239 -0
  24. package/dist/esm/charts/cartesian/glyph.d.ts +53 -0
  25. package/dist/esm/charts/cartesian/glyphs/density.d.ts +142 -0
  26. package/dist/esm/charts/cartesian/glyphs/lines.d.ts +23 -0
  27. package/dist/esm/charts/cartesian/glyphs/points.d.ts +24 -0
  28. package/dist/esm/charts/cartesian/label-interner.d.ts +21 -0
  29. package/dist/esm/charts/cartesian/tooltip-lines.d.ts +11 -0
  30. package/dist/esm/charts/chart-base.d.ts +402 -0
  31. package/dist/esm/charts/chart.d.ts +338 -0
  32. package/dist/esm/charts/common/band-layout.d.ts +32 -0
  33. package/dist/esm/charts/common/categorical-y-chart.d.ts +53 -0
  34. package/dist/esm/charts/common/category-axis-resolver.d.ts +90 -0
  35. package/dist/esm/charts/common/chrome-cache.d.ts +18 -0
  36. package/dist/esm/charts/common/draw-tooltip-box.d.ts +9 -0
  37. package/dist/esm/charts/common/leaf-color.d.ts +33 -0
  38. package/dist/esm/charts/common/node-store.d.ts +81 -0
  39. package/dist/esm/charts/common/tree-chart.d.ts +48 -0
  40. package/dist/esm/charts/common/tree-chrome.d.ts +31 -0
  41. package/dist/esm/charts/common/tree-data.d.ts +54 -0
  42. package/dist/esm/charts/common/visible-extent.d.ts +51 -0
  43. package/dist/esm/charts/heatmap/heatmap-build.d.ts +86 -0
  44. package/dist/esm/charts/heatmap/heatmap-interact.d.ts +19 -0
  45. package/dist/esm/charts/heatmap/heatmap-render.d.ts +19 -0
  46. package/dist/esm/charts/heatmap/heatmap-y-axis.d.ts +46 -0
  47. package/dist/esm/charts/heatmap/heatmap.d.ts +117 -0
  48. package/dist/esm/charts/map/map.d.ts +67 -0
  49. package/dist/esm/charts/registry.d.ts +14 -0
  50. package/dist/esm/charts/series/glyphs/draw-areas.d.ts +30 -0
  51. package/dist/esm/charts/series/glyphs/draw-bars.d.ts +15 -0
  52. package/dist/esm/charts/series/glyphs/draw-lines.d.ts +34 -0
  53. package/dist/esm/charts/series/glyphs/draw-scatter.d.ts +33 -0
  54. package/dist/esm/charts/series/series-build.d.ts +228 -0
  55. package/dist/esm/charts/series/series-interact.d.ts +35 -0
  56. package/dist/esm/charts/series/series-render.d.ts +41 -0
  57. package/dist/esm/charts/series/series-type.d.ts +49 -0
  58. package/dist/esm/charts/series/series.d.ts +317 -0
  59. package/dist/esm/charts/sunburst/sunburst-interact.d.ts +7 -0
  60. package/dist/esm/charts/sunburst/sunburst-layout.d.ts +33 -0
  61. package/dist/esm/charts/sunburst/sunburst-render.d.ts +22 -0
  62. package/dist/esm/charts/sunburst/sunburst.d.ts +85 -0
  63. package/dist/esm/charts/treemap/treemap-interact.d.ts +12 -0
  64. package/dist/esm/charts/treemap/treemap-layout.d.ts +28 -0
  65. package/dist/esm/charts/treemap/treemap-render.d.ts +18 -0
  66. package/dist/esm/charts/treemap/treemap.d.ts +74 -0
  67. package/dist/esm/config.d.ts +27 -0
  68. package/dist/esm/data/lazy-row.d.ts +32 -0
  69. package/dist/esm/data/split-groups.d.ts +20 -0
  70. package/dist/esm/data/view-reader.d.ts +35 -0
  71. package/dist/esm/event-detail.d.ts +28 -0
  72. package/dist/esm/index.d.ts +3 -0
  73. package/dist/esm/interaction/hit-test.d.ts +30 -0
  74. package/dist/esm/interaction/host-sink-dom.d.ts +19 -0
  75. package/dist/esm/interaction/host-sink-message.d.ts +46 -0
  76. package/dist/esm/interaction/lazy-tooltip.d.ts +61 -0
  77. package/dist/esm/interaction/raw-event-forwarder.d.ts +27 -0
  78. package/dist/esm/interaction/spatial-grid.d.ts +15 -0
  79. package/dist/esm/interaction/tooltip-controller.d.ts +193 -0
  80. package/dist/esm/interaction/zoom-controller.d.ts +106 -0
  81. package/dist/esm/interaction/zoom-router.d.ts +48 -0
  82. package/dist/esm/layout/facet-grid.d.ts +126 -0
  83. package/dist/esm/layout/plot-layout.d.ts +104 -0
  84. package/dist/esm/layout/ticks.d.ts +17 -0
  85. package/dist/esm/map/mercator.d.ts +102 -0
  86. package/dist/esm/map/tile-cache.d.ts +38 -0
  87. package/dist/esm/map/tile-layer.d.ts +66 -0
  88. package/dist/esm/map/tile-loader.d.ts +52 -0
  89. package/dist/esm/map/tile-source.d.ts +66 -0
  90. package/dist/esm/perspective-viewer-charts.js +3 -0
  91. package/dist/esm/perspective-viewer-charts.js.map +7 -0
  92. package/dist/esm/plugin/charts.d.ts +40 -0
  93. package/dist/esm/plugin/plugin.d.ts +95 -0
  94. package/dist/esm/render/scheduler.d.ts +41 -0
  95. package/dist/esm/theme/gradient.d.ts +48 -0
  96. package/dist/esm/theme/palette.d.ts +13 -0
  97. package/dist/esm/theme/theme-snapshot.d.ts +7 -0
  98. package/dist/esm/theme/theme.d.ts +53 -0
  99. package/dist/esm/transport/protocol.d.ts +430 -0
  100. package/dist/esm/transport/renderer-transport.d.ts +201 -0
  101. package/dist/esm/utils/css.d.ts +1 -0
  102. package/dist/esm/utils/font-snapshot.d.ts +50 -0
  103. package/dist/esm/webgl/buffer-pool.d.ts +62 -0
  104. package/dist/esm/webgl/context-manager.d.ts +184 -0
  105. package/dist/esm/webgl/gradient-texture.d.ts +17 -0
  106. package/dist/esm/webgl/instanced-attrs.d.ts +44 -0
  107. package/dist/esm/webgl/plot-frame.d.ts +39 -0
  108. package/dist/esm/webgl/program-cache.d.ts +13 -0
  109. package/dist/esm/webgl/shader-manifest.d.ts +53 -0
  110. package/dist/esm/webgl/shader-registry.d.ts +22 -0
  111. package/dist/esm/worker/boot.d.ts +0 -0
  112. package/dist/esm/worker/dispatch.d.ts +9 -0
  113. package/dist/esm/worker/font-loader.d.ts +2 -0
  114. package/dist/esm/worker/renderer.worker.d.ts +115 -0
  115. package/dist/esm/worker/session-host.d.ts +26 -0
  116. package/package.json +47 -0
  117. package/src/css/perspective-viewer-charts.css +95 -0
  118. package/src/ts/axis/axis-primitives.ts +125 -0
  119. package/src/ts/axis/bar-axis.ts +345 -0
  120. package/src/ts/axis/canvas.ts +64 -0
  121. package/src/ts/axis/categorical-axis-core.ts +125 -0
  122. package/src/ts/axis/categorical-axis.ts +716 -0
  123. package/src/ts/axis/facet-chrome.ts +42 -0
  124. package/src/ts/axis/label-geometry.ts +188 -0
  125. package/src/ts/axis/legend.ts +218 -0
  126. package/src/ts/axis/numeric-axis.ts +353 -0
  127. package/src/ts/charts/candlestick/candlestick-build.ts +516 -0
  128. package/src/ts/charts/candlestick/candlestick-interact.ts +256 -0
  129. package/src/ts/charts/candlestick/candlestick-render.ts +387 -0
  130. package/src/ts/charts/candlestick/candlestick.ts +367 -0
  131. package/src/ts/charts/candlestick/glyphs/draw-candlesticks.ts +432 -0
  132. package/src/ts/charts/candlestick/glyphs/draw-ohlc.ts +317 -0
  133. package/src/ts/charts/canvas-types.ts +30 -0
  134. package/src/ts/charts/cartesian/cartesian-build.ts +616 -0
  135. package/src/ts/charts/cartesian/cartesian-interact.ts +355 -0
  136. package/src/ts/charts/cartesian/cartesian-render.ts +948 -0
  137. package/src/ts/charts/cartesian/cartesian.ts +469 -0
  138. package/src/ts/charts/cartesian/glyph.ts +81 -0
  139. package/src/ts/charts/cartesian/glyphs/density.ts +1263 -0
  140. package/src/ts/charts/cartesian/glyphs/lines.ts +320 -0
  141. package/src/ts/charts/cartesian/glyphs/points.ts +239 -0
  142. package/src/ts/charts/cartesian/label-interner.ts +56 -0
  143. package/src/ts/charts/cartesian/tooltip-lines.ts +80 -0
  144. package/src/ts/charts/chart-base.ts +840 -0
  145. package/src/ts/charts/chart.ts +427 -0
  146. package/src/ts/charts/common/band-layout.ts +63 -0
  147. package/src/ts/charts/common/categorical-y-chart.ts +81 -0
  148. package/src/ts/charts/common/category-axis-resolver.ts +314 -0
  149. package/src/ts/charts/common/chrome-cache.ts +79 -0
  150. package/src/ts/charts/common/draw-tooltip-box.ts +84 -0
  151. package/src/ts/charts/common/leaf-color.ts +92 -0
  152. package/src/ts/charts/common/node-store.ts +235 -0
  153. package/src/ts/charts/common/tree-chart.ts +76 -0
  154. package/src/ts/charts/common/tree-chrome.ts +123 -0
  155. package/src/ts/charts/common/tree-data.ts +623 -0
  156. package/src/ts/charts/common/visible-extent.ts +112 -0
  157. package/src/ts/charts/heatmap/heatmap-build.ts +426 -0
  158. package/src/ts/charts/heatmap/heatmap-interact.ts +274 -0
  159. package/src/ts/charts/heatmap/heatmap-render.ts +815 -0
  160. package/src/ts/charts/heatmap/heatmap-y-axis.ts +351 -0
  161. package/src/ts/charts/heatmap/heatmap.ts +368 -0
  162. package/src/ts/charts/map/map.ts +201 -0
  163. package/src/ts/charts/registry.ts +65 -0
  164. package/src/ts/charts/series/glyphs/draw-areas.ts +331 -0
  165. package/src/ts/charts/series/glyphs/draw-bars.ts +113 -0
  166. package/src/ts/charts/series/glyphs/draw-lines.ts +320 -0
  167. package/src/ts/charts/series/glyphs/draw-scatter.ts +328 -0
  168. package/src/ts/charts/series/series-build.ts +848 -0
  169. package/src/ts/charts/series/series-interact.ts +604 -0
  170. package/src/ts/charts/series/series-render.ts +1109 -0
  171. package/src/ts/charts/series/series-type.ts +99 -0
  172. package/src/ts/charts/series/series.ts +794 -0
  173. package/src/ts/charts/sunburst/sunburst-interact.ts +460 -0
  174. package/src/ts/charts/sunburst/sunburst-layout.ts +238 -0
  175. package/src/ts/charts/sunburst/sunburst-render.ts +887 -0
  176. package/src/ts/charts/sunburst/sunburst.ts +248 -0
  177. package/src/ts/charts/treemap/treemap-interact.ts +445 -0
  178. package/src/ts/charts/treemap/treemap-layout.ts +328 -0
  179. package/src/ts/charts/treemap/treemap-render.ts +886 -0
  180. package/src/ts/charts/treemap/treemap.ts +247 -0
  181. package/src/ts/config.ts +41 -0
  182. package/src/ts/data/lazy-row.ts +140 -0
  183. package/src/ts/data/split-groups.ts +97 -0
  184. package/src/ts/data/view-reader.ts +107 -0
  185. package/src/ts/event-detail.ts +44 -0
  186. package/src/ts/index.ts +53 -0
  187. package/src/ts/interaction/hit-test.ts +106 -0
  188. package/src/ts/interaction/host-sink-dom.ts +85 -0
  189. package/src/ts/interaction/host-sink-message.ts +75 -0
  190. package/src/ts/interaction/lazy-tooltip.ts +102 -0
  191. package/src/ts/interaction/raw-event-forwarder.ts +175 -0
  192. package/src/ts/interaction/spatial-grid.ts +100 -0
  193. package/src/ts/interaction/tooltip-controller.ts +407 -0
  194. package/src/ts/interaction/zoom-controller.ts +468 -0
  195. package/src/ts/interaction/zoom-router.ts +230 -0
  196. package/src/ts/layout/facet-grid.ts +346 -0
  197. package/src/ts/layout/plot-layout.ts +277 -0
  198. package/src/ts/layout/ticks.ts +168 -0
  199. package/src/ts/map/mercator.ts +204 -0
  200. package/src/ts/map/tile-cache.ts +96 -0
  201. package/src/ts/map/tile-layer.ts +382 -0
  202. package/src/ts/map/tile-loader.ts +143 -0
  203. package/src/ts/map/tile-source.ts +156 -0
  204. package/src/ts/plugin/charts.ts +286 -0
  205. package/src/ts/plugin/plugin.ts +668 -0
  206. package/src/ts/render/scheduler.ts +339 -0
  207. package/src/ts/shaders/area.frag.glsl +20 -0
  208. package/src/ts/shaders/area.vert.glsl +19 -0
  209. package/src/ts/shaders/bar.frag.glsl +25 -0
  210. package/src/ts/shaders/bar.vert.glsl +60 -0
  211. package/src/ts/shaders/candlestick-body.frag.glsl +19 -0
  212. package/src/ts/shaders/candlestick-body.vert.glsl +34 -0
  213. package/src/ts/shaders/density-extreme.frag.glsl +30 -0
  214. package/src/ts/shaders/density-mrt.frag.glsl +44 -0
  215. package/src/ts/shaders/density-mrt.vert.glsl +48 -0
  216. package/src/ts/shaders/density-resolve.frag.glsl +89 -0
  217. package/src/ts/shaders/density-resolve.vert.glsl +23 -0
  218. package/src/ts/shaders/density-splat.frag.glsl +34 -0
  219. package/src/ts/shaders/density-splat.vert.glsl +52 -0
  220. package/src/ts/shaders/gridline.frag.glsl +18 -0
  221. package/src/ts/shaders/gridline.vert.glsl +18 -0
  222. package/src/ts/shaders/heatmap.frag.glsl +23 -0
  223. package/src/ts/shaders/heatmap.vert.glsl +42 -0
  224. package/src/ts/shaders/line-uniform.frag.glsl +26 -0
  225. package/src/ts/shaders/line-uniform.vert.glsl +54 -0
  226. package/src/ts/shaders/line.frag.glsl +28 -0
  227. package/src/ts/shaders/line.vert.glsl +87 -0
  228. package/src/ts/shaders/scatter.frag.glsl +39 -0
  229. package/src/ts/shaders/scatter.vert.glsl +67 -0
  230. package/src/ts/shaders/sunburst-arc.frag.glsl +19 -0
  231. package/src/ts/shaders/sunburst-arc.vert.glsl +79 -0
  232. package/src/ts/shaders/tile.frag.glsl +27 -0
  233. package/src/ts/shaders/tile.vert.glsl +35 -0
  234. package/src/ts/shaders/treemap.frag.glsl +19 -0
  235. package/src/ts/shaders/treemap.vert.glsl +25 -0
  236. package/src/ts/shaders/y-scatter.frag.glsl +30 -0
  237. package/src/ts/shaders/y-scatter.vert.glsl +31 -0
  238. package/src/ts/theme/gradient.ts +312 -0
  239. package/src/ts/theme/palette.ts +64 -0
  240. package/src/ts/theme/theme-snapshot.ts +66 -0
  241. package/src/ts/theme/theme.ts +166 -0
  242. package/src/ts/transport/protocol.ts +497 -0
  243. package/src/ts/transport/renderer-transport.ts +788 -0
  244. package/src/ts/utils/css.ts +36 -0
  245. package/src/ts/utils/font-snapshot.ts +159 -0
  246. package/src/ts/webgl/buffer-pool.ts +163 -0
  247. package/src/ts/webgl/context-manager.ts +414 -0
  248. package/src/ts/webgl/gradient-texture.ts +84 -0
  249. package/src/ts/webgl/instanced-attrs.ts +139 -0
  250. package/src/ts/webgl/plot-frame.ts +91 -0
  251. package/src/ts/webgl/program-cache.ts +46 -0
  252. package/src/ts/webgl/shader-manifest.ts +148 -0
  253. package/src/ts/webgl/shader-registry.ts +97 -0
  254. package/src/ts/worker/boot.ts +22 -0
  255. package/src/ts/worker/dispatch.ts +99 -0
  256. package/src/ts/worker/font-loader.ts +89 -0
  257. package/src/ts/worker/renderer.worker.ts +734 -0
  258. package/src/ts/worker/session-host.ts +118 -0
@@ -0,0 +1,33 @@
1
+ import type { WebGLContextManager } from "../../../webgl/context-manager";
2
+ import type { SeriesChart } from "../series";
3
+ type GL = WebGL2RenderingContext | WebGLRenderingContext;
4
+ /**
5
+ * Scatter glyph for {@link SeriesChart}. Owns the program + per-axis
6
+ * (position, color) GPU buffers. Single program/buffer set; left and
7
+ * right axes are merged into shared buffers with sub-ranges.
8
+ */
9
+ export declare class ScatterGlyph {
10
+ private _program;
11
+ private _buffers;
12
+ private ensureProgram;
13
+ /**
14
+ * Drop persistent scatter buffer state. The underlying GL buffer
15
+ * objects on `_program` are reused (owned by the program cache,
16
+ * not the per-build buffer view).
17
+ */
18
+ invalidateBuffers(_chart: SeriesChart): void;
19
+ /**
20
+ * Build merged per-axis (position, color) buffers for every visible
21
+ * scatter series and upload them. Hidden series are excluded — call
22
+ * this from data-load and from the legend-toggle path so the GPU
23
+ * buffers always reflect the current visible mask.
24
+ */
25
+ rebuildBuffers(chart: SeriesChart, glManager: WebGLContextManager): void;
26
+ /**
27
+ * Bind the persistent left/right buffers and issue up to two draw
28
+ * calls. No per-frame allocations or buffer uploads.
29
+ */
30
+ draw(chart: SeriesChart, gl: GL, glManager: WebGLContextManager, projLeft: Float32Array, projRight: Float32Array): void;
31
+ destroy(chart: SeriesChart): void;
32
+ }
33
+ export {};
@@ -0,0 +1,228 @@
1
+ import type { ColumnDataMap } from "../../data/view-reader";
2
+ import type { CategoricalLevel } from "../../axis/categorical-axis";
3
+ import { type AxisMode, type NumericCategoryDomain } from "../common/category-axis-resolver";
4
+ import { type ChartType, type ColumnChartConfig } from "./series-type";
5
+ export interface SeriesInfo {
6
+ seriesId: number;
7
+ aggIdx: number;
8
+ splitIdx: number;
9
+ aggName: string;
10
+ splitKey: string;
11
+ label: string;
12
+ color: [number, number, number];
13
+ axis: 0 | 1;
14
+ chartType: ChartType;
15
+ stack: boolean;
16
+ }
17
+ /**
18
+ * Logical bar/area record. Synthesized on demand from {@link BarColumns}
19
+ * via {@link readBarRecord} for tooltip / hover paths. The pipeline never
20
+ * materializes these — see `BarColumns` for the columnar storage that
21
+ * replaces the legacy `SeriesChartRecord[]`.
22
+ */
23
+ export interface SeriesChartRecord {
24
+ catIdx: number;
25
+ aggIdx: number;
26
+ splitIdx: number;
27
+ seriesId: number;
28
+ xCenter: number;
29
+ halfWidth: number;
30
+ y0: number;
31
+ y1: number;
32
+ value: number;
33
+ axis: 0 | 1;
34
+ /**
35
+ * `"bar"` quads or `"area"` strip segments both stack via this record.
36
+ */
37
+ chartType: "bar" | "area";
38
+ }
39
+ export declare const BAR_TYPE_BAR = 0;
40
+ export declare const BAR_TYPE_AREA = 1;
41
+ /**
42
+ * Columnar storage for the bar/area record set. Replaces the legacy
43
+ * `SeriesChartRecord[]` to avoid per-record POJO allocation at scale —
44
+ * with N×M×P potentially in the millions, the array-of-objects layout
45
+ * was the dominant build-time GC pressure.
46
+ *
47
+ * Records are appended in `(catIdx, aggIdx, splitIdx)` lexicographic
48
+ * order — the outer category loop guarantees `catIdx` is monotonically
49
+ * non-decreasing, which the renderer / hit-test use for binary-search
50
+ * narrowing.
51
+ *
52
+ * `count` is the active record count; the underlying typed arrays may
53
+ * be over-allocated for capacity reuse across builds.
54
+ */
55
+ /**
56
+ * Compact columnar storage for the bar/area record set.
57
+ *
58
+ * Three fields the prior schema carried have been dropped because
59
+ * they're cheaply derivable at hover time:
60
+ * - `aggIdx` ← `seriesId / splitCount` (integer division)
61
+ * - `splitIdx` ← `seriesId % splitCount`
62
+ * - `value` ← `samples[catIdx * S + seriesId]`
63
+ *
64
+ * Per-cell write count drops from 11 to 8 (~27% fewer typed-array
65
+ * stores) and per-record memory drops from 58 B to 42 B (~28% lower
66
+ * footprint at scale). `chartType` is kept (1 B / record) — it's
67
+ * read in tight loops in the render and hit-test paths and a string
68
+ * dispatch via `_series[]` would be slower than the byte compare.
69
+ */
70
+ export interface BarColumns {
71
+ count: number;
72
+ catIdx: Int32Array;
73
+ seriesId: Int32Array;
74
+ /**
75
+ * 0 = left axis, 1 = right axis.
76
+ */
77
+ axis: Uint8Array;
78
+ /**
79
+ * {@link BAR_TYPE_BAR} | {@link BAR_TYPE_AREA}.
80
+ */
81
+ chartType: Uint8Array;
82
+ xCenter: Float64Array;
83
+ halfWidth: Float64Array;
84
+ y0: Float64Array;
85
+ y1: Float64Array;
86
+ }
87
+ export declare function emptyBarColumns(): BarColumns;
88
+ /**
89
+ * Reuse `prev`'s typed arrays when capacity is sufficient, else allocate
90
+ * fresh. Resets `count` to 0 either way; pipeline writes from index 0.
91
+ */
92
+ export declare function ensureBarColumnsCapacity(prev: BarColumns | null, capacity: number): BarColumns;
93
+ /**
94
+ * Synthesize a {@link SeriesChartRecord} POJO for record `i`. Used by
95
+ * tooltip / hover paths that hand out a single record reference; not
96
+ * called in any frame-rate hot loop.
97
+ *
98
+ * `splitCount` is `splitPrefixes.length` from the build result (= `P`
99
+ * in pipeline notation). `samples` + `numSeries` recover the raw
100
+ * value from the unstacked sample grid; `samples[catIdx * S + sid]`
101
+ * always carries the same value the pipeline saw when emitting the
102
+ * record (both writes share the same `v` source).
103
+ */
104
+ export declare function readBarRecord(cols: BarColumns, i: number, splitCount: number, samples: Float32Array, numSeries: number): SeriesChartRecord;
105
+ /**
106
+ * Reusable Float64 scratch — chart owns one for `posStack` and one for
107
+ * `negStack`. Pipeline zero-fills the active prefix on entry.
108
+ */
109
+ export declare function ensureFloat64Scratch(prev: Float64Array | null, capacity: number): Float64Array;
110
+ export interface SeriesPipelineInput {
111
+ columns: ColumnDataMap;
112
+ numRows: number;
113
+ columnSlots: (string | null)[];
114
+ groupBy: string[];
115
+ splitBy: string[];
116
+ /**
117
+ * Source-column types for `group_by` columns (table.schema() merged
118
+ * with view.expression_schema()). Used to (a) stringify non-string
119
+ * row-path levels and (b) decide between category and numeric axis
120
+ * mode for single-level group_bys.
121
+ */
122
+ groupByTypes: Record<string, string>;
123
+ columnsConfig: Record<string, ColumnChartConfig> | undefined;
124
+ /**
125
+ * Plugin-scoped default glyph when a column has no explicit entry.
126
+ */
127
+ defaultChartType?: ChartType;
128
+ /**
129
+ * Plugin-config knobs consumed by the build pipeline. Pulled from
130
+ * the chart impl's `_pluginConfig` (sourced from the host's
131
+ * `plugin_config_schema` / `restore({ plugin_config })`):
132
+ *
133
+ * - `autoAltYAxis` — auto-split aggregates onto a secondary Y
134
+ * axis when their magnitude ratio exceeds
135
+ * `DUAL_Y_RATIO_THRESHOLD`. Replaces the `AUTO_ALT_Y_AXIS`
136
+ * compile-time toggle.
137
+ * - `bandInnerFrac` / `barInnerPad` — band-slot geometry forwarded
138
+ * to `computeSlotGeometry`. Replace the `BAND_INNER_FRAC` /
139
+ * `BAR_INNER_PAD` constants.
140
+ */
141
+ autoAltYAxis: boolean;
142
+ bandInnerFrac: number;
143
+ barInnerPad: number;
144
+ /**
145
+ * Anchor value-axis extents to zero. When `true` (bar / area
146
+ * default), `leftDomain` / `rightDomain` are guaranteed to enclose
147
+ * `0` so bars and areas render against their natural baseline.
148
+ * When `false` (line / scatter default), the domain is the raw
149
+ * `min`/`max` of the data — the axis tightens around the visible
150
+ * variation. Maps directly to `PluginConfig.include_zero`.
151
+ */
152
+ includeZero: boolean;
153
+ /**
154
+ * Reusable scratch — pipeline writes records into these in place
155
+ * and zero-fills the stack ladder. Pass the previous build's
156
+ * outputs to amortize allocation across data reloads.
157
+ */
158
+ scratchBars?: BarColumns | null;
159
+ scratchPosStack?: Float64Array | null;
160
+ scratchNegStack?: Float64Array | null;
161
+ }
162
+ export type { NumericCategoryDomain };
163
+ export interface SeriesPipelineResult {
164
+ aggregates: string[];
165
+ splitPrefixes: string[];
166
+ rowPaths: CategoricalLevel[];
167
+ numCategories: number;
168
+ rowOffset: number;
169
+ /**
170
+ * Axis mode discriminator. `category` is the default (zero or
171
+ * many group_by levels, or a single string/boolean level). `numeric`
172
+ * fires for a single non-string non-boolean group_by — bars are
173
+ * positioned by the underlying data value rather than logical
174
+ * category index.
175
+ */
176
+ axisMode: AxisMode;
177
+ /**
178
+ * Populated only when `axisMode.mode === "numeric"`.
179
+ */
180
+ numericCategoryDomain: NumericCategoryDomain | null;
181
+ /**
182
+ * Per-category X coordinate in real data units. Populated only in
183
+ * numeric axis mode — `null` in category mode where catIdx itself
184
+ * is the position. Indexed by `catIdx` (0..numCategories-1).
185
+ */
186
+ categoryPositions: Float64Array | null;
187
+ series: SeriesInfo[];
188
+ /**
189
+ * Columnar bar/area records, one per (catIdx, agg, split) for series
190
+ * where `stack === true && chartType in ["bar", "area"]` (stacked) or
191
+ * `chartType in ["bar", "area"]` with non-zero value (unstacked).
192
+ */
193
+ bars: BarColumns;
194
+ /**
195
+ * Reusable scratch passthrough — these own the stack ladder typed
196
+ * arrays so the next build can reuse capacity.
197
+ */
198
+ posStack: Float64Array | null;
199
+ negStack: Float64Array | null;
200
+ /**
201
+ * Unstacked sample grid: `samples[catIdx * S + seriesId]` is the raw
202
+ * value for that cell. Only valid for non-stacking series (or for
203
+ * stacking series when you need the raw, pre-stack value); the
204
+ * corresponding bit in `sampleValid` indicates whether the cell carries
205
+ * data. `S === series.length`.
206
+ */
207
+ samples: Float32Array;
208
+ sampleValid: Uint8Array;
209
+ leftDomain: {
210
+ min: number;
211
+ max: number;
212
+ };
213
+ rightDomain: {
214
+ min: number;
215
+ max: number;
216
+ } | null;
217
+ hasRightAxis: boolean;
218
+ }
219
+ /**
220
+ * Pure pipeline: turn a raw `ColumnDataMap` into (a) columnar stacked
221
+ * bar/area records and (b) an unstacked `samples` grid for line/scatter
222
+ * glyphs plus non-stacking bar/area series. Holds row_path data as
223
+ * zero-copy views (no materialization of category strings).
224
+ *
225
+ * Automatically splits aggregates across a secondary Y axis when their
226
+ * extents differ by more than {@link DUAL_Y_RATIO_THRESHOLD}×.
227
+ */
228
+ export declare function buildSeriesPipeline(input: SeriesPipelineInput): SeriesPipelineResult;
@@ -0,0 +1,35 @@
1
+ import type { SeriesChart } from "./series";
2
+ import { type SeriesChartRecord } from "./series-build";
3
+ /**
4
+ * Unified accessor for the currently hovered glyph. Returns either the
5
+ * real {@link SeriesChartRecord} from `_bars` (bar / stacked-area hits) or the
6
+ * synthetic one stored in `_hoveredSample` (line / scatter / non-stacked
7
+ * area hits), or `null`.
8
+ */
9
+ export declare function getHoveredBar(chart: SeriesChart): SeriesChartRecord | null;
10
+ /**
11
+ * Handle mouse-move across all glyph types. Tests (in reverse paint order
12
+ * so top glyphs win): scatter points → line points → bars → areas.
13
+ * Updates `_hoveredBarIdx` or `_hoveredSample` and re-renders on change.
14
+ */
15
+ export declare function handleBarHover(chart: SeriesChart, mx: number, my: number): void;
16
+ /**
17
+ * Handle a click on the legend area. Returns true when the click hit a
18
+ * legend entry (the caller should then treat the event as consumed).
19
+ */
20
+ export declare function handleBarLegendClick(chart: SeriesChart, mx: number, my: number): boolean;
21
+ /**
22
+ * Build the per-bar tooltip content lines.
23
+ */
24
+ export declare function buildBarTooltipLines(chart: SeriesChart, b: SeriesChartRecord): string[];
25
+ /**
26
+ * Format the hierarchical path label for a given category index. Used by
27
+ * the tooltip — the axis uses per-level text directly instead.
28
+ */
29
+ export declare function formatBarCategoryPath(chart: SeriesChart, catIdx: number): string;
30
+ export declare function showBarPinnedTooltip(chart: SeriesChart, barIdx: number): void;
31
+ /**
32
+ * Pin a tooltip against a synthetic BarRecord (scatter/line/area hit).
33
+ */
34
+ export declare function showBarPinnedTooltipForSample(chart: SeriesChart, bar: SeriesChartRecord): void;
35
+ export declare function dismissBarPinnedTooltip(chart: SeriesChart): void;
@@ -0,0 +1,41 @@
1
+ import type { WebGLContextManager } from "../../webgl/context-manager";
2
+ import { type SeriesChart } from "./series";
3
+ /**
4
+ * Upload bar instance buffers from the columnar `_bars` storage. Filters
5
+ * to bar-typed records only (areas draw as triangle strips). Skips
6
+ * hidden series. Re-called from data-load and legend-toggle paths; the
7
+ * scratch buffers and `_visibleBarIndices` are reused across calls.
8
+ */
9
+ export declare function uploadBarInstances(chart: SeriesChart, glManager: WebGLContextManager): void;
10
+ /**
11
+ * Re-upload the per-bar color attribute. Short-circuits when the new
12
+ * colors match the last-uploaded snapshot byte-for-byte. Legacy code
13
+ * ran this every frame regardless; with the cached palette now stable
14
+ * across pan/zoom this becomes a no-op except after data load /
15
+ * `restyle()`.
16
+ */
17
+ export declare function uploadBarColors(chart: SeriesChart, glManager: WebGLContextManager): void;
18
+ /**
19
+ * Drop persistent vertex buffers for line / scatter / area glyphs.
20
+ * Called from `uploadAndRender` before {@link rebuildGlyphBuffers}.
21
+ */
22
+ export declare function invalidateGlyphBuffers(chart: SeriesChart): void;
23
+ /**
24
+ * Build persistent vertex buffers for line / scatter / area glyphs.
25
+ * The legacy renderers rebuilt and re-uploaded these every frame inside
26
+ * the per-glyph draw functions; with stable post-build geometry the
27
+ * uploads now happen exactly once per data-load / palette change.
28
+ */
29
+ export declare function rebuildGlyphBuffers(chart: SeriesChart, glManager: WebGLContextManager): void;
30
+ /**
31
+ * Full-frame render: gridlines → WebGL bars (instanced) → chrome overlay.
32
+ */
33
+ export declare function renderBarFrame(chart: SeriesChart, glManager: WebGLContextManager): void;
34
+ /**
35
+ * Draw axes chrome + legend + tooltip onto the overlay canvas.
36
+ */
37
+ export declare function renderBarChromeOverlay(chart: SeriesChart): void;
38
+ export declare function rightAxisDataToPixel(chart: SeriesChart, x: number, y: number): {
39
+ px: number;
40
+ py: number;
41
+ };
@@ -0,0 +1,49 @@
1
+ export type ChartType = "bar" | "line" | "scatter" | "area";
2
+ /**
3
+ * Per-column entry inside the viewer's `columns_config` map. The map itself
4
+ * is typed as `Record<string, any>` at the plugin boundary because
5
+ * `columns_config` is shared across plugins; this interface documents the
6
+ * keys the Y-bar glyph router consumes.
7
+ */
8
+ export interface ColumnChartConfig {
9
+ /**
10
+ * "Bar" | "Line" | "Scatter" | "Area" (case-insensitive). Invalid / missing → bar.
11
+ */
12
+ chart_type?: string;
13
+ /**
14
+ * Explicit stack override. If omitted: bar / area stack by default,
15
+ * line / scatter do not.
16
+ */
17
+ stack?: boolean;
18
+ /**
19
+ * Force this aggregate onto the secondary (right) Y axis,
20
+ * independent of `autoAltYAxis` and the dual-axis ratio
21
+ * heuristic. Missing / false → axis assignment is driven by
22
+ * `autoAltYAxis` alone.
23
+ */
24
+ alt_axis?: boolean;
25
+ }
26
+ /**
27
+ * Resolve the render glyph for an aggregate base name. Lookup key is the
28
+ * *base* (e.g. `"Sales"`); composite arrow columns like `"North|Sales"`
29
+ * should strip the prefix before calling — the bar pipeline already
30
+ * tracks aggregates as base names, so call sites pass the base directly.
31
+ *
32
+ * `fallback` is the plugin's default glyph (e.g. `"line"` for Y Line),
33
+ * supplied by the plugin element via `setDefaultChartType`. Falls back to
34
+ * `"bar"` when the plugin never set one.
35
+ */
36
+ export declare function resolveChartType(aggName: string, cfg: Record<string, ColumnChartConfig> | undefined, fallback?: ChartType): ChartType;
37
+ /**
38
+ * Resolve whether a series stacks with its aggregate siblings.
39
+ * Default: `true` for bar/area, `false` for line/scatter. Overridable
40
+ * per column via `columns_config[aggName].stack`.
41
+ */
42
+ export declare function resolveStack(aggName: string, chartType: ChartType, cfg: Record<string, ColumnChartConfig> | undefined): boolean;
43
+ /**
44
+ * Resolve whether a column is pinned to the secondary Y axis via
45
+ * `columns_config[aggName].alt_axis`. Independent of `autoAltYAxis`:
46
+ * when `true`, the per-column override forces axis 1 regardless of
47
+ * the auto-split heuristic.
48
+ */
49
+ export declare function resolveAltAxis(aggName: string, cfg: Record<string, ColumnChartConfig> | undefined): boolean;