velo-plot 1.19.0 → 2.20.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 (86) hide show
  1. package/dist/{ChartCore-DQ691eXH.js → ChartCore-ivzLqxVb.js} +1376 -1153
  2. package/dist/ChartCore-ivzLqxVb.js.map +1 -0
  3. package/dist/SciPlot-CEU4ApgD.js +463 -0
  4. package/dist/SciPlot-CEU4ApgD.js.map +1 -0
  5. package/dist/axisFormat-CzumxpCL.js +200 -0
  6. package/dist/axisFormat-CzumxpCL.js.map +1 -0
  7. package/dist/core/InteractionManager.d.ts +1 -0
  8. package/dist/core/OverlayRenderer.d.ts +11 -0
  9. package/dist/core/chart/ChartAxisManager.d.ts +2 -0
  10. package/dist/core/chart/ChartCore.d.ts +20 -0
  11. package/dist/core/chart/ChartPluginBridge.d.ts +1 -0
  12. package/dist/core/chart/ChartRenderLoop.d.ts +7 -0
  13. package/dist/core/chart/ChartRenderer.d.ts +5 -0
  14. package/dist/core/chart/ChartStateManager.d.ts +2 -0
  15. package/dist/core/chart/positionLines.d.ts +12 -0
  16. package/dist/core/chart/types.d.ts +7 -0
  17. package/dist/core/format/axisFormat.d.ts +2 -1
  18. package/dist/core/indicator/addIndicator.d.ts +1 -1
  19. package/dist/core/indicator/indicatorPresets.d.ts +10 -2
  20. package/dist/core/sync/index.d.ts +0 -1
  21. package/dist/core/time/TimeScale.d.ts +2 -2
  22. package/dist/core/time/applyTimeScale.d.ts +10 -0
  23. package/dist/createStackedChart-DxNW0VkF.js +705 -0
  24. package/dist/createStackedChart-DxNW0VkF.js.map +1 -0
  25. package/dist/{index-D7dTq6VB.js → index-BBpJwOct.js} +17 -19
  26. package/dist/index-BBpJwOct.js.map +1 -0
  27. package/dist/{index-CUGS98p4.js → index-CaXWSOTk.js} +3 -6
  28. package/dist/index-CaXWSOTk.js.map +1 -0
  29. package/dist/{index-DjeWClO9.js → index-qunX30Xu.js} +2 -2
  30. package/dist/{index-DjeWClO9.js.map → index-qunX30Xu.js.map} +1 -1
  31. package/dist/{index.core-BtGFYMOu.js → index.core-COREBDNq.js} +25 -24
  32. package/dist/{index.core-BtGFYMOu.js.map → index.core-COREBDNq.js.map} +1 -1
  33. package/dist/index.d.ts +6 -1
  34. package/dist/mockDatafeed-927foCM4.js +511 -0
  35. package/dist/mockDatafeed-927foCM4.js.map +1 -0
  36. package/dist/plugins/analysis/contours.d.ts +31 -0
  37. package/dist/plugins/analysis.js +494 -407
  38. package/dist/plugins/analysis.js.map +1 -1
  39. package/dist/plugins/broken-axis.js +170 -181
  40. package/dist/plugins/broken-axis.js.map +1 -1
  41. package/dist/plugins/drawing-tools/index.d.ts +14 -1
  42. package/dist/plugins/drawing-tools/measure.d.ts +21 -0
  43. package/dist/plugins/drawing-tools/snapToCandle.d.ts +21 -0
  44. package/dist/plugins/forecasting/algorithms.d.ts +7 -2
  45. package/dist/plugins/forecasting/types.d.ts +13 -3
  46. package/dist/plugins/forecasting.js +355 -175
  47. package/dist/plugins/forecasting.js.map +1 -1
  48. package/dist/plugins/latex/symbols.d.ts +50 -0
  49. package/dist/plugins/latex/types.d.ts +13 -1
  50. package/dist/plugins/latex.js +351 -331
  51. package/dist/plugins/latex.js.map +1 -1
  52. package/dist/plugins/ml-integration/native-algorithms.d.ts +24 -4
  53. package/dist/plugins/ml-integration/types.d.ts +19 -0
  54. package/dist/plugins/ml-integration.js +191 -140
  55. package/dist/plugins/ml-integration.js.map +1 -1
  56. package/dist/plugins/pattern-recognition/types.d.ts +28 -1
  57. package/dist/plugins/pattern-recognition.js +416 -343
  58. package/dist/plugins/pattern-recognition.js.map +1 -1
  59. package/dist/plugins/snapshot.js +36 -36
  60. package/dist/plugins/snapshot.js.map +1 -1
  61. package/dist/plugins/sync.js +1 -1
  62. package/dist/plugins/tools.js +1 -1
  63. package/dist/plugins/virtualization.js +1 -1
  64. package/dist/react.js +5 -5
  65. package/dist/symbols-DT0eLlpW.js +568 -0
  66. package/dist/symbols-DT0eLlpW.js.map +1 -0
  67. package/dist/trading/datafeed.d.ts +48 -0
  68. package/dist/trading/index.d.ts +29 -0
  69. package/dist/trading/mockDatafeed.d.ts +9 -0
  70. package/dist/trading/ohlcvGenerator.d.ts +25 -0
  71. package/dist/trading.d.ts +1 -0
  72. package/dist/trading.js +95 -0
  73. package/dist/trading.js.map +1 -0
  74. package/dist/types.d.ts +1 -1
  75. package/dist/velo-plot.full.js +835 -1054
  76. package/dist/velo-plot.full.js.map +1 -1
  77. package/dist/velo-plot.js +13 -13
  78. package/dist/workers/indicatorsAsync.d.ts +24 -0
  79. package/package.json +13 -1
  80. package/dist/ChartCore-DQ691eXH.js.map +0 -1
  81. package/dist/axisFormat-B7o_uIEA.js +0 -127
  82. package/dist/axisFormat-B7o_uIEA.js.map +0 -1
  83. package/dist/createStackedChart-BPooTQ9z.js +0 -1164
  84. package/dist/createStackedChart-BPooTQ9z.js.map +0 -1
  85. package/dist/index-CUGS98p4.js.map +0 -1
  86. package/dist/index-D7dTq6VB.js.map +0 -1
@@ -0,0 +1,200 @@
1
+ var m = Object.defineProperty;
2
+ var g = (t, e, n) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var l = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n);
4
+ class $ {
5
+ constructor() {
6
+ l(this, "listeners", /* @__PURE__ */ new Map());
7
+ }
8
+ /**
9
+ * Subscribe to an event
10
+ */
11
+ on(e, n) {
12
+ this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(n);
13
+ }
14
+ /**
15
+ * Unsubscribe from an event
16
+ */
17
+ off(e, n) {
18
+ const r = this.listeners.get(e);
19
+ r && r.delete(n);
20
+ }
21
+ /**
22
+ * Emit an event with data
23
+ */
24
+ emit(e, n) {
25
+ const r = this.listeners.get(e);
26
+ r && r.forEach((i) => {
27
+ try {
28
+ i(n);
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, n) {
38
+ const r = (i) => {
39
+ this.off(e, r), n(i);
40
+ };
41
+ this.on(e, r);
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 n;
54
+ return ((n = this.listeners.get(e)) == null ? void 0 : n.size) ?? 0;
55
+ }
56
+ }
57
+ const d = 864e5;
58
+ function S(t) {
59
+ return new Date(t).getUTCDay();
60
+ }
61
+ function T(t, e = {}) {
62
+ const n = S(t);
63
+ return n !== 0 && n !== 6;
64
+ }
65
+ function b(t, e = {}) {
66
+ const n = e.calendar ?? "business-day", r = t.length, i = new Float64Array(r), c = new Int32Array(r);
67
+ if (c.fill(-1), n === "continuous") {
68
+ for (let s = 0; s < r; s++)
69
+ i[s] = t[s], c[s] = s;
70
+ return {
71
+ scaledX: i,
72
+ timeByIndex: t instanceof Float64Array ? t : Float64Array.from(t),
73
+ sourceToScaled: c
74
+ };
75
+ }
76
+ const a = [];
77
+ let f = 0;
78
+ for (let s = 0; s < r; s++) {
79
+ const u = t[s];
80
+ if (!Number.isFinite(u) || !T(u, e)) {
81
+ i[s] = Number.NaN;
82
+ continue;
83
+ }
84
+ i[s] = f, a[f] = u, c[s] = f, f++;
85
+ }
86
+ return {
87
+ scaledX: i,
88
+ timeByIndex: Float64Array.from(a),
89
+ sourceToScaled: c
90
+ };
91
+ }
92
+ function D(t, e) {
93
+ return t.timeByIndex[e];
94
+ }
95
+ function B(t, e, n) {
96
+ const r = Math.max(0, Math.floor(e)), i = Math.min(t.timeByIndex.length - 1, Math.ceil(n)), c = t.timeByIndex[r], a = t.timeByIndex[i];
97
+ return c == null || a == null ? d : Math.abs(a - c) || d;
98
+ }
99
+ function P(t) {
100
+ var e;
101
+ return t.type === "time" && (((e = t.timeScale) == null ? void 0 : e.calendar) ?? "business-day") !== "continuous";
102
+ }
103
+ function I(t) {
104
+ return {
105
+ calendar: "business-day",
106
+ session: "24x7",
107
+ ...t.timeScale
108
+ };
109
+ }
110
+ function V(t, e) {
111
+ const n = b(t, I(e));
112
+ return { displayX: n.scaledX, mapping: n };
113
+ }
114
+ function M(t, e) {
115
+ const n = Math.round(t), r = D(e, n);
116
+ if (r === void 0) return null;
117
+ const i = B(e, n - 1, n + 1);
118
+ return y(r, i);
119
+ }
120
+ const w = {
121
+ n: 1e-9,
122
+ µ: 1e-6,
123
+ m: 1e-3,
124
+ "": 1,
125
+ k: 1e3,
126
+ M: 1e6
127
+ };
128
+ function x(t) {
129
+ const e = Math.abs(t);
130
+ return e >= 1e6 ? "M" : e >= 1e3 ? "k" : e > 0 && e < 1e-6 ? "n" : e > 0 && e < 1e-3 ? "µ" : e > 0 && e < 1 ? "m" : "";
131
+ }
132
+ function o(t, e) {
133
+ const n = e === "auto" ? x(t) : e, r = w[n];
134
+ return `${(t / r).toPrecision(3)}${n}`;
135
+ }
136
+ function E(t) {
137
+ return t <= 1e3 * 60 * 60 * 36 ? new Intl.DateTimeFormat(void 0, {
138
+ day: "2-digit",
139
+ month: "2-digit",
140
+ hour: "2-digit",
141
+ minute: "2-digit"
142
+ }) : t <= 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" });
143
+ }
144
+ function y(t, e) {
145
+ return E(e ?? 864e5).format(new Date(t));
146
+ }
147
+ function h(t, e) {
148
+ const n = t.toExponential(e), [r, i] = n.split("e"), c = {
149
+ 0: "⁰",
150
+ 1: "¹",
151
+ 2: "²",
152
+ 3: "³",
153
+ 4: "⁴",
154
+ 5: "⁵",
155
+ 6: "⁶",
156
+ 7: "⁷",
157
+ 8: "⁸",
158
+ 9: "⁹",
159
+ "-": "⁻",
160
+ "+": "⁺"
161
+ }, a = i.replace("+", "").replace(/[0-9\-]/g, (f) => c[f]);
162
+ return `${r}e${a}`;
163
+ }
164
+ function k(t, e, n, r) {
165
+ if ((e == null ? void 0 : e.type) === "time" && r) {
166
+ const f = M(t, r);
167
+ return f || "";
168
+ }
169
+ if ((e == null ? void 0 : e.type) === "time")
170
+ return y(t, n);
171
+ if ((e == null ? void 0 : e.prefix) !== void 0 && e.prefix !== "")
172
+ return o(t, e.prefix);
173
+ const i = (e == null ? void 0 : e.scientific) === !0, c = (e == null ? void 0 : e.scientific) === !1, a = Math.abs(t);
174
+ return i || !c && a !== 0 && a < 1e-3 ? h(t, 1) : t.toFixed(3).replace(/\.?0+$/, "");
175
+ }
176
+ function A(t, e) {
177
+ if (t === 0) return "0";
178
+ const n = (e == null ? void 0 : e.scientific) === !0, r = (e == null ? void 0 : e.scientific) === !1, i = Math.abs(t);
179
+ return (e == null ? void 0 : e.prefix) !== void 0 && e.prefix !== "" ? o(t, e.prefix) : n || !r && (i < 1e-4 || i >= 1e6) ? h(t, 1) : i >= 1e3 ? t.toLocaleString(void 0, { maximumFractionDigits: 2 }) : t.toPrecision(3);
180
+ }
181
+ function N(t, e) {
182
+ return k(t, e == null ? void 0 : e.x, e == null ? void 0 : e.xSpan);
183
+ }
184
+ function L(t, e) {
185
+ return A(t, e == null ? void 0 : e.y);
186
+ }
187
+ export {
188
+ $ as E,
189
+ P as a,
190
+ B as b,
191
+ V as c,
192
+ N as d,
193
+ L as e,
194
+ M as f,
195
+ k as g,
196
+ A as h,
197
+ T as i,
198
+ b as m
199
+ };
200
+ //# sourceMappingURL=axisFormat-CzumxpCL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axisFormat-CzumxpCL.js","sources":["../src/core/EventEmitter.ts","../src/core/time/TimeScale.ts","../src/core/time/applyTimeScale.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 * TimeScale — business-day / session-aware X mapping for trading charts.\n * Stage 2.1–2.3\n */\n\nexport type TimeScaleCalendar = \"continuous\" | \"business-day\";\nexport type MarketSession = \"24x7\" | \"NYSE\";\n\nexport interface TimeScaleOptions {\n calendar?: TimeScaleCalendar;\n session?: MarketSession;\n /** IANA timezone (reserved for future session-hour filtering) */\n timezone?: string;\n}\n\nexport interface BusinessDayMapping {\n /** X values for chart (consecutive indices on business days) */\n scaledX: Float64Array;\n /** Original timestamp per scaled index (for tooltips / ticks) */\n timeByIndex: Float64Array;\n /** Original index → scaled index (-1 if skipped) */\n sourceToScaled: Int32Array;\n}\n\nconst MS_DAY = 86_400_000;\n\n/** UTC day-of-week: 0 = Sunday, 6 = Saturday */\nfunction dayOfWeekUtc(ts: number): number {\n return new Date(ts).getUTCDay();\n}\n\n/** Weekend check (NYSE calendar MVP — UTC weekends). */\nexport function isBusinessDay(ts: number, _opts: TimeScaleOptions = {}): boolean {\n const dow = dayOfWeekUtc(ts);\n return dow !== 0 && dow !== 6;\n}\n\n/**\n * Map timestamp series to consecutive business-day indices (skips Sat/Sun bars).\n * NaN in scaledX marks non-business bars (hidden gap).\n */\nexport function mapToBusinessDayScale(\n times: Float32Array | Float64Array,\n opts: TimeScaleOptions = {},\n): BusinessDayMapping {\n const calendar = opts.calendar ?? \"business-day\";\n const n = times.length;\n const scaledX = new Float64Array(n);\n const sourceToScaled = new Int32Array(n);\n sourceToScaled.fill(-1);\n\n if (calendar === \"continuous\") {\n for (let i = 0; i < n; i++) {\n scaledX[i] = times[i];\n sourceToScaled[i] = i;\n }\n return {\n scaledX,\n timeByIndex: times instanceof Float64Array ? times : Float64Array.from(times),\n sourceToScaled,\n };\n }\n\n const timeByIndex: number[] = [];\n let logical = 0;\n for (let i = 0; i < n; i++) {\n const t = times[i];\n if (!Number.isFinite(t) || !isBusinessDay(t, opts)) {\n scaledX[i] = Number.NaN;\n continue;\n }\n scaledX[i] = logical;\n timeByIndex[logical] = t;\n sourceToScaled[i] = logical;\n logical++;\n }\n\n return {\n scaledX,\n timeByIndex: Float64Array.from(timeByIndex),\n sourceToScaled,\n };\n}\n\n/** Resolve timestamp at a scaled business-day index (for axis ticks). */\nexport function timeAtBusinessIndex(mapping: BusinessDayMapping, index: number): number | undefined {\n return mapping.timeByIndex[index];\n}\n\n/** Visible span in ms using business-day mapping. */\nexport function businessDaySpanMs(mapping: BusinessDayMapping, xMin: number, xMax: number): number {\n const i0 = Math.max(0, Math.floor(xMin));\n const i1 = Math.min(mapping.timeByIndex.length - 1, Math.ceil(xMax));\n const t0 = mapping.timeByIndex[i0];\n const t1 = mapping.timeByIndex[i1];\n if (t0 == null || t1 == null) return MS_DAY;\n return Math.abs(t1 - t0) || MS_DAY;\n}\n","/**\n * Wire TimeScale into chart series + axis formatting (Stage 2.2–2.3).\n */\n\nimport type { AxisOptions } from \"../../types\";\nimport { formatTimeTick } from \"../format/axisFormat\";\nimport {\n businessDaySpanMs,\n mapToBusinessDayScale,\n timeAtBusinessIndex,\n type BusinessDayMapping,\n type TimeScaleOptions,\n} from \"./TimeScale\";\n\nexport function isBusinessDayScaleActive(xAxis: AxisOptions): boolean {\n return (\n xAxis.type === \"time\" &&\n (xAxis.timeScale?.calendar ?? \"business-day\") !== \"continuous\"\n );\n}\n\nexport function resolveTimeScaleOpts(xAxis: AxisOptions): TimeScaleOptions {\n return {\n calendar: \"business-day\",\n session: \"24x7\",\n ...xAxis.timeScale,\n };\n}\n\nexport function applyBusinessDayX(\n x: Float32Array | Float64Array,\n xAxis: AxisOptions,\n): { displayX: Float64Array; mapping: BusinessDayMapping } {\n const mapping = mapToBusinessDayScale(x, resolveTimeScaleOpts(xAxis));\n return { displayX: mapping.scaledX, mapping };\n}\n\nexport function formatBusinessDayTick(\n logicalIndex: number,\n mapping: BusinessDayMapping,\n): string | null {\n const idx = Math.round(logicalIndex);\n const t = timeAtBusinessIndex(mapping, idx);\n if (t === undefined) return null;\n const span = businessDaySpanMs(mapping, idx - 1, idx + 1);\n return formatTimeTick(t, span);\n}\n","/**\n * Shared axis tick and tooltip value formatting.\n */\nimport type { AxisOptions } from \"../../types\";\nimport type { BusinessDayMapping } from \"../time/TimeScale\";\nimport { formatBusinessDayTick } from \"../time/applyTimeScale\";\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];\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]);\n\n return `${mantissa}e${unicodeExp}`;\n}\n\nexport function formatXTickValue(\n value: number,\n options?: AxisOptions,\n domainSpan?: number,\n businessDayMapping?: BusinessDayMapping | null,\n): string {\n if (options?.type === \"time\" && businessDayMapping) {\n const label = formatBusinessDayTick(value, businessDayMapping);\n if (label) return label;\n return \"\";\n }\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","MS_DAY","dayOfWeekUtc","ts","isBusinessDay","_opts","dow","mapToBusinessDayScale","times","opts","calendar","n","scaledX","sourceToScaled","i","timeByIndex","logical","t","timeAtBusinessIndex","mapping","index","businessDaySpanMs","xMin","xMax","i0","i1","t0","t1","isBusinessDayScaleActive","xAxis","resolveTimeScaleOpts","applyBusinessDayX","x","formatBusinessDayTick","logicalIndex","idx","span","formatTimeTick","PREFIXDivisors","autoPrefixFor","value","absVal","applyPrefix","prefix","resolved","divisor","pickTimeFormatter","spanMs","toScientificUnicode","precision","str","mantissa","exponent","superscriptMap","unicodeExp","char","formatXTickValue","options","domainSpan","businessDayMapping","label","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,MAAA;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,cAAcL,GAA+B;AAtExC,QAAAM;AAuEH,aAAOA,IAA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,GAAOyB,KAAA,gBAAAA,EAAY,GAA8BA,KAAA,gBAAAA,EAAY,KAAK;AAC5F;AAEO,SAASC,EAAe1B,GAAeyB,GAAwC;AACpF,SAAOF,EAAiBvB,GAAOyB,KAAA,gBAAAA,EAAY,CAA4B;AACzE;"}
@@ -59,6 +59,7 @@ export declare class InteractionManager {
59
59
  private isBoxZooming;
60
60
  private selectionStart;
61
61
  private lastMousePos;
62
+ private mouseDownPos;
62
63
  private mode;
63
64
  private boundWheel;
64
65
  private boundMouseDown;
@@ -3,12 +3,18 @@ import { ChartTheme } from '../theme';
3
3
  import { Series } from './Series';
4
4
  import { PlotArea, CursorState, AxisOptions } from '../types';
5
5
  import { ChartTitleOptions, AxisLayoutOptions } from './layout/types';
6
+ import { BusinessDayMapping } from './time/TimeScale';
6
7
 
7
8
  export declare class OverlayRenderer {
8
9
  private ctx;
9
10
  private theme;
10
11
  private latexAPI;
12
+ private businessDayMapping;
11
13
  constructor(ctx: CanvasRenderingContext2D, theme: ChartTheme);
14
+ setBusinessDayMapping(mapping: BusinessDayMapping | null): void;
15
+ /** Filter X ticks to valid business-day indices (unique integers in range). */
16
+ private filterBusinessDayXTicks;
17
+ private resolveXTicks;
12
18
  /**
13
19
  * Set LaTeX API for rendering mathematical expressions
14
20
  */
@@ -87,4 +93,9 @@ export declare class OverlayRenderer {
87
93
  private formatYTick;
88
94
  /** Draw buy/sell markers on candlestick series (Stage 2.14). */
89
95
  drawCandlestickMarkers(plotArea: PlotArea, series: Series, xScale: Scale, yScale: Scale): void;
96
+ /** Horizontal dashed lines for active price alerts (Stage 2.19). */
97
+ drawPriceAlertLines(plotArea: PlotArea, alerts: Array<{
98
+ price: number;
99
+ direction?: string;
100
+ }>, yScale: Scale): void;
90
101
  }
@@ -14,6 +14,8 @@ export interface AxisManagerContext {
14
14
  export declare class ChartAxisManager {
15
15
  private ctx;
16
16
  constructor(ctx: AxisManagerContext);
17
+ /** Swap the X scale (e.g. broken-axis plugin) so tick generation uses it. */
18
+ setXScale(scale: Scale): void;
17
19
  /**
18
20
  * Add a new Y axis dynamically
19
21
  */
@@ -11,6 +11,7 @@ import { Chart, ExportOptions } from './types';
11
11
  import { ChartAnimationConfig } from '../animation';
12
12
  import { AddIndicatorOptions, AddIndicatorResult, IndicatorPresetName } from '../indicator/addIndicator';
13
13
  import { PriceAlertOptions } from './ChartAlerts';
14
+ import { PositionLineOptions } from './positionLines';
14
15
 
15
16
  export declare class ChartImpl implements Chart {
16
17
  private container;
@@ -24,6 +25,12 @@ export declare class ChartImpl implements Chart {
24
25
  private yAxisOptionsMap;
25
26
  private primaryYAxisId;
26
27
  private dpr;
28
+ /**
29
+ * When set, overrides the device pixel ratio used by `resize()` instead of
30
+ * recomputing it from `window.devicePixelRatio`. Used by high-resolution
31
+ * export (snapshot) so the boosted DPR is not clobbered on the next resize.
32
+ */
33
+ private dprOverride;
27
34
  private backgroundColor;
28
35
  private plotAreaBackground;
29
36
  private renderer;
@@ -89,6 +96,7 @@ export declare class ChartImpl implements Chart {
89
96
  get sync(): any;
90
97
  get brokenAxis(): any;
91
98
  get forecasting(): any;
99
+ get patterns(): any;
92
100
  get latex(): any;
93
101
  private animationEngine;
94
102
  private animationConfig;
@@ -96,6 +104,8 @@ export declare class ChartImpl implements Chart {
96
104
  private selectionManager;
97
105
  private responsiveManager;
98
106
  private alertManager;
107
+ private timeScaleMapping;
108
+ private positionLineCounter;
99
109
  constructor(options: ChartOptions);
100
110
  /**
101
111
  * Start the chart initialization (called by queue system)
@@ -154,6 +164,8 @@ export declare class ChartImpl implements Chart {
154
164
  addAlert(options: PriceAlertOptions): string;
155
165
  removeAlert(id: string): boolean;
156
166
  clearAlerts(): void;
167
+ getAlerts(): PriceAlertOptions[];
168
+ addPositionLine(options: PositionLineOptions): string;
157
169
  setDrawingMode(mode: import('../../plugins/drawing-tools').DrawingMode): void;
158
170
  getSeries(id: string): Series | undefined;
159
171
  getAllSeries(): Series[];
@@ -234,6 +246,14 @@ export declare class ChartImpl implements Chart {
234
246
  * Set device pixel ratio and re-render
235
247
  */
236
248
  setDPR(dpr: number): void;
249
+ /**
250
+ * Locks the device pixel ratio to an explicit value (or clears the lock with
251
+ * `null`). Unlike {@link setDPR}, this survives subsequent `resize()` calls,
252
+ * which is required for high-resolution export: the backing stores must stay
253
+ * enlarged while the snapshot is captured. Pass `null` to restore automatic
254
+ * DPR handling based on `window.devicePixelRatio`.
255
+ */
256
+ setDevicePixelRatioOverride(dpr: number | null): void;
237
257
  /**
238
258
  * Update X axis configuration
239
259
  */
@@ -22,6 +22,7 @@ export declare class ChartPluginBridge {
22
22
  get sync(): any;
23
23
  get brokenAxis(): any;
24
24
  get forecasting(): any;
25
+ get patterns(): any;
25
26
  get latex(): any;
26
27
  /**
27
28
  * Get a plugin API by name
@@ -44,6 +44,11 @@ export interface RenderLoopContext {
44
44
  getPlotArea: () => PlotArea;
45
45
  pixelToDataX: (px: number) => number;
46
46
  pixelToDataY: (py: number, yAxisId?: string) => number;
47
+ getBusinessDayMapping?: () => import('../time/TimeScale').BusinessDayMapping | null;
48
+ getAlerts?: () => Array<{
49
+ price: number;
50
+ direction?: string;
51
+ }>;
47
52
  get yScale(): Scale;
48
53
  }
49
54
  export declare class ChartRenderLoop {
@@ -61,6 +66,8 @@ export declare class ChartRenderLoop {
61
66
  startInit(): void;
62
67
  /** Wire renderer after async WebGPU init (context holds a snapshot, not a live ref). */
63
68
  setRenderer(renderer: ChartSeriesRenderer): void;
69
+ /** Swap the X scale (e.g. broken-axis plugin) — the context holds a snapshot. */
70
+ setXScale(scale: Scale): void;
64
71
  /**
65
72
  * Check if init has started
66
73
  */
@@ -42,6 +42,11 @@ export interface RenderContext {
42
42
  hoveredSeriesId: string | null;
43
43
  layout: import('../layout').LayoutOptions;
44
44
  latexAPI?: any;
45
+ getBusinessDayMapping?: () => import('../time/TimeScale').BusinessDayMapping | null;
46
+ getAlerts?: () => Array<{
47
+ price: number;
48
+ direction?: string;
49
+ }>;
45
50
  }
46
51
  /**
47
52
  * Prepare series data for WebGL rendering
@@ -35,6 +35,8 @@ export interface StateManagerContext {
35
35
  export declare class ChartStateManager {
36
36
  private ctx;
37
37
  constructor(ctx: StateManagerContext);
38
+ /** Swap the X scale (e.g. broken-axis plugin) — the context holds a snapshot. */
39
+ setXScale(scale: Scale): void;
38
40
  /**
39
41
  * Export complete chart state
40
42
  */
@@ -0,0 +1,12 @@
1
+ import { Annotation } from '../annotations/types';
2
+
3
+ export type PositionLineStyle = "entry" | "sl" | "tp";
4
+ export interface PositionLineOptions {
5
+ id?: string;
6
+ price: number;
7
+ label?: string;
8
+ color?: string;
9
+ style?: PositionLineStyle;
10
+ interactive?: boolean;
11
+ }
12
+ export declare function buildPositionLineAnnotation(options: PositionLineOptions, id: string): Annotation;
@@ -22,6 +22,8 @@ export interface Chart {
22
22
  addAlert(options: import('./ChartAlerts').PriceAlertOptions): string;
23
23
  removeAlert(id: string): boolean;
24
24
  clearAlerts(): void;
25
+ getAlerts(): import('./ChartAlerts').PriceAlertOptions[];
26
+ addPositionLine(options: import('./positionLines').PositionLineOptions): string;
25
27
  setDrawingMode(mode: import('../../plugins/drawing-tools').DrawingMode): void;
26
28
  zoom(options: ZoomOptions & {
27
29
  animate?: boolean;
@@ -46,6 +48,11 @@ export interface Chart {
46
48
  getActiveRenderer(): "webgl" | "webgpu";
47
49
  /** Set device pixel ratio and trigger re-render */
48
50
  setDPR(dpr: number): void;
51
+ /**
52
+ * Lock the device pixel ratio to an explicit value (or clear with `null`).
53
+ * Survives subsequent `resize()` calls; required for high-resolution export.
54
+ */
55
+ setDevicePixelRatioOverride?(dpr: number | null): void;
49
56
  render(): void;
50
57
  on<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
51
58
  off<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
@@ -1,11 +1,12 @@
1
1
  import { AxisOptions } from '../../types';
2
+ import { BusinessDayMapping } from '../time/TimeScale';
2
3
 
3
4
  export declare function autoPrefixFor(value: number): NonNullable<AxisOptions["prefix"]>;
4
5
  export declare function applyPrefix(value: number, prefix: NonNullable<AxisOptions["prefix"]>): string;
5
6
  export declare function pickTimeFormatter(spanMs: number): Intl.DateTimeFormat;
6
7
  export declare function formatTimeTick(value: number, spanMs?: number): string;
7
8
  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 formatXTickValue(value: number, options?: AxisOptions, domainSpan?: number, businessDayMapping?: BusinessDayMapping | null): string;
9
10
  export declare function formatYTickValue(value: number, options?: AxisOptions): string;
10
11
  export interface TooltipAxisFormat {
11
12
  x?: Partial<AxisOptions>;
@@ -32,5 +32,5 @@ export declare function addIndicatorToChart(chart: ChartIndicatorHost, preset: I
32
32
  /**
33
33
  * Build a stacked pane config for an indicator (use when creating or extending stacks).
34
34
  */
35
- export declare function buildIndicatorPaneFromPreset(preset: IndicatorPresetName, x: Float32Array | Float64Array, prices: Float32Array | Float64Array, options: IndicatorPresetOptions & Pick<BuildIndicatorPaneOptions, "id" | "height" | "label" | "yRange" | "tickCount" | "showXAxis" | "seriesId" | "style">): Promise<StackedPaneConfig>;
35
+ export declare function buildIndicatorPaneFromPreset(preset: IndicatorPresetName, x: Float32Array | Float64Array, prices: Float32Array | Float64Array, options: IndicatorPresetOptions & Pick<BuildIndicatorPaneOptions, "id" | "height" | "label" | "yRange" | "tickCount" | "showXAxis" | "seriesId" | "style">, source?: import('../Series').Series): Promise<StackedPaneConfig>;
36
36
  export type { IndicatorPresetName, IndicatorPresetOptions, ComputedIndicatorPreset };
@@ -1,7 +1,7 @@
1
1
  import { IndicatorData } from './types';
2
2
  import { Series } from '../Series';
3
3
 
4
- export type IndicatorPresetName = "rsi" | "macd" | "bollinger" | "bollingerBands" | "ema" | "sma";
4
+ export type IndicatorPresetName = "rsi" | "macd" | "bollinger" | "bollingerBands" | "ema" | "sma" | "stochastic";
5
5
  export interface IndicatorPresetOptions {
6
6
  period?: number;
7
7
  fastPeriod?: number;
@@ -25,6 +25,14 @@ export declare function extractPriceSeries(source: Series): {
25
25
  x: Float32Array | Float64Array;
26
26
  prices: Float32Array | Float64Array;
27
27
  };
28
+ /** Extract OHLC from candlestick series for stochastic and similar presets. */
29
+ export declare function extractOhlcSeries(source: Series): {
30
+ x: Float32Array | Float64Array;
31
+ open: Float32Array | Float64Array;
32
+ high: Float32Array | Float64Array;
33
+ low: Float32Array | Float64Array;
34
+ close: Float32Array | Float64Array;
35
+ };
28
36
  /** Resolve source series from chart API surface. */
29
37
  export declare function resolveSourceSeries(chart: {
30
38
  getSeries(id: string): Series | undefined;
@@ -33,5 +41,5 @@ export declare function resolveSourceSeries(chart: {
33
41
  /**
34
42
  * Compute composite indicator layers for a preset (async worker path when available).
35
43
  */
36
- export declare function computeIndicatorPreset(preset: IndicatorPresetName, x: Float32Array | Float64Array, prices: Float32Array | Float64Array, options?: IndicatorPresetOptions): Promise<ComputedIndicatorPreset>;
44
+ export declare function computeIndicatorPreset(preset: IndicatorPresetName, x: Float32Array | Float64Array, prices: Float32Array | Float64Array, options?: IndicatorPresetOptions, source?: Series): Promise<ComputedIndicatorPreset>;
37
45
  export declare function isOverlayPreset(preset: IndicatorPresetName): boolean;
@@ -84,7 +84,6 @@ export declare class ChartGroup {
84
84
  clearAllSelections(): void;
85
85
  destroy(): void;
86
86
  private isSyncSource;
87
- private canPropagateFrom;
88
87
  private hasValidViewBounds;
89
88
  private attachEventHandlers;
90
89
  private detachEventHandlers;
@@ -12,9 +12,9 @@ export interface TimeScaleOptions {
12
12
  }
13
13
  export interface BusinessDayMapping {
14
14
  /** X values for chart (consecutive indices on business days) */
15
- scaledX: Float32Array;
15
+ scaledX: Float64Array;
16
16
  /** Original timestamp per scaled index (for tooltips / ticks) */
17
- timeByIndex: Float32Array;
17
+ timeByIndex: Float64Array;
18
18
  /** Original index → scaled index (-1 if skipped) */
19
19
  sourceToScaled: Int32Array;
20
20
  }
@@ -0,0 +1,10 @@
1
+ import { AxisOptions } from '../../types';
2
+ import { BusinessDayMapping, TimeScaleOptions } from './TimeScale';
3
+
4
+ export declare function isBusinessDayScaleActive(xAxis: AxisOptions): boolean;
5
+ export declare function resolveTimeScaleOpts(xAxis: AxisOptions): TimeScaleOptions;
6
+ export declare function applyBusinessDayX(x: Float32Array | Float64Array, xAxis: AxisOptions): {
7
+ displayX: Float64Array;
8
+ mapping: BusinessDayMapping;
9
+ };
10
+ export declare function formatBusinessDayTick(logicalIndex: number, mapping: BusinessDayMapping): string | null;