@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,24 @@
1
+ import type { Context2D } from "../charts/canvas-types";
2
+ import type { PlotRect } from "../layout/plot-layout";
3
+ export declare const TICK_SIZE = 5;
4
+ /**
5
+ * One horizontal row of numeric axis ticks + labels at CSS-pixel `axisY`.
6
+ * `side` selects tick direction (down into the bottom margin or up into
7
+ * the top margin) and the corresponding label baseline. Caller owns
8
+ * `strokeStyle`, `fillStyle`, `font`, and `lineWidth`.
9
+ */
10
+ export declare function drawXTickRow(ctx: Context2D, plot: PlotRect, ticks: number[], axisY: number, side: "top" | "bottom", xToPixel: (v: number) => number, format: (v: number) => string): void;
11
+ /**
12
+ * One vertical column of numeric axis ticks + labels at CSS-pixel `axisX`.
13
+ * `side` selects tick direction (out toward the left or right margin) and
14
+ * the corresponding label alignment. Caller owns styling state.
15
+ */
16
+ export declare function drawYTickColumn(ctx: Context2D, plot: PlotRect, ticks: number[], axisX: number, side: "left" | "right", yToPixel: (v: number) => number, format: (v: number) => string): void;
17
+ /**
18
+ * Vertical gridlines at numeric X ticks, clipped to `plot`.
19
+ */
20
+ export declare function drawGridlinesX(ctx: Context2D, plot: PlotRect, ticks: number[], xToPixel: (v: number) => number): void;
21
+ /**
22
+ * Horizontal gridlines at numeric Y ticks, clipped to `plot`.
23
+ */
24
+ export declare function drawGridlinesY(ctx: Context2D, plot: PlotRect, ticks: number[], yToPixel: (v: number) => number): void;
@@ -0,0 +1,51 @@
1
+ import type { Canvas2D, Context2D } from "../charts/canvas-types";
2
+ import { PlotLayout } from "../layout/plot-layout";
3
+ import { type CategoricalDomain } from "./categorical-axis";
4
+ import type { AxisDomain } from "./numeric-axis";
5
+ import type { Theme } from "../theme/theme";
6
+ /**
7
+ * The category-axis side of a bar chart can render as either a
8
+ * stringified hierarchical category axis or a true numeric axis (when
9
+ * the single group_by level is date / datetime / integer / float).
10
+ * Both shapes flow through `renderBarAxesChrome`; the discriminator is
11
+ * the `mode` field.
12
+ */
13
+ export type BarCategoryAxis = {
14
+ mode: "category";
15
+ domain: CategoricalDomain;
16
+ } | {
17
+ mode: "numeric";
18
+ domain: AxisDomain;
19
+ ticks: number[];
20
+ };
21
+ /**
22
+ * Render a numeric date-aware axis along the bottom of the plot. Aliases
23
+ * the bar-axis bottom variant so heatmap can share the implementation.
24
+ */
25
+ export declare function drawNumericCategoryX(ctx: Context2D, layout: PlotLayout, domain: AxisDomain, ticks: number[], theme: Theme, formatter?: (v: number) => string): void;
26
+ export declare function drawNumericCategoryY(ctx: Context2D, layout: PlotLayout, domain: AxisDomain, ticks: number[], theme: Theme, formatter?: (v: number) => string): void;
27
+ /**
28
+ * Render bar-chart chrome: L-shaped axis lines, a categorical axis
29
+ * (bottom for Y Bar, left for X Bar), and one or two numeric axes on
30
+ * the opposite sides.
31
+ *
32
+ * `isHorizontal=true` flips orientation for X Bar: categorical axis on
33
+ * the left, numeric axes on the bottom (and top for dual-axis). The
34
+ * `altDomain`/`altTicks` arguments always describe the *secondary*
35
+ * numeric axis regardless of orientation.
36
+ */
37
+ export interface BarAxesFormatters {
38
+ /** Formatter for the value (Y in vertical, X in horizontal) axis. */
39
+ value?: (v: number) => string;
40
+ /** Formatter for the secondary alt value axis. */
41
+ alt?: (v: number) => string;
42
+ /** Formatter for the numeric category axis (when `catAxis.mode === "numeric"`). */
43
+ category?: (v: number) => string;
44
+ }
45
+ export declare function renderBarAxesChrome(canvas: Canvas2D, catAxis: BarCategoryAxis, valueDomain: AxisDomain, valueTicks: number[], layout: PlotLayout, theme: Theme, dpr: number, altDomain?: AxisDomain, altTicks?: number[], isHorizontal?: boolean, formatters?: BarAxesFormatters): void;
46
+ /**
47
+ * Render gridlines at the numeric axis ticks. In vertical bar charts
48
+ * the gridlines run horizontally at numeric Y ticks; in horizontal bar
49
+ * charts they run vertically at numeric X ticks.
50
+ */
51
+ export declare function renderBarGridlines(canvas: Canvas2D, layout: PlotLayout, valueTicks: number[], theme: Theme, dpr: number, isHorizontal?: boolean): void;
@@ -0,0 +1,24 @@
1
+ import type { Canvas2D, Context2D } from "../charts/canvas-types";
2
+ import type { PlotLayout } from "../layout/plot-layout";
3
+ /**
4
+ * Destructive per-frame canvas setup: resize to CSS pixels × DPR,
5
+ * clear, and return a DPR-scaled 2D context. Call this exactly once
6
+ * per canvas per frame — setting `canvas.width` / `canvas.height`
7
+ * always wipes the bitmap and resets the transform, so calling it in
8
+ * a per-facet loop wipes every previously-drawn facet.
9
+ *
10
+ * Faceted renderers call this once per frame and then
11
+ * {@link getScaledContext} per facet to obtain the same context
12
+ * without re-wiping.
13
+ */
14
+ export declare function initCanvas(canvas: Canvas2D, layout: PlotLayout, dpr: number): Context2D | null;
15
+ /**
16
+ * Non-destructive variant: returns the 2D context with its transform
17
+ * forced to `scale(dpr, dpr)` via `setTransform` (idempotent — no
18
+ * stacking). Assumes `initCanvas` was already called on this canvas
19
+ * this frame; does NOT resize or clear.
20
+ *
21
+ * Intended for per-facet render helpers that must not wipe the shared
22
+ * canvas bitmap mid-frame.
23
+ */
24
+ export declare function getScaledContext(canvas: Canvas2D, dpr: number): Context2D | null;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Orientation-neutral helpers shared by the horizontal and vertical
3
+ * hierarchical categorical axes. Both axis painters specialize on top of
4
+ * this core; the only thing they disagree on is where bracket lines and
5
+ * leaf labels land on the plot chrome.
6
+ */
7
+ /**
8
+ * One run of consecutive equal dictionary indices in a level's `indices`
9
+ * array, with the label pre-resolved. Used by the outer-level bracket
10
+ * renderer to coalesce a span of contiguous cells into a single labelled
11
+ * group.
12
+ */
13
+ export interface GroupRun {
14
+ startIdx: number;
15
+ /**
16
+ * Inclusive.
17
+ */
18
+ endIdx: number;
19
+ label: string;
20
+ }
21
+ /**
22
+ * Single-pass run-length encoding of `indices[startRow..endRow)` keyed
23
+ * by `dictionary`. Relies on perspective's guarantee that rows sharing
24
+ * an outer-level dictionary entry are emitted contiguously in traversal
25
+ * order — equal neighbours always belong to the same span. The emitted
26
+ * `label` is a direct reference into `dictionary` (no per-row copy).
27
+ */
28
+ export declare function buildGroupRuns(indices: Int32Array | ArrayLike<number>, dictionary: string[], startRow: number, endRow: number): GroupRun[];
29
+ /**
30
+ * Longest string length in a dictionary. O(dictSize), not O(numRows).
31
+ * Drives the rotation decision on the leaf level of the X axis and the
32
+ * column-width decision on the Y axis.
33
+ */
34
+ export declare function maxDictLength(dictionary: string[]): number;
35
+ /**
36
+ * Filter a precomputed `runs` array to those whose index range
37
+ * intersects `[visMin, visMax]` (inclusive on both sides). Runs that
38
+ * straddle an endpoint are clipped so the caller sees `startIdx`/
39
+ * `endIdx` pinned to the visible slice — this matches the legacy
40
+ * `buildGroupRuns(indices, visMin, visMax + 1)` return shape.
41
+ */
42
+ export declare function runsInRange(runs: GroupRun[], visMin: number, visMax: number): GroupRun[];
@@ -0,0 +1,27 @@
1
+ import type { Context2D } from "../charts/canvas-types";
2
+ import { PlotLayout } from "../layout/plot-layout";
3
+ import { type GroupRun } from "./categorical-axis-core";
4
+ import type { Theme } from "../theme/theme";
5
+ export interface CategoricalLevel {
6
+ labels: string[];
7
+ runs: GroupRun[];
8
+ maxLabelChars: number;
9
+ }
10
+ export interface CategoricalDomain {
11
+ levels: CategoricalLevel[];
12
+ numRows: number;
13
+ levelLabels: string[];
14
+ }
15
+ interface LevelTickLayout {
16
+ size: number;
17
+ rotation: 0 | 45 | 90;
18
+ }
19
+ declare function categoryIndexToPixelX(layout: PlotLayout, index: number): number;
20
+ export declare const categoryIndexToPixel: typeof categoryIndexToPixelX;
21
+ export declare function measureCategoricalLevels(domain: CategoricalDomain, plotWidth: number): LevelTickLayout[];
22
+ export declare function measureCategoricalLevelWidths(domain: CategoricalDomain): number[];
23
+ export declare function measureCategoricalAxisHeight(domain: CategoricalDomain, plotWidth: number): number;
24
+ export declare function measureCategoricalAxisWidth(domain: CategoricalDomain): number;
25
+ export declare function renderCategoricalXTicks(ctx: Context2D, layout: PlotLayout, domain: CategoricalDomain, theme: Theme): void;
26
+ export declare function renderCategoricalYTicks(ctx: Context2D, layout: PlotLayout, domain: CategoricalDomain, theme: Theme): void;
27
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Canvas2D } from "../charts/canvas-types";
2
+ import type { Theme } from "../theme/theme";
3
+ /**
4
+ * Paint a single facet's title strip — one line of centered text in the
5
+ * caller-supplied `rect`. Shared by every faceted chart family
6
+ * (cartesian, heatmap, …) so the title typography stays uniform.
7
+ */
8
+ export declare function drawFacetTitle(canvas: Canvas2D, label: string, rect: {
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ }, theme: Theme, dpr: number): void;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Generic pixel-space label geometry helpers shared by the axis,
3
+ * legend, and tooltip overlays.
4
+ *
5
+ * All rectangles are in CSS pixels, origin top-left, Y-axis pointing down.
6
+ */
7
+ import type { Context2D } from "../charts/canvas-types";
8
+ export interface Rect {
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ }
14
+ export type Rotation = 0 | 45 | 90;
15
+ /**
16
+ * Bounding rectangle of a text label anchored at `(cx, cy)`, accounting for
17
+ * rotation. Matches d3fc's approximation of rotated text bounds.
18
+ */
19
+ export declare function labelRect(cx: number, cy: number, textWidth: number, textHeight: number, rotation: Rotation): Rect;
20
+ export declare function rectsOverlap(a: Rect, b: Rect): boolean;
21
+ /**
22
+ * Rotated-label overlap heuristic from d3fc: for steeply-rotated labels
23
+ * the right edge of the previous box must precede the right edge of the
24
+ * next (plus a small gap).
25
+ */
26
+ export declare function rotatedLabelsOverlap(a: Rect, b: Rect): boolean;
27
+ export declare function rectContained(inner: Rect, outer: Rect): boolean;
28
+ /**
29
+ * Truncate `label` with a trailing ellipsis so the rendered width fits
30
+ * within `maxWidth`. Returns "" when even one character would overflow.
31
+ */
32
+ export declare function truncateLabel(ctx: Context2D, label: string, maxWidth: number): string;
33
+ /**
34
+ * Word-wrap `text` into at most `maxLines` lines, each fitting within
35
+ * `maxWidth`. Breaks at the last whitespace before the fit boundary
36
+ * when possible, falls back to a hard character break otherwise. The
37
+ * final line is ellipsis-truncated via {@link truncateLabel} if it
38
+ * still doesn't fit. Returns `[]` when nothing meaningful fits (only
39
+ * one line of ≤ 2 chars after wrapping).
40
+ */
41
+ export declare function wrapLabel(ctx: Context2D, text: string, maxWidth: number, maxLines: number): string[];
@@ -0,0 +1,44 @@
1
+ import type { Canvas2D } from "../charts/canvas-types";
2
+ import type { PlotLayout, PlotRect } from "../layout/plot-layout";
3
+ import { type GradientStop } from "../theme/gradient";
4
+ import type { Theme } from "../theme/theme";
5
+ /**
6
+ * Render a vertical color gradient legend on the Canvas2D overlay.
7
+ * Only call when a color column is active. When `colorDomain` crosses
8
+ * zero the 50% stop (sign pivot) is annotated with a tick + `0` label.
9
+ *
10
+ * Per-facet wrapper; computes the anchor from `layout` and delegates
11
+ * to {@link renderLegendAt}. Facet grids render one shared gradient
12
+ * legend and pass an explicit rect to `renderLegendAt` directly.
13
+ */
14
+ export declare function renderLegend(canvas: Canvas2D, layout: PlotLayout, colorDomain: {
15
+ min: number;
16
+ max: number;
17
+ label: string;
18
+ }, stops: GradientStop[], theme: Theme, formatter?: (v: number) => string): void;
19
+ /**
20
+ * Render a gradient legend at an explicit canvas-absolute rect.
21
+ * Used by facet grids that paint one legend for the whole grid and
22
+ * by single-plot charts through {@link renderLegend}.
23
+ */
24
+ export declare function renderLegendAt(canvas: Canvas2D, rect: PlotRect, colorDomain: {
25
+ min: number;
26
+ max: number;
27
+ label: string;
28
+ }, stops: GradientStop[], theme: Theme, formatter?: (v: number) => string): void;
29
+ /**
30
+ * Render a categorical legend with discrete colored swatches.
31
+ * Used when split_by or string color columns produce distinct categories.
32
+ *
33
+ * The per-facet wrapper; computes the anchor from `layout` and delegates
34
+ * to {@link renderCategoricalLegendAt}. Facet grids that render one
35
+ * shared legend pass an explicit rect to `renderCategoricalLegendAt`
36
+ * directly.
37
+ */
38
+ export declare function renderCategoricalLegend(canvas: Canvas2D, layout: PlotLayout, labels: Map<string, number>, palette: [number, number, number][], theme: Theme): void;
39
+ /**
40
+ * Render a categorical legend at an explicit canvas-absolute rect.
41
+ * Used by facet grids that paint one legend for the whole grid and by
42
+ * single-plot charts through {@link renderCategoricalLegend}.
43
+ */
44
+ export declare function renderCategoricalLegendAt(canvas: Canvas2D, rect: PlotRect, labels: Map<string, number>, palette: [number, number, number][], theme: Theme): void;
@@ -0,0 +1,20 @@
1
+ import type { Canvas2D } from "../charts/canvas-types";
2
+ import { PlotLayout, type PlotRect } from "../layout/plot-layout";
3
+ import type { Theme } from "../theme/theme";
4
+ export interface AxisDomain {
5
+ min: number;
6
+ max: number;
7
+ label: string;
8
+ isDate?: boolean;
9
+ }
10
+ export interface TickResult {
11
+ xTicks: number[];
12
+ yTicks: number[];
13
+ }
14
+ export declare function computeTicks(xDomain: AxisDomain, yDomain: AxisDomain, layout: PlotLayout): TickResult;
15
+ export declare function renderGridlines(canvas: Canvas2D, layout: PlotLayout, xTicks: number[], yTicks: number[], theme: Theme, dpr: number): void;
16
+ export declare function renderCellXAxis(canvas: Canvas2D, xDomain: AxisDomain, layout: PlotLayout, xTicks: number[], theme: Theme, hasLabel: boolean, dpr: number, formatter?: (v: number) => string): void;
17
+ export declare function renderCellYAxis(canvas: Canvas2D, yDomain: AxisDomain, layout: PlotLayout, yTicks: number[], theme: Theme, hasLabel: boolean, dpr: number, formatter?: (v: number) => string): void;
18
+ export declare function renderAxesChrome(canvas: Canvas2D, xDomain: AxisDomain, yDomain: AxisDomain, layout: PlotLayout, xTicks: number[], yTicks: number[], theme: Theme, dpr: number, xFormatter?: (v: number) => string, yFormatter?: (v: number) => string): void;
19
+ export declare function renderOuterXAxis(canvas: Canvas2D, rect: PlotRect, xDomain: AxisDomain, xTicks: number[], colLayouts: PlotLayout[], theme: Theme, hasLabel: boolean, dpr: number, formatter?: (v: number) => string): void;
20
+ export declare function renderOuterYAxis(canvas: Canvas2D, rect: PlotRect, yDomain: AxisDomain, yTicks: number[], rowLayouts: PlotLayout[], theme: Theme, hasLabel: boolean, dpr: number, formatter?: (v: number) => string): void;
@@ -0,0 +1,129 @@
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
+ export interface CandleSeriesInfo {
5
+ seriesId: number;
6
+ splitIdx: number;
7
+ splitKey: string;
8
+ label: string;
9
+ }
10
+ /**
11
+ * Logical candle record. Synthesized on demand from {@link CandleColumns}
12
+ * via {@link readCandleRecord} for tooltip / hover paths. The pipeline
13
+ * never materializes these — see `CandleColumns` for the columnar
14
+ * storage that replaces the legacy `CandleRecord[]`.
15
+ */
16
+ export interface CandleRecord {
17
+ catIdx: number;
18
+ splitIdx: number;
19
+ seriesId: number;
20
+ xCenter: number;
21
+ halfWidth: number;
22
+ open: number;
23
+ close: number;
24
+ high: number;
25
+ low: number;
26
+ isUp: boolean;
27
+ }
28
+ /**
29
+ * Columnar storage for the candle record set. Replaces the legacy
30
+ * `CandleRecord[]` to avoid per-record POJO allocation at scale.
31
+ *
32
+ * Records are appended in `(splitIdx, catIdx)` order as the pipeline
33
+ * loop is structured (outer split, inner category) — both `xCenter` and
34
+ * `catIdx` are monotonically non-decreasing within a split, which the
35
+ * hit-test uses for binary-search narrowing.
36
+ *
37
+ * `count` is the active record count; the underlying typed arrays may
38
+ * be over-allocated for capacity reuse across builds.
39
+ */
40
+ export interface CandleColumns {
41
+ count: number;
42
+ catIdx: Int32Array;
43
+ splitIdx: Int32Array;
44
+ seriesId: Int32Array;
45
+ xCenter: Float64Array;
46
+ halfWidth: Float64Array;
47
+ open: Float64Array;
48
+ close: Float64Array;
49
+ high: Float64Array;
50
+ low: Float64Array;
51
+ /**
52
+ * 1 = up (close ≥ open), 0 = down.
53
+ */
54
+ isUp: Uint8Array;
55
+ }
56
+ export declare function emptyCandleColumns(): CandleColumns;
57
+ /**
58
+ * Reuse `prev`'s typed arrays when capacity is sufficient, else allocate
59
+ * fresh. Resets `count` to 0; pipeline writes from index 0.
60
+ */
61
+ export declare function ensureCandleColumnsCapacity(prev: CandleColumns | null, capacity: number): CandleColumns;
62
+ /**
63
+ * Synthesize a {@link CandleRecord} POJO for record `i`. Used by
64
+ * tooltip / pinned tooltip / hover return paths; not called in any
65
+ * frame-rate hot loop.
66
+ */
67
+ export declare function readCandleRecord(cols: CandleColumns, i: number): CandleRecord;
68
+ export interface CandlestickPipelineInput {
69
+ columns: ColumnDataMap;
70
+ numRows: number;
71
+ columnSlots: (string | null)[];
72
+ groupBy: string[];
73
+ splitBy: string[];
74
+ /**
75
+ * Source-column types for `group_by` columns. Same shape as the bar
76
+ * pipeline — used to stringify non-string row-paths and to enable
77
+ * numeric-axis mode for a single non-string non-boolean group_by.
78
+ */
79
+ groupByTypes: Record<string, string>;
80
+ /**
81
+ * Band-slot geometry knobs sourced from
82
+ * {@link PluginConfig.band_inner_frac} / `bar_inner_pad`. Forwarded
83
+ * to `computeSlotGeometry`. Replace the `BAND_INNER_FRAC` /
84
+ * `BAR_INNER_PAD` constants.
85
+ */
86
+ bandInnerFrac: number;
87
+ barInnerPad: number;
88
+ /**
89
+ * Reusable scratch — pipeline writes records into the typed arrays
90
+ * in place. Pass the previous build's columns to amortize
91
+ * allocation across data reloads.
92
+ */
93
+ scratchCandles?: CandleColumns | null;
94
+ }
95
+ export type { NumericCategoryDomain };
96
+ export interface CandlestickPipelineResult {
97
+ splitPrefixes: string[];
98
+ rowPaths: CategoricalLevel[];
99
+ numCategories: number;
100
+ rowOffset: number;
101
+ /**
102
+ * Axis mode discriminator (see bar-build for semantics).
103
+ */
104
+ axisMode: AxisMode;
105
+ numericCategoryDomain: NumericCategoryDomain | null;
106
+ /**
107
+ * Per-category X position (real data units) in numeric mode.
108
+ */
109
+ categoryPositions: Float64Array | null;
110
+ series: CandleSeriesInfo[];
111
+ candles: CandleColumns;
112
+ yDomain: {
113
+ min: number;
114
+ max: number;
115
+ };
116
+ }
117
+ /**
118
+ * Pure pipeline: turn a raw `ColumnDataMap` into a columnar
119
+ * {@link CandleColumns}. Column slots (Open / Close / High / Low) mirror
120
+ * d3fc's convention:
121
+ * - `Open` is required.
122
+ * - `Close` falls back to the next row's Open (last row: own Open).
123
+ * - `High` falls back to `max(open, close)`.
124
+ * - `Low` falls back to `min(open, close)`.
125
+ *
126
+ * The fallbacks apply per series when `split_by` is active, so each
127
+ * split reads the "next row" from its own series.
128
+ */
129
+ export declare function buildCandlestickPipeline(input: CandlestickPipelineInput): CandlestickPipelineResult;
@@ -0,0 +1,10 @@
1
+ import type { CandlestickChart } from "./candlestick";
2
+ export declare function handleCandlestickHover(chart: CandlestickChart, mx: number, my: number): void;
3
+ export declare function showCandlestickPinnedTooltip(chart: CandlestickChart, idx: number): void;
4
+ export declare function dismissCandlestickPinnedTooltip(chart: CandlestickChart): void;
5
+ /**
6
+ * Build tooltip lines for candle at index `idx` in the columnar
7
+ * storage. Indexed access avoids materializing a `CandleRecord` POJO
8
+ * on the hot tooltip path.
9
+ */
10
+ export declare function buildCandlestickTooltipLines(chart: CandlestickChart, idx: number): string[];
@@ -0,0 +1,24 @@
1
+ import type { WebGLContextManager } from "../../webgl/context-manager";
2
+ import type { CandlestickChart } from "./candlestick";
3
+ /**
4
+ * Resolve up/down body colors from `theme.gradientStops`. Cached on the
5
+ * chart via `_upDownColorKey` (reference identity of the stops array)
6
+ * — only `restyle()` (which clears the theme cache via
7
+ * `invalidateTheme`) or a data load with a fresh theme triggers
8
+ * resampling. Legacy code re-sampled every frame.
9
+ */
10
+ export declare function ensureUpDownColors(chart: CandlestickChart): void;
11
+ /**
12
+ * Drop persistent body / wick / OHLC vertex buffers. Subsequent draws
13
+ * no-op until the next {@link rebuildGlyphBuffers} call.
14
+ */
15
+ export declare function invalidateGlyphBuffers(chart: CandlestickChart): void;
16
+ /**
17
+ * Rebuild the persistent body / wick / OHLC vertex buffers. Reads
18
+ * `_candles` (columnar) plus the cached `_upColor` / `_downColor` to
19
+ * populate the GPU buffers exactly once per data load. Subsequent pan/
20
+ * zoom redraws bind + dispatch with no uploads.
21
+ */
22
+ export declare function rebuildGlyphBuffers(chart: CandlestickChart, glManager: WebGLContextManager): void;
23
+ export declare function renderCandlestickFrame(chart: CandlestickChart, glManager: WebGLContextManager): void;
24
+ export declare function renderCandlestickChromeOverlay(chart: CandlestickChart): void;
@@ -0,0 +1,144 @@
1
+ import type { ColumnDataMap } from "../../data/view-reader";
2
+ import type { WebGLContextManager } from "../../webgl/context-manager";
3
+ import { CategoricalYChart } from "../common/categorical-y-chart";
4
+ import { type CandleColumns, type CandleSeriesInfo, type NumericCategoryDomain } from "./candlestick-build";
5
+ import { BodyWickGlyph } from "./glyphs/draw-candlesticks";
6
+ import { OHLCGlyph } from "./glyphs/draw-ohlc";
7
+ /**
8
+ * Per-frame memo of the auto-fit Y extent for a {@link CandlestickChart},
9
+ * keyed on the visible X window. Hover-only redraws hit the cache.
10
+ */
11
+ export interface CandlestickAutoFitCache {
12
+ xMin: number;
13
+ xMax: number;
14
+ min: number;
15
+ max: number;
16
+ hasFit: boolean;
17
+ }
18
+ export interface CandlestickLocations {
19
+ u_proj_left: WebGLUniformLocation | null;
20
+ u_proj_right: WebGLUniformLocation | null;
21
+ u_hover_series: WebGLUniformLocation | null;
22
+ a_corner: number;
23
+ a_x_center: number;
24
+ a_half_width: number;
25
+ a_y0: number;
26
+ a_y1: number;
27
+ a_color: number;
28
+ a_series_id: number;
29
+ a_axis: number;
30
+ }
31
+ /**
32
+ * Candlestick / OHLC chart. Both plugins (`y-candlestick`, `y-ohlc`)
33
+ * share this class — the only per-plugin difference is
34
+ * `_defaultChartType` (`"candlestick"` vs `"ohlc"`), which
35
+ * {@link renderCandlestickFrame} uses to pick the glyph draw function.
36
+ *
37
+ * Fields are package-internal (no `private`) so helper modules in this
38
+ * folder can read/write them.
39
+ */
40
+ export declare class CandlestickChart extends CategoricalYChart {
41
+ _locations: CandlestickLocations | null;
42
+ _splitPrefixes: string[];
43
+ _series: CandleSeriesInfo[];
44
+ /**
45
+ * Columnar candle records. Indexed in `[0, _candles.count)`.
46
+ * Replaces the legacy `CandleRecord[]` to avoid per-record POJO
47
+ * allocation on data load.
48
+ */
49
+ _candles: CandleColumns;
50
+ _yDomain: {
51
+ min: number;
52
+ max: number;
53
+ };
54
+ /**
55
+ * `domain_mode: "expand"` accumulators. Hold the running union of
56
+ * the value-axis (and, in numeric-category mode, category-axis)
57
+ * extent across data loads. Cleared in `resetExpandedDomain` —
58
+ * wired from the worker's `resetAllZooms` and from view-config
59
+ * mutations on `AbstractChart`. `null` whenever the option is
60
+ * `"fit"` or the accumulator has just been cleared.
61
+ */
62
+ _expandedYDomain: {
63
+ min: number;
64
+ max: number;
65
+ } | null;
66
+ _expandedCategoryDomain: {
67
+ min: number;
68
+ max: number;
69
+ } | null;
70
+ /**
71
+ * Numeric category-axis state (single non-string group_by).
72
+ */
73
+ _categoryAxisMode: "category" | "numeric";
74
+ _numericCategoryDomain: NumericCategoryDomain | null;
75
+ _categoryPositions: Float64Array | null;
76
+ _lastCatTicks: number[] | null;
77
+ /**
78
+ * Origin used to rebase candle xCenters before f32 narrowing — see {@link SeriesChart._categoryOrigin}.
79
+ */
80
+ _categoryOrigin: number;
81
+ /**
82
+ * Gradient-sampled colors for the up (close ≥ open) / down sides.
83
+ * Cached via `_upDownColorKey` — only `restyle()` (which clears the
84
+ * theme cache) or a data load forces re-sampling.
85
+ */
86
+ _upColor: [number, number, number];
87
+ _downColor: [number, number, number];
88
+ /**
89
+ * Identity of the gradient-stops reference last used to sample the
90
+ * up/down colors. When this matches the current `theme.gradientStops`
91
+ * reference, `ensureUpDownColors` short-circuits.
92
+ */
93
+ _upDownColorKey: unknown;
94
+ _hoveredIdx: number;
95
+ _pinnedIdx: number;
96
+ /**
97
+ * Typed glyph composition. Each glyph owns its own program cache
98
+ * and persistent vertex buffers privately; the chart routes
99
+ * draw/rebuild/invalidate via `_glyphs`. `_defaultChartType`
100
+ * (`"candlestick"` vs `"ohlc"`) selects which glyph the frame
101
+ * builder dispatches to.
102
+ */
103
+ readonly _glyphs: {
104
+ readonly bodyWick: BodyWickGlyph;
105
+ readonly ohlc: OHLCGlyph;
106
+ };
107
+ /**
108
+ * Auto-fit the price (Y) axis to the `low`/`high` extent of
109
+ * candles whose `xCenter` falls inside the visible X window. Pairs
110
+ * with the locked Y axis: the lock means user input can't zoom Y
111
+ * directly, auto-fit is what actually moves it as the user scrolls
112
+ * through time. Default: on (financial-chart convention).
113
+ */
114
+ _autoFitValue: boolean;
115
+ /**
116
+ * Per-frame memo of the auto-fit Y extent keyed on the visible X
117
+ * window. Hover-only redraws (X window unchanged) hit the cache.
118
+ * Reset to null on data upload.
119
+ */
120
+ _autoFitCache: CandlestickAutoFitCache | null;
121
+ protected tooltipCallbacks(): {
122
+ onHover: (mx: number, my: number) => void;
123
+ onLeave: () => void;
124
+ onPin: (mx: number, my: number) => void;
125
+ onUnpin: () => void;
126
+ };
127
+ /**
128
+ * Resolve a clicked candle into a `PerspectiveClickDetail` and
129
+ * emit both `perspective-click` and
130
+ * `perspective-global-filter selected:true`.
131
+ *
132
+ * One candle per (catIdx, splitIdx). Like the series pipeline,
133
+ * `catIdx + _rowOffset` is the source-view row; the column name is
134
+ * the Close column (the canonical "y" target for OHLC). Group-by
135
+ * values come from `_rowPaths`; split-by values come from
136
+ * `_splitPrefixes[splitIdx]` split on `|`.
137
+ */
138
+ private _emitCandleClickSelect;
139
+ invalidateTheme(): void;
140
+ uploadAndRender(glManager: WebGLContextManager, columns: ColumnDataMap, startRow: number, endRow: number): Promise<void>;
141
+ _fullRender(glManager: WebGLContextManager): void;
142
+ resetExpandedDomain(): void;
143
+ protected destroyInternal(): void;
144
+ }
@@ -0,0 +1,36 @@
1
+ import type { WebGLContextManager } from "../../../webgl/context-manager";
2
+ import type { CandlestickChart } from "../candlestick";
3
+ type GL = WebGL2RenderingContext | WebGLRenderingContext;
4
+ /**
5
+ * Candlestick body + wick glyph. Owns the body and wick programs +
6
+ * their corner/segment/instance buffers, and the persistent up/down
7
+ * wick vertex buffers built per data load.
8
+ */
9
+ export declare class BodyWickGlyph {
10
+ private _program;
11
+ private _buffers;
12
+ /**
13
+ * Lazily compile the body and wick programs and create their static
14
+ * GPU buffers (corner / quad). Cached for the lifetime of the chart.
15
+ */
16
+ private ensureProgram;
17
+ /**
18
+ * Drop persistent body + wick vertex buffers. Called from data-load
19
+ * (before `rebuildBuffers`) and from chart-destroy paths.
20
+ */
21
+ invalidateBuffers(chart: CandlestickChart): void;
22
+ /**
23
+ * Pre-build the per-instance body buffer (interleaved
24
+ * [xCenter, halfWidth, y0, y1, r, g, b]) and the up/down wick
25
+ * line-segment buffers. Single GPU upload per buffer per data load.
26
+ */
27
+ rebuildBuffers(chart: CandlestickChart, glManager: WebGLContextManager): void;
28
+ draw(chart: CandlestickChart, gl: GL, glManager: WebGLContextManager, projection: Float32Array): void;
29
+ /**
30
+ * Free program-local GPU buffers + persistent vertex buffers. The
31
+ * shader programs themselves are owned by `WebGLContextManager.shaders`
32
+ * and not freed here.
33
+ */
34
+ destroy(chart: CandlestickChart): void;
35
+ }
36
+ export {};