velo-plot 2.0.0 → 3.0.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.
- package/README.md +15 -8
- package/dist/{ChartCore-BhQ4j7f5.js → ChartCore-BpzRvN4Y.js} +998 -855
- package/dist/ChartCore-BpzRvN4Y.js.map +1 -0
- package/dist/a11y-Bw6urYpr.js +105 -0
- package/dist/a11y-Bw6urYpr.js.map +1 -0
- package/dist/angular/hooks-entry.d.ts +1 -0
- package/dist/angular/hooks.d.ts +26 -0
- package/dist/angular/index.d.ts +8 -0
- package/dist/angular/velo-plot.component.d.ts +46 -0
- package/dist/angular-hooks.d.ts +1 -0
- package/dist/angular-hooks.js +9 -0
- package/dist/angular-hooks.js.map +1 -0
- package/dist/angular.d.ts +1 -0
- package/dist/angular.js +166 -0
- package/dist/angular.js.map +1 -0
- package/dist/assets/indicator.worker-bv0zC4EX.js.map +1 -1
- package/dist/astro/StackedPlot.astro +19 -0
- package/dist/astro/VeloPlot.astro +23 -0
- package/dist/{axisFormat-SPX-CD5s.js → axisFormat-CzumxpCL.js} +3 -3
- package/dist/axisFormat-CzumxpCL.js.map +1 -0
- package/dist/bindings/shared/a11y.d.ts +26 -0
- package/dist/bindings/shared/chartLifecycle.d.ts +16 -0
- package/dist/bindings/shared/chartSyncBridge.d.ts +8 -0
- package/dist/bindings/shared/dimensions.d.ts +1 -0
- package/dist/bindings/shared/index.d.ts +9 -0
- package/dist/bindings/shared/indicatorBridge.d.ts +11 -0
- package/dist/bindings/shared/optionsSync.d.ts +7 -0
- package/dist/bindings/shared/seriesDiff.d.ts +8 -0
- package/dist/bindings/shared/stackedSync.d.ts +9 -0
- package/dist/bindings/shared/types.d.ts +46 -0
- package/dist/bindings/test-utils/index.d.ts +35 -0
- package/dist/bindings/test-utils/mockLifecycle.d.ts +120 -0
- package/dist/bindings/test-utils/vitestSveltePlugin.d.ts +3 -0
- package/dist/chartSyncBridge-DbWrwtyP.js +57 -0
- package/dist/chartSyncBridge-DbWrwtyP.js.map +1 -0
- package/dist/core/Chart.d.ts +1 -1
- package/dist/core/InteractionManager.d.ts +7 -1
- package/dist/core/OverlayRenderer.d.ts +5 -0
- package/dist/core/annotations/types.d.ts +1 -1
- package/dist/core/chart/ChartAxisManager.d.ts +2 -0
- package/dist/core/chart/ChartCore.d.ts +17 -2
- package/dist/core/chart/ChartPluginBridge.d.ts +1 -0
- package/dist/core/chart/ChartRenderLoop.d.ts +2 -0
- package/dist/core/chart/ChartStateManager.d.ts +2 -0
- package/dist/core/chart/types.d.ts +6 -1
- package/dist/core/clipboard/index.d.ts +1 -1
- package/dist/core/debug/index.d.ts +1 -1
- package/dist/core/keybindings/index.d.ts +1 -1
- package/dist/core/loading/index.d.ts +1 -1
- package/dist/core/locale/index.d.ts +1 -1
- package/dist/core/stacked/paneResize.d.ts +3 -0
- package/dist/core/stacked/types.d.ts +10 -0
- package/dist/core/sync/index.d.ts +0 -1
- package/dist/core/theme-editor/index.d.ts +1 -1
- package/dist/createStackedChart-Dm-YqUT7.js +756 -0
- package/dist/createStackedChart-Dm-YqUT7.js.map +1 -0
- package/dist/examples/PluginDemonstration.d.ts +1 -1
- package/dist/gpuRenderer-BpaMYz-k.js.map +1 -1
- package/dist/hooks-CYPCxoZx.js +69 -0
- package/dist/hooks-CYPCxoZx.js.map +1 -0
- package/dist/{index-D7dTq6VB.js → index-0InEyj0q.js} +130 -134
- package/dist/index-0InEyj0q.js.map +1 -0
- package/dist/index-BMiZoKmm.js.map +1 -1
- package/dist/{index-DoYxf1cV.js → index-CWxIHdwX.js} +38 -98
- package/dist/index-CWxIHdwX.js.map +1 -0
- package/dist/{index-CUGS98p4.js → index-CaXWSOTk.js} +3 -6
- package/dist/index-CaXWSOTk.js.map +1 -0
- package/dist/index-Dag88bW4.js.map +1 -1
- package/dist/index-qhscKTDy.js.map +1 -1
- package/dist/{index-CWipqOLP.js → index-qunX30Xu.js} +2 -2
- package/dist/index-qunX30Xu.js.map +1 -0
- package/dist/index-x4stH3jD.js.map +1 -1
- package/dist/{index.core-fpZ1dYN0.js → index.core-BmZe2jRQ.js} +30 -29
- package/dist/index.core-BmZe2jRQ.js.map +1 -0
- package/dist/index.core.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/indicators--eJGmVox.js.map +1 -1
- package/dist/{mockDatafeed-Cdg5hKEo.js → mockDatafeed-DHIDPcpX.js} +150 -146
- package/dist/mockDatafeed-DHIDPcpX.js.map +1 -0
- package/dist/optionsSync-QUiN4Inw.js +119 -0
- package/dist/optionsSync-QUiN4Inw.js.map +1 -0
- package/dist/plugins/3d/index.d.ts +2 -2
- package/dist/plugins/3d.d.ts +2 -2
- package/dist/plugins/3d.js.map +1 -1
- package/dist/plugins/analysis/contours.d.ts +31 -0
- package/dist/plugins/analysis/index.d.ts +1 -1
- package/dist/plugins/analysis/indicators.d.ts +1 -1
- package/dist/plugins/analysis.d.ts +2 -2
- package/dist/plugins/analysis.js +495 -408
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/annotations/index.d.ts +1 -1
- package/dist/plugins/annotations.d.ts +2 -2
- package/dist/plugins/annotations.js.map +1 -1
- package/dist/plugins/anomaly-detection.js +1 -1
- package/dist/plugins/anomaly-detection.js.map +1 -1
- package/dist/plugins/broken-axis.d.ts +2 -2
- package/dist/plugins/broken-axis.js +170 -181
- package/dist/plugins/broken-axis.js.map +1 -1
- package/dist/plugins/builtins/crosshair/CrosshairPlugin.d.ts +1 -1
- package/dist/plugins/builtins/index.d.ts +1 -1
- package/dist/plugins/caching.d.ts +2 -2
- package/dist/plugins/clipboard/index.d.ts +2 -2
- package/dist/plugins/clipboard.d.ts +2 -2
- package/dist/plugins/clipboard.js.map +1 -1
- package/dist/plugins/context-menu/index.d.ts +1 -1
- package/dist/plugins/context-menu.d.ts +2 -2
- package/dist/plugins/context-menu.js +1 -1
- package/dist/plugins/context-menu.js.map +1 -1
- package/dist/plugins/data-export/index.d.ts +1 -1
- package/dist/plugins/data-export.d.ts +2 -2
- package/dist/plugins/data-export.js +2 -2
- package/dist/plugins/data-export.js.map +1 -1
- package/dist/plugins/data-transform.d.ts +2 -2
- package/dist/plugins/data-transform.js +19 -19
- package/dist/plugins/data-transform.js.map +1 -1
- package/dist/plugins/debug/index.d.ts +2 -2
- package/dist/plugins/debug.d.ts +2 -2
- package/dist/plugins/debug.js +2 -2
- package/dist/plugins/debug.js.map +1 -1
- package/dist/plugins/forecasting/algorithms.d.ts +7 -2
- package/dist/plugins/forecasting/index.d.ts +1 -1
- package/dist/plugins/forecasting/types.d.ts +13 -3
- package/dist/plugins/forecasting.js +355 -175
- package/dist/plugins/forecasting.js.map +1 -1
- package/dist/plugins/gpu/index.d.ts +2 -2
- package/dist/plugins/gpu.d.ts +2 -2
- package/dist/plugins/gpu.js.map +1 -1
- package/dist/plugins/i18n/index.d.ts +2 -2
- package/dist/plugins/i18n.d.ts +2 -2
- package/dist/plugins/i18n.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/keyboard.d.ts +2 -2
- package/dist/plugins/keyboard.js +65 -5
- package/dist/plugins/keyboard.js.map +1 -1
- package/dist/plugins/latex/symbols.d.ts +50 -0
- package/dist/plugins/latex/types.d.ts +13 -1
- package/dist/plugins/latex.js +351 -331
- package/dist/plugins/latex.js.map +1 -1
- package/dist/plugins/lazy-load.d.ts +2 -2
- package/dist/plugins/loading/index.d.ts +1 -1
- package/dist/plugins/loading.d.ts +2 -2
- package/dist/plugins/ml-integration/native-algorithms.d.ts +24 -4
- package/dist/plugins/ml-integration/types.d.ts +19 -0
- package/dist/plugins/ml-integration.d.ts +2 -2
- package/dist/plugins/ml-integration.js +190 -139
- package/dist/plugins/ml-integration.js.map +1 -1
- package/dist/plugins/offscreen.d.ts +2 -2
- package/dist/plugins/pattern-recognition/types.d.ts +28 -1
- package/dist/plugins/pattern-recognition.d.ts +2 -2
- package/dist/plugins/pattern-recognition.js +417 -344
- package/dist/plugins/pattern-recognition.js.map +1 -1
- package/dist/plugins/radar.d.ts +2 -2
- package/dist/plugins/regression.d.ts +2 -2
- package/dist/plugins/regression.js +1 -1
- package/dist/plugins/regression.js.map +1 -1
- package/dist/plugins/roi.js +9 -9
- package/dist/plugins/roi.js.map +1 -1
- package/dist/plugins/snapshot/index.d.ts +1 -1
- package/dist/plugins/snapshot/types.d.ts +1 -1
- package/dist/plugins/snapshot.d.ts +2 -2
- package/dist/plugins/snapshot.js +36 -36
- package/dist/plugins/snapshot.js.map +1 -1
- package/dist/plugins/streaming/index.d.ts +2 -2
- package/dist/plugins/streaming.d.ts +2 -2
- package/dist/plugins/sync/index.d.ts +3 -2
- package/dist/plugins/sync.d.ts +2 -2
- package/dist/plugins/sync.js +1 -1
- package/dist/plugins/sync.js.map +1 -1
- package/dist/plugins/theme-editor/index.d.ts +1 -1
- package/dist/plugins/theme-editor.d.ts +2 -2
- package/dist/plugins/tools/index.d.ts +1 -1
- package/dist/plugins/tools/tooltip/index.d.ts +1 -1
- package/dist/plugins/tools.d.ts +2 -2
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/plugins/video-recorder.d.ts +2 -2
- package/dist/plugins/virtualization.d.ts +2 -2
- package/dist/plugins/virtualization.js +1 -1
- package/dist/pool-DZ8shSqv.js +109 -0
- package/dist/pool-DZ8shSqv.js.map +1 -0
- package/dist/react/StackedPlot.d.ts +31 -0
- package/dist/react/VeloPlot.d.ts +29 -0
- package/dist/react/index.d.ts +25 -3
- package/dist/react/useChartSync.d.ts +8 -0
- package/dist/react/useIndicator.d.ts +12 -0
- package/dist/react/useVeloPlot.d.ts +19 -0
- package/dist/react.js +328 -24
- package/dist/react.js.map +1 -1
- package/dist/scientific/index.d.ts +48 -0
- package/dist/scientific.d.ts +1 -0
- package/dist/scientific.js +91 -0
- package/dist/scientific.js.map +1 -0
- package/dist/solid/VeloPlot.d.ts +16 -0
- package/dist/solid/index.d.ts +13 -0
- package/dist/solid/useChartSync.d.ts +6 -0
- package/dist/solid/useIndicator.d.ts +11 -0
- package/dist/solid/useStackedPlot.d.ts +14 -0
- package/dist/solid/useVeloPlot.d.ts +18 -0
- package/dist/solid.d.ts +1 -0
- package/dist/solid.js +172 -0
- package/dist/solid.js.map +1 -0
- package/dist/stackedSync-tnrunZMt.js +100 -0
- package/dist/stackedSync-tnrunZMt.js.map +1 -0
- package/dist/svelte/StackedPlot.svelte +29 -0
- package/dist/svelte/StackedPlot.test.ts +114 -0
- package/dist/svelte/VeloPlot.svelte +44 -0
- package/dist/svelte/VeloPlot.test.ts +105 -0
- package/dist/svelte/index.d.ts +11 -0
- package/dist/svelte/index.test.ts +20 -0
- package/dist/svelte/index.ts +15 -0
- package/dist/svelte/useChartSync.d.ts +8 -0
- package/dist/svelte/useChartSync.test.ts +49 -0
- package/dist/svelte/useChartSync.ts +29 -0
- package/dist/svelte/useIndicator.d.ts +13 -0
- package/dist/svelte/useIndicator.test.ts +67 -0
- package/dist/svelte/useIndicator.ts +43 -0
- package/dist/svelte/useStackedPlot.d.ts +16 -0
- package/dist/svelte/useStackedPlot.test.ts +76 -0
- package/dist/svelte/useStackedPlot.ts +54 -0
- package/dist/svelte/useVeloPlot.d.ts +21 -0
- package/dist/svelte/useVeloPlot.test.ts +100 -0
- package/dist/svelte/useVeloPlot.ts +81 -0
- package/dist/svelte.d.ts +1 -0
- package/dist/svelte.js +143 -0
- package/dist/svelte.js.map +1 -0
- package/dist/symbols-DT0eLlpW.js +568 -0
- package/dist/symbols-DT0eLlpW.js.map +1 -0
- package/dist/testing/index.d.ts +1 -1
- package/dist/theme/index.d.ts +2 -1
- package/dist/trading.js +7 -7
- package/dist/types.d.ts +1 -1
- package/dist/{utils-BK5UUXxj.js → utils-Dx0h0bgQ.js} +9 -9
- package/dist/{utils-BK5UUXxj.js.map → utils-Dx0h0bgQ.js.map} +1 -1
- package/dist/velo-plot.full.js +444 -433
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +15 -15
- package/dist/vue/StackedPlot.vue.d.ts +48 -0
- package/dist/vue/VeloPlot.vue.d.ts +64 -0
- package/dist/vue/index.d.ts +250 -0
- package/dist/vue/useChartSync.d.ts +52 -0
- package/dist/vue/useIndicator.d.ts +23 -0
- package/dist/vue/useStackedPlot.d.ts +15 -0
- package/dist/vue/useVeloPlot.d.ts +20 -0
- package/dist/vue.d.ts +1 -0
- package/dist/vue.js +312 -0
- package/dist/vue.js.map +1 -0
- package/dist/workers/indicatorsAsync.d.ts +26 -0
- package/dist/workers/pool.d.ts +9 -0
- package/package.json +88 -10
- package/dist/ChartCore-BhQ4j7f5.js.map +0 -1
- package/dist/SciPlot-GJvw7GJo.js +0 -463
- package/dist/SciPlot-GJvw7GJo.js.map +0 -1
- package/dist/axisFormat-SPX-CD5s.js.map +0 -1
- package/dist/createStackedChart-DJSmqerD.js +0 -706
- package/dist/createStackedChart-DJSmqerD.js.map +0 -1
- package/dist/index-CUGS98p4.js.map +0 -1
- package/dist/index-CWipqOLP.js.map +0 -1
- package/dist/index-D7dTq6VB.js.map +0 -1
- package/dist/index-DoYxf1cV.js.map +0 -1
- package/dist/index.core-fpZ1dYN0.js.map +0 -1
- package/dist/mockDatafeed-Cdg5hKEo.js.map +0 -1
- package/dist/pool-15HMCNv8.js +0 -88
- package/dist/pool-15HMCNv8.js.map +0 -1
- package/dist/react/SciPlot.d.ts +0 -60
- package/dist/react/useSciPlot.d.ts +0 -56
|
@@ -130,7 +130,7 @@ function x(t) {
|
|
|
130
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
131
|
}
|
|
132
132
|
function o(t, e) {
|
|
133
|
-
const n = e === "auto" ? x(t) : e, r = w[n]
|
|
133
|
+
const n = e === "auto" ? x(t) : e, r = w[n];
|
|
134
134
|
return `${(t / r).toPrecision(3)}${n}`;
|
|
135
135
|
}
|
|
136
136
|
function E(t) {
|
|
@@ -158,7 +158,7 @@ function h(t, e) {
|
|
|
158
158
|
9: "⁹",
|
|
159
159
|
"-": "⁻",
|
|
160
160
|
"+": "⁺"
|
|
161
|
-
}, a = i.replace("+", "").replace(/[0-9\-]/g, (f) => c[f]
|
|
161
|
+
}, a = i.replace("+", "").replace(/[0-9\-]/g, (f) => c[f]);
|
|
162
162
|
return `${r}e${a}`;
|
|
163
163
|
}
|
|
164
164
|
function k(t, e, n, r) {
|
|
@@ -197,4 +197,4 @@ export {
|
|
|
197
197
|
T as i,
|
|
198
198
|
b as m
|
|
199
199
|
};
|
|
200
|
-
//# sourceMappingURL=axisFormat-
|
|
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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AID,CAAK;AAE7B,SAAIqB,KAAoB,CAACC,KAAerB,MAAW,KAAKA,IAAS,OACxDO,EAAoBR,GAAO,CAAC,IAG9BA,EAAM,QAAQ,CAAC,EAAE,QAAQ,UAAU,EAAE;AAC9C;AAEO,SAASuB,EAAiBvB,GAAeiB,GAA+B;AAC7E,MAAIjB,MAAU,EAAG,QAAO;AAExB,QAAMqB,KAAkBJ,KAAA,gBAAAA,EAAS,gBAAe,IAC1CK,KAAcL,KAAA,gBAAAA,EAAS,gBAAe,IACtChB,IAAS,KAAK,IAAID,CAAK;AAE7B,UAAIiB,KAAA,gBAAAA,EAAS,YAAW,UAAaA,EAAQ,WAAW,KAC/Cf,EAAYF,GAAOiB,EAAQ,MAAM,IAGtCI,KAAoB,CAACC,MAAgBrB,IAAS,QAAUA,KAAU,OAC7DO,EAAoBR,GAAO,CAAC,IAGjCC,KAAU,MACLD,EAAM,eAAe,QAAW,EAAE,uBAAuB,GAAG,IAG9DA,EAAM,YAAY,CAAC;AAC5B;AAQO,SAASwB,EAAexB,GAAeyB,GAAwC;AACpF,SAAOT,EAAiBhB,GAAOyB,KAAA,gBAAAA,EAAY,GAA8BA,KAAA,gBAAAA,EAAY,KAAK;AAC5F;AAEO,SAASC,EAAe1B,GAAeyB,GAAwC;AACpF,SAAOF,EAAiBvB,GAAOyB,KAAA,gBAAAA,EAAY,CAA4B;AACzE;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Bounds } from '../../types';
|
|
2
|
+
import { VeloPlotSeries } from './types';
|
|
3
|
+
import { KeyBindingManager } from '../../core/keybindings';
|
|
4
|
+
|
|
5
|
+
export interface A11yOptions {
|
|
6
|
+
label?: string;
|
|
7
|
+
series?: VeloPlotSeries[];
|
|
8
|
+
bounds?: Bounds | null;
|
|
9
|
+
enableKeyboard?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface A11yHandle {
|
|
12
|
+
keyboard?: KeyBindingManager;
|
|
13
|
+
srTable?: HTMLTableElement;
|
|
14
|
+
cleanup: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildAriaLabel(series?: VeloPlotSeries[], bounds?: Bounds | null, customLabel?: string): string;
|
|
17
|
+
export declare function applyChartA11y(container: HTMLElement, chart: {
|
|
18
|
+
resetZoom?: () => void;
|
|
19
|
+
zoom?: (opts: {
|
|
20
|
+
x?: [number, number];
|
|
21
|
+
y?: [number, number];
|
|
22
|
+
}) => void;
|
|
23
|
+
pan?: (dx: number, dy: number) => void;
|
|
24
|
+
getViewBounds?: () => Bounds;
|
|
25
|
+
}, options?: A11yOptions): A11yHandle;
|
|
26
|
+
export declare function updateA11y(container: HTMLElement, srTable: HTMLTableElement | undefined, options: A11yOptions): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Chart } from '../../core/Chart';
|
|
2
|
+
import { ChartOptions, Bounds } from '../../types';
|
|
3
|
+
import { BindingChartOptions } from './types';
|
|
4
|
+
|
|
5
|
+
export type ChartBindingOptions = Omit<ChartOptions, "container"> & BindingChartOptions;
|
|
6
|
+
export interface ChartLifecycleHandle {
|
|
7
|
+
chart: Chart;
|
|
8
|
+
destroy: () => void;
|
|
9
|
+
getBounds: () => Bounds | null;
|
|
10
|
+
}
|
|
11
|
+
export interface ChartLifecycleCallbacks {
|
|
12
|
+
onBoundsChange?: (bounds: Bounds) => void;
|
|
13
|
+
onError?: (error: Error) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function createChartLifecycle(container: HTMLDivElement, options: ChartBindingOptions, callbacks?: ChartLifecycleCallbacks): ChartLifecycleHandle;
|
|
16
|
+
export declare function attachZoomListener(chart: Chart, onBoundsChange: (bounds: Bounds) => void): () => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChartGroup, ChartLike, SyncOptions } from '../../core/sync';
|
|
2
|
+
|
|
3
|
+
export interface ChartSyncHandle {
|
|
4
|
+
group: ChartGroup;
|
|
5
|
+
destroy: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function createChartSync(charts: ChartLike[], options?: SyncOptions): ChartSyncHandle;
|
|
8
|
+
export declare function updateChartSync(handle: ChartSyncHandle | null, charts: ChartLike[], options?: SyncOptions): ChartSyncHandle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatBindingDimension(value: number | string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './chartLifecycle';
|
|
3
|
+
export * from './seriesDiff';
|
|
4
|
+
export * from './optionsSync';
|
|
5
|
+
export * from './stackedSync';
|
|
6
|
+
export * from './indicatorBridge';
|
|
7
|
+
export * from './chartSyncBridge';
|
|
8
|
+
export * from './a11y';
|
|
9
|
+
export * from './dimensions';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Chart } from '../../core/chart/types';
|
|
2
|
+
import { StackedChart } from '../../core/stacked/types';
|
|
3
|
+
import { AddIndicatorOptions, AddIndicatorResult } from '../../core/indicator/addIndicator';
|
|
4
|
+
import { IndicatorPresetName } from '../../core/indicator/indicatorPresets';
|
|
5
|
+
|
|
6
|
+
export type IndicatorHost = Chart | StackedChart | null;
|
|
7
|
+
export declare function isStackedChart(host: IndicatorHost): host is StackedChart;
|
|
8
|
+
export declare function addIndicatorToHost(host: IndicatorHost, preset: IndicatorPresetName, options?: AddIndicatorOptions): Promise<AddIndicatorResult & {
|
|
9
|
+
paneId?: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function removeIndicatorFromChart(chart: Chart, rootId: string): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Chart } from '../../core/chart/types';
|
|
2
|
+
import { ChartOptions } from '../../types';
|
|
3
|
+
|
|
4
|
+
export type SyncableChartOptions = Omit<ChartOptions, "container">;
|
|
5
|
+
export declare function optionsChanged(prev: SyncableChartOptions, next: SyncableChartOptions): boolean;
|
|
6
|
+
export declare function syncChartOptions(chart: Chart, prev: SyncableChartOptions, next: SyncableChartOptions): void;
|
|
7
|
+
export declare function pickSyncableOptions(options: SyncableChartOptions): SyncableChartOptions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SeriesOptions } from '../../types';
|
|
2
|
+
import { ChartSeriesActions, VeloPlotSeries } from './types';
|
|
3
|
+
|
|
4
|
+
export declare function veloPlotSeriesToOptions(series: VeloPlotSeries): SeriesOptions;
|
|
5
|
+
export declare function diffSeries(chart: ChartSeriesActions, current: VeloPlotSeries[], previous: Map<string, VeloPlotSeries>): Map<string, VeloPlotSeries>;
|
|
6
|
+
export declare function serializePaneIds(panes: {
|
|
7
|
+
id: string;
|
|
8
|
+
}[]): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StackedChart, StackedChartOptions, StackedPaneConfig } from '../../core/stacked/types';
|
|
2
|
+
import { VeloPlotSeries } from './types';
|
|
3
|
+
|
|
4
|
+
export type SyncableStackedOptions = Omit<StackedChartOptions, "container">;
|
|
5
|
+
export declare function stackedStructureKey(panes: StackedPaneConfig[]): string;
|
|
6
|
+
export declare function syncStackedTheme(stack: StackedChart, theme: StackedChartOptions["theme"]): void;
|
|
7
|
+
export declare function syncStackedSyncOptions(stack: StackedChart, sync: StackedChartOptions["sync"]): void;
|
|
8
|
+
export declare function syncStackedPaneSeries(stack: StackedChart, panes: StackedPaneConfig[], previousSeries: Map<string, Map<string, VeloPlotSeries>>): Map<string, Map<string, VeloPlotSeries>>;
|
|
9
|
+
export declare function syncStackedOptions(stack: StackedChart, options: SyncableStackedOptions): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SeriesOptions, SeriesUpdateData, HeatmapData } from '../../types';
|
|
2
|
+
|
|
3
|
+
export type VeloPlotSeriesType = "line" | "candlestick" | "bar" | "heatmap";
|
|
4
|
+
export interface VeloPlotSeriesBase {
|
|
5
|
+
id: string;
|
|
6
|
+
type?: VeloPlotSeriesType;
|
|
7
|
+
color?: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface VeloPlotLineSeries extends VeloPlotSeriesBase {
|
|
13
|
+
type?: "line";
|
|
14
|
+
x: Float32Array | Float64Array;
|
|
15
|
+
y: Float32Array | Float64Array;
|
|
16
|
+
}
|
|
17
|
+
export interface VeloPlotCandlestickSeries extends VeloPlotSeriesBase {
|
|
18
|
+
type: "candlestick";
|
|
19
|
+
x: Float32Array | Float64Array;
|
|
20
|
+
open: Float32Array | Float64Array;
|
|
21
|
+
high: Float32Array | Float64Array;
|
|
22
|
+
low: Float32Array | Float64Array;
|
|
23
|
+
close: Float32Array | Float64Array;
|
|
24
|
+
}
|
|
25
|
+
export interface VeloPlotBarSeries extends VeloPlotSeriesBase {
|
|
26
|
+
type: "bar";
|
|
27
|
+
x: Float32Array | Float64Array;
|
|
28
|
+
y: Float32Array | Float64Array;
|
|
29
|
+
}
|
|
30
|
+
export interface VeloPlotHeatmapSeries extends VeloPlotSeriesBase {
|
|
31
|
+
type: "heatmap";
|
|
32
|
+
data: HeatmapData;
|
|
33
|
+
}
|
|
34
|
+
export type VeloPlotSeries = VeloPlotLineSeries | VeloPlotCandlestickSeries | VeloPlotBarSeries | VeloPlotHeatmapSeries;
|
|
35
|
+
export interface ChartSeriesActions {
|
|
36
|
+
addSeries: (options: SeriesOptions) => void;
|
|
37
|
+
updateSeries: (id: string, data: SeriesUpdateData) => void;
|
|
38
|
+
removeSeries: (id: string) => void;
|
|
39
|
+
autoScale?: () => void;
|
|
40
|
+
}
|
|
41
|
+
export interface BindingChartOptions {
|
|
42
|
+
autoResize?: boolean;
|
|
43
|
+
responsive?: boolean | {
|
|
44
|
+
reducedMotion?: boolean | "auto";
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import { Chart } from '../../core/chart/types';
|
|
3
|
+
|
|
4
|
+
export declare function createMockContainer(): HTMLDivElement;
|
|
5
|
+
export declare function sampleLineData(n?: number): {
|
|
6
|
+
x: Float32Array;
|
|
7
|
+
y: Float32Array;
|
|
8
|
+
};
|
|
9
|
+
export declare function sampleOhlcData(n?: number): {
|
|
10
|
+
x: Float32Array;
|
|
11
|
+
open: Float32Array;
|
|
12
|
+
high: Float32Array;
|
|
13
|
+
low: Float32Array;
|
|
14
|
+
close: Float32Array;
|
|
15
|
+
};
|
|
16
|
+
export declare function buildMockChart(id?: string): Chart & {
|
|
17
|
+
destroy: ReturnType<typeof vi.fn>;
|
|
18
|
+
addSeries: ReturnType<typeof vi.fn>;
|
|
19
|
+
updateSeries: ReturnType<typeof vi.fn>;
|
|
20
|
+
removeSeries: ReturnType<typeof vi.fn>;
|
|
21
|
+
on: ReturnType<typeof vi.fn>;
|
|
22
|
+
off: ReturnType<typeof vi.fn>;
|
|
23
|
+
zoom: ReturnType<typeof vi.fn>;
|
|
24
|
+
resetZoom: ReturnType<typeof vi.fn>;
|
|
25
|
+
autoScale: ReturnType<typeof vi.fn>;
|
|
26
|
+
enableCursor: ReturnType<typeof vi.fn>;
|
|
27
|
+
disableCursor: ReturnType<typeof vi.fn>;
|
|
28
|
+
setTheme: ReturnType<typeof vi.fn>;
|
|
29
|
+
updateXAxis: ReturnType<typeof vi.fn>;
|
|
30
|
+
updateYAxis: ReturnType<typeof vi.fn>;
|
|
31
|
+
resize: ReturnType<typeof vi.fn>;
|
|
32
|
+
getViewBounds: ReturnType<typeof vi.fn>;
|
|
33
|
+
getAllSeries: ReturnType<typeof vi.fn>;
|
|
34
|
+
};
|
|
35
|
+
export declare function expectDestroyCalled(destroyFn: ReturnType<typeof vi.fn>): void;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
export declare function createMockChartLifecycle(): {
|
|
4
|
+
chart: import('../..').Chart & {
|
|
5
|
+
destroy: ReturnType<typeof vi.fn>;
|
|
6
|
+
addSeries: ReturnType<typeof vi.fn>;
|
|
7
|
+
updateSeries: ReturnType<typeof vi.fn>;
|
|
8
|
+
removeSeries: ReturnType<typeof vi.fn>;
|
|
9
|
+
on: ReturnType<typeof vi.fn>;
|
|
10
|
+
off: ReturnType<typeof vi.fn>;
|
|
11
|
+
zoom: ReturnType<typeof vi.fn>;
|
|
12
|
+
resetZoom: ReturnType<typeof vi.fn>;
|
|
13
|
+
autoScale: ReturnType<typeof vi.fn>;
|
|
14
|
+
enableCursor: ReturnType<typeof vi.fn>;
|
|
15
|
+
disableCursor: ReturnType<typeof vi.fn>;
|
|
16
|
+
setTheme: ReturnType<typeof vi.fn>;
|
|
17
|
+
updateXAxis: ReturnType<typeof vi.fn>;
|
|
18
|
+
updateYAxis: ReturnType<typeof vi.fn>;
|
|
19
|
+
resize: ReturnType<typeof vi.fn>;
|
|
20
|
+
getViewBounds: ReturnType<typeof vi.fn>;
|
|
21
|
+
getAllSeries: ReturnType<typeof vi.fn>;
|
|
22
|
+
};
|
|
23
|
+
destroy: import('vitest').Mock<(...args: any[]) => any>;
|
|
24
|
+
handle: {
|
|
25
|
+
chart: import('../..').Chart & {
|
|
26
|
+
destroy: ReturnType<typeof vi.fn>;
|
|
27
|
+
addSeries: ReturnType<typeof vi.fn>;
|
|
28
|
+
updateSeries: ReturnType<typeof vi.fn>;
|
|
29
|
+
removeSeries: ReturnType<typeof vi.fn>;
|
|
30
|
+
on: ReturnType<typeof vi.fn>;
|
|
31
|
+
off: ReturnType<typeof vi.fn>;
|
|
32
|
+
zoom: ReturnType<typeof vi.fn>;
|
|
33
|
+
resetZoom: ReturnType<typeof vi.fn>;
|
|
34
|
+
autoScale: ReturnType<typeof vi.fn>;
|
|
35
|
+
enableCursor: ReturnType<typeof vi.fn>;
|
|
36
|
+
disableCursor: ReturnType<typeof vi.fn>;
|
|
37
|
+
setTheme: ReturnType<typeof vi.fn>;
|
|
38
|
+
updateXAxis: ReturnType<typeof vi.fn>;
|
|
39
|
+
updateYAxis: ReturnType<typeof vi.fn>;
|
|
40
|
+
resize: ReturnType<typeof vi.fn>;
|
|
41
|
+
getViewBounds: ReturnType<typeof vi.fn>;
|
|
42
|
+
getAllSeries: ReturnType<typeof vi.fn>;
|
|
43
|
+
};
|
|
44
|
+
getBounds: () => import('../..').Bounds;
|
|
45
|
+
destroy: import('vitest').Mock<(...args: any[]) => any>;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare function mockChartLifecycleModule(): {
|
|
49
|
+
createChartLifecycle: import('vitest').Mock<() => {
|
|
50
|
+
chart: import('../..').Chart & {
|
|
51
|
+
destroy: ReturnType<typeof vi.fn>;
|
|
52
|
+
addSeries: ReturnType<typeof vi.fn>;
|
|
53
|
+
updateSeries: ReturnType<typeof vi.fn>;
|
|
54
|
+
removeSeries: ReturnType<typeof vi.fn>;
|
|
55
|
+
on: ReturnType<typeof vi.fn>;
|
|
56
|
+
off: ReturnType<typeof vi.fn>;
|
|
57
|
+
zoom: ReturnType<typeof vi.fn>;
|
|
58
|
+
resetZoom: ReturnType<typeof vi.fn>;
|
|
59
|
+
autoScale: ReturnType<typeof vi.fn>;
|
|
60
|
+
enableCursor: ReturnType<typeof vi.fn>;
|
|
61
|
+
disableCursor: ReturnType<typeof vi.fn>;
|
|
62
|
+
setTheme: ReturnType<typeof vi.fn>;
|
|
63
|
+
updateXAxis: ReturnType<typeof vi.fn>;
|
|
64
|
+
updateYAxis: ReturnType<typeof vi.fn>;
|
|
65
|
+
resize: ReturnType<typeof vi.fn>;
|
|
66
|
+
getViewBounds: ReturnType<typeof vi.fn>;
|
|
67
|
+
getAllSeries: ReturnType<typeof vi.fn>;
|
|
68
|
+
};
|
|
69
|
+
getBounds: () => import('../..').Bounds;
|
|
70
|
+
destroy: import('vitest').Mock<(...args: any[]) => any>;
|
|
71
|
+
}>;
|
|
72
|
+
pickSyncableOptions: (o: object) => object;
|
|
73
|
+
optionsChanged: () => boolean;
|
|
74
|
+
syncChartOptions: import('vitest').Mock<(...args: any[]) => any>;
|
|
75
|
+
lifecycle: {
|
|
76
|
+
chart: import('../..').Chart & {
|
|
77
|
+
destroy: ReturnType<typeof vi.fn>;
|
|
78
|
+
addSeries: ReturnType<typeof vi.fn>;
|
|
79
|
+
updateSeries: ReturnType<typeof vi.fn>;
|
|
80
|
+
removeSeries: ReturnType<typeof vi.fn>;
|
|
81
|
+
on: ReturnType<typeof vi.fn>;
|
|
82
|
+
off: ReturnType<typeof vi.fn>;
|
|
83
|
+
zoom: ReturnType<typeof vi.fn>;
|
|
84
|
+
resetZoom: ReturnType<typeof vi.fn>;
|
|
85
|
+
autoScale: ReturnType<typeof vi.fn>;
|
|
86
|
+
enableCursor: ReturnType<typeof vi.fn>;
|
|
87
|
+
disableCursor: ReturnType<typeof vi.fn>;
|
|
88
|
+
setTheme: ReturnType<typeof vi.fn>;
|
|
89
|
+
updateXAxis: ReturnType<typeof vi.fn>;
|
|
90
|
+
updateYAxis: ReturnType<typeof vi.fn>;
|
|
91
|
+
resize: ReturnType<typeof vi.fn>;
|
|
92
|
+
getViewBounds: ReturnType<typeof vi.fn>;
|
|
93
|
+
getAllSeries: ReturnType<typeof vi.fn>;
|
|
94
|
+
};
|
|
95
|
+
destroy: import('vitest').Mock<(...args: any[]) => any>;
|
|
96
|
+
handle: {
|
|
97
|
+
chart: import('../..').Chart & {
|
|
98
|
+
destroy: ReturnType<typeof vi.fn>;
|
|
99
|
+
addSeries: ReturnType<typeof vi.fn>;
|
|
100
|
+
updateSeries: ReturnType<typeof vi.fn>;
|
|
101
|
+
removeSeries: ReturnType<typeof vi.fn>;
|
|
102
|
+
on: ReturnType<typeof vi.fn>;
|
|
103
|
+
off: ReturnType<typeof vi.fn>;
|
|
104
|
+
zoom: ReturnType<typeof vi.fn>;
|
|
105
|
+
resetZoom: ReturnType<typeof vi.fn>;
|
|
106
|
+
autoScale: ReturnType<typeof vi.fn>;
|
|
107
|
+
enableCursor: ReturnType<typeof vi.fn>;
|
|
108
|
+
disableCursor: ReturnType<typeof vi.fn>;
|
|
109
|
+
setTheme: ReturnType<typeof vi.fn>;
|
|
110
|
+
updateXAxis: ReturnType<typeof vi.fn>;
|
|
111
|
+
updateYAxis: ReturnType<typeof vi.fn>;
|
|
112
|
+
resize: ReturnType<typeof vi.fn>;
|
|
113
|
+
getViewBounds: ReturnType<typeof vi.fn>;
|
|
114
|
+
getAllSeries: ReturnType<typeof vi.fn>;
|
|
115
|
+
};
|
|
116
|
+
getBounds: () => import('../..').Bounds;
|
|
117
|
+
destroy: import('vitest').Mock<(...args: any[]) => any>;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { c as a, k as d } from "./ChartCore-BpzRvN4Y.js";
|
|
2
|
+
import { c as u } from "./index-CaXWSOTk.js";
|
|
3
|
+
function c(e) {
|
|
4
|
+
const r = e.responsive ?? { reducedMotion: "auto" };
|
|
5
|
+
return { ...e, responsive: r };
|
|
6
|
+
}
|
|
7
|
+
function y(e, r, o = {}) {
|
|
8
|
+
const t = a({
|
|
9
|
+
...c(r),
|
|
10
|
+
container: e
|
|
11
|
+
}), i = () => {
|
|
12
|
+
var s;
|
|
13
|
+
(s = o.onBoundsChange) == null || s.call(o, t.getViewBounds());
|
|
14
|
+
};
|
|
15
|
+
t.on("zoom", i);
|
|
16
|
+
let n;
|
|
17
|
+
return r.autoResize !== !1 && (n = new ResizeObserver(() => {
|
|
18
|
+
t.resize();
|
|
19
|
+
}), n.observe(e)), {
|
|
20
|
+
chart: t,
|
|
21
|
+
getBounds: () => t.getViewBounds(),
|
|
22
|
+
destroy: () => {
|
|
23
|
+
n == null || n.disconnect(), t.off("zoom", i), t.destroy();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function f(e) {
|
|
28
|
+
return e != null && "getPanes" in e && typeof e.getPanes == "function";
|
|
29
|
+
}
|
|
30
|
+
async function C(e, r, o = {}) {
|
|
31
|
+
if (!e)
|
|
32
|
+
throw new Error(
|
|
33
|
+
"[useIndicator] Chart is not ready. Wait for isReady before adding indicators."
|
|
34
|
+
);
|
|
35
|
+
return f(e) ? await e.addIndicator(r, o) : d(e, r, o);
|
|
36
|
+
}
|
|
37
|
+
function h(e, r) {
|
|
38
|
+
for (const o of [...e.getAllSeries()]) {
|
|
39
|
+
const t = o.getId();
|
|
40
|
+
(t === r || t.startsWith(`${r}-`)) && e.removeSeries(t);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function v(e, r) {
|
|
44
|
+
const o = u(e, r);
|
|
45
|
+
return {
|
|
46
|
+
group: o,
|
|
47
|
+
destroy: () => o.destroy()
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
C as a,
|
|
52
|
+
v as b,
|
|
53
|
+
y as c,
|
|
54
|
+
f as i,
|
|
55
|
+
h as r
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=chartSyncBridge-DbWrwtyP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartSyncBridge-DbWrwtyP.js","sources":["../src/bindings/shared/chartLifecycle.ts","../src/bindings/shared/indicatorBridge.ts","../src/bindings/shared/chartSyncBridge.ts"],"sourcesContent":["/**\n * Framework-agnostic chart lifecycle helpers.\n */\n\nimport { createChart, type Chart } from \"../../core/Chart\";\nimport type { ChartOptions, Bounds } from \"../../types\";\nimport type { BindingChartOptions } from \"./types\";\n\nexport type ChartBindingOptions = Omit<ChartOptions, \"container\"> &\n BindingChartOptions;\n\nexport interface ChartLifecycleHandle {\n chart: Chart;\n destroy: () => void;\n getBounds: () => Bounds | null;\n}\n\nexport interface ChartLifecycleCallbacks {\n onBoundsChange?: (bounds: Bounds) => void;\n onError?: (error: Error) => void;\n}\n\nfunction defaultResponsive(\n options: ChartBindingOptions,\n): ChartBindingOptions {\n const responsive = options.responsive ?? { reducedMotion: \"auto\" as const };\n return { ...options, responsive };\n}\n\nexport function createChartLifecycle(\n container: HTMLDivElement,\n options: ChartBindingOptions,\n callbacks: ChartLifecycleCallbacks = {},\n): ChartLifecycleHandle {\n const chart = createChart({\n ...defaultResponsive(options),\n container,\n });\n\n const onZoom = () => {\n callbacks.onBoundsChange?.(chart.getViewBounds());\n };\n chart.on(\"zoom\", onZoom);\n\n let resizeObserver: ResizeObserver | undefined;\n if (options.autoResize !== false) {\n resizeObserver = new ResizeObserver(() => {\n chart.resize();\n });\n resizeObserver.observe(container);\n }\n\n return {\n chart,\n getBounds: () => chart.getViewBounds(),\n destroy: () => {\n resizeObserver?.disconnect();\n chart.off(\"zoom\", onZoom);\n chart.destroy();\n },\n };\n}\n\nexport function attachZoomListener(\n chart: Chart,\n onBoundsChange: (bounds: Bounds) => void,\n): () => void {\n const handler = () => onBoundsChange(chart.getViewBounds());\n chart.on(\"zoom\", handler);\n return () => chart.off(\"zoom\", handler);\n}\n","/**\n * Indicator bridge for framework bindings.\n */\n\nimport type { Chart } from \"../../core/chart/types\";\nimport type { StackedChart } from \"../../core/stacked/types\";\nimport {\n addIndicatorToChart,\n type AddIndicatorOptions,\n type AddIndicatorResult,\n} from \"../../core/indicator/addIndicator\";\nimport type { IndicatorPresetName } from \"../../core/indicator/indicatorPresets\";\n\nexport type IndicatorHost = Chart | StackedChart | null;\n\nexport function isStackedChart(host: IndicatorHost): host is StackedChart {\n return (\n host != null &&\n \"getPanes\" in host &&\n typeof (host as StackedChart).getPanes === \"function\"\n );\n}\n\nexport async function addIndicatorToHost(\n host: IndicatorHost,\n preset: IndicatorPresetName,\n options: AddIndicatorOptions = {},\n): Promise<AddIndicatorResult & { paneId?: string }> {\n if (!host) {\n throw new Error(\n \"[useIndicator] Chart is not ready. Wait for isReady before adding indicators.\",\n );\n }\n\n if (isStackedChart(host)) {\n const result = await host.addIndicator(preset, options);\n return result;\n }\n\n return addIndicatorToChart(host, preset, options);\n}\n\nexport function removeIndicatorFromChart(\n chart: Chart,\n rootId: string,\n): void {\n for (const s of [...chart.getAllSeries()]) {\n const sid = s.getId();\n if (sid === rootId || sid.startsWith(`${rootId}-`)) {\n chart.removeSeries(sid);\n }\n }\n}\n","/**\n * Chart sync bridge for framework bindings.\n */\n\nimport {\n ChartGroup,\n createChartGroup,\n type ChartLike,\n type SyncOptions,\n} from \"../../core/sync\";\n\nexport interface ChartSyncHandle {\n group: ChartGroup;\n destroy: () => void;\n}\n\nexport function createChartSync(\n charts: ChartLike[],\n options?: SyncOptions,\n): ChartSyncHandle {\n const group = createChartGroup(charts, options);\n return {\n group,\n destroy: () => group.destroy(),\n };\n}\n\nexport function updateChartSync(\n handle: ChartSyncHandle | null,\n charts: ChartLike[],\n options?: SyncOptions,\n): ChartSyncHandle {\n handle?.destroy();\n if (charts.length < 2) {\n return { group: new ChartGroup(options), destroy: () => {} };\n }\n return createChartSync(charts, options);\n}\n"],"names":["defaultResponsive","options","responsive","createChartLifecycle","container","callbacks","chart","createChart","onZoom","_a","resizeObserver","isStackedChart","host","addIndicatorToHost","preset","addIndicatorToChart","removeIndicatorFromChart","rootId","s","sid","createChartSync","charts","group","createChartGroup"],"mappings":";;AAsBA,SAASA,EACPC,GACqB;AACrB,QAAMC,IAAaD,EAAQ,cAAc,EAAE,eAAe,OAAA;AAC1D,SAAO,EAAE,GAAGA,GAAS,YAAAC,EAAA;AACvB;AAEO,SAASC,EACdC,GACAH,GACAI,IAAqC,CAAA,GACf;AACtB,QAAMC,IAAQC,EAAY;AAAA,IACxB,GAAGP,EAAkBC,CAAO;AAAA,IAC5B,WAAAG;AAAA,EAAA,CACD,GAEKI,IAAS,MAAM;;AACnB,KAAAC,IAAAJ,EAAU,mBAAV,QAAAI,EAAA,KAAAJ,GAA2BC,EAAM;EACnC;AACA,EAAAA,EAAM,GAAG,QAAQE,CAAM;AAEvB,MAAIE;AACJ,SAAIT,EAAQ,eAAe,OACzBS,IAAiB,IAAI,eAAe,MAAM;AACxC,IAAAJ,EAAM,OAAA;AAAA,EACR,CAAC,GACDI,EAAe,QAAQN,CAAS,IAG3B;AAAA,IACL,OAAAE;AAAA,IACA,WAAW,MAAMA,EAAM,cAAA;AAAA,IACvB,SAAS,MAAM;AACb,MAAAI,KAAA,QAAAA,EAAgB,cAChBJ,EAAM,IAAI,QAAQE,CAAM,GACxBF,EAAM,QAAA;AAAA,IACR;AAAA,EAAA;AAEJ;AC9CO,SAASK,EAAeC,GAA2C;AACxE,SACEA,KAAQ,QACR,cAAcA,KACd,OAAQA,EAAsB,YAAa;AAE/C;AAEA,eAAsBC,EACpBD,GACAE,GACAb,IAA+B,CAAA,GACoB;AACnD,MAAI,CAACW;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAIJ,SAAID,EAAeC,CAAI,IACN,MAAMA,EAAK,aAAaE,GAAQb,CAAO,IAIjDc,EAAoBH,GAAME,GAAQb,CAAO;AAClD;AAEO,SAASe,EACdV,GACAW,GACM;AACN,aAAWC,KAAK,CAAC,GAAGZ,EAAM,aAAA,CAAc,GAAG;AACzC,UAAMa,IAAMD,EAAE,MAAA;AACd,KAAIC,MAAQF,KAAUE,EAAI,WAAW,GAAGF,CAAM,GAAG,MAC/CX,EAAM,aAAaa,CAAG;AAAA,EAE1B;AACF;ACpCO,SAASC,EACdC,GACApB,GACiB;AACjB,QAAMqB,IAAQC,EAAiBF,GAAQpB,CAAO;AAC9C,SAAO;AAAA,IACL,OAAAqB;AAAA,IACA,SAAS,MAAMA,EAAM,QAAA;AAAA,EAAQ;AAEjC;"}
|
package/dist/core/Chart.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface InteractionCallbacks {
|
|
|
29
29
|
onDragStart?: () => void;
|
|
30
30
|
/** Called when any drag operation ends */
|
|
31
31
|
onDragEnd?: () => void;
|
|
32
|
+
/** Called on double-tap (mobile reset zoom) */
|
|
33
|
+
onDoubleTap?: () => void;
|
|
32
34
|
/** Called for all raw interaction events for plugin processing */
|
|
33
35
|
onInteraction?: (event: import('../plugins/types').InteractionEvent) => void;
|
|
34
36
|
}
|
|
@@ -61,6 +63,10 @@ export declare class InteractionManager {
|
|
|
61
63
|
private lastMousePos;
|
|
62
64
|
private mouseDownPos;
|
|
63
65
|
private mode;
|
|
66
|
+
private pinchStartDistance;
|
|
67
|
+
private pinchStartBounds;
|
|
68
|
+
private lastTapTime;
|
|
69
|
+
private readonly doubleTapMs;
|
|
64
70
|
private boundWheel;
|
|
65
71
|
private boundMouseDown;
|
|
66
72
|
private boundMouseMove;
|
|
@@ -74,7 +80,7 @@ export declare class InteractionManager {
|
|
|
74
80
|
private detachListeners;
|
|
75
81
|
/**
|
|
76
82
|
* Set the interaction mode
|
|
77
|
-
* @deprecated Use setMode instead
|
|
83
|
+
* @deprecated Use setMode instead. **Removed in v4.0.**
|
|
78
84
|
*/
|
|
79
85
|
setPanMode(enabled: boolean): void;
|
|
80
86
|
/**
|
|
@@ -15,6 +15,11 @@ export declare class OverlayRenderer {
|
|
|
15
15
|
/** Filter X ticks to valid business-day indices (unique integers in range). */
|
|
16
16
|
private filterBusinessDayXTicks;
|
|
17
17
|
private resolveXTicks;
|
|
18
|
+
/**
|
|
19
|
+
* Grid X lines use the full viewport domain (nice even spacing), including
|
|
20
|
+
* regions past the loaded series. Axis labels stay filtered to real data.
|
|
21
|
+
*/
|
|
22
|
+
private resolveGridXTicks;
|
|
18
23
|
/**
|
|
19
24
|
* Set LaTeX API for rendering mathematical expressions
|
|
20
25
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Annotation Types
|
|
3
3
|
*
|
|
4
|
-
* Type definitions for all annotation types supported by
|
|
4
|
+
* Type definitions for all annotation types supported by Velo Plot.
|
|
5
5
|
*/
|
|
6
6
|
export type AnnotationType = 'horizontal-line' | 'vertical-line' | 'rectangle' | 'band' | 'text' | 'arrow';
|
|
7
7
|
export interface BaseAnnotation {
|
|
@@ -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
|
*/
|
|
@@ -25,6 +25,12 @@ export declare class ChartImpl implements Chart {
|
|
|
25
25
|
private yAxisOptionsMap;
|
|
26
26
|
private primaryYAxisId;
|
|
27
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;
|
|
28
34
|
private backgroundColor;
|
|
29
35
|
private plotAreaBackground;
|
|
30
36
|
private renderer;
|
|
@@ -90,6 +96,7 @@ export declare class ChartImpl implements Chart {
|
|
|
90
96
|
get sync(): any;
|
|
91
97
|
get brokenAxis(): any;
|
|
92
98
|
get forecasting(): any;
|
|
99
|
+
get patterns(): any;
|
|
93
100
|
get latex(): any;
|
|
94
101
|
private animationEngine;
|
|
95
102
|
private animationConfig;
|
|
@@ -239,6 +246,14 @@ export declare class ChartImpl implements Chart {
|
|
|
239
246
|
* Set device pixel ratio and re-render
|
|
240
247
|
*/
|
|
241
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;
|
|
242
257
|
/**
|
|
243
258
|
* Update X axis configuration
|
|
244
259
|
*/
|
|
@@ -293,7 +308,7 @@ export declare class ChartImpl implements Chart {
|
|
|
293
308
|
configureSelection(config: Partial<SelectionConfig>): void;
|
|
294
309
|
/**
|
|
295
310
|
* Set pan mode (true = pan, false = selection)
|
|
296
|
-
* @deprecated Use setMode('pan') or setMode('select') instead
|
|
311
|
+
* @deprecated Use setMode('pan') or setMode('select') instead. **Removed in v4.0.**
|
|
297
312
|
*/
|
|
298
313
|
setPanMode(enabled: boolean): void;
|
|
299
314
|
/**
|
|
@@ -350,7 +365,7 @@ export declare class ChartImpl implements Chart {
|
|
|
350
365
|
* Suspend canvas backing-store resize (inactive panes during stacked drag).
|
|
351
366
|
*/
|
|
352
367
|
setResizeSuspended(suspended: boolean): void;
|
|
353
|
-
/** @deprecated Use CSS transform on pane wrapper during drag; canvas stays untouched. */
|
|
368
|
+
/** @deprecated Use CSS transform on pane wrapper during drag; canvas stays untouched. **Removed in v4.0.** */
|
|
354
369
|
syncDragLayout(width?: number, height?: number): void;
|
|
355
370
|
isResizeSuspended(): boolean;
|
|
356
371
|
resize(): void;
|
|
@@ -66,6 +66,8 @@ export declare class ChartRenderLoop {
|
|
|
66
66
|
startInit(): void;
|
|
67
67
|
/** Wire renderer after async WebGPU init (context holds a snapshot, not a live ref). */
|
|
68
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;
|
|
69
71
|
/**
|
|
70
72
|
* Check if init has started
|
|
71
73
|
*/
|
|
@@ -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
|
*/
|
|
@@ -48,6 +48,11 @@ export interface Chart {
|
|
|
48
48
|
getActiveRenderer(): "webgl" | "webgpu";
|
|
49
49
|
/** Set device pixel ratio and trigger re-render */
|
|
50
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;
|
|
51
56
|
render(): void;
|
|
52
57
|
on<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
|
|
53
58
|
off<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
|
|
@@ -139,7 +144,7 @@ export interface Chart {
|
|
|
139
144
|
configureSelection(config: any): void;
|
|
140
145
|
/**
|
|
141
146
|
* Set pan mode (true = pan, false = selection)
|
|
142
|
-
* @deprecated Use setMode('pan') or setMode('select') instead
|
|
147
|
+
* @deprecated Use setMode('pan') or setMode('select') instead. **Removed in v4.0.**
|
|
143
148
|
*/
|
|
144
149
|
setPanMode(enabled: boolean): void;
|
|
145
150
|
/**
|