velo-plot 1.11.1 → 1.12.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 (54) hide show
  1. package/README.md +21 -2
  2. package/dist/axisFormat-B7o_uIEA.js +127 -0
  3. package/dist/axisFormat-B7o_uIEA.js.map +1 -0
  4. package/dist/core/OverlayRenderer.d.ts +1 -2
  5. package/dist/core/OverlayRenderer.test.d.ts +1 -0
  6. package/dist/core/chart/ChartCore.d.ts +17 -1
  7. package/dist/core/chart/ChartRenderLoop.d.ts +4 -0
  8. package/dist/core/chart/ChartScaling.d.ts +11 -0
  9. package/dist/core/chart/ChartScaling.test.d.ts +1 -0
  10. package/dist/core/chart/NavigationUtils.d.ts +12 -0
  11. package/dist/core/chart/NavigationUtils.test.d.ts +1 -0
  12. package/dist/core/chart/types.d.ts +11 -1
  13. package/dist/core/format/axisFormat.d.ts +16 -0
  14. package/dist/core/format/axisFormat.test.d.ts +1 -0
  15. package/dist/core/indicator/buildIndicatorPane.d.ts +22 -0
  16. package/dist/core/indicator/buildIndicatorSeries.d.ts +14 -0
  17. package/dist/core/indicator/buildIndicatorSeries.test.d.ts +1 -0
  18. package/dist/core/indicator/index.d.ts +3 -0
  19. package/dist/core/indicator/types.d.ts +74 -0
  20. package/dist/core/series/SeriesBounds.d.ts +1 -1
  21. package/dist/core/series/SeriesBounds.test.d.ts +1 -0
  22. package/dist/core/stacked/createStackedChart.d.ts +3 -0
  23. package/dist/core/stacked/createStackedChart.test.d.ts +1 -0
  24. package/dist/core/stacked/index.d.ts +4 -0
  25. package/dist/core/stacked/paneAxis.d.ts +20 -0
  26. package/dist/core/stacked/paneAxis.test.d.ts +1 -0
  27. package/dist/core/stacked/paneResize.d.ts +32 -0
  28. package/dist/core/stacked/paneResize.test.d.ts +1 -0
  29. package/dist/core/stacked/types.d.ts +91 -0
  30. package/dist/core/sync/index.d.ts +25 -70
  31. package/dist/core/sync/index.test.d.ts +1 -0
  32. package/dist/{index-D8ifudJH.js → index-DjeWClO9.js} +601 -561
  33. package/dist/index-DjeWClO9.js.map +1 -0
  34. package/dist/{index.core-CYu3tydL.js → index.core-xiNcuFfJ.js} +1760 -1405
  35. package/dist/index.core-xiNcuFfJ.js.map +1 -0
  36. package/dist/index.d.ts +2 -0
  37. package/dist/plugins/sync.js +169 -145
  38. package/dist/plugins/sync.js.map +1 -1
  39. package/dist/plugins/tools/tooltip/TooltipManager.d.ts +9 -1
  40. package/dist/plugins/tools/tooltip/format.d.ts +7 -0
  41. package/dist/plugins/tools/tooltip/format.test.d.ts +1 -0
  42. package/dist/plugins/tools/tooltip/types.d.ts +6 -8
  43. package/dist/plugins/tools.js +1 -1
  44. package/dist/react/index.d.ts +2 -1
  45. package/dist/react/useStackedPlot.d.ts +17 -0
  46. package/dist/types.d.ts +21 -1
  47. package/dist/velo-plot.full.js +2906 -2399
  48. package/dist/velo-plot.full.js.map +1 -1
  49. package/dist/velo-plot.js +11 -11
  50. package/package.json +9 -2
  51. package/dist/EventEmitter-DAbs2K1C.js +0 -60
  52. package/dist/EventEmitter-DAbs2K1C.js.map +0 -1
  53. package/dist/index-D8ifudJH.js.map +0 -1
  54. package/dist/index.core-CYu3tydL.js.map +0 -1
package/README.md CHANGED
@@ -22,12 +22,31 @@ A high-performance, WebGL-powered scientific charting engine built for precision
22
22
 
23
23
  ## 🛠️ Installation
24
24
 
25
+ **Requirements:** Node.js **24+**, pnpm **11+** (enforced via `packageManager` in `package.json`).
26
+
27
+ ```bash
28
+ # Enable pnpm via Corepack (recommended)
29
+ corepack enable
30
+ corepack prepare pnpm@11.9.0 --activate
31
+
32
+ # Or install pnpm: https://pnpm.io/installation
33
+ ```
34
+
25
35
  ```bash
26
- npm install velo-plot
27
- # or
28
36
  pnpm add velo-plot
29
37
  ```
30
38
 
39
+ ### Development (this repo)
40
+
41
+ ```bash
42
+ git clone https://github.com/jigonzalez930209/velo-plot.git
43
+ cd velo-plot
44
+ pnpm install
45
+ pnpm test
46
+ pnpm build
47
+ pnpm docs:dev
48
+ ```
49
+
31
50
  ## 🚀 Quick Examples
32
51
 
33
52
  ### React (Recommended)
@@ -0,0 +1,127 @@
1
+ var l = Object.defineProperty;
2
+ var h = (r, e, t) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var s = (r, e, t) => h(r, typeof e != "symbol" ? e + "" : e, t);
4
+ class S {
5
+ constructor() {
6
+ s(this, "listeners", /* @__PURE__ */ new Map());
7
+ }
8
+ /**
9
+ * Subscribe to an event
10
+ */
11
+ on(e, t) {
12
+ this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t);
13
+ }
14
+ /**
15
+ * Unsubscribe from an event
16
+ */
17
+ off(e, t) {
18
+ const i = this.listeners.get(e);
19
+ i && i.delete(t);
20
+ }
21
+ /**
22
+ * Emit an event with data
23
+ */
24
+ emit(e, t) {
25
+ const i = this.listeners.get(e);
26
+ i && i.forEach((n) => {
27
+ try {
28
+ n(t);
29
+ } catch (c) {
30
+ console.error(`[EventEmitter] Error in handler for "${String(e)}":`, c);
31
+ }
32
+ });
33
+ }
34
+ /**
35
+ * Subscribe to an event once
36
+ */
37
+ once(e, t) {
38
+ const i = (n) => {
39
+ this.off(e, i), t(n);
40
+ };
41
+ this.on(e, i);
42
+ }
43
+ /**
44
+ * Remove all listeners
45
+ */
46
+ clear() {
47
+ this.listeners.clear();
48
+ }
49
+ /**
50
+ * Get listener count for an event
51
+ */
52
+ listenerCount(e) {
53
+ var t;
54
+ return ((t = this.listeners.get(e)) == null ? void 0 : t.size) ?? 0;
55
+ }
56
+ }
57
+ const m = {
58
+ n: 1e-9,
59
+ µ: 1e-6,
60
+ m: 1e-3,
61
+ "": 1,
62
+ k: 1e3,
63
+ M: 1e6
64
+ };
65
+ function g(r) {
66
+ const e = Math.abs(r);
67
+ return e >= 1e6 ? "M" : e >= 1e3 ? "k" : e > 0 && e < 1e-6 ? "n" : e > 0 && e < 1e-3 ? "µ" : e > 0 && e < 1 ? "m" : "";
68
+ }
69
+ function u(r, e) {
70
+ const t = e === "auto" ? g(r) : e, i = m[t] ?? 1;
71
+ return `${(r / i).toPrecision(3)}${t}`;
72
+ }
73
+ function E(r) {
74
+ return r <= 1e3 * 60 * 60 * 36 ? new Intl.DateTimeFormat(void 0, {
75
+ day: "2-digit",
76
+ month: "2-digit",
77
+ hour: "2-digit",
78
+ minute: "2-digit"
79
+ }) : r <= 1e3 * 60 * 60 * 24 * 90 ? new Intl.DateTimeFormat(void 0, { day: "2-digit", month: "2-digit" }) : new Intl.DateTimeFormat(void 0, { month: "short", year: "2-digit" });
80
+ }
81
+ function T(r, e) {
82
+ return E(e ?? 864e5).format(new Date(r));
83
+ }
84
+ function a(r, e) {
85
+ const t = r.toExponential(e), [i, n] = t.split("e"), c = {
86
+ 0: "⁰",
87
+ 1: "¹",
88
+ 2: "²",
89
+ 3: "³",
90
+ 4: "⁴",
91
+ 5: "⁵",
92
+ 6: "⁶",
93
+ 7: "⁷",
94
+ 8: "⁸",
95
+ 9: "⁹",
96
+ "-": "⁻",
97
+ "+": "⁺"
98
+ }, d = n.replace("+", "").replace(/[0-9\-]/g, (f) => c[f] || f);
99
+ return `${i}e${d}`;
100
+ }
101
+ function b(r, e, t) {
102
+ if ((e == null ? void 0 : e.type) === "time")
103
+ return T(r, t);
104
+ if ((e == null ? void 0 : e.prefix) !== void 0 && e.prefix !== "")
105
+ return u(r, e.prefix);
106
+ const i = (e == null ? void 0 : e.scientific) === !0, n = (e == null ? void 0 : e.scientific) === !1, c = Math.abs(r);
107
+ return i || !n && c !== 0 && c < 1e-3 ? a(r, 1) : r.toFixed(3).replace(/\.?0+$/, "");
108
+ }
109
+ function w(r, e) {
110
+ if (r === 0) return "0";
111
+ const t = (e == null ? void 0 : e.scientific) === !0, i = (e == null ? void 0 : e.scientific) === !1, n = Math.abs(r);
112
+ return (e == null ? void 0 : e.prefix) !== void 0 && e.prefix !== "" ? u(r, e.prefix) : t || !i && (n < 1e-4 || n >= 1e6) ? a(r, 1) : n >= 1e3 ? r.toLocaleString(void 0, { maximumFractionDigits: 2 }) : r.toPrecision(3);
113
+ }
114
+ function k(r, e) {
115
+ return b(r, e == null ? void 0 : e.x, e == null ? void 0 : e.xSpan);
116
+ }
117
+ function D(r, e) {
118
+ return w(r, e == null ? void 0 : e.y);
119
+ }
120
+ export {
121
+ S as E,
122
+ D as a,
123
+ b,
124
+ w as c,
125
+ k as f
126
+ };
127
+ //# sourceMappingURL=axisFormat-B7o_uIEA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axisFormat-B7o_uIEA.js","sources":["../src/core/EventEmitter.ts","../src/core/format/axisFormat.ts"],"sourcesContent":["/**\n * Type-safe event emitter for chart events\n */\n\nexport class EventEmitter<EventMap extends object> {\n private listeners: Map<keyof EventMap, Set<(data: unknown) => void>> =\n new Map();\n\n /**\n * Subscribe to an event\n */\n on<K extends keyof EventMap>(\n event: K,\n handler: (data: EventMap[K]) => void\n ): void {\n if (!this.listeners.has(event)) {\n this.listeners.set(event, new Set());\n }\n this.listeners.get(event)!.add(handler as (data: unknown) => void);\n }\n\n /**\n * Unsubscribe from an event\n */\n off<K extends keyof EventMap>(\n event: K,\n handler: (data: EventMap[K]) => void\n ): void {\n const handlers = this.listeners.get(event);\n if (handlers) {\n handlers.delete(handler as (data: unknown) => void);\n }\n }\n\n /**\n * Emit an event with data\n */\n emit<K extends keyof EventMap>(event: K, data: EventMap[K]): void {\n const handlers = this.listeners.get(event);\n if (handlers) {\n handlers.forEach((handler) => {\n try {\n handler(data);\n } catch (error) {\n console.error(`[EventEmitter] Error in handler for \"${String(event)}\":`, error);\n }\n });\n }\n }\n\n /**\n * Subscribe to an event once\n */\n once<K extends keyof EventMap>(\n event: K,\n handler: (data: EventMap[K]) => void\n ): void {\n const wrappedHandler = (data: EventMap[K]) => {\n this.off(event, wrappedHandler);\n handler(data);\n };\n this.on(event, wrappedHandler);\n }\n\n /**\n * Remove all listeners\n */\n clear(): void {\n this.listeners.clear();\n }\n\n /**\n * Get listener count for an event\n */\n listenerCount(event: keyof EventMap): number {\n return this.listeners.get(event)?.size ?? 0;\n }\n}\n","/**\n * Shared axis tick and tooltip value formatting.\n */\nimport type { AxisOptions } from \"../../types\";\n\nconst PREFIXDivisors: Record<string, number> = {\n n: 1e-9,\n µ: 1e-6,\n m: 1e-3,\n \"\": 1,\n k: 1e3,\n M: 1e6,\n};\n\nexport function autoPrefixFor(value: number): NonNullable<AxisOptions[\"prefix\"]> {\n const absVal = Math.abs(value);\n if (absVal >= 1e6) return \"M\";\n if (absVal >= 1e3) return \"k\";\n if (absVal > 0 && absVal < 1e-6) return \"n\";\n if (absVal > 0 && absVal < 1e-3) return \"µ\";\n if (absVal > 0 && absVal < 1) return \"m\";\n return \"\";\n}\n\nexport function applyPrefix(\n value: number,\n prefix: NonNullable<AxisOptions[\"prefix\"]>,\n): string {\n const resolved = prefix === \"auto\" ? autoPrefixFor(value) : prefix;\n const divisor = PREFIXDivisors[resolved] ?? 1;\n const scaled = value / divisor;\n return `${scaled.toPrecision(3)}${resolved}`;\n}\n\nexport function pickTimeFormatter(spanMs: number): Intl.DateTimeFormat {\n if (spanMs <= 1000 * 60 * 60 * 36) {\n return new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n }\n if (spanMs <= 1000 * 60 * 60 * 24 * 90) {\n return new Intl.DateTimeFormat(undefined, { day: \"2-digit\", month: \"2-digit\" });\n }\n return new Intl.DateTimeFormat(undefined, { month: \"short\", year: \"2-digit\" });\n}\n\nexport function formatTimeTick(value: number, spanMs?: number): string {\n const span = spanMs ?? 1000 * 60 * 60 * 24;\n return pickTimeFormatter(span).format(new Date(value));\n}\n\nexport function toScientificUnicode(value: number, precision: number): string {\n const str = value.toExponential(precision);\n const [mantissa, exponent] = str.split(\"e\");\n\n const superscriptMap: Record<string, string> = {\n \"0\": \"⁰\",\n \"1\": \"¹\",\n \"2\": \"²\",\n \"3\": \"³\",\n \"4\": \"⁴\",\n \"5\": \"⁵\",\n \"6\": \"⁶\",\n \"7\": \"⁷\",\n \"8\": \"⁸\",\n \"9\": \"⁹\",\n \"-\": \"⁻\",\n \"+\": \"⁺\",\n };\n\n const unicodeExp = exponent\n .replace(\"+\", \"\")\n .replace(/[0-9\\-]/g, (char) => superscriptMap[char] || char);\n\n return `${mantissa}e${unicodeExp}`;\n}\n\nexport function formatXTickValue(\n value: number,\n options?: AxisOptions,\n domainSpan?: number,\n): string {\n if (options?.type === \"time\") {\n return formatTimeTick(value, domainSpan);\n }\n\n if (options?.prefix !== undefined && options.prefix !== \"\") {\n return applyPrefix(value, options.prefix);\n }\n\n const forceScientific = options?.scientific === true;\n const forceLinear = options?.scientific === false;\n const absVal = Math.abs(value);\n\n if (forceScientific || (!forceLinear && absVal !== 0 && absVal < 0.001)) {\n return toScientificUnicode(value, 1);\n }\n\n return value.toFixed(3).replace(/\\.?0+$/, \"\");\n}\n\nexport function formatYTickValue(value: number, options?: AxisOptions): string {\n if (value === 0) return \"0\";\n\n const forceScientific = options?.scientific === true;\n const forceLinear = options?.scientific === false;\n const absVal = Math.abs(value);\n\n if (options?.prefix !== undefined && options.prefix !== \"\") {\n return applyPrefix(value, options.prefix);\n }\n\n if (forceScientific || (!forceLinear && (absVal < 0.0001 || absVal >= 1e6))) {\n return toScientificUnicode(value, 1);\n }\n\n if (absVal >= 1000) {\n return value.toLocaleString(undefined, { maximumFractionDigits: 2 });\n }\n\n return value.toPrecision(3);\n}\n\nexport interface TooltipAxisFormat {\n x?: Partial<AxisOptions>;\n y?: Partial<AxisOptions>;\n xSpan?: number;\n}\n\nexport function formatTooltipX(value: number, axisFormat?: TooltipAxisFormat): string {\n return formatXTickValue(value, axisFormat?.x as AxisOptions | undefined, axisFormat?.xSpan);\n}\n\nexport function formatTooltipY(value: number, axisFormat?: TooltipAxisFormat): string {\n return formatYTickValue(value, axisFormat?.y as AxisOptions | undefined);\n}\n"],"names":["EventEmitter","__publicField","event","handler","handlers","data","error","wrappedHandler","_a","PREFIXDivisors","autoPrefixFor","value","absVal","applyPrefix","prefix","resolved","divisor","pickTimeFormatter","spanMs","formatTimeTick","toScientificUnicode","precision","str","mantissa","exponent","superscriptMap","unicodeExp","char","formatXTickValue","options","domainSpan","forceScientific","forceLinear","formatYTickValue","formatTooltipX","axisFormat","formatTooltipY"],"mappings":";;;AAIO,MAAMA,EAAsC;AAAA,EAA5C;AACG,IAAAC,EAAA,uCACF,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN,GACEC,GACAC,GACM;AACN,IAAK,KAAK,UAAU,IAAID,CAAK,KAC3B,KAAK,UAAU,IAAIA,GAAO,oBAAI,KAAK,GAErC,KAAK,UAAU,IAAIA,CAAK,EAAG,IAAIC,CAAkC;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA,EAKA,IACED,GACAC,GACM;AACN,UAAMC,IAAW,KAAK,UAAU,IAAIF,CAAK;AACzC,IAAIE,KACFA,EAAS,OAAOD,CAAkC;AAAA,EAEtD;AAAA;AAAA;AAAA;AAAA,EAKA,KAA+BD,GAAUG,GAAyB;AAChE,UAAMD,IAAW,KAAK,UAAU,IAAIF,CAAK;AACzC,IAAIE,KACFA,EAAS,QAAQ,CAACD,MAAY;AAC5B,UAAI;AACF,QAAAA,EAAQE,CAAI;AAAA,MACd,SAASC,GAAO;AACd,gBAAQ,MAAM,wCAAwC,OAAOJ,CAAK,CAAC,MAAMI,CAAK;AAAA,MAChF;AAAA,IACF,CAAC;AAAA,EAEL;AAAA;AAAA;AAAA;AAAA,EAKA,KACEJ,GACAC,GACM;AACN,UAAMI,IAAiB,CAACF,MAAsB;AAC5C,WAAK,IAAIH,GAAOK,CAAc,GAC9BJ,EAAQE,CAAI;AAAA,IACd;AACA,SAAK,GAAGH,GAAOK,CAAc;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA,EAKA,QAAc;AACZ,SAAK,UAAU,MAA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,CAACC,MAAgBpB,IAAS,QAAUA,KAAU,OAC7DQ,EAAoBT,GAAO,CAAC,IAGjCC,KAAU,MACLD,EAAM,eAAe,QAAW,EAAE,uBAAuB,GAAG,IAG9DA,EAAM,YAAY,CAAC;AAC5B;AAQO,SAASuB,EAAevB,GAAewB,GAAwC;AACpF,SAAOP,EAAiBjB,GAAOwB,KAAA,gBAAAA,EAAY,GAA8BA,KAAA,gBAAAA,EAAY,KAAK;AAC5F;AAEO,SAASC,EAAezB,GAAewB,GAAwC;AACpF,SAAOF,EAAiBtB,GAAOwB,KAAA,gBAAAA,EAAY,CAA4B;AACzE;"}
@@ -28,7 +28,7 @@ export declare class OverlayRenderer {
28
28
  /**
29
29
  * Draw the grid
30
30
  */
31
- drawGrid(plotArea: PlotArea, xScale: Scale, yScale: Scale): void;
31
+ drawGrid(plotArea: PlotArea, xScale: Scale, yScale: Scale, xAxisOptions?: AxisOptions, yAxisOptions?: AxisOptions): void;
32
32
  /**
33
33
  * Draw polar grid (radial circles and angular spokes)
34
34
  */
@@ -85,5 +85,4 @@ export declare class OverlayRenderer {
85
85
  private generateMinorTicks;
86
86
  private formatXTick;
87
87
  private formatYTick;
88
- private toScientificUnicode;
89
88
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { ChartOptions, AxisOptions, SeriesOptions, HeatmapOptions, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Bounds } from '../../types';
1
+ import { ChartOptions, AxisOptions, SeriesOptions, HeatmapOptions, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Bounds, FitOptions } from '../../types';
2
2
  import { EventEmitter } from '../EventEmitter';
3
3
  import { Series } from '../Series';
4
4
  import { Scale } from '../../scales';
@@ -44,9 +44,12 @@ export declare class ChartImpl implements Chart {
44
44
  private controls;
45
45
  private layout;
46
46
  private _isDestroyed;
47
+ /** When true, skip resize (stacked pane drag uses CSS scaling instead). */
48
+ private resizeSuspended;
47
49
  private autoScroll;
48
50
  private showStatistics;
49
51
  private initQueueId;
52
+ private readonly chartId;
50
53
  private commandQueue;
51
54
  private annotationQueue;
52
55
  private annotationIdCounter;
@@ -145,6 +148,8 @@ export declare class ChartImpl implements Chart {
145
148
  }): void;
146
149
  pan(deltaX: number, deltaY: number, axisId?: string): void;
147
150
  resetZoom(): void;
151
+ fit(options?: FitOptions): void;
152
+ getId(): string;
148
153
  getViewBounds(): Bounds;
149
154
  autoScale(animate?: boolean): void;
150
155
  /**
@@ -219,6 +224,10 @@ export declare class ChartImpl implements Chart {
219
224
  * Get Y axis configuration by ID
220
225
  */
221
226
  getYAxis(id: string): AxisOptions | undefined;
227
+ /**
228
+ * Get X axis configuration
229
+ */
230
+ getXAxis(): AxisOptions;
222
231
  /**
223
232
  * Get all Y axes configurations
224
233
  */
@@ -313,6 +322,13 @@ export declare class ChartImpl implements Chart {
313
322
  */
314
323
  fromUrlHash(hash: string, compressed?: boolean): void;
315
324
  use(plugin: any): Promise<void>;
325
+ /**
326
+ * Suspend canvas backing-store resize (inactive panes during stacked drag).
327
+ */
328
+ setResizeSuspended(suspended: boolean): void;
329
+ /** @deprecated Use CSS transform on pane wrapper during drag; canvas stays untouched. */
330
+ syncDragLayout(width?: number, height?: number): void;
331
+ isResizeSuspended(): boolean;
316
332
  resize(): void;
317
333
  requestRender(): void;
318
334
  requestOverlayRender(): void;
@@ -75,6 +75,10 @@ export declare class ChartRenderLoop {
75
75
  * Schedule render on next animation frame
76
76
  */
77
77
  private scheduleRenderFrame;
78
+ /**
79
+ * Perform an immediate full render (used after resize to avoid flicker).
80
+ */
81
+ flushRender(): void;
78
82
  /**
79
83
  * Cancel any pending render
80
84
  */
@@ -5,6 +5,17 @@ import { ZoomOptions } from '../../types';
5
5
  * Auto-scale all axes to fit data
6
6
  */
7
7
  export declare function autoScaleAll(ctx: NavigationContext): void;
8
+ /**
9
+ * Fit view to data or explicit ranges. Returns false when there is nothing to fit.
10
+ */
11
+ export declare function fitToData(ctx: NavigationContext, options?: {
12
+ x?: [number, number];
13
+ y?: [number, number];
14
+ padding?: number | {
15
+ x?: number;
16
+ y?: number;
17
+ };
18
+ }): boolean;
8
19
  /**
9
20
  * Auto-scale only Y-axes to fit data (keeps X-axis stable)
10
21
  * Used during streaming to prevent X-axis shifting
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared navigation helpers for zoom/pan behavior.
3
+ */
4
+ export interface NavSeriesLike {
5
+ isVisible(): boolean;
6
+ getType(): string;
7
+ }
8
+ /**
9
+ * Pin Y minimum to 0 only for pure volume-style bar charts (bars only, no overlays).
10
+ * Mixed indicator panes (histogram + lines) get full Y pan/zoom freedom.
11
+ */
12
+ export declare function usesVolumeBarPinning(series: Iterable<NavSeriesLike>): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { SeriesOptions, HeatmapOptions, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Bounds, AxisOptions } from '../../types';
1
+ import { SeriesOptions, HeatmapOptions, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Bounds, AxisOptions, FitOptions } from '../../types';
2
2
  import { Series } from '../Series';
3
3
  import { Annotation } from '../annotations';
4
4
  import { ChartAnimationConfig } from '../animation';
@@ -21,12 +21,20 @@ export interface Chart {
21
21
  zoom(options: ZoomOptions & {
22
22
  animate?: boolean;
23
23
  }): void;
24
+ /** Fit view to data; no-op when series have no valid bounds */
25
+ fit(options?: FitOptions): void;
26
+ /** Stable chart id for sync groups */
27
+ getId(): string;
24
28
  pan(deltaX: number, deltaY: number): void;
25
29
  resetZoom(): void;
26
30
  getViewBounds(): Bounds;
27
31
  enableCursor(options: CursorOptions): void;
28
32
  disableCursor(): void;
29
33
  resize(width?: number, height?: number): void;
34
+ /** Pause backing-store resize — canvases scale via CSS until cleared */
35
+ setResizeSuspended?(suspended: boolean): void;
36
+ /** Re-apply CSS canvas fill after pane flex changes during drag */
37
+ syncDragLayout?(width?: number, height?: number): void;
30
38
  /** Get current device pixel ratio used for rendering */
31
39
  getDPR(): number;
32
40
  /** Set device pixel ratio and trigger re-render */
@@ -93,6 +101,8 @@ export interface Chart {
93
101
  updateXAxis(options: Partial<AxisOptions>): void;
94
102
  /** Get Y axis configuration by ID */
95
103
  getYAxis(id: string): AxisOptions | undefined;
104
+ /** Get X axis configuration */
105
+ getXAxis(): AxisOptions;
96
106
  /** Get all Y axes configurations */
97
107
  getAllYAxes(): AxisOptions[];
98
108
  /** Get the primary Y axis ID */
@@ -0,0 +1,16 @@
1
+ import { AxisOptions } from '../../types';
2
+
3
+ export declare function autoPrefixFor(value: number): NonNullable<AxisOptions["prefix"]>;
4
+ export declare function applyPrefix(value: number, prefix: NonNullable<AxisOptions["prefix"]>): string;
5
+ export declare function pickTimeFormatter(spanMs: number): Intl.DateTimeFormat;
6
+ export declare function formatTimeTick(value: number, spanMs?: number): string;
7
+ export declare function toScientificUnicode(value: number, precision: number): string;
8
+ export declare function formatXTickValue(value: number, options?: AxisOptions, domainSpan?: number): string;
9
+ export declare function formatYTickValue(value: number, options?: AxisOptions): string;
10
+ export interface TooltipAxisFormat {
11
+ x?: Partial<AxisOptions>;
12
+ y?: Partial<AxisOptions>;
13
+ xSpan?: number;
14
+ }
15
+ export declare function formatTooltipX(value: number, axisFormat?: TooltipAxisFormat): string;
16
+ export declare function formatTooltipY(value: number, axisFormat?: TooltipAxisFormat): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ import { Range } from '../../types';
2
+ import { StackedPaneConfig } from '../stacked/types';
3
+ import { IndicatorData, IndicatorStyle } from './types';
4
+
5
+ export interface BuildIndicatorPaneOptions {
6
+ id: string;
7
+ /** Flex ratio inside createStackedChart (default 0.25) */
8
+ height?: number | string;
9
+ label?: string;
10
+ data: IndicatorData;
11
+ style?: IndicatorStyle;
12
+ /** Lock Y range (recommended for oscillators) */
13
+ yRange?: Range | "auto";
14
+ tickCount?: number;
15
+ showXAxis?: boolean;
16
+ seriesId?: string;
17
+ }
18
+ /**
19
+ * Build a stacked pane pre-configured for a trading indicator
20
+ * (histogram + lines + fills + markers).
21
+ */
22
+ export declare function buildIndicatorPane(options: BuildIndicatorPaneOptions): StackedPaneConfig;
@@ -0,0 +1,14 @@
1
+ import { SeriesOptions } from '../../types';
2
+ import { IndicatorSeriesOptions } from './types';
3
+
4
+ /**
5
+ * Build native series options from an indicator definition.
6
+ * Use in any chart pane — standalone or inside createStackedChart.
7
+ */
8
+ export declare function buildIndicatorSeries(options: IndicatorSeriesOptions): SeriesOptions[];
9
+ /** Convenience: one call returns all series for chart.addSeries / stacked pane config. */
10
+ export declare function createIndicatorSeries(options: IndicatorSeriesOptions): SeriesOptions[];
11
+ /**
12
+ * Detect local extrema on a line for peak/trough markers.
13
+ */
14
+ export declare function detectIndicatorMarkers(x: Float32Array | Float64Array | number[], y: Float32Array | Float64Array | number[], window?: number): import('./types').IndicatorMarker[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export type { IndicatorData, IndicatorFillLayer, IndicatorHistogramLayer, IndicatorLineColorZones, IndicatorLineLayer, IndicatorMarker, IndicatorMarkerKind, IndicatorReferenceLine, IndicatorSeriesOptions, IndicatorStyle, } from './types';
2
+ export { buildIndicatorSeries, createIndicatorSeries, detectIndicatorMarkers, } from './buildIndicatorSeries';
3
+ export { buildIndicatorPane, type BuildIndicatorPaneOptions } from './buildIndicatorPane';
@@ -0,0 +1,74 @@
1
+ export type IndicatorMarkerKind = "peak" | "trough";
2
+ /** Two-tone line segments — buy/sell zones relative to a reference. */
3
+ export interface IndicatorLineColorZones {
4
+ /** Constant Y, `'zero'`, or `id` of another line layer in the same indicator */
5
+ ref?: number | "zero" | string;
6
+ /** Color when line is at or above the reference */
7
+ aboveColor: string;
8
+ /** Color when line is below the reference */
9
+ belowColor: string;
10
+ }
11
+ export interface IndicatorLineLayer {
12
+ id?: string;
13
+ y: Float32Array | Float64Array | number[];
14
+ color?: string;
15
+ width?: number;
16
+ opacity?: number;
17
+ /** Split line into colored segments (e.g. buy above signal, sell below) */
18
+ colorZones?: IndicatorLineColorZones;
19
+ }
20
+ export interface IndicatorFillLayer {
21
+ id?: string;
22
+ upper: Float32Array | Float64Array | number[];
23
+ lower: Float32Array | Float64Array | number[];
24
+ color?: string;
25
+ opacity?: number;
26
+ }
27
+ export interface IndicatorMarker {
28
+ x: number;
29
+ y: number;
30
+ kind: IndicatorMarkerKind;
31
+ color?: string;
32
+ size?: number;
33
+ }
34
+ export interface IndicatorHistogramLayer {
35
+ y: Float32Array | Float64Array | number[];
36
+ positiveColor?: string;
37
+ negativeColor?: string;
38
+ opacity?: number;
39
+ barWidth?: number;
40
+ }
41
+ export interface IndicatorReferenceLine {
42
+ y: number;
43
+ color?: string;
44
+ width?: number;
45
+ dash?: number[];
46
+ }
47
+ /** Composite trading-indicator payload (histogram, lines, fills, markers). */
48
+ export interface IndicatorData {
49
+ x: Float32Array | Float64Array | number[];
50
+ histogram?: IndicatorHistogramLayer;
51
+ lines?: IndicatorLineLayer[];
52
+ fills?: IndicatorFillLayer[];
53
+ markers?: IndicatorMarker[];
54
+ /** Baseline Y value (default 0) — rendered as dashed reference line */
55
+ baseline?: number;
56
+ referenceLines?: IndicatorReferenceLine[];
57
+ }
58
+ export interface IndicatorStyle {
59
+ baselineColor?: string;
60
+ baselineWidth?: number;
61
+ baselineDash?: number[];
62
+ peakColor?: string;
63
+ troughColor?: string;
64
+ peakSize?: number;
65
+ troughSize?: number;
66
+ }
67
+ export interface IndicatorSeriesOptions {
68
+ id: string;
69
+ type: "indicator";
70
+ data: IndicatorData;
71
+ style?: IndicatorStyle;
72
+ visible?: boolean;
73
+ name?: string;
74
+ }
@@ -1,3 +1,3 @@
1
1
  import { SeriesData, Bounds, SeriesType, HeatmapData, PolarData } from '../../types';
2
2
 
3
- export declare function calculateSeriesBounds(type: SeriesType, data: SeriesData, heatmapData?: HeatmapData, polarData?: PolarData): Bounds;
3
+ export declare function calculateSeriesBounds(type: SeriesType, data: SeriesData, heatmapData?: HeatmapData, polarData?: PolarData): Bounds | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { StackedChart, StackedChartOptions } from './types';
2
+
3
+ export declare function createStackedChart(options: StackedChartOptions): StackedChart;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { createStackedChart } from './createStackedChart';
2
+ export type { StackedChart, StackedChartOptions, StackedPaneConfig, StackedSyncOptions } from './types';
3
+ export { STACKED_MAX_PANES, STACKED_DEFAULT_MIN_PANE_RATIO, } from './types';
4
+ export { normalizePaneHeights, resolveMinPaneHeightPx, } from './paneResize';
@@ -0,0 +1,20 @@
1
+ import { Chart } from '../chart/types';
2
+
3
+ /** Adaptive Y tick count from pane height (~1 tick per 36px, capped by base). */
4
+ export declare function tickCountForPaneHeight(heightPx: number, base?: number): number;
5
+ /** Adaptive X tick count from pane width. */
6
+ export declare function tickCountForPaneWidth(widthPx: number, base?: number): number;
7
+ export interface PaneAxisMeta {
8
+ chart: Chart;
9
+ wrapper: HTMLDivElement;
10
+ baseYTickCount: number;
11
+ baseXTickCount: number;
12
+ showXAxis: boolean;
13
+ }
14
+ export declare function readBaseYTickCount(yAxis?: {
15
+ tickCount?: number;
16
+ } | {
17
+ tickCount?: number;
18
+ }[]): number;
19
+ export declare function adaptPaneAxes(meta: PaneAxisMeta): void;
20
+ export declare function adaptAllPaneAxes(metas: PaneAxisMeta[]): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * VS Code–style drag dividers between stacked chart panes.
3
+ */
4
+ export interface PaneResizeOptions {
5
+ /** Min pane height as fraction of available height (default 1/6) */
6
+ minPaneRatio?: number;
7
+ /** Absolute min pane height in px — used when larger than ratio-based min */
8
+ minPanePx?: number;
9
+ /** Divider hit area height (default 6) */
10
+ dividerSize?: number;
11
+ /** Called while dragging with normalized flex ratios keyed by pane id */
12
+ onResize?: (ratiosById: Record<string, number>) => void;
13
+ /** Called when divider drag starts — return initial pane heights for this drag session */
14
+ onDragStart?: (topIdx: number, bottomIdx: number) => number[];
15
+ /** Called each pointer move (batched to rAF by consumer) with updated heights */
16
+ onDragMove?: (heightsPx: number[], topIdx: number, bottomIdx: number) => void;
17
+ /** Called when divider drag ends — perform chart resize here */
18
+ onDragEnd?: (finalHeightsPx: number[]) => void;
19
+ }
20
+ export interface PaneResizeController {
21
+ dividers: HTMLDivElement[];
22
+ destroy: () => void;
23
+ }
24
+ /** Resolve per-pane minimum height in px for the current available stack height. */
25
+ export declare function resolveMinPaneHeightPx(availHeight: number, paneCount: number, minPaneRatio?: number, minPanePx?: number): number;
26
+ /**
27
+ * Scale pane heights to exactly fill available space (fixes sub-pixel gaps during drag).
28
+ */
29
+ export declare function normalizePaneHeights(heightsPx: number[], targetTotal: number): number[];
30
+ export declare function attachPaneResize(container: HTMLDivElement, paneWrappers: HTMLDivElement[], paneIds: string[], ratios: number[], options?: PaneResizeOptions): PaneResizeController;
31
+ export declare function applyPaneFlexRatios(paneWrappers: HTMLDivElement[], ratios: number[]): void;
32
+ export declare function initialPaneRatio(height: number | string): number;
@@ -0,0 +1 @@
1
+ export {};