@wick-charts/vue 0.4.1 → 0.5.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 (146) hide show
  1. package/README.md +5 -3
  2. package/dist/BarSeries.vue.js +44 -0
  3. package/dist/BarSeries.vue2.js +4 -0
  4. package/dist/CandlestickSeries.vue.js +45 -0
  5. package/dist/CandlestickSeries.vue2.js +4 -0
  6. package/dist/ChartContainer.vue.js +168 -0
  7. package/dist/ChartContainer.vue2.js +4 -0
  8. package/dist/LineSeries.vue.js +44 -0
  9. package/dist/LineSeries.vue2.js +4 -0
  10. package/dist/PieSeries.vue.js +34 -0
  11. package/dist/PieSeries.vue2.js +4 -0
  12. package/dist/composables.js +44 -0
  13. package/dist/context.js +25 -0
  14. package/dist/core/dist/animation/animator.js +72 -0
  15. package/dist/core/dist/animation/config.js +145 -0
  16. package/dist/core/dist/animation/easing.js +4 -0
  17. package/dist/core/dist/animation/scalar-spring.js +57 -0
  18. package/dist/core/dist/animation/spring.js +11 -0
  19. package/dist/core/dist/animation/time.js +19 -0
  20. package/dist/core/dist/animation/viewport-engine.js +174 -0
  21. package/dist/core/dist/animation/visible-range-spring.js +64 -0
  22. package/dist/core/dist/animation/y-range-hermite.js +72 -0
  23. package/dist/core/dist/animation/y-range-snap.js +31 -0
  24. package/dist/core/dist/animation/y-range-spring.js +59 -0
  25. package/dist/core/dist/axis/dom-labels.js +60 -0
  26. package/dist/core/dist/canvas-manager.js +109 -0
  27. package/dist/core/dist/chart/edge-indicators.js +26 -0
  28. package/dist/core/dist/chart/fit-to-data.js +9 -0
  29. package/dist/core/dist/chart/last-value.js +31 -0
  30. package/dist/core/dist/chart/options.js +35 -0
  31. package/dist/core/dist/chart/pan-zoom-math.js +66 -0
  32. package/dist/core/dist/chart/streaming-cadence.js +70 -0
  33. package/dist/core/dist/chart/streaming-target.js +22 -0
  34. package/dist/core/dist/chart/viewport-padding.js +6 -0
  35. package/dist/core/dist/chart/y-target.js +24 -0
  36. package/dist/core/dist/chart.js +1495 -0
  37. package/dist/core/dist/components/crosshair.js +9 -0
  38. package/dist/core/dist/components/edge-indicator.js +36 -0
  39. package/dist/core/dist/components/grid.js +22 -0
  40. package/dist/core/dist/components/marker.js +41 -0
  41. package/dist/core/dist/components/reference-line.js +48 -0
  42. package/dist/core/dist/components/time-region.js +35 -0
  43. package/dist/core/dist/data/decimation.js +54 -0
  44. package/dist/core/dist/data/store.js +76 -0
  45. package/dist/core/dist/data/sync.js +47 -0
  46. package/dist/core/dist/events.js +19 -0
  47. package/dist/core/dist/interactions/handler.js +84 -0
  48. package/dist/core/dist/interactions/pan.js +26 -0
  49. package/dist/core/dist/interactions/zoom.js +21 -0
  50. package/dist/core/dist/navigator/controller.js +374 -0
  51. package/dist/core/dist/navigator/decimate.js +44 -0
  52. package/dist/core/dist/navigator/interactions.js +28 -0
  53. package/dist/core/dist/navigator/render.js +68 -0
  54. package/dist/core/dist/perf/counting-context.js +19 -0
  55. package/dist/core/dist/perf/perf-hud.js +453 -0
  56. package/dist/core/dist/perf/perf-monitor.js +132 -0
  57. package/dist/core/dist/render-scheduler.js +31 -0
  58. package/dist/core/dist/scales/tick-tracker.js +110 -0
  59. package/dist/core/dist/scales/x-scale.js +145 -0
  60. package/dist/core/dist/scales/y-scale.js +156 -0
  61. package/dist/core/dist/series/bar.js +341 -0
  62. package/dist/core/dist/series/base-multi-layer.js +438 -0
  63. package/dist/core/dist/series/candlestick.js +481 -0
  64. package/dist/core/dist/series/definition.js +11 -0
  65. package/dist/core/dist/series/line.js +446 -0
  66. package/dist/core/dist/series/painters/builtins.js +36 -0
  67. package/dist/core/dist/series/painters/canvas-path.js +79 -0
  68. package/dist/core/dist/series/painters/resolve.js +32 -0
  69. package/dist/core/dist/series/pie.js +545 -0
  70. package/dist/core/dist/series/register-builtins.js +11 -0
  71. package/dist/core/dist/series/stack-math.js +17 -0
  72. package/dist/core/dist/snapshots.js +107 -0
  73. package/dist/core/dist/theme/create.js +176 -0
  74. package/dist/core/dist/theme/resolve.js +14 -0
  75. package/dist/core/dist/theme/themes/andromeda.js +33 -0
  76. package/dist/core/dist/theme/themes/ayu-mirage.js +33 -0
  77. package/dist/core/dist/theme/themes/catppuccin.js +33 -0
  78. package/dist/core/dist/theme/themes/dracula.js +35 -0
  79. package/dist/core/dist/theme/themes/github-light.js +34 -0
  80. package/dist/core/dist/theme/themes/gruvbox.js +33 -0
  81. package/dist/core/dist/theme/themes/handwritten.js +101 -0
  82. package/dist/core/dist/theme/themes/high-contrast.js +33 -0
  83. package/dist/core/dist/theme/themes/lavender-mist.js +33 -0
  84. package/dist/core/dist/theme/themes/light-pink.js +34 -0
  85. package/dist/core/dist/theme/themes/material-palenight.js +33 -0
  86. package/dist/core/dist/theme/themes/minimal-light.js +34 -0
  87. package/dist/core/dist/theme/themes/mint-breeze.js +33 -0
  88. package/dist/core/dist/theme/themes/monokai-pro.js +33 -0
  89. package/dist/core/dist/theme/themes/night-owl.js +35 -0
  90. package/dist/core/dist/theme/themes/one-dark-pro.js +33 -0
  91. package/dist/core/dist/theme/themes/panda.js +33 -0
  92. package/dist/core/dist/theme/themes/peach-cream.js +33 -0
  93. package/dist/core/dist/theme/themes/quiet-light.js +37 -0
  94. package/dist/core/dist/theme/themes/rose-pine-dawn.js +33 -0
  95. package/dist/core/dist/theme/themes/sand-dune.js +33 -0
  96. package/dist/core/dist/theme/themes/solarized-light.js +34 -0
  97. package/dist/core/dist/tooltip-position.js +10 -0
  98. package/dist/core/dist/utils/color.js +37 -0
  99. package/dist/core/dist/utils/format.js +29 -0
  100. package/dist/core/dist/utils/math.js +26 -0
  101. package/dist/core/dist/utils/poisoned-data-reporter.js +15 -0
  102. package/dist/core/dist/utils/time.js +41 -0
  103. package/dist/index.d.ts +1096 -63
  104. package/dist/index.js +142 -7754
  105. package/dist/ui/Crosshair.vue.js +53 -0
  106. package/dist/ui/Crosshair.vue2.js +4 -0
  107. package/dist/ui/InfoBar.vue.js +143 -0
  108. package/dist/ui/InfoBar.vue2.js +4 -0
  109. package/dist/ui/Legend.vue.js +212 -0
  110. package/dist/ui/Legend.vue2.js +4 -0
  111. package/dist/ui/Marker.vue.js +47 -0
  112. package/dist/ui/Marker.vue2.js +4 -0
  113. package/dist/ui/Navigator.vue.js +58 -0
  114. package/dist/ui/Navigator.vue2.js +4 -0
  115. package/dist/ui/NumberFlow.vue.js +69 -0
  116. package/dist/ui/NumberFlow.vue2.js +4 -0
  117. package/dist/ui/PieLegend.vue.js +132 -0
  118. package/dist/ui/PieLegend.vue2.js +4 -0
  119. package/dist/ui/PieTooltip.vue.js +135 -0
  120. package/dist/ui/PieTooltip.vue2.js +4 -0
  121. package/dist/ui/ReferenceLine.vue.js +44 -0
  122. package/dist/ui/ReferenceLine.vue2.js +4 -0
  123. package/dist/ui/TimeAxis.vue.js +43 -0
  124. package/dist/ui/TimeAxis.vue2.js +4 -0
  125. package/dist/ui/TimeRegion.vue.js +41 -0
  126. package/dist/ui/TimeRegion.vue2.js +4 -0
  127. package/dist/ui/Title.vue.js +54 -0
  128. package/dist/ui/Title.vue2.js +4 -0
  129. package/dist/ui/Tooltip.vue.js +195 -0
  130. package/dist/ui/Tooltip.vue2.js +4 -0
  131. package/dist/ui/YAxis.vue.js +42 -0
  132. package/dist/ui/YAxis.vue2.js +4 -0
  133. package/dist/ui/YLabel.vue.js +105 -0
  134. package/dist/ui/YLabel.vue2.js +4 -0
  135. package/package.json +2 -2
  136. package/src/BarSeries.vue +12 -13
  137. package/src/CandlestickSeries.vue +17 -6
  138. package/src/LineSeries.vue +12 -13
  139. package/src/PieSeries.vue +2 -1
  140. package/src/composables.ts +12 -2
  141. package/src/index.ts +42 -0
  142. package/src/ui/Crosshair.vue +28 -3
  143. package/src/ui/Legend.vue +1 -2
  144. package/src/ui/Marker.vue +62 -0
  145. package/src/ui/ReferenceLine.vue +58 -0
  146. package/src/ui/TimeRegion.vue +54 -0
package/dist/index.d.ts CHANGED
@@ -26,32 +26,45 @@ position: "bottom" | "right";
26
26
  mode: LegendMode;
27
27
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
28
28
 
29
- declare const __VLS_component_4: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {
29
+ declare const __VLS_component_4: DefineComponent<__VLS_Props_11, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_11> & Readonly<{}>, {
30
30
  position: PieLegendPosition;
31
31
  format: ValueFormatter;
32
32
  mode: PieLegendMode;
33
33
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
34
34
 
35
- declare const __VLS_component_5: DefineComponent<__VLS_Props_11, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_11> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
35
+ declare const __VLS_component_5: DefineComponent<__VLS_Props_12, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_12> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
36
36
  containerRef: HTMLDivElement;
37
37
  }, any>;
38
38
 
39
- declare const __VLS_component_6: DefineComponent<__VLS_Props_13, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_13> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
39
+ declare const __VLS_component_6: DefineComponent<__VLS_Props_16, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_16> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
40
40
 
41
- declare const __VLS_component_7: DefineComponent<__VLS_Props_14, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_14> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
41
+ declare const __VLS_component_7: DefineComponent<__VLS_Props_17, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_17> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
42
42
  containerRef: HTMLDivElement;
43
43
  }, any>;
44
44
 
45
- declare const __VLS_component_8: DefineComponent<__VLS_Props_16, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_16> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
45
+ declare const __VLS_component_8: DefineComponent<__VLS_Props_19, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_19> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
46
46
 
47
47
  declare type __VLS_Props = {
48
- data: TimePoint[][];
48
+ /** Flat `TimePoint[]`, `TimePoint[][]`, or named `{ label, color?, data }` layers. Time accepts ms or `Date`. */
49
+ data: MultiLayerData;
49
50
  options?: Partial<BarSeriesOptions>;
50
51
  /** Stable series ID — same value across remounts. */
51
52
  id?: string;
52
53
  };
53
54
 
54
55
  declare type __VLS_Props_10 = {
56
+ value: number;
57
+ /**
58
+ * Value-to-string formatter. Defaults to the current locale's
59
+ * `Intl.NumberFormat` when omitted. `Intl.NumberFormatOptions` is also
60
+ * accepted (legacy) — routed through the built-in `Intl.NumberFormat`.
61
+ */
62
+ format?: ((value: number) => string) | Intl.NumberFormatOptions;
63
+ locale?: string;
64
+ spinDuration?: number;
65
+ };
66
+
67
+ declare type __VLS_Props_11 = {
55
68
  /**
56
69
  * Owning series id. **Optional** — when omitted, the first visible pie
57
70
  * series is picked.
@@ -65,7 +78,7 @@ declare type __VLS_Props_10 = {
65
78
  position?: PieLegendPosition;
66
79
  };
67
80
 
68
- declare type __VLS_Props_11 = {
81
+ declare type __VLS_Props_12 = {
69
82
  /**
70
83
  * Owning series id. **Optional** — when omitted, the first visible pie
71
84
  * series is picked.
@@ -75,14 +88,42 @@ declare type __VLS_Props_11 = {
75
88
  format?: ValueFormatter;
76
89
  };
77
90
 
78
- declare type __VLS_Props_12 = {
91
+ declare type __VLS_Props_13 = {
92
+ /** Horizontal line at this Y data value. Mutually exclusive with `time`. */
93
+ value?: number;
94
+ /** Vertical line at this `time` (epoch ms or `Date`). Mutually exclusive with `value`. */
95
+ time?: TimeValue;
96
+ /** Line and label-pill color. Default: the theme line color. */
97
+ color?: string;
98
+ /** Optional text label drawn in a pill at the line's near end. */
99
+ label?: string;
100
+ /** Dash style. Default: `'dashed'`. */
101
+ style?: ReferenceLineStyle;
102
+ /** Stroke width in CSS pixels. Default: `1`. */
103
+ width?: number;
104
+ };
105
+
106
+ declare type __VLS_Props_14 = {
79
107
  /** Desired number of labels (≥ 2). Overrides chart-level `axis.x.labelCount`. */
80
108
  labelCount?: number;
81
109
  /** Minimum pixel gap between adjacent labels (hard floor). Overrides chart-level. */
82
110
  minLabelSpacing?: number;
83
111
  };
84
112
 
85
- declare type __VLS_Props_13 = {
113
+ declare type __VLS_Props_15 = {
114
+ /** Left edge — epoch ms or a `Date`. */
115
+ from: TimeValue;
116
+ /** Right edge — epoch ms or a `Date`. Omit (or pass `'now'`) for an open-ended band to the right edge. */
117
+ to?: TimeRegionEnd;
118
+ /** Band fill — any CSS color, typically translucent. Default: a faint tint of `color`. */
119
+ fill?: string;
120
+ /** Optional text label drawn in a pill at the top of the band. */
121
+ label?: string;
122
+ /** Edge-line and label-pill accent. Default: the theme's muted axis text color. */
123
+ color?: string;
124
+ };
125
+
126
+ declare type __VLS_Props_16 = {
86
127
  /**
87
128
  * @deprecated Use the named `sub` slot instead — it accepts arbitrary
88
129
  * inline markup (icons, badges, formatted text) to mirror React's
@@ -96,12 +137,12 @@ declare type __VLS_Props_13 = {
96
137
  sub?: string;
97
138
  };
98
139
 
99
- declare type __VLS_Props_14 = {
140
+ declare type __VLS_Props_17 = {
100
141
  sort?: SnapshotSort;
101
142
  format?: TooltipFormatter;
102
143
  };
103
144
 
104
- declare type __VLS_Props_15 = {
145
+ declare type __VLS_Props_18 = {
105
146
  /** Custom tick-label formatter. Overrides the built-in range-adaptive default. */
106
147
  format?: ValueFormatter;
107
148
  /**
@@ -113,7 +154,7 @@ declare type __VLS_Props_15 = {
113
154
  minLabelSpacing?: number;
114
155
  };
115
156
 
116
- declare type __VLS_Props_16 = {
157
+ declare type __VLS_Props_19 = {
117
158
  /**
118
159
  * Owning series id. **Optional** — when omitted, the first visible
119
160
  * single-layer time series is picked, falling back to the first visible
@@ -126,7 +167,8 @@ declare type __VLS_Props_16 = {
126
167
  };
127
168
 
128
169
  declare type __VLS_Props_2 = {
129
- data: OHLCInput[];
170
+ /** Flat `OHLCInput[]`, or `{ label, data }` to name the stream. */
171
+ data: CandlestickData;
130
172
  options?: Partial<CandlestickSeriesOptions>;
131
173
  /** Stable series ID — same value across remounts. */
132
174
  id?: string;
@@ -214,7 +256,8 @@ declare type __VLS_Props_3 = {
214
256
  };
215
257
 
216
258
  declare type __VLS_Props_4 = {
217
- data: TimePoint[][];
259
+ /** Flat `TimePoint[]`, `TimePoint[][]`, or named `{ label, color?, data }` layers. Time accepts ms or `Date`. */
260
+ data: MultiLayerData;
218
261
  options?: Partial<LineSeriesOptions>;
219
262
  /** Stable series ID — same value across remounts. */
220
263
  id?: string;
@@ -240,21 +283,26 @@ declare type __VLS_Props_7 = {
240
283
  };
241
284
 
242
285
  declare type __VLS_Props_8 = {
243
- data: NavigatorData;
244
- /** Strip height in CSS pixels. Defaults to `theme.navigator.height` (60). */
245
- height?: number;
286
+ /** X anchor — epoch ms or a `Date`. */
287
+ time: TimeValue;
288
+ /** Y anchor as a data value. Omit and set `seriesId` to snap to that series' value at `time`. */
289
+ value?: number;
290
+ /** Snap Y to this series' value at `time` when `value` is omitted. Also the default color source. */
291
+ seriesId?: string;
292
+ /** Glyph at the anchor. Default: `'dot'`. Arrows point their tip at the anchor. */
293
+ shape?: MarkerShape;
294
+ /** Reuse the line pulse halo around the anchor. Default: `false`. */
295
+ pulse?: boolean;
296
+ /** Optional text label drawn in a pill next to the anchor. */
297
+ label?: string;
298
+ /** Color override. Falls back to the series color (when `seriesId` is set), then the theme line color. */
299
+ color?: string;
246
300
  };
247
301
 
248
302
  declare type __VLS_Props_9 = {
249
- value: number;
250
- /**
251
- * Value-to-string formatter. Defaults to the current locale's
252
- * `Intl.NumberFormat` when omitted. `Intl.NumberFormatOptions` is also
253
- * accepted (legacy) — routed through the built-in `Intl.NumberFormat`.
254
- */
255
- format?: ((value: number) => string) | Intl.NumberFormatOptions;
256
- locale?: string;
257
- spinDuration?: number;
303
+ data: NavigatorData;
304
+ /** Strip height in CSS pixels. Defaults to `theme.navigator.height` (60). */
305
+ height?: number;
258
306
  };
259
307
 
260
308
  declare function __VLS_template(): {
@@ -815,14 +863,49 @@ export declare const ayuMirage: ThemePreset;
815
863
  */
816
864
  declare type BarEntryAnimation = 'none' | 'fade' | 'grow' | 'slide' | 'fade-grow';
817
865
 
866
+ /** Post-transform bitmap rectangle a bar painter fills. */
867
+ declare interface BarGeometry {
868
+ x: number;
869
+ y: number;
870
+ width: number;
871
+ height: number;
872
+ /** The edge the bar grows from — the zero line, or the segment's own base. */
873
+ baselineY: number;
874
+ }
875
+
876
+ /** Arguments handed to a {@link BarPainter} once per bar / stacked segment. */
877
+ export declare interface BarPaintArgs {
878
+ geom: BarGeometry;
879
+ /** Semantic fill color — the legend / tooltip source of truth. */
880
+ color: string;
881
+ /**
882
+ * Free-end-aware corner mask. The renderer computed this from the draw mode
883
+ * (single / overlap / stacked-positive / stacked-negative / percent). A square
884
+ * bar arrives as all-false.
885
+ */
886
+ corners: CornerMask;
887
+ /** Resolved, pre-clamped bitmap radius. `0` means square. */
888
+ radius: number;
889
+ /**
890
+ * Entrance progress 0→1; advisory only — `geom` is already transformed by it.
891
+ * Forced to `1` when `isProjected` (a forecast bar doesn't "arrive").
892
+ */
893
+ progress: number;
894
+ /** Ghost / forecast flag derived from the series' `projectedFrom`. */
895
+ isProjected: boolean;
896
+ }
897
+
898
+ /** Paints one bar / stacked segment. Owns its fill — it calls `ctx.fill()`. */
899
+ export declare type BarPainter = (env: PaintEnv, args: BarPaintArgs) => void;
900
+
818
901
  export declare const BarSeries: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
819
902
 
903
+ /** Series definition for `chart.addSeries` — keeps the chart renderer-agnostic
904
+ * so hosts that never render bars don't bundle this module. */
905
+ export declare const BarSeriesDef: SeriesDefinition<BarSeriesOptions>;
906
+
820
907
  /** Visual options for a bar series. */
821
908
  export declare interface BarSeriesOptions {
822
- /** Display label shown in the tooltip (e.g. "Volume"). */
823
- label?: string;
824
- /** One color per layer. */
825
- colors: string[];
826
909
  /** Width of each bar as a fraction of the available bar slot (0–1). `1` = bars touch; `0.6` = roughly 60 % of the slot. Default: 0.7. */
827
910
  barWidthRatio: number;
828
911
  /** Stacking mode. Default: 'off'. */
@@ -874,6 +957,207 @@ export declare interface BarSeriesOptions {
874
957
  * disable that wins over this field.
875
958
  */
876
959
  smoothMs?: number | false;
960
+ /**
961
+ * Free-end corner radius in CSS pixels. Default: `4`. `0` is byte-identical to
962
+ * the pre-rounding square output. The radius is clamped to half the smaller
963
+ * bar dimension, so thin bars / sub-radius segments degrade to flat.
964
+ *
965
+ * The renderer decides which edge is "free" per draw mode — a positive bar
966
+ * rounds its top, a negative bar its bottom, and in a stack only the topmost
967
+ * (or bottommost) segment per column rounds, interior segments stay square.
968
+ * `anchor` is orthogonal: rounding operates on the already-offset rect.
969
+ */
970
+ cornerRadius?: number;
971
+ /**
972
+ * Custom bar painter — a raw `BarPainter` function that owns the bar fill.
973
+ * Leave unset for the built-in rounded fill (driven by `cornerRadius`). Read
974
+ * fresh each frame; a new function reference is honored on the next render
975
+ * regardless of wrapper change-detection. Keep it a stable reference (module
976
+ * scope or `useCallback`) so the wrapper diffs it cleanly. A throw falls back
977
+ * to the default fill.
978
+ */
979
+ barPainter?: BarPainter;
980
+ /**
981
+ * Time (epoch ms) at/after which bars are flagged as projected / forecast
982
+ * "ghost" bars. The default painter fills those with a translucent derivative
983
+ * of their color; projected bars also skip the entrance transform so the ghost
984
+ * never double-fades. Omitted: no projected bars.
985
+ */
986
+ projectedFrom?: number;
987
+ }
988
+
989
+ /**
990
+ * Members shared by every series renderer, regardless of whether it owns a
991
+ * time axis. Chart dispatches these uniformly; type-specific behavior is
992
+ * opted into via the optional members below.
993
+ *
994
+ * Single-layer renderers (Candlestick, Pie) default most layer methods to no-ops.
995
+ * Multi-layer renderers (Line, Bar) override them against each internal store.
996
+ *
997
+ * Time-series data queries are NOT here — they live on {@link TimeSeriesRenderer}
998
+ * as required methods, so Chart narrows via `kind !== 'pie'` and calls them
999
+ * directly (no optional chaining).
1000
+ */
1001
+ declare interface BaseSeriesRenderer {
1002
+ /** Paint the series on the main layer. */
1003
+ render(ctx: SeriesRenderContext): void;
1004
+ /**
1005
+ * Replace the series' data. For multi-layer renderers (Line, Bar), `layerIndex`
1006
+ * selects which internal store to target; defaults to 0.
1007
+ */
1008
+ setData(data: unknown, layerIndex?: number): void;
1009
+ /** Append a single point (real-time tick). Optional — not all renderers support streaming. */
1010
+ appendPoint?(point: unknown, layerIndex?: number): void;
1011
+ /** Replace the last point in place (live candle update). Optional. */
1012
+ updateLastPoint?(point: unknown, layerIndex?: number): void;
1013
+ /**
1014
+ * Keep only the last `count` points; drop the oldest. No-op when the series
1015
+ * is already at or below the cap. Smooth Y-range update — does NOT trigger
1016
+ * the snap that {@link setData} forces.
1017
+ */
1018
+ keepLast?(count: number, layerIndex?: number): void;
1019
+ /** Number of visual layers the renderer owns. Default: 1. */
1020
+ getLayerCount(): number;
1021
+ /** Show/hide a layer. No-op for single-layer renderers. */
1022
+ setLayerVisible(index: number, visible: boolean): void;
1023
+ /** Current visibility of a layer. */
1024
+ isLayerVisible(index: number): boolean;
1025
+ /** Per-layer colors. Single-layer renderers return `[primary]`. */
1026
+ getLayerColors(): string[];
1027
+ /**
1028
+ * Set per-layer color overrides carried in `data` (sparse — `undefined` keeps
1029
+ * the theme base). Only multi-layer (line / bar) renderers implement it.
1030
+ */
1031
+ setColorOverrides?(overrides: (ValueColor | undefined)[]): void;
1032
+ /** Apply a new theme. Each renderer decides what that means for itself. */
1033
+ applyTheme(theme: ChartTheme, prevTheme: ChartTheme): void;
1034
+ /**
1035
+ * Shallow-merge new visual options into the renderer's configuration.
1036
+ * Each renderer narrows the parameter in its concrete signature.
1037
+ */
1038
+ updateOptions(options: any): void;
1039
+ /**
1040
+ * Hit-test a bitmap-space coordinate; return the hovered index or -1. Optional.
1041
+ * `padding` is in **bitmap pixels** (already scaled by `verticalPixelRatio`)
1042
+ * so its values align with the `bx`/`by`/`bitmapWidth`/`bitmapHeight` arguments
1043
+ * — the hit area then matches the painted geometry exactly.
1044
+ */
1045
+ hitTest?(bx: number, by: number, bitmapWidth: number, bitmapHeight: number, padding?: RenderPadding): number;
1046
+ /** Set the currently hovered index. Returns true if the value changed. Optional. */
1047
+ setHoverIndex?(index: number): boolean;
1048
+ /** Get info about the currently hovered element, or null. Optional. */
1049
+ getHoverInfo?(theme: ChartTheme): HoverInfo | null;
1050
+ /** Pie-style breakdown of all elements. Optional. */
1051
+ getSliceInfo?(theme: ChartTheme): SliceInfo[] | null;
1052
+ /** Last data value for the series, or null if empty. Optional. */
1053
+ getLastValue?(): number | null;
1054
+ /** Nearest data point to a given time, or null. Optional. */
1055
+ getDataAtTime?(time: number, interval: number): TimePoint | OHLCData | null;
1056
+ /**
1057
+ * For multi-layer renderers: nearest data point per visible layer at `time`.
1058
+ * Each entry carries the owning `layerIndex` (so filtered hidden layers
1059
+ * don't shift the caller's identity mapping) and the **resolved sample
1060
+ * time** of the snapped point (not the query time). Used by Chart for
1061
+ * tooltips/legends.
1062
+ * Returns null for single-layer renderers or when no visible layer has data.
1063
+ */
1064
+ getLayerSnapshots?(time: number, interval: number): {
1065
+ layerIndex: number;
1066
+ time: number;
1067
+ value: number;
1068
+ color: string;
1069
+ }[] | null;
1070
+ /**
1071
+ * Stacked last value — cumulative top of the rendered stack for multi-layer
1072
+ * renderers. Falls back to `getLastValue()` behavior for single-layer
1073
+ * renderers (or when no layer is visible). Chart uses this to anchor a
1074
+ * `<YLabel />` at the same point the canvas paints the stack head.
1075
+ */
1076
+ getStackedLastValue?(): {
1077
+ value: number;
1078
+ isLive: boolean;
1079
+ } | null;
1080
+ /**
1081
+ * Per-layer last snapshots, each with its own `time`. Useful for ragged
1082
+ * multi-layer series where layers advance independently — last-mode
1083
+ * overlays need to show each layer at its true last time, not at the
1084
+ * primary layer's time.
1085
+ * Returns null for single-layer renderers or when no visible layer has data.
1086
+ */
1087
+ getLayerLastSnapshots?(): {
1088
+ layerIndex: number;
1089
+ time: number;
1090
+ value: number;
1091
+ color: string;
1092
+ }[] | null;
1093
+ /** Total data points across all owned stores. Used by Chart for batch-load detection. */
1094
+ getTotalLength?(): number;
1095
+ /**
1096
+ * Abort in-flight entrance animations (per-point/per-bar intros). Called
1097
+ * when the user pans or zooms — continuing to tween bar fills while the
1098
+ * chart is being dragged reads as flicker.
1099
+ *
1100
+ * Live-tracking smoothing (the halo/last-value lerp) is NOT cancelled here;
1101
+ * that motion is subtle and shouldn't jump when the viewport moves.
1102
+ */
1103
+ cancelEntranceAnimations?(): void;
1104
+ /**
1105
+ * Start a series-level alpha cross-fade. Chart calls this on
1106
+ * `setSeriesVisible` so the show/hide animation lives next to the geometry
1107
+ * that owns it. `target` is the destination opacity in `[0, 1]` and
1108
+ * `durationMs <= 0` snaps. Optional — renderers that don't need a fade
1109
+ * (e.g. pie) leave it unimplemented; the chart falls back to a binary
1110
+ * visibility flag.
1111
+ */
1112
+ setAlpha?(target: number, durationMs: number): void;
1113
+ /** Current series-level opacity in `[0, 1]`. Chart applies it as `globalAlpha` during render. */
1114
+ getAlpha?(): number;
1115
+ /**
1116
+ * Start a per-layer alpha cross-fade. Chart calls this on `setLayerVisible`
1117
+ * so the toggled layer fades over the same `toggleMs` window the engine
1118
+ * uses to ease the Y axis. Renderers that don't support per-layer alpha
1119
+ * (single-store: candlestick, pie) leave it unimplemented; the chart
1120
+ * skips the call and the layer toggles binary.
1121
+ */
1122
+ setLayerAlpha?(index: number, target: number, durationMs: number): void;
1123
+ /** Current per-layer opacity in `[0, 1]`. Multiplied into `globalAlpha` by the renderer at draw time. */
1124
+ getLayerAlpha?(index: number): number;
1125
+ /** True while the renderer has an active animation (Chart polls per frame). */
1126
+ readonly needsAnimation?: boolean;
1127
+ /**
1128
+ * Optional overlay hook. Chart invokes this during the overlay pass so each
1129
+ * renderer can paint type-specific overlays (crosshair dots, pulse dots).
1130
+ */
1131
+ drawOverlay?(ctx: OverlayRenderContext): void;
1132
+ /** True when the renderer wants the overlay layer to keep ticking (pulse animations, etc.). */
1133
+ readonly overlayNeedsAnimation?: boolean;
1134
+ /**
1135
+ * True if the renderer has overlay content (e.g. pulse dots) whose positions fall within
1136
+ * [from, to]. Chart uses this to stop scheduling overlay frames when animated content is
1137
+ * fully off-screen. Default when omitted: assume visible (safe, may waste CPU).
1138
+ */
1139
+ hasOverlayContentInRange?(from: number, to: number): boolean;
1140
+ /**
1141
+ * Subscribe to data-changed notifications (any internal store update).
1142
+ * Returns an unsubscribe function.
1143
+ */
1144
+ onDataChanged?(listener: () => void): () => void;
1145
+ /** Tear down listeners and any owned resources. */
1146
+ dispose(): void;
1147
+ }
1148
+
1149
+ declare interface BitmapCoordinateSpace {
1150
+ context: CanvasRenderingContext2D;
1151
+ bitmapSize: {
1152
+ width: number;
1153
+ height: number;
1154
+ };
1155
+ mediaSize: {
1156
+ width: number;
1157
+ height: number;
1158
+ };
1159
+ horizontalPixelRatio: number;
1160
+ verticalPixelRatio: number;
877
1161
  }
878
1162
 
879
1163
  /**
@@ -920,6 +1204,46 @@ export declare interface BuildLastSnapshotsArgs {
920
1204
  cacheKey: string;
921
1205
  }
922
1206
 
1207
+ /** Post-transform bitmap rectangle a candle-body painter fills. */
1208
+ declare interface CandleGeometry {
1209
+ x: number;
1210
+ y: number;
1211
+ width: number;
1212
+ height: number;
1213
+ }
1214
+
1215
+ /** Arguments handed to a {@link CandlePainter} once per candle body. */
1216
+ export declare interface CandlePaintArgs {
1217
+ geom: CandleGeometry;
1218
+ /**
1219
+ * Engine-resolved fillStyle — the 2-stop gradient when the body color is a
1220
+ * `[top, bottom]` tuple AND the body is tall enough, else the flat color. It
1221
+ * is ALSO pre-set on `ctx.fillStyle`, so a painter that ignores this field
1222
+ * still fills correctly. The painter MUST NOT call `createLinearGradient` —
1223
+ * the ≤2px collapse and gradient build already happened upstream.
1224
+ */
1225
+ fillStyle: string | CanvasGradient;
1226
+ /** Representative flat color (the gradient's top stop). For derived shades. */
1227
+ color: string;
1228
+ /** All-true for candles (no baseline); the radius is clamped per element. */
1229
+ corners: CornerMask;
1230
+ /** Resolved, pre-clamped bitmap radius. `0` means square. */
1231
+ radius: number;
1232
+ /** Entrance progress 0→1; advisory only — `geom` is already transformed. */
1233
+ progress: number;
1234
+ /** `close >= open`. */
1235
+ isBullish: boolean;
1236
+ }
1237
+
1238
+ /** Paints one candle body. Owns its fill. Never re-creates the gradient. */
1239
+ export declare type CandlePainter = (env: PaintEnv, args: CandlePaintArgs) => void;
1240
+
1241
+ /**
1242
+ * `data` shape for a candlestick series — a flat `OHLCInput[]` stream, or a
1243
+ * `SeriesLayer<OHLCInput>` that names it for the tooltip / info bar / legend.
1244
+ */
1245
+ declare type CandlestickData = OHLCInput[] | SeriesLayer<OHLCInput>;
1246
+
923
1247
  /**
924
1248
  * `body` shape encodes the fill mode: a single color renders flat; a
925
1249
  * `[top, bottom]` tuple renders a 2-stop vertical gradient. Use
@@ -945,10 +1269,12 @@ declare type CandlestickEntryAnimation = 'none' | 'fade' | 'unfold' | 'slide' |
945
1269
 
946
1270
  export declare const CandlestickSeries: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
947
1271
 
1272
+ /** Series definition for `chart.addSeries` — keeps the chart renderer-agnostic
1273
+ * so hosts that never render candles don't bundle this module. */
1274
+ export declare const CandlestickSeriesDef: SeriesDefinition<CandlestickSeriesOptions>;
1275
+
948
1276
  /** Visual options for a candlestick series. */
949
1277
  export declare interface CandlestickSeriesOptions {
950
- /** Display label shown in the tooltip. */
951
- label?: string;
952
1278
  /** Colours for bullish candles (close ≥ open). */
953
1279
  up: CandlestickDirectionColors;
954
1280
  /** Colours for bearish candles (close < open). */
@@ -1003,6 +1329,24 @@ export declare interface CandlestickSeriesOptions {
1003
1329
  * a hard disable that wins over this field.
1004
1330
  */
1005
1331
  smoothMs?: number | false;
1332
+ /**
1333
+ * Body corner radius in CSS pixels, applied to all four corners (a candle
1334
+ * body has no baseline). Default: `3`. `0` is byte-identical to the prior
1335
+ * square output. Clamped to half the smaller body dimension, so dojis and
1336
+ * ≤2px bodies degrade to flat. The `[top, bottom]` gradient is preserved —
1337
+ * the painter fills with the engine-resolved gradient and never rebuilds it.
1338
+ */
1339
+ cornerRadius?: number;
1340
+ /**
1341
+ * Custom candle-body painter — a raw `CandlePainter` function that owns the
1342
+ * body fill. Leave unset for the built-in rounded fill (driven by
1343
+ * `cornerRadius`). Read fresh each frame; a new reference is honored on the
1344
+ * next render regardless of wrapper change-detection. Keep it a stable
1345
+ * reference (module scope or `useCallback`) so the wrapper diffs it cleanly.
1346
+ * A throw falls back to the default fill. The wick and volume histogram are
1347
+ * unaffected.
1348
+ */
1349
+ candlePainter?: CandlePainter;
1006
1350
  }
1007
1351
 
1008
1352
  export declare const catppuccin: ThemePreset;
@@ -1048,26 +1392,95 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
1048
1392
  get xAxisHeight(): number;
1049
1393
  constructor(container: HTMLElement, options?: ChartOptions);
1050
1394
  /**
1051
- * Add a series of the given `type` and return its unique ID. `options` is
1052
- * typed per `type` via the overloads. `layers` (line/bar) and `id` are
1053
- * consumed here; everything else is forwarded to the renderer.
1395
+ * Add a series and return its unique ID. `options` is typed per series via
1396
+ * the overloads. `layers` (line/bar) and `id` are consumed here; everything
1397
+ * else is forwarded to the renderer.
1398
+ *
1399
+ * Preferred form: pass a {@link SeriesDefinition}
1400
+ * (`chart.addSeries(LineSeriesDef, …)`) — the chart stays renderer-agnostic
1401
+ * and bundlers drop the series types a host never imports. The string form
1402
+ * resolves through the registry and requires a one-time
1403
+ * `registerBuiltinSeries()` call at startup.
1054
1404
  */
1055
1405
  addSeries(type: 'candlestick', options?: Partial<CandlestickSeriesOptions & {
1056
1406
  id?: string;
1407
+ label?: string;
1057
1408
  }>): string;
1058
1409
  addSeries(type: 'line', options?: Partial<LineSeriesOptions & {
1059
1410
  layers?: number;
1060
1411
  id?: string;
1412
+ label?: string;
1413
+ labels?: (string | undefined)[];
1061
1414
  }>): string;
1062
1415
  addSeries(type: 'bar', options?: Partial<BarSeriesOptions & {
1063
1416
  layers?: number;
1064
1417
  id?: string;
1418
+ label?: string;
1419
+ labels?: (string | undefined)[];
1065
1420
  }>): string;
1066
1421
  addSeries(type: 'pie', options?: Partial<PieSeriesOptions & {
1067
1422
  id?: string;
1423
+ label?: string;
1068
1424
  }>): string;
1425
+ addSeries<O>(def: SeriesDefinition<O>, options?: Partial<O> & {
1426
+ layers?: number;
1427
+ id?: string;
1428
+ label?: string;
1429
+ labels?: (string | undefined)[];
1430
+ }): string;
1069
1431
  /** Remove a series by ID and clean up its resources. */
1070
1432
  removeSeries(id: string): void;
1433
+ /**
1434
+ * Pin a point annotation to `time` (X) and `value` (Y), or to a series via
1435
+ * `seriesId` (Y snaps to the nearest data point at `time`). Returns the marker
1436
+ * id for later {@link updateMarker} / {@link removeMarker}.
1437
+ *
1438
+ * Markers render on the overlay layer and stay out of the series model — they
1439
+ * are excluded from tooltips, the legend, and the Y-range autoscale, and never
1440
+ * appear in series queries.
1441
+ */
1442
+ addMarker(config: MarkerConfig): string;
1443
+ /** Replace a marker's config in place. No-op when the id is unknown. */
1444
+ updateMarker(id: string, config: MarkerConfig): void;
1445
+ /** Remove a marker by id. No-op when the id is unknown. */
1446
+ removeMarker(id: string): void;
1447
+ /** Read-only snapshot of the registered markers (normalized). Mutate via add / update / removeMarker. */
1448
+ getMarkers(): readonly Readonly<MarkerEntry>[];
1449
+ /**
1450
+ * Shade the time interval `[from, to]` with a translucent vertical band —
1451
+ * an anomaly window, a maintenance window, a highlighted session. Omit `to`
1452
+ * (or pass `'now'`) for an open-ended band that extends to the right edge of
1453
+ * the plot — the "still firing" case. Returns the region id for later
1454
+ * {@link updateRegion} / {@link removeRegion}.
1455
+ *
1456
+ * Regions render on the main layer *behind* the series and stay out of the
1457
+ * series model — they never affect the Y-range autoscale, tooltips, or the
1458
+ * legend.
1459
+ */
1460
+ addRegion(config: TimeRegionConfig): string;
1461
+ /** Replace a region's config in place. No-op when the id is unknown. */
1462
+ updateRegion(id: string, config: TimeRegionConfig): void;
1463
+ /** Remove a region by id. No-op when the id is unknown. */
1464
+ removeRegion(id: string): void;
1465
+ /** Read-only snapshot of the registered regions (normalized). Mutate via add / update / removeRegion. */
1466
+ getRegions(): readonly Readonly<RegionEntry>[];
1467
+ /**
1468
+ * Draw a reference line across the plot — a horizontal threshold / baseline
1469
+ * pinned to a `value`, or a vertical event boundary pinned to a `time`
1470
+ * (mutually exclusive). Returns the line id for later {@link updateLine} /
1471
+ * {@link removeLine}.
1472
+ *
1473
+ * Lines render on the overlay layer *above* the series and stay out of the
1474
+ * series model — they never affect the Y-range autoscale, tooltips, or the
1475
+ * legend.
1476
+ */
1477
+ addLine(config: ReferenceLineConfig): string;
1478
+ /** Replace a reference line's config in place. No-op when the id is unknown. */
1479
+ updateLine(id: string, config: ReferenceLineConfig): void;
1480
+ /** Remove a reference line by id. No-op when the id is unknown. */
1481
+ removeLine(id: string): void;
1482
+ /** Read-only snapshot of the registered reference lines (normalized). Mutate via add / update / removeLine. */
1483
+ getLines(): readonly Readonly<LineEntry>[];
1071
1484
  /**
1072
1485
  * Read-only snapshot of the chart's X / Y viewport animation. The same
1073
1486
  * shape (`xRange`, `yRange`, `animating`) every frame — call this inside
@@ -1267,7 +1680,25 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
1267
1680
  }[] | null;
1268
1681
  /** Get the primary display color for a series. */
1269
1682
  getSeriesColor(seriesId: string): string | null;
1683
+ /** The series' primary name (first layer). Used for single-layer overlays. */
1270
1684
  getSeriesLabel(seriesId: string): string | undefined;
1685
+ /** The display name of one layer, or `undefined` when that layer is unnamed. */
1686
+ getLayerLabel(seriesId: string, layerIndex: number): string | undefined;
1687
+ /**
1688
+ * Set every layer's display name at once (index = layer). Drives the tooltip,
1689
+ * legend, and info bar. Called by the framework wrappers as the carried
1690
+ * per-layer labels in `data` change. No-ops (and skips the overlay bump) when
1691
+ * the labels are unchanged, so it's safe to call on every data tick.
1692
+ */
1693
+ setSeriesLabels(seriesId: string, labels: (string | undefined)[]): void;
1694
+ /**
1695
+ * Set the per-layer color overrides carried in `data` (sparse — `undefined`
1696
+ * leaves that layer on the theme base). A {@link ValueColor} per layer: a
1697
+ * string (uniform) or a function of value (per bar / per segment). Handed to
1698
+ * the renderer, which keeps them separate from the theme base so a theme swap
1699
+ * preserves them. Called by the framework wrappers; no-ops when unchanged.
1700
+ */
1701
+ setLayerColors(seriesId: string, overrides: (ValueColor | undefined)[]): void;
1271
1702
  /** Get per-layer colors for a series. Returns null for single-layer non-bar/line series. */
1272
1703
  getSeriesLayers(seriesId: string): {
1273
1704
  color: string;
@@ -1458,20 +1889,17 @@ export declare interface ChartOptions {
1458
1889
  onEdgeReached?: (info: EdgeReachedInfo) => void;
1459
1890
  /**
1460
1891
  * Runtime performance instrumentation. Opt-in — absent by default so the
1461
- * hot render path stays free of timing/counting overhead.
1892
+ * hot render path stays free of timing/counting overhead, and so bundles
1893
+ * without instrumentation carry no perf code at all (the chart never
1894
+ * imports it; whatever you pass here is what ships).
1462
1895
  *
1463
- * - `false` / omitted — no instrumentation, no HUD, byte-identical to a perf-free build.
1464
- * - `true` — create an internal {@link PerfMonitor} and mount a visible HUD overlay.
1465
- * - `{ hud: true, ...options }` — same, with monitor options forwarded.
1466
- * - `{ hud: false, ...options }` — instrument but do not render a HUD (useful when
1467
- * the host app consumes stats via `monitor.onFrame` and renders its own UI).
1468
- * - `PerfMonitor` instance — attach to a pre-constructed monitor. Useful when several
1469
- * charts share one telemetry sink. HUD defaults to off in this mode.
1896
+ * - omitted — no instrumentation, no HUD.
1897
+ * - `perfHud()` — monitor + visible HUD overlay (replaces the old `perf: true`).
1898
+ * - `PerfMonitor` instance — instrument without a HUD; useful when the host
1899
+ * consumes stats via `monitor.onFrame` and renders its own UI, or when
1900
+ * several charts share one telemetry sink.
1470
1901
  */
1471
- perf?: boolean | PerfMonitor | (PerfMonitorOptions & {
1472
- hud?: boolean;
1473
- monitor?: PerfMonitor;
1474
- });
1902
+ perf?: PerfMonitor | PerfConfig;
1475
1903
  }
1476
1904
 
1477
1905
  /**
@@ -1529,6 +1957,35 @@ export declare interface ChartTheme {
1529
1957
  };
1530
1958
  /** Color palette for multi-series charts (stacked bars, overlays). */
1531
1959
  seriesColors: string[];
1960
+ /**
1961
+ * Default single-layer bar color. A {@link ValueColor}: a string for a uniform
1962
+ * bar, or a function of the bar's value for sign / threshold coloring.
1963
+ * {@link createTheme} defaults it to a sign function (candlestick up / down
1964
+ * body), which is how bars get green-up / red-down without any option.
1965
+ *
1966
+ * Optional so hand-built theme literals keep compiling — the bar renderer
1967
+ * falls back to {@link ChartTheme.seriesColors}`[0]`. A function value makes
1968
+ * the theme non-JSON-serializable; that is an accepted trade-off (the theme
1969
+ * editor simply omits it).
1970
+ */
1971
+ bar?: {
1972
+ /** Default fill — a string (uniform) or a value-fn (e.g. sign-based up/down). */
1973
+ color: ValueColor;
1974
+ };
1975
+ /**
1976
+ * Pie / donut specific colors. Optional so hand-built theme literals that
1977
+ * predate the field keep compiling — renderers fall back to
1978
+ * {@link ChartTheme.axis} `textColor` (the same muted tone
1979
+ * {@link createTheme} derives by default).
1980
+ */
1981
+ pie?: {
1982
+ /**
1983
+ * Fill of the synthetic "Other" slice produced by small-slice grouping.
1984
+ * Deliberately muted: a vivid palette color would give the aggregate the
1985
+ * same visual weight as a real category.
1986
+ */
1987
+ otherColor: string;
1988
+ };
1532
1989
  /** Bollinger band / envelope fill colors. */
1533
1990
  bands: {
1534
1991
  /** Fill for the upper band region (above the middle band). */
@@ -1664,6 +2121,18 @@ export declare interface ChartTheme {
1664
2121
 
1665
2122
  export declare function computeTooltipPosition(args: TooltipPositionArgs): TooltipPosition;
1666
2123
 
2124
+ /**
2125
+ * Which corners a rounded-rect path rounds. A `false` corner is drawn square.
2126
+ * The RENDERER owns this decision (it knows the stack / overlap / percent mode);
2127
+ * a painter consumes the mask verbatim and never infers which edge is free.
2128
+ */
2129
+ export declare interface CornerMask {
2130
+ tl: boolean;
2131
+ tr: boolean;
2132
+ br: boolean;
2133
+ bl: boolean;
2134
+ }
2135
+
1667
2136
  /**
1668
2137
  * Build a complete {@link ThemePreset} from a partial config.
1669
2138
  * Only `background` is required — everything else is derived from it.
@@ -1684,6 +2153,9 @@ export declare interface CrosshairPosition {
1684
2153
  y: number;
1685
2154
  }
1686
2155
 
2156
+ /** Path-shape selector for {@link tracePath}. */
2157
+ export declare type CurveKind = 'straight' | 'smooth' | 'stepped';
2158
+
1687
2159
  export declare function detectInterval(times: number[]): number;
1688
2160
 
1689
2161
  export declare const dracula: ThemePreset;
@@ -1717,6 +2189,19 @@ declare class EventEmitter<Events = Record<string, Listener>> {
1717
2189
  removeAllListeners(): void;
1718
2190
  }
1719
2191
 
2192
+ /**
2193
+ * Fill a rounded rectangle with per-corner masking, using manual `arcTo` so the
2194
+ * output is deterministic and independent of `CanvasRenderingContext2D.roundRect`
2195
+ * availability. Self-contained: it opens its own path and fills with the current
2196
+ * `ctx.fillStyle`.
2197
+ *
2198
+ * Degenerate inputs — a sub-1px clamped radius, or a non-positive dimension —
2199
+ * fall back to a plain `fillRect`. That guarantees a tiny / 1px bar or a doji can
2200
+ * never emit a zero-radius or `NaN` `arcTo`, byte-matching the pre-rounding
2201
+ * output for those cases.
2202
+ */
2203
+ export declare function fillRoundedRect(ctx: CanvasRenderingContext2D, args: RoundedRectArgs): void;
2204
+
1720
2205
  /**
1721
2206
  * Compact notation for large magnitudes (K / M / B / T) with adaptive
1722
2207
  * precision for values below 1. Default decimal count for the compact
@@ -1822,6 +2307,17 @@ declare type LegendMode = 'toggle' | 'isolate' | 'solo';
1822
2307
 
1823
2308
  export declare const lightPink: ThemePreset;
1824
2309
 
2310
+ /** Internal bookkeeping for a registered reference line. `coord` is a Y value (horizontal) or normalized epoch ms (vertical). */
2311
+ declare interface LineEntry {
2312
+ id: string;
2313
+ orientation: ReferenceLineOrientation;
2314
+ coord: number;
2315
+ color?: string;
2316
+ label?: string;
2317
+ style: ReferenceLineStyle;
2318
+ width: number;
2319
+ }
2320
+
1825
2321
  /**
1826
2322
  * Entrance animation styles for new line points.
1827
2323
  * - `'none'` — new segments appear instantly.
@@ -1830,14 +2326,53 @@ export declare const lightPink: ThemePreset;
1830
2326
  */
1831
2327
  declare type LineEntryAnimation = 'none' | 'grow' | 'fade';
1832
2328
 
2329
+ /** Arguments handed to a {@link LinePainter} once per finite run. */
2330
+ export declare interface LinePaintArgs {
2331
+ /**
2332
+ * One finite run of points — gaps already split runs, and the trailing-grow
2333
+ * endpoint is already appended. Read-only.
2334
+ */
2335
+ points: readonly LinePoint[];
2336
+ color: string;
2337
+ lineWidth: number;
2338
+ /**
2339
+ * `false` while building the stroke path; `true` while building the area-fill
2340
+ * top edge, before the engine appends the baseline `lineTo`×2 + `closePath` +
2341
+ * `fill`.
2342
+ */
2343
+ closing: boolean;
2344
+ /**
2345
+ * `true` while the trailing endpoint is an eased, frame-moving point (the
2346
+ * 'grow' entrance). A smooth builder MUST degrade the in-flight last segment to
2347
+ * a straight `lineTo` (only the settled run is curve-fit) so the head can't
2348
+ * wobble or overshoot while it glides.
2349
+ */
2350
+ grew: boolean;
2351
+ }
2352
+
2353
+ /**
2354
+ * Builds the path for one finite run. MUST issue only
2355
+ * `moveTo` / `lineTo` / `bezierCurveTo` / `quadraticCurveTo` onto `env.ctx`, and
2356
+ * MUST NOT call `beginPath` / `stroke` / `fill` / `closePath` — the engine wraps
2357
+ * the builder so the SAME path drives both the stroke and the baseline-closed
2358
+ * area polygon.
2359
+ */
2360
+ export declare type LinePainter = (env: PaintEnv, args: LinePaintArgs) => void;
2361
+
2362
+ /** A single bitmap-space point on a line run. */
2363
+ declare interface LinePoint {
2364
+ x: number;
2365
+ y: number;
2366
+ }
2367
+
1833
2368
  export declare const LineSeries: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1834
2369
 
2370
+ /** Series definition for `chart.addSeries` — keeps the chart renderer-agnostic
2371
+ * so hosts that never render lines don't bundle this module. */
2372
+ export declare const LineSeriesDef: SeriesDefinition<LineSeriesOptions>;
2373
+
1835
2374
  /** Visual options for a line series. */
1836
2375
  export declare interface LineSeriesOptions {
1837
- /** Display label shown in the tooltip (e.g. "BTC", "Revenue"). */
1838
- label?: string;
1839
- /** One color per layer. */
1840
- colors: string[];
1841
2376
  /** Stroke width in CSS pixels. Default: 1. `0` hides the line stroke. */
1842
2377
  strokeWidth: number;
1843
2378
  /** Area-fill configuration. Default: `{ visible: true }`. */
@@ -1918,10 +2453,95 @@ export declare interface LineSeriesOptions {
1918
2453
  * disable that wins over this field.
1919
2454
  */
1920
2455
  smoothMs?: number | false;
2456
+ /**
2457
+ * Declarative line smoothing. Default: `'straight'` (zero visual change —
2458
+ * the prior polyline). Resolves to a shipped built-in path builder inside the
2459
+ * renderer and drives the stroke, the area fill, and stacked slices from one
2460
+ * path:
2461
+ * - `'straight'` — plain polyline.
2462
+ * - `'smooth'` — Fritsch–Carlson monotone cubic (non-overshooting, so it stays
2463
+ * inside an area fill that closes to a baseline).
2464
+ * - `'stepped'` — horizontal-then-vertical step at each sample.
2465
+ */
2466
+ curve?: 'straight' | 'smooth' | 'stepped';
2467
+ /**
2468
+ * Custom line path builder — a raw `LinePainter` function. Overrides `curve`,
2469
+ * applied per finite run to both the stroke and the area-fill top edge. Read
2470
+ * fresh each frame; keep it a stable reference so the wrapper diffs it cleanly.
2471
+ * A throw falls back to the straight builder. Stacked mode uses the `curve`
2472
+ * kind for gap-free interior tiling, so a custom `linePainter` there falls back
2473
+ * to `'straight'`.
2474
+ */
2475
+ linePainter?: LinePainter;
2476
+ /**
2477
+ * Threshold coloring. Paints the stroke and the area fill one color below a Y
2478
+ * `value` and another above it, with the switch pinned to that value's pixel
2479
+ * row — a vertical canvas gradient, so it tracks the Y-axis as it autoscales.
2480
+ * Use it to make a series visibly "go critical" past a limit: the line runs
2481
+ * calm below the level and hot above it.
2482
+ *
2483
+ * Positional, so it is independent of (and overrides) the per-layer
2484
+ * `data.color` for the stroke and fill. Applies to unstacked lines only.
2485
+ *
2486
+ * ```
2487
+ * <LineSeries data={data} options={{ threshold: { value: 70, above: '#f0556a' } }} />
2488
+ * ```
2489
+ */
2490
+ threshold?: {
2491
+ /** Y data value where the color switches. */
2492
+ value: number;
2493
+ /** Color above the threshold (toward the top of the plot). */
2494
+ above: string;
2495
+ /** Color below the threshold. Default: the series' resolved color. */
2496
+ below?: string;
2497
+ };
1921
2498
  }
1922
2499
 
1923
2500
  declare type Listener = (...args: any[]) => void;
1924
2501
 
2502
+ export declare const Marker: DefineComponent<__VLS_Props_8, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_8> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
2503
+
2504
+ /**
2505
+ * A point annotation pinned to a `time` (X) and a `value` (Y) — "anomaly opened
2506
+ * here", "deploy happened here". Markers live outside the series model, so they
2507
+ * are excluded from tooltips, the legend, and the Y-range autoscale, and never
2508
+ * pollute series queries. Drawn on the overlay layer, clipped to the plot area.
2509
+ */
2510
+ export declare interface MarkerConfig {
2511
+ /** X anchor — epoch ms or a `Date`. Normalized on the way in. */
2512
+ time: TimeValue;
2513
+ /**
2514
+ * Y anchor as a data value. Omit and set {@link MarkerConfig.seriesId} to snap
2515
+ * the marker to that series' nearest data point at `time`.
2516
+ */
2517
+ value?: number;
2518
+ /** Snap Y to this series' value at `time` when `value` is omitted. Also the default color source. */
2519
+ seriesId?: string;
2520
+ /** Glyph at the anchor. Default: `'dot'`. */
2521
+ shape?: MarkerShape;
2522
+ /** Reuse the line pulse halo around the anchor. Default: `false`. */
2523
+ pulse?: boolean;
2524
+ /** Optional text label drawn in a pill next to the anchor. */
2525
+ label?: string;
2526
+ /** Color override. Falls back to the series color (when `seriesId` is set), then the theme line color. */
2527
+ color?: string;
2528
+ }
2529
+
2530
+ /** Internal bookkeeping for a registered marker. `time` is normalized to epoch ms; `shape`/`pulse` carry resolved defaults. */
2531
+ declare interface MarkerEntry {
2532
+ id: string;
2533
+ time: number;
2534
+ value?: number;
2535
+ seriesId?: string;
2536
+ shape: MarkerShape;
2537
+ pulse: boolean;
2538
+ label?: string;
2539
+ color?: string;
2540
+ }
2541
+
2542
+ /** Glyph drawn at the marker anchor. Arrows point their tip *at* the anchor point. */
2543
+ export declare type MarkerShape = 'dot' | 'circle' | 'arrow-up' | 'arrow-down';
2544
+
1925
2545
  export declare const materialPalenight: ThemePreset;
1926
2546
 
1927
2547
  /**
@@ -1939,7 +2559,19 @@ export declare const mintBreeze: ThemePreset;
1939
2559
 
1940
2560
  export declare const monokaiPro: ThemePreset;
1941
2561
 
1942
- declare const Navigator_2: DefineComponent<__VLS_Props_8, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_8> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
2562
+ /**
2563
+ * Omnivorous `data` shape for line and bar series. Accepts, interchangeably:
2564
+ * - `TimePointInput[]` — one auto-named layer (the common single-series case);
2565
+ * - `TimePointInput[][]` — N auto-named layers;
2566
+ * - `SeriesLayer<TimePointInput>` — one named/colored layer;
2567
+ * - an array mixing raw `TimePointInput[]` layers and named `SeriesLayer`s.
2568
+ *
2569
+ * Everything normalizes to `SeriesLayer[]` internally (see `toLayers`). Time
2570
+ * accepts epoch milliseconds or a `Date` on every point.
2571
+ */
2572
+ declare type MultiLayerData = TimePointInput[] | SeriesLayer<TimePointInput> | Array<TimePointInput[] | SeriesLayer<TimePointInput>>;
2573
+
2574
+ declare const Navigator_2: DefineComponent<__VLS_Props_9, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_9> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
1943
2575
  stripRef: HTMLDivElement;
1944
2576
  }, any>;
1945
2577
  export { Navigator_2 as Navigator }
@@ -1965,9 +2597,14 @@ export declare interface NavigatorCandlePoint {
1965
2597
  * active zone aligns with the main chart's plot area (matches the TimeAxis).
1966
2598
  *
1967
2599
  * Event topology — navigator is a pure listener on the chart side, never emits:
1968
- * chart.viewportChange → reposition window DOM + redraw on next frame
2600
+ * chart.viewportChange → reposition window DOM on next frame (canvas untouched)
2601
+ * chart.tickFrame → reposition window DOM on next frame (window glide)
1969
2602
  * chart.overlayChange → full redraw (catches data + theme swaps)
1970
2603
  * ResizeObserver → resize canvas + full redraw
2604
+ *
2605
+ * The canvas miniature depends only on data / theme / size, so per-frame
2606
+ * viewport signals take the light DOM-only path — a wheel-zoom or pan never
2607
+ * re-decimates the dataset or repaints the strip.
1971
2608
  */
1972
2609
  export declare class NavigatorController {
1973
2610
  #private;
@@ -2026,7 +2663,7 @@ export declare const nightOwl: ThemePreset;
2026
2663
  /** Convert a {@link TimeValue} (number ms or Date) to a millisecond timestamp. */
2027
2664
  export declare function normalizeTime(t: TimeValue): number;
2028
2665
 
2029
- export declare const NumberFlow: DefineComponent<__VLS_Props_9, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_9> & Readonly<{}>, {
2666
+ export declare const NumberFlow: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {
2030
2667
  locale: string;
2031
2668
  spinDuration: number;
2032
2669
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLSpanElement>;
@@ -2048,6 +2685,46 @@ export declare type OHLCInput = Omit<OHLCData, 'time'> & {
2048
2685
 
2049
2686
  export declare const oneDarkPro: ThemePreset;
2050
2687
 
2688
+ /** Overlay render state passed to {@link SeriesRenderer.drawOverlay}. */
2689
+ declare interface OverlayRenderContext {
2690
+ scope: BitmapCoordinateSpace;
2691
+ timeScale: XScale;
2692
+ yScale: YScale;
2693
+ theme: ChartTheme;
2694
+ dataInterval: number;
2695
+ /** Vertical padding in **CSS pixels** — see {@link RenderPadding}. */
2696
+ padding: RenderPadding;
2697
+ /** Current crosshair position, or null when none. */
2698
+ crosshair: {
2699
+ mediaX: number;
2700
+ mediaY: number;
2701
+ time: number;
2702
+ y: number;
2703
+ } | null;
2704
+ /**
2705
+ * Engine-owned animation state. Pulse renderers read `state.pulsePhase`
2706
+ * here so the halo cycles off the same clock the rest of the chart uses.
2707
+ */
2708
+ state?: AnimationState;
2709
+ /** The chart-side id for this series. See {@link SeriesRenderContext.seriesId}. */
2710
+ seriesId?: string;
2711
+ }
2712
+
2713
+ /**
2714
+ * Engine context shared by every painter. `ctx.globalAlpha` is ALREADY composed
2715
+ * (layer × series × entrance fade) by the renderer, and every geometry handed to
2716
+ * a painter is already post-transform. Painters MUST NOT mutate `globalAlpha`
2717
+ * and MUST NOT re-run an entrance transform.
2718
+ */
2719
+ export declare interface PaintEnv {
2720
+ ctx: CanvasRenderingContext2D;
2721
+ theme: ChartTheme;
2722
+ /** Horizontal device-pixel ratio — scale your own CSS-px radii / insets by this. */
2723
+ horizontalPixelRatio: number;
2724
+ /** Vertical device-pixel ratio. */
2725
+ verticalPixelRatio: number;
2726
+ }
2727
+
2051
2728
  export declare const panda: ThemePreset;
2052
2729
 
2053
2730
  /**
@@ -2071,6 +2748,39 @@ declare interface PanZoomTarget {
2071
2748
 
2072
2749
  export declare const peachCream: ThemePreset;
2073
2750
 
2751
+ /**
2752
+ * Chart-ready perf configuration: a monitor plus an optional HUD mount.
2753
+ * Produced by {@link perfHud} (or hand-assembled); passed as the chart's
2754
+ * `perf` option. The chart itself never imports perf code — whatever the
2755
+ * config carries is all that ships in the bundle.
2756
+ */
2757
+ export declare interface PerfConfig {
2758
+ /** Monitor that collects frame timing / draw calls for this chart. */
2759
+ monitor: PerfMonitor;
2760
+ /** Mounts the HUD overlay; the chart calls it at construction and destroys the result. */
2761
+ hud?: (container: HTMLElement, monitor: PerfMonitor) => {
2762
+ destroy(): void;
2763
+ };
2764
+ /** True when the config constructed the monitor — the chart then destroys it on teardown. */
2765
+ ownsMonitor?: boolean;
2766
+ }
2767
+
2768
+ /**
2769
+ * Performance instrumentation with the visible HUD overlay — the factory
2770
+ * replacement for the old `perf: true`:
2771
+ *
2772
+ * ```ts
2773
+ * new ChartInstance(el, { perf: perfHud() });
2774
+ * <ChartContainer perf={perfHud({ windowMs: 500 })} />
2775
+ * perfHud(sharedMonitor) // HUD on an externally-owned monitor
2776
+ * ```
2777
+ *
2778
+ * Importing this factory is what pulls the monitor + HUD code into the
2779
+ * bundle; pass a bare `PerfMonitor` instance as `perf` for HUD-less
2780
+ * instrumentation.
2781
+ */
2782
+ export declare function perfHud(init?: PerfMonitorOptions | PerfMonitor): PerfConfig;
2783
+
2074
2784
  /**
2075
2785
  * Collects per-frame timing, draw-call counts, per-series render ms, and heap
2076
2786
  * usage. All collection sites short-circuit to no-ops when no monitor is
@@ -2081,7 +2791,7 @@ export declare const peachCream: ThemePreset;
2081
2791
  * monitor. Multiple charts may share a monitor, but `perSeries` keys must be
2082
2792
  * unique across charts or samples will collide.
2083
2793
  */
2084
- declare class PerfMonitor {
2794
+ export declare class PerfMonitor {
2085
2795
  /** Draw-call tally map for the main layer. Mutated in place by the counting context; cleared at the start of each frame. */
2086
2796
  readonly drawCallsMain: Map<string, number>;
2087
2797
  /** Draw-call tally map for the overlay layer. Same contract as `drawCallsMain`. */
@@ -2105,6 +2815,13 @@ declare class PerfMonitor {
2105
2815
  constructor(options?: PerfMonitorOptions);
2106
2816
  /** Clear the draw-call tally for the given layer. Call at the start of each frame. */
2107
2817
  resetDrawCalls(kind: FrameKind): void;
2818
+ /**
2819
+ * Wrap a 2D context in a draw-call-counting Proxy feeding this monitor's
2820
+ * tally for `kind`. Lives on the monitor (rather than being imported by
2821
+ * the chart's canvas manager) so charts without instrumentation carry no
2822
+ * perf code at all.
2823
+ */
2824
+ wrapContext(ctx: CanvasRenderingContext2D, kind: FrameKind): CanvasRenderingContext2D;
2108
2825
  /** Record a completed frame's wall-clock duration and emit stats to subscribers. */
2109
2826
  recordFrame(kind: FrameKind, ms: number, timestamp: number): void;
2110
2827
  /** Record one series renderer's time slice inside the main pass. Called from inside `renderMain`, so the enclosing `recordFrame('main', …)` trim takes care of age. */
@@ -2119,7 +2836,7 @@ declare class PerfMonitor {
2119
2836
  private sampleHeap;
2120
2837
  }
2121
2838
 
2122
- declare interface PerfMonitorOptions {
2839
+ export declare interface PerfMonitorOptions {
2123
2840
  /**
2124
2841
  * Age of the rolling window in milliseconds. Samples older than this are
2125
2842
  * dropped from FPS / percentile calculations. Defaults to 5000 (5 seconds).
@@ -2141,12 +2858,15 @@ declare interface PerfMonitorOptions {
2141
2858
 
2142
2859
  declare type PerfOption = NonNullable<ChartOptions['perf']>;
2143
2860
 
2144
- declare interface PerfStats {
2861
+ export declare interface PerfStats {
2145
2862
  /**
2146
- * Main-layer renders per second, derived from the interval between recent main
2147
- * frames. Charts render on demand (data change, pan, zoom, resize, streaming
2148
- * tick), so `0` during an idle chart is normal — not a stutter. `0` until two
2149
- * frames have been recorded.
2863
+ * Main-layer renders per second. During continuous rendering this is the
2864
+ * rate of the trailing run of back-to-back frames (so it reflects the
2865
+ * *current* rate immediately instead of ramping up as idle time ages out
2866
+ * of the window); for sparse on-demand renders it is the window-wide
2867
+ * average. Charts render on demand (data change, pan, zoom, resize,
2868
+ * streaming tick), so `0` during an idle chart is normal — not a stutter.
2869
+ * `0` until two frames have been recorded.
2150
2870
  */
2151
2871
  mainRendersPerSec: number;
2152
2872
  /** Same as {@link mainRendersPerSec} but for the overlay (crosshair + pulse) layer. */
@@ -2220,8 +2940,33 @@ declare type PieLegendMode = 'value' | 'percent' | 'both';
2220
2940
 
2221
2941
  declare type PieLegendPosition = 'bottom' | 'right' | 'overlay';
2222
2942
 
2943
+ /**
2944
+ * Grouping of the smallest slices into a single synthetic "Other" slice.
2945
+ * Enabled by default: when the data holds more than {@link maxSlices} slices,
2946
+ * the largest `maxSlices - 1` keep their original order and the rest are
2947
+ * summed into one "Other" slice appended at the end. The grouped slice
2948
+ * behaves like a regular slice in labels / legend / tooltip / hit-testing.
2949
+ */
2950
+ declare interface PieOtherOptions {
2951
+ /** Max number of rendered slices including "Other". Default: 8. */
2952
+ maxSlices?: number;
2953
+ /** Label of the aggregated slice. Default: `'Other'`. */
2954
+ label?: string;
2955
+ /**
2956
+ * Color override for the aggregated slice. Default: `theme.pie.otherColor`
2957
+ * (falls back to `axis.textColor` for themes without a `pie` block) — a
2958
+ * muted tone so the aggregate doesn't carry the same visual weight as a
2959
+ * real category.
2960
+ */
2961
+ color?: string;
2962
+ }
2963
+
2223
2964
  export declare const PieSeries: DefineComponent<__VLS_Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_5> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
2224
2965
 
2966
+ /** Series definition for `chart.addSeries` — keeps the chart renderer-agnostic
2967
+ * so hosts that never render pies don't bundle this module. */
2968
+ export declare const PieSeriesDef: SeriesDefinition<PieSeriesOptions>;
2969
+
2225
2970
  /** Visual options for a pie/donut series. `innerRadiusRatio > 0` makes it a donut. */
2226
2971
  export declare interface PieSeriesOptions {
2227
2972
  /** Palette fallback (defaults to theme.seriesColors). */
@@ -2234,6 +2979,13 @@ export declare interface PieSeriesOptions {
2234
2979
  label?: string;
2235
2980
  /** Per-slice label rendering on the pie itself. See {@link PieLabelsOptions}. */
2236
2981
  sliceLabels?: PieLabelsOptions;
2982
+ /**
2983
+ * Group the smallest slices into a single "Other" slice when the dataset
2984
+ * exceeds `maxSlices` (default: 8 rendered slices total). On by default so
2985
+ * dense datasets stay readable — pass `false` to always render every slice.
2986
+ * See {@link PieOtherOptions}.
2987
+ */
2988
+ other?: boolean | PieOtherOptions;
2237
2989
  /**
2238
2990
  * When `true`, enables pie motion effects: the outside-label entrance
2239
2991
  * draw-in on mount / data swap, and the hover-explode slice offset.
@@ -2243,6 +2995,14 @@ export declare interface PieSeriesOptions {
2243
2995
  * value.
2244
2996
  */
2245
2997
  animate?: boolean;
2998
+ /**
2999
+ * Per-slice radial *depth* gradient — a subtle lightening from the slice
3000
+ * center toward its edge that gives the pie a soft 3D sheen. On by default.
3001
+ * Set `false` for flat, solid-color slices (the material / infographic
3002
+ * look). Orthogonal to {@link innerShadow}: an explicit `innerShadow` still
3003
+ * paints its dark rim band even when the depth gradient is off.
3004
+ */
3005
+ gradient?: boolean;
2246
3006
  /**
2247
3007
  * Ambient *outer* drop-shadow behind each slice. Adds lift for flat
2248
3008
  * dashboards. Omit / `false` to disable (default). `true` uses soft
@@ -2278,6 +3038,11 @@ export declare interface PieSeriesOptions {
2278
3038
  };
2279
3039
  }
2280
3040
 
3041
+ /** A spatial renderer with no time axis (Pie). Has no time-series queries. */
3042
+ declare interface PieSeriesRenderer extends BaseSeriesRenderer {
3043
+ readonly kind: 'pie';
3044
+ }
3045
+
2281
3046
  /** Optional min/max constraints for the Y axis. Omit a side for automatic scaling. */
2282
3047
  /** A single slice in a pie/donut chart. */
2283
3048
  export declare interface PieSliceData {
@@ -2299,6 +3064,83 @@ declare interface Rect {
2299
3064
  height: number;
2300
3065
  }
2301
3066
 
3067
+ export declare const ReferenceLine: DefineComponent<__VLS_Props_13, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_13> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
3068
+
3069
+ /**
3070
+ * A straight reference line across the plot — a horizontal threshold / baseline
3071
+ * pinned to a `value`, or a vertical event boundary pinned to a `time`. Like
3072
+ * markers and regions, reference lines stay out of the series model: they don't
3073
+ * affect the Y-range autoscale, tooltips, or the legend. Drawn on the overlay
3074
+ * layer, *above* the series and clipped to the plot area, so the line reads on
3075
+ * top of the data the way a threshold should.
3076
+ */
3077
+ export declare interface ReferenceLineConfig {
3078
+ /** Horizontal line at this Y data value. Mutually exclusive with {@link time}. */
3079
+ value?: number;
3080
+ /** Vertical line at this `time` (epoch ms or `Date`). Mutually exclusive with {@link value}. */
3081
+ time?: TimeValue;
3082
+ /** Line and label-pill color. Default: the theme line color. */
3083
+ color?: string;
3084
+ /** Optional text label drawn in a pill at the line's near end. */
3085
+ label?: string;
3086
+ /** Dash style. Default: `'dashed'`. */
3087
+ style?: ReferenceLineStyle;
3088
+ /** Stroke width in CSS pixels. Default: `1`. */
3089
+ width?: number;
3090
+ }
3091
+
3092
+ /** Orientation of a resolved reference line. */
3093
+ export declare type ReferenceLineOrientation = 'horizontal' | 'vertical';
3094
+
3095
+ /** Dash pattern of a {@link ReferenceLineConfig}. */
3096
+ export declare type ReferenceLineStyle = 'solid' | 'dashed';
3097
+
3098
+ /** Internal bookkeeping for a registered time region. `from`/`to` are normalized to epoch ms; `to: null` is open-ended. */
3099
+ declare interface RegionEntry {
3100
+ id: string;
3101
+ from: number;
3102
+ to: number | null;
3103
+ fill?: string;
3104
+ color?: string;
3105
+ label?: string;
3106
+ }
3107
+
3108
+ /**
3109
+ * Register the four built-in series so the string form
3110
+ * `chart.addSeries('line', …)` resolves. Call it once at startup.
3111
+ *
3112
+ * Importing this helper pulls every renderer into the bundle — hosts that
3113
+ * care about size should pass definitions directly instead:
3114
+ * `chart.addSeries(LineSeriesDef, options)`.
3115
+ */
3116
+ export declare function registerBuiltinSeries(): void;
3117
+
3118
+ /**
3119
+ * Make a definition resolvable through the string form
3120
+ * `chart.addSeries('line', …)`. The built-ins register in one call via
3121
+ * `registerBuiltinSeries()`; hosts that pass definitions directly never
3122
+ * need the registry.
3123
+ */
3124
+ export declare function registerSeriesDefinition(def: SeriesDefinition): void;
3125
+
3126
+ /**
3127
+ * Vertical padding reserved at the top/bottom of the chart area.
3128
+ *
3129
+ * **Unitless on its own** — the unit is fixed by the call site:
3130
+ * - In {@link SeriesRenderContext} / {@link OverlayRenderContext}: **CSS pixels**
3131
+ * (multiply by `scope.verticalPixelRatio` to convert to bitmap pixels).
3132
+ * - In {@link SeriesRenderer.hitTest}: **bitmap pixels** (the chart pre-scales
3133
+ * so the values align with the `bx`/`by` bitmap-space pointer coords).
3134
+ *
3135
+ * Time-based renderers absorb this implicitly via the YScale's value range,
3136
+ * but spatial renderers (Pie) need the raw pixel reservation to keep their
3137
+ * layout out of the Title / InfoBar overlay regions.
3138
+ */
3139
+ declare interface RenderPadding {
3140
+ top: number;
3141
+ bottom: number;
3142
+ }
3143
+
2302
3144
  /**
2303
3145
  * Resolve the effective font size for a given axis, falling back to the
2304
3146
  * shared `axis.fontSize` default when no per-axis override is set.
@@ -2355,8 +3197,95 @@ declare interface RetargetOptions {
2355
3197
 
2356
3198
  export declare const rosePineDawn: ThemePreset;
2357
3199
 
3200
+ /** DEFAULT bar painter (registered as `'rounded'`). Trusts the engine-supplied
3201
+ * `corners` / `radius` / `isProjected`; a projected bar fills with a translucent
3202
+ * derivative of its color instead of mutating `globalAlpha`. */
3203
+ export declare const roundedBarFill: BarPainter;
3204
+
3205
+ /** DEFAULT candle-body painter (registered as `'rounded'`). Fills with the
3206
+ * engine-resolved `fillStyle` (gradient or flat) and never rebuilds a gradient. */
3207
+ export declare const roundedCandleFill: CandlePainter;
3208
+
3209
+ /** Arguments for {@link fillRoundedRect}. */
3210
+ export declare interface RoundedRectArgs {
3211
+ x: number;
3212
+ y: number;
3213
+ width: number;
3214
+ height: number;
3215
+ /** Pre-resolved bitmap radius applied to masked corners. */
3216
+ radius: number;
3217
+ /** Which corners to round; unmasked corners are square. */
3218
+ corners: CornerMask;
3219
+ }
3220
+
2358
3221
  export declare const sandDune: ThemePreset;
2359
3222
 
3223
+ /** Environment the chart hands a {@link SeriesDefinition} when constructing its renderer. */
3224
+ export declare interface SeriesCreateEnv {
3225
+ /** Active chart theme — definitions read their default colours from it. */
3226
+ theme: ChartTheme;
3227
+ /** Number of stacked layers requested via `layers` (`1` when omitted). */
3228
+ layerCount: number;
3229
+ }
3230
+
3231
+ /**
3232
+ * A series type the chart knows how to instantiate.
3233
+ *
3234
+ * Pass one to `chart.addSeries(def, options)` — the chart itself stays
3235
+ * renderer-agnostic, so bundlers only ship the series a host actually
3236
+ * imports. The built-in definitions live next to their renderers
3237
+ * (`CandlestickSeriesDef`, `LineSeriesDef`, `BarSeriesDef`, `PieSeriesDef`).
3238
+ */
3239
+ export declare interface SeriesDefinition<O = Record<string, unknown>> {
3240
+ /** Discriminator for animation defaults and string-form lookup. */
3241
+ readonly type: SeriesType;
3242
+ /** Construct the renderer. `options` arrives with the chart's animation defaults/overrides already merged. */
3243
+ create(env: SeriesCreateEnv, options: Partial<O>): SeriesRenderer;
3244
+ }
3245
+
3246
+ /**
3247
+ * A single named (and optionally colored) layer. Carries the layer's display
3248
+ * name and color *alongside* its data, so `Tooltip` / `Legend` show per-layer
3249
+ * names without a separate `label` option. `color` applies to line/bar layers;
3250
+ * a candlestick stream ignores it (candle colors come from `up` / `down`).
3251
+ */
3252
+ declare interface SeriesLayer<T> {
3253
+ /** Display name shown in tooltip / legend. A multi-layer series defaults each unnamed layer to `Series N`. */
3254
+ label?: string;
3255
+ /** Stroke + fill color for this layer; overrides the theme default. A function colors per bar / per line segment by value. Ignored by candlestick. */
3256
+ color?: ValueColor;
3257
+ /** The layer's points. */
3258
+ data: T[];
3259
+ }
3260
+
3261
+ declare interface SeriesRenderContext {
3262
+ scope: BitmapCoordinateSpace;
3263
+ timeScale: XScale;
3264
+ yScale: YScale;
3265
+ theme: ChartTheme;
3266
+ dataInterval: number;
3267
+ /** Vertical padding in **CSS pixels** — see {@link RenderPadding}. */
3268
+ padding: RenderPadding;
3269
+ /**
3270
+ * Engine-owned animation state — pulse phase, live values, entry
3271
+ * progress. Optional during the Phase 2 migration: renderers that
3272
+ * haven't been ported yet keep reading their own state and ignore this.
3273
+ */
3274
+ state?: AnimationState;
3275
+ /**
3276
+ * The id under which the chart registered this series — used by
3277
+ * stateful per-series lookups (`state.pulsePhase.get(seriesId)`,
3278
+ * `state.seriesAlpha.get(seriesId)`).
3279
+ */
3280
+ seriesId?: string;
3281
+ }
3282
+
3283
+ /**
3284
+ * Every series renderer is one of these. Discriminated on `kind`: narrow with
3285
+ * `kind === 'pie'` (or `!== 'pie'`) to reach the variant-specific surface.
3286
+ */
3287
+ declare type SeriesRenderer = TimeSeriesRenderer | PieSeriesRenderer;
3288
+
2360
3289
  /**
2361
3290
  * Frozen, per-row snapshot of a series at a single point in time. The shape
2362
3291
  * `buildHoverSnapshots` / `buildLastSnapshots` return to overlay slot
@@ -2394,6 +3323,10 @@ declare interface Size {
2394
3323
 
2395
3324
  export declare type SliceInfo = HoverInfo;
2396
3325
 
3326
+ /** `curve: 'smooth'` — monotone cubic. The in-flight last segment stays straight
3327
+ * while the trailing endpoint is growing so the head can't wobble / overshoot. */
3328
+ export declare const smoothCurve: LinePainter;
3329
+
2397
3330
  /** Sort order applied to a snapshot list by the helper. */
2398
3331
  export declare type SnapshotSort = 'none' | 'asc' | 'desc';
2399
3332
 
@@ -2402,6 +3335,13 @@ export declare const solarizedLight: ThemePreset;
2402
3335
  /** Stacking mode for bar/line series: off (overlap), normal (stacked), percent (100% stacked). */
2403
3336
  export declare type StackingMode = 'off' | 'normal' | 'percent';
2404
3337
 
3338
+ /** `curve: 'stepped'` — horizontal-then-vertical step at each sample. */
3339
+ export declare const steppedCurve: LinePainter;
3340
+
3341
+ /** DEFAULT line builder (`curve: 'straight'`). A plain polyline — identical to
3342
+ * the pre-feature stroke path. */
3343
+ export declare const straightCurve: LinePainter;
3344
+
2405
3345
  /**
2406
3346
  * Input config for {@link createTheme}. Mirrors the structure of {@link ChartTheme}
2407
3347
  * but everything is optional except `background`. Missing values are derived automatically.
@@ -2419,6 +3359,8 @@ export declare interface ThemeConfig {
2419
3359
  };
2420
3360
  line?: Partial<ChartTheme['line']>;
2421
3361
  seriesColors?: string[];
3362
+ bar?: Partial<NonNullable<ChartTheme['bar']>>;
3363
+ pie?: Partial<NonNullable<ChartTheme['pie']>>;
2422
3364
  bands?: Partial<ChartTheme['bands']>;
2423
3365
  crosshair?: Partial<ChartTheme['crosshair']>;
2424
3366
  axis?: Partial<ChartTheme['axis']>;
@@ -2482,7 +3424,7 @@ declare interface TickTrackerSnapshot {
2482
3424
  readonly isAnimating: boolean;
2483
3425
  }
2484
3426
 
2485
- export declare const TimeAxis: DefineComponent<__VLS_Props_12, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_12> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
3427
+ export declare const TimeAxis: DefineComponent<__VLS_Props_14, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_14> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
2486
3428
  containerRef: HTMLDivElement;
2487
3429
  }, HTMLDivElement>;
2488
3430
 
@@ -2497,6 +3439,67 @@ export declare type TimePointInput = Omit<TimePoint, 'time'> & {
2497
3439
  time: TimeValue;
2498
3440
  };
2499
3441
 
3442
+ export declare const TimeRegion: DefineComponent<__VLS_Props_15, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_15> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
3443
+
3444
+ /**
3445
+ * A translucent vertical band shading the interval `[from, to]` — Grafana's
3446
+ * "annotation region", TradingView's highlighted session, an SRE anomaly
3447
+ * window. Regions live outside the series model: they never affect the Y-range
3448
+ * autoscale, tooltips, or the legend. Drawn on the main layer *behind* the
3449
+ * series so the data reads on top of the shading, clipped to the plot area.
3450
+ */
3451
+ export declare interface TimeRegionConfig {
3452
+ /** Left edge — epoch ms or a `Date`. Normalized on the way in. */
3453
+ from: TimeValue;
3454
+ /**
3455
+ * Right edge — epoch ms or a `Date`. Omit (or pass `'now'`) for an open-ended
3456
+ * region that extends to the right edge of the plot — the "still firing" case.
3457
+ */
3458
+ to?: TimeRegionEnd;
3459
+ /** Band fill — any CSS color, typically translucent. Default: a faint tint of `color`. */
3460
+ fill?: string;
3461
+ /** Optional text label drawn in a pill at the top of the band. */
3462
+ label?: string;
3463
+ /** Edge-line and label-pill accent. Default: the theme's muted axis text color. */
3464
+ color?: string;
3465
+ }
3466
+
3467
+ /**
3468
+ * Right edge of a {@link TimeRegionConfig}. A concrete time closes the band;
3469
+ * `'now'` (or an omitted `to`) leaves it open-ended — it extends to the right
3470
+ * edge of the plot, the "still firing" case.
3471
+ */
3472
+ export declare type TimeRegionEnd = TimeValue | 'now';
3473
+
3474
+ /**
3475
+ * A renderer with a time axis (Candlestick, Line, Bar). Owns its data and
3476
+ * answers the time-series queries directly — Chart never reaches into a store.
3477
+ * Multi-layer renderers (Line, Bar) aggregate across their layers internally;
3478
+ * `getLastDataPoint` / `getSecondLastDataPoint` / `getVisibleDataPoints` are
3479
+ * pinned to layer 0 (see {@link BaseMultiLayerSeries}).
3480
+ */
3481
+ declare interface TimeSeriesRenderer extends BaseSeriesRenderer {
3482
+ readonly kind: 'candlestick' | 'line' | 'bar';
3483
+ /** Earliest/latest sample time across all owned layers, or null when empty. */
3484
+ getTimeBounds(): {
3485
+ first: number;
3486
+ last: number;
3487
+ } | null;
3488
+ /** Last data point (layer 0 for multi-layer), or null when empty. */
3489
+ getLastDataPoint(): OHLCData | TimePoint | null;
3490
+ /** Second-to-last data point (layer 0 for multi-layer), or null. */
3491
+ getSecondLastDataPoint(): OHLCData | TimePoint | null;
3492
+ /** First `maxCount` sample times from the first populated layer — feeds interval detection. */
3493
+ sampleTimes(maxCount: number): number[];
3494
+ /** Visible points in `[from, to]` (layer 0 for multi-layer). */
3495
+ getVisibleDataPoints(from: number, to: number): readonly (OHLCData | TimePoint)[];
3496
+ /** Effective min/max for auto-range (stacked totals for multi-layer; raw min/max otherwise). */
3497
+ getValueRange(from: number, to: number): {
3498
+ min: number;
3499
+ max: number;
3500
+ } | null;
3501
+ }
3502
+
2500
3503
  /**
2501
3504
  * Accepted time input: a timestamp in **milliseconds** (like `Date.now()`) or a `Date` object.
2502
3505
  * `Date` values are converted to milliseconds internally via `Date.getTime()`.
@@ -2547,6 +3550,27 @@ export declare interface TooltipPositionArgs {
2547
3550
  offsetY?: number;
2548
3551
  }
2549
3552
 
3553
+ /**
3554
+ * Emit path commands for one run of points onto `env.ctx`. Issues only
3555
+ * `moveTo` / `lineTo` / `bezierCurveTo`; it never opens or closes a path, so the
3556
+ * engine can wrap the same trace into both a stroke and a baseline-closed area
3557
+ * polygon. Takes the full {@link PaintEnv} (not the raw context) so a custom
3558
+ * painter can compose on it directly with the `(env, args)` it receives.
3559
+ */
3560
+ export declare function tracePath(env: PaintEnv, args: TracePathArgs): void;
3561
+
3562
+ /** Arguments for {@link tracePath}. */
3563
+ export declare interface TracePathArgs {
3564
+ points: readonly LinePoint[];
3565
+ kind: CurveKind;
3566
+ /**
3567
+ * When `true`, the final segment is drawn as a straight `lineTo` even for the
3568
+ * smooth kind — used while the trailing endpoint is mid-grow so the moving head
3569
+ * can't wobble or overshoot.
3570
+ */
3571
+ settledOnly: boolean;
3572
+ }
3573
+
2550
3574
  /**
2551
3575
  * Smoothing-curve contract. Implementations (`YRangeHermite`, `YRangeSpring`,
2552
3576
  * `RangeSnap` for Y; `VisibleRangeSpring`, `RangeSnap` for X) drive a value
@@ -2623,6 +3647,15 @@ export declare function useVisibleRange(chart: ChartInstance): Ref<VisibleRange>
2623
3647
 
2624
3648
  export declare function useYRange(chart: ChartInstance): Ref<YRange>;
2625
3649
 
3650
+ /**
3651
+ * A color, or a function of a datum's value → color. The function form is
3652
+ * evaluated per element — per bar in a bar series, per segment in a line — so
3653
+ * one layer can paint by sign / threshold (e.g. `v => v >= 0 ? up : down`)
3654
+ * without any extra option. Used both for the per-layer `data` override and the
3655
+ * theme's default bar color.
3656
+ */
3657
+ declare type ValueColor = string | ((value: number) => string);
3658
+
2626
3659
  /**
2627
3660
  * Default value formatters used across the chart library.
2628
3661
  *
@@ -2737,7 +3770,7 @@ declare class XScale {
2737
3770
  private countTicks;
2738
3771
  }
2739
3772
 
2740
- export declare const YAxis: DefineComponent<__VLS_Props_15, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_15> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
3773
+ export declare const YAxis: DefineComponent<__VLS_Props_18, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_18> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
2741
3774
  containerRef: HTMLDivElement;
2742
3775
  }, HTMLDivElement>;
2743
3776