velo-plot 1.11.1 → 1.15.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 (118) hide show
  1. package/README.md +35 -2
  2. package/dist/{index.core-CYu3tydL.js → ChartCore-BimVvUEg.js} +1936 -1588
  3. package/dist/ChartCore-BimVvUEg.js.map +1 -0
  4. package/dist/axisFormat-B7o_uIEA.js +127 -0
  5. package/dist/axisFormat-B7o_uIEA.js.map +1 -0
  6. package/dist/core/OverlayRenderer.d.ts +1 -2
  7. package/dist/core/chart/ChartCore.d.ts +18 -1
  8. package/dist/core/chart/ChartRenderLoop.d.ts +4 -0
  9. package/dist/core/chart/ChartScaling.d.ts +11 -0
  10. package/dist/core/chart/NavigationUtils.d.ts +12 -0
  11. package/dist/core/chart/exporter/SVGExporter.d.ts +7 -2
  12. package/dist/core/chart/types.d.ts +13 -1
  13. package/dist/core/format/axisFormat.d.ts +16 -0
  14. package/dist/core/indicator/buildIndicatorPane.d.ts +22 -0
  15. package/dist/core/indicator/buildIndicatorSeries.d.ts +14 -0
  16. package/dist/core/indicator/index.d.ts +3 -0
  17. package/dist/core/indicator/types.d.ts +74 -0
  18. package/dist/core/render/pixelSnap.d.ts +8 -0
  19. package/dist/core/series/SeriesBounds.d.ts +1 -1
  20. package/dist/core/stacked/createStackedChart.d.ts +3 -0
  21. package/dist/core/stacked/index.d.ts +6 -0
  22. package/dist/core/stacked/paneAxis.d.ts +20 -0
  23. package/dist/core/stacked/paneResize.d.ts +29 -0
  24. package/dist/core/stacked/stackExport.d.ts +18 -0
  25. package/dist/core/stacked/types.d.ts +120 -0
  26. package/dist/core/sync/index.d.ts +25 -70
  27. package/dist/createStackedChart-CjsKcOvX.js +1088 -0
  28. package/dist/createStackedChart-CjsKcOvX.js.map +1 -0
  29. package/dist/index-CUGS98p4.js +277 -0
  30. package/dist/index-CUGS98p4.js.map +1 -0
  31. package/dist/index-ChgIdk3N.js +229 -0
  32. package/dist/index-ChgIdk3N.js.map +1 -0
  33. package/dist/{index-D8ifudJH.js → index-DjeWClO9.js} +601 -561
  34. package/dist/index-DjeWClO9.js.map +1 -0
  35. package/dist/index.core-C_-CFftD.js +167 -0
  36. package/dist/index.core-C_-CFftD.js.map +1 -0
  37. package/dist/index.d.ts +2 -0
  38. package/dist/math-Ddm2EZjj.js +85 -0
  39. package/dist/math-Ddm2EZjj.js.map +1 -0
  40. package/dist/plugins/analysis.js +132 -130
  41. package/dist/plugins/analysis.js.map +1 -1
  42. package/dist/plugins/anomaly-detection.d.ts +1 -0
  43. package/dist/plugins/anomaly-detection.js +221 -0
  44. package/dist/plugins/anomaly-detection.js.map +1 -0
  45. package/dist/plugins/broken-axis.d.ts +3 -0
  46. package/dist/plugins/broken-axis.js +262 -0
  47. package/dist/plugins/broken-axis.js.map +1 -0
  48. package/dist/plugins/caching.d.ts +3 -0
  49. package/dist/plugins/caching.js +182 -0
  50. package/dist/plugins/caching.js.map +1 -0
  51. package/dist/plugins/data-transform.d.ts +3 -0
  52. package/dist/plugins/data-transform.js +146 -0
  53. package/dist/plugins/data-transform.js.map +1 -0
  54. package/dist/plugins/debug.js +12 -11
  55. package/dist/plugins/debug.js.map +1 -1
  56. package/dist/plugins/forecasting.d.ts +1 -0
  57. package/dist/plugins/forecasting.js +236 -0
  58. package/dist/plugins/forecasting.js.map +1 -0
  59. package/dist/plugins/latex.d.ts +1 -0
  60. package/dist/plugins/latex.js +454 -0
  61. package/dist/plugins/latex.js.map +1 -0
  62. package/dist/plugins/lazy-load.d.ts +3 -0
  63. package/dist/plugins/lazy-load.js +189 -0
  64. package/dist/plugins/lazy-load.js.map +1 -0
  65. package/dist/plugins/ml-integration.d.ts +3 -0
  66. package/dist/plugins/ml-integration.js +355 -0
  67. package/dist/plugins/ml-integration.js.map +1 -0
  68. package/dist/plugins/offscreen.d.ts +3 -0
  69. package/dist/plugins/offscreen.js +169 -0
  70. package/dist/plugins/offscreen.js.map +1 -0
  71. package/dist/plugins/pattern-recognition.d.ts +3 -0
  72. package/dist/plugins/pattern-recognition.js +690 -0
  73. package/dist/plugins/pattern-recognition.js.map +1 -0
  74. package/dist/plugins/radar.d.ts +3 -0
  75. package/dist/plugins/radar.js +103 -0
  76. package/dist/plugins/radar.js.map +1 -0
  77. package/dist/plugins/regression.d.ts +3 -0
  78. package/dist/plugins/regression.js +634 -0
  79. package/dist/plugins/regression.js.map +1 -0
  80. package/dist/plugins/roi.d.ts +1 -0
  81. package/dist/plugins/roi.js +223 -0
  82. package/dist/plugins/roi.js.map +1 -0
  83. package/dist/plugins/snapshot/types.d.ts +1 -1
  84. package/dist/plugins/snapshot.d.ts +3 -0
  85. package/dist/plugins/snapshot.js +90 -0
  86. package/dist/plugins/snapshot.js.map +1 -0
  87. package/dist/plugins/sync/index.d.ts +2 -1
  88. package/dist/plugins/sync.js +12 -244
  89. package/dist/plugins/sync.js.map +1 -1
  90. package/dist/plugins/tools/tooltip/TooltipManager.d.ts +9 -1
  91. package/dist/plugins/tools/tooltip/format.d.ts +7 -0
  92. package/dist/plugins/tools/tooltip/types.d.ts +6 -8
  93. package/dist/plugins/tools.js +1 -1
  94. package/dist/plugins/video-recorder.d.ts +3 -0
  95. package/dist/plugins/video-recorder.js +104 -0
  96. package/dist/plugins/video-recorder.js.map +1 -0
  97. package/dist/plugins/virtualization.d.ts +3 -0
  98. package/dist/plugins/virtualization.js +6 -0
  99. package/dist/plugins/virtualization.js.map +1 -0
  100. package/dist/react/index.d.ts +2 -1
  101. package/dist/react/useStackedPlot.d.ts +17 -0
  102. package/dist/react.d.ts +1 -0
  103. package/dist/react.js +31 -0
  104. package/dist/react.js.map +1 -0
  105. package/dist/types.d.ts +21 -1
  106. package/dist/utils-BK5UUXxj.js +172 -0
  107. package/dist/utils-BK5UUXxj.js.map +1 -0
  108. package/dist/velo-plot.full.js +1000 -5576
  109. package/dist/velo-plot.full.js.map +1 -1
  110. package/dist/velo-plot.js +23 -22
  111. package/dist/velo-plot.js.map +1 -1
  112. package/package.json +17 -3
  113. package/dist/EventEmitter-DAbs2K1C.js +0 -60
  114. package/dist/EventEmitter-DAbs2K1C.js.map +0 -1
  115. package/dist/index-D8ifudJH.js.map +0 -1
  116. package/dist/index.core-CYu3tydL.js.map +0 -1
  117. package/dist/utils-Dbro9-qM.js +0 -254
  118. package/dist/utils-Dbro9-qM.js.map +0 -1
@@ -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,GA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KAAK,IAAID,CAAK;AAE7B,UAAIkB,KAAA,gBAAAA,EAAS,YAAW,UAAaA,EAAQ,WAAW,KAC/ChB,EAAYF,GAAOkB,EAAQ,MAAM,IAGtCE,KAAoB,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
  }
@@ -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;
@@ -123,6 +126,7 @@ export declare class ChartImpl implements Chart {
123
126
  };
124
127
  private getInteractedBounds;
125
128
  exportImage(type?: "png" | "jpeg"): string;
129
+ exportSVG(): string;
126
130
  private getSeriesContext;
127
131
  addSeries(options: SeriesOptions | HeatmapOptions): void;
128
132
  addBar(options: Omit<SeriesOptions, "type">): void;
@@ -145,6 +149,8 @@ export declare class ChartImpl implements Chart {
145
149
  }): void;
146
150
  pan(deltaX: number, deltaY: number, axisId?: string): void;
147
151
  resetZoom(): void;
152
+ fit(options?: FitOptions): void;
153
+ getId(): string;
148
154
  getViewBounds(): Bounds;
149
155
  autoScale(animate?: boolean): void;
150
156
  /**
@@ -219,6 +225,10 @@ export declare class ChartImpl implements Chart {
219
225
  * Get Y axis configuration by ID
220
226
  */
221
227
  getYAxis(id: string): AxisOptions | undefined;
228
+ /**
229
+ * Get X axis configuration
230
+ */
231
+ getXAxis(): AxisOptions;
222
232
  /**
223
233
  * Get all Y axes configurations
224
234
  */
@@ -313,6 +323,13 @@ export declare class ChartImpl implements Chart {
313
323
  */
314
324
  fromUrlHash(hash: string, compressed?: boolean): void;
315
325
  use(plugin: any): Promise<void>;
326
+ /**
327
+ * Suspend canvas backing-store resize (inactive panes during stacked drag).
328
+ */
329
+ setResizeSuspended(suspended: boolean): void;
330
+ /** @deprecated Use CSS transform on pane wrapper during drag; canvas stays untouched. */
331
+ syncDragLayout(width?: number, height?: number): void;
332
+ isResizeSuspended(): boolean;
316
333
  resize(): void;
317
334
  requestRender(): void;
318
335
  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,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;
@@ -1,6 +1,11 @@
1
1
  import { Series } from '../../Series';
2
- import { Bounds, PlotArea } from '../../../types';
2
+ import { AxisOptions, Bounds, PlotArea } from '../../../types';
3
3
  import { Scale } from '../../../scales';
4
4
  import { ChartTheme } from '../../../theme';
5
5
 
6
- export declare function exportToSVG(series: Series[], _viewBounds: Bounds, plotArea: PlotArea, xAxis: Scale, yAxes: Map<string, Scale>, theme: ChartTheme, width: number, height: number): string;
6
+ export interface SVGExportOptions {
7
+ xAxis?: AxisOptions;
8
+ yAxis?: AxisOptions;
9
+ primaryYAxisId?: string;
10
+ }
11
+ export declare function exportToSVG(series: Series[], _viewBounds: Bounds, plotArea: PlotArea, xAxis: Scale, yAxes: Map<string, Scale>, theme: ChartTheme, width: number, height: number, axisOptions?: SVGExportOptions): string;
@@ -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 */
@@ -36,6 +44,8 @@ export interface Chart {
36
44
  off<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
37
45
  destroy(): void;
38
46
  exportImage(type?: "png" | "jpeg"): string;
47
+ /** Vector export of series, axes, grid, and tick labels */
48
+ exportSVG(): string;
39
49
  autoScale(animate?: boolean): void;
40
50
  setTheme(theme: string | object): void;
41
51
  /** Access to data analysis utilities */
@@ -93,6 +103,8 @@ export interface Chart {
93
103
  updateXAxis(options: Partial<AxisOptions>): void;
94
104
  /** Get Y axis configuration by ID */
95
105
  getYAxis(id: string): AxisOptions | undefined;
106
+ /** Get X axis configuration */
107
+ getXAxis(): AxisOptions;
96
108
  /** Get all Y axes configurations */
97
109
  getAllYAxes(): AxisOptions[];
98
110
  /** 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,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,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
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Canvas pixel-alignment helpers for crisp 1px lines and sharper text.
3
+ * Coordinates are in CSS/logical space (before or after setTransform(dpr)).
4
+ */
5
+ /** Snap a coordinate to the center of a physical pixel (crisp 1px strokes). */
6
+ export declare function snapLineCoord(value: number): number;
7
+ /** Snap label positions to whole pixels (reduces sub-pixel blur on fillText). */
8
+ export declare function snapLabelCoord(value: number): number;
@@ -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,3 @@
1
+ import { StackedChart, StackedChartOptions } from './types';
2
+
3
+ export declare function createStackedChart(options: StackedChartOptions): StackedChart;
@@ -0,0 +1,6 @@
1
+ export { createStackedChart } from './createStackedChart';
2
+ export type { StackedChart, StackedChartOptions, StackedPaneConfig, StackedSyncOptions, StackDirection, StackSnapshotOptions, } from './types';
3
+ export { STACKED_MAX_PANES, STACKED_DEFAULT_MIN_PANE_RATIO, } from './types';
4
+ export { exportStackImage } from './stackExport';
5
+ export type { StackExportOptions } from './stackExport';
6
+ 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,29 @@
1
+ import { StackDirection } from './types';
2
+
3
+ export interface PaneResizeOptions {
4
+ /** Stack layout direction */
5
+ direction?: StackDirection;
6
+ /** Min pane size as fraction of available stack dimension (default 1/6) */
7
+ minPaneRatio?: number;
8
+ /** Absolute min pane size in px */
9
+ minPanePx?: number;
10
+ /** Divider hit area size (default 6) */
11
+ dividerSize?: number;
12
+ onResize?: (ratiosById: Record<string, number>) => void;
13
+ onDragStart?: (leadingIdx: number, trailingIdx: number) => number[];
14
+ onDragMove?: (sizesPx: number[], leadingIdx: number, trailingIdx: number) => void;
15
+ onDragEnd?: (finalSizesPx: number[]) => void;
16
+ }
17
+ export interface PaneResizeController {
18
+ dividers: HTMLDivElement[];
19
+ destroy: () => void;
20
+ }
21
+ declare function paneFlexStyle(ratio: number | string, direction: StackDirection): string;
22
+ export declare function resolveMinPaneHeightPx(availHeight: number, paneCount: number, minPaneRatio?: number, minPanePx?: number): number;
23
+ export declare function resolveMinPaneWidthPx(availWidth: number, paneCount: number, minPaneRatio?: number, minPanePx?: number): number;
24
+ export declare function normalizePaneHeights(heightsPx: number[], targetTotal: number): number[];
25
+ export declare const normalizePaneWidths: typeof normalizePaneHeights;
26
+ export declare function attachPaneResize(container: HTMLDivElement, paneWrappers: HTMLDivElement[], paneIds: string[], ratios: number[], options?: PaneResizeOptions): PaneResizeController;
27
+ export declare function applyPaneFlexRatios(paneWrappers: HTMLDivElement[], ratios: number[], direction?: StackDirection): void;
28
+ export declare function initialPaneRatio(height: number | string): number;
29
+ export { paneFlexStyle };
@@ -0,0 +1,18 @@
1
+ import { Chart } from '../chart/types';
2
+
3
+ export type StackExportFormat = "png" | "jpeg" | "webp";
4
+ export type StackExportResolution = "standard" | "2k" | "4k" | "8k" | number;
5
+ export interface StackExportOptions {
6
+ format?: StackExportFormat;
7
+ quality?: number;
8
+ resolution?: StackExportResolution;
9
+ includeBackground?: boolean;
10
+ includeDividers?: boolean;
11
+ transparent?: boolean;
12
+ }
13
+ /** @internal Exported for unit tests */
14
+ export declare function stackResolutionScale(res: StackExportResolution): number;
15
+ /**
16
+ * Compose every pane chart into one raster image matching the on-screen stack layout.
17
+ */
18
+ export declare function exportStackImage(container: HTMLDivElement, paneWrappers: HTMLDivElement[], paneCharts: Chart[], dividers: HTMLDivElement[], backgroundColor: string, options?: StackExportOptions): Promise<string>;