@perspective-dev/viewer-charts 5.2.0 → 5.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 (49) hide show
  1. package/dist/cdn/perspective-viewer-charts.js +2 -2
  2. package/dist/cdn/perspective-viewer-charts.js.map +4 -4
  3. package/dist/esm/charts/candlestick/candlestick-render.d.ts +3 -0
  4. package/dist/esm/charts/cartesian/cartesian.d.ts +1 -0
  5. package/dist/esm/charts/chart-base.d.ts +22 -9
  6. package/dist/esm/charts/chart.d.ts +4 -0
  7. package/dist/esm/charts/common/category-axis-resolver.d.ts +1 -1
  8. package/dist/esm/charts/common/tree-chart.d.ts +1 -0
  9. package/dist/esm/charts/heatmap/heatmap.d.ts +1 -0
  10. package/dist/esm/charts/series/series-type.d.ts +18 -0
  11. package/dist/esm/charts/series/series.d.ts +4 -1
  12. package/dist/esm/charts/sunburst/sunburst-render.d.ts +4 -0
  13. package/dist/esm/perspective-viewer-charts.js +2 -2
  14. package/dist/esm/perspective-viewer-charts.js.map +4 -4
  15. package/dist/esm/plugin/plugin.d.ts +8 -1
  16. package/dist/esm/theme/gradient.d.ts +31 -0
  17. package/dist/esm/theme/overrides.d.ts +19 -0
  18. package/dist/esm/transport/protocol.d.ts +13 -2
  19. package/dist/esm/utils/css.d.ts +4 -0
  20. package/dist/esm/worker/renderer.worker.d.ts +27 -0
  21. package/package.json +1 -1
  22. package/src/ts/charts/candlestick/candlestick-build.ts +1 -0
  23. package/src/ts/charts/candlestick/candlestick-render.ts +8 -0
  24. package/src/ts/charts/candlestick/candlestick.ts +4 -3
  25. package/src/ts/charts/cartesian/cartesian-render.ts +5 -0
  26. package/src/ts/charts/cartesian/cartesian.ts +4 -0
  27. package/src/ts/charts/chart-base.ts +42 -10
  28. package/src/ts/charts/chart.ts +5 -0
  29. package/src/ts/charts/common/category-axis-resolver.ts +44 -5
  30. package/src/ts/charts/common/tree-chart.ts +4 -0
  31. package/src/ts/charts/heatmap/heatmap-build.ts +7 -1
  32. package/src/ts/charts/heatmap/heatmap-interact.ts +10 -1
  33. package/src/ts/charts/heatmap/heatmap-render.ts +5 -0
  34. package/src/ts/charts/heatmap/heatmap.ts +8 -3
  35. package/src/ts/charts/series/series-build.ts +1 -0
  36. package/src/ts/charts/series/series-interact.ts +2 -13
  37. package/src/ts/charts/series/series-render.ts +5 -0
  38. package/src/ts/charts/series/series-type.ts +65 -0
  39. package/src/ts/charts/series/series.ts +21 -8
  40. package/src/ts/charts/sunburst/sunburst-render.ts +9 -0
  41. package/src/ts/charts/treemap/treemap-render.ts +5 -0
  42. package/src/ts/layout/ticks.ts +36 -12
  43. package/src/ts/plugin/plugin.ts +95 -10
  44. package/src/ts/theme/gradient.ts +241 -1
  45. package/src/ts/theme/overrides.ts +76 -0
  46. package/src/ts/transport/protocol.ts +14 -2
  47. package/src/ts/transport/renderer-transport.ts +24 -10
  48. package/src/ts/utils/css.ts +12 -0
  49. package/src/ts/worker/renderer.worker.ts +113 -5
@@ -21,4 +21,7 @@ export declare function invalidateGlyphBuffers(chart: CandlestickChart): void;
21
21
  */
22
22
  export declare function rebuildGlyphBuffers(chart: CandlestickChart, glManager: WebGLContextManager): void;
23
23
  export declare function renderCandlestickFrame(chart: CandlestickChart, glManager: WebGLContextManager): void;
24
+ /**
25
+ * Draw axes chrome + (optional) tooltip onto the overlay canvas.
26
+ */
24
27
  export declare function renderCandlestickChromeOverlay(chart: CandlestickChart): void;
@@ -29,6 +29,7 @@ export interface SplitGroup {
29
29
  export declare class CartesianChart extends AbstractChart {
30
30
  readonly glyph: Glyph;
31
31
  constructor(glyph: Glyph);
32
+ protected colorScaleColumn(): string | null;
32
33
  /**
33
34
  * Rendering pipeline selector. `"cartesian"` is the default —
34
35
  * draws axes, gridlines, and ticks via the chrome canvas.
@@ -57,6 +57,7 @@ export declare abstract class AbstractChart implements ChartImplementation {
57
57
  _glManager: WebGLContextManager | null;
58
58
  _gridlineCanvas: HTMLCanvasElement | OffscreenCanvas | null;
59
59
  _chromeCanvas: HTMLCanvasElement | OffscreenCanvas | null;
60
+ _overlayPresenter: (() => void) | null;
60
61
  /**
61
62
  * 2D-canvas draw closures collected during `_fullRender` (the GL
62
63
  * pass) and flushed by {@link _flush2D} *after* the scheduler's
@@ -163,11 +164,14 @@ export declare abstract class AbstractChart implements ChartImplementation {
163
164
  _emitQueue: Promise<void>;
164
165
  /**
165
166
  * Cached resolved theme — populated on first `_resolveTheme()` call,
166
- * cleared by `invalidateTheme()` (driven from `plugin.restyle()`).
167
- * `getComputedStyle` / `getPropertyValue` reads cost ~100µs each;
168
- * zoom/hover dispatch redraws at 60Hz so we resolve once and reuse.
167
+ * cleared by `invalidateTheme()` (driven from `plugin.restyle()`)
168
+ * and by `setColumnsConfig` (per-column color overrides patch the
169
+ * resolved theme). `getComputedStyle` / `getPropertyValue` reads
170
+ * cost ~100µs each; zoom/hover dispatch redraws at 60Hz so we
171
+ * resolve once and reuse.
169
172
  */
170
173
  _theme: Theme | null;
174
+ _themeColorColumn: string | null;
171
175
  /**
172
176
  * On-demand single-row fetcher used by lazy tooltip column
173
177
  * lookups. Reset on every `setView` call; subclasses read
@@ -181,6 +185,12 @@ export declare abstract class AbstractChart implements ChartImplementation {
181
185
  _lazyRows: LazyRowFetcher | null;
182
186
  setGridlineCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
183
187
  setChromeCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
188
+ setOverlayPresenter(cb: () => void): void;
189
+ /**
190
+ * Present a chrome-overlay repaint that ran outside the scheduler's
191
+ * frame chain.
192
+ */
193
+ presentOverlay(): void;
184
194
  setTheme(vars: Record<string, string>): void;
185
195
  setZoomController(zc: ZoomController): void;
186
196
  /**
@@ -294,12 +304,15 @@ export declare abstract class AbstractChart implements ChartImplementation {
294
304
  * inputs in `uploadAndRender`; they take effect on next data load.
295
305
  */
296
306
  setPluginConfig(cfg: PluginConfig): void;
297
- /**
298
- * Lazily decode the host-supplied theme vars. Subsequent calls hit
299
- * the cache until `invalidateTheme()` clears it. Render-path
300
- * callers should always read theme values through this method so
301
- * the parsed `Theme` (gradient stops, palette, etc.) amortizes
302
- * across an entire frame.
307
+ protected colorScaleColumn(): string | null;
308
+ /**
309
+ * Lazily decode the host-supplied theme vars, then patch in any
310
+ * per-column color-scale override for `colorScaleColumn()`.
311
+ * Subsequent calls hit the cache until `invalidateTheme()` /
312
+ * `setColumnsConfig` clears it or the color column changes.
313
+ * Render-path callers should always read theme values through this
314
+ * method so the parsed `Theme` (gradient stops, palette, etc.)
315
+ * amortizes across an entire frame.
303
316
  */
304
317
  _resolveTheme(): Theme;
305
318
  /**
@@ -59,6 +59,10 @@ export interface ChartImplementation {
59
59
  * Set the chrome canvas (above WebGL, for axes/labels/legend/tooltip).
60
60
  */
61
61
  setChromeCanvas?(canvas: HTMLCanvasElement | OffscreenCanvas): void;
62
+ /**
63
+ * Install the renderer's overlay-present hook.
64
+ */
65
+ setOverlayPresenter?(cb: () => void): void;
62
66
  /**
63
67
  * Hand the chart a pre-computed CSS-variable map produced on the
64
68
  * main thread via `snapshotThemeVars(el)`, which it can decode into
@@ -87,7 +87,7 @@ export declare function synthesizeStringLevel(rp: ColumnData, numRows: number, l
87
87
  * category axis falls back to the raw row index — callers infer that
88
88
  * from `rowPaths.length === 0`.
89
89
  */
90
- export declare function resolveCategoryAxis(columns: ColumnDataMap, numRows: number, groupByLen: number, levelTypes?: string[]): CategoryAxisResult;
90
+ export declare function resolveCategoryAxis(columns: ColumnDataMap, numRows: number, groupByLen: number, levelTypes?: string[], axisMode?: AxisMode): CategoryAxisResult;
91
91
  export interface ValueCategoryColumn {
92
92
  /**
93
93
  * Source aggregate column name; used only for the axis label fallback.
@@ -18,6 +18,7 @@ export declare function firstNonMetadataColumn(columns: ColumnDataMap): string;
18
18
  * layout modules can read/write them without friction.
19
19
  */
20
20
  export declare abstract class TreeChartBase extends AbstractChart {
21
+ protected colorScaleColumn(): string | null;
21
22
  _sizeName: string;
22
23
  _colorName: string;
23
24
  /**
@@ -41,6 +41,7 @@ export interface HeatmapFacet {
41
41
  * scale and a single legend.
42
42
  */
43
43
  export declare class HeatmapChart extends AbstractChart {
44
+ protected colorScaleColumn(): string | null;
44
45
  _program: WebGLProgram | null;
45
46
  _locations: HeatmapLocations | null;
46
47
  _cornerBuffer: WebGLBuffer | null;
@@ -28,6 +28,16 @@ export interface ColumnChartConfig {
28
28
  * `"skip"`). Default `"skip"`. No effect on bar / scatter.
29
29
  */
30
30
  interpolate?: InterpolateMode;
31
+ /**
32
+ * Single series-color override (`#rrggbb`) — the no-`split_by`
33
+ * shape.
34
+ */
35
+ color?: string;
36
+ /**
37
+ * Discrete color palette cycled over this column's split-generated
38
+ * series — the `split_by` shape.
39
+ */
40
+ palette?: string;
31
41
  }
32
42
  /**
33
43
  * Resolve the render glyph for an aggregate base name. Lookup key is the
@@ -45,6 +55,14 @@ export declare function resolveStack(aggName: string, chartType: ChartType, cfg:
45
55
  * `columns_config[aggName].alt_axis`.
46
56
  */
47
57
  export declare function resolveAltAxis(aggName: string, cfg: Record<string, ColumnChartConfig> | undefined): boolean;
58
+ /**
59
+ * Resolve a per-series color override from `columns_config`, or `null`
60
+ * when the theme palette applies.
61
+ */
62
+ export declare function resolveSeriesColorOverride(series: {
63
+ aggName: string;
64
+ splitIdx: number;
65
+ }, facetActive: boolean, cfg: Record<string, ColumnChartConfig> | undefined): [number, number, number] | null;
48
66
  /**
49
67
  * Resolve the interpolation mode for this aggregate.
50
68
  */
@@ -190,13 +190,16 @@ export declare class SeriesChart extends CategoricalYChart {
190
190
  /**
191
191
  * Cached palette + identity-keys for short-circuiting per-frame
192
192
  * resolution. Inputs (`seriesPalette` ref, `gradientStops` ref,
193
- * `series.length`) only change on data load or `restyle()`.
193
+ * `series.length`, `_columnsConfig` ref — per-series color
194
+ * overrides) only change on data load, `restyle()`, or
195
+ * `setColumnsConfig`.
194
196
  */
195
197
  _paletteCache: [number, number, number][] | null;
196
198
  _paletteCacheKey: {
197
199
  seriesPalette: [number, number, number][] | null;
198
200
  gradientStops: unknown;
199
201
  seriesLength: number;
202
+ columnsConfig: unknown;
200
203
  } | null;
201
204
  /**
202
205
  * Reusable scratch for the build pipeline — keeps the stack ladder
@@ -19,4 +19,8 @@ export declare function facetCenterForNode(chart: SunburstChart, nodeId: number)
19
19
  * Full-frame render: layout → WebGL arcs → chrome overlay.
20
20
  */
21
21
  export declare function renderSunburstFrame(chart: SunburstChart, glManager: WebGLContextManager): void;
22
+ /**
23
+ * Render the chrome overlay (labels, center text, hover highlight +
24
+ * tooltip).
25
+ */
22
26
  export declare function renderSunburstChromeOverlay(chart: SunburstChart): void;