velo-plot 1.11.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +35 -2
  2. package/dist/{index.core-CYu3tydL.js → ChartCore-BimVvUEg.js} +1936 -1588
  3. package/dist/ChartCore-BimVvUEg.js.map +1 -0
  4. package/dist/axisFormat-B7o_uIEA.js +127 -0
  5. package/dist/axisFormat-B7o_uIEA.js.map +1 -0
  6. package/dist/core/OverlayRenderer.d.ts +1 -2
  7. package/dist/core/chart/ChartCore.d.ts +18 -1
  8. package/dist/core/chart/ChartRenderLoop.d.ts +4 -0
  9. package/dist/core/chart/ChartScaling.d.ts +11 -0
  10. package/dist/core/chart/NavigationUtils.d.ts +12 -0
  11. package/dist/core/chart/exporter/SVGExporter.d.ts +7 -2
  12. package/dist/core/chart/types.d.ts +13 -1
  13. package/dist/core/format/axisFormat.d.ts +16 -0
  14. package/dist/core/indicator/buildIndicatorPane.d.ts +22 -0
  15. package/dist/core/indicator/buildIndicatorSeries.d.ts +14 -0
  16. package/dist/core/indicator/index.d.ts +3 -0
  17. package/dist/core/indicator/types.d.ts +74 -0
  18. package/dist/core/render/pixelSnap.d.ts +8 -0
  19. package/dist/core/series/SeriesBounds.d.ts +1 -1
  20. package/dist/core/stacked/createStackedChart.d.ts +3 -0
  21. package/dist/core/stacked/index.d.ts +6 -0
  22. package/dist/core/stacked/paneAxis.d.ts +20 -0
  23. package/dist/core/stacked/paneResize.d.ts +29 -0
  24. package/dist/core/stacked/stackExport.d.ts +18 -0
  25. package/dist/core/stacked/types.d.ts +120 -0
  26. package/dist/core/sync/index.d.ts +25 -70
  27. package/dist/createStackedChart-CjsKcOvX.js +1088 -0
  28. package/dist/createStackedChart-CjsKcOvX.js.map +1 -0
  29. package/dist/index-CUGS98p4.js +277 -0
  30. package/dist/index-CUGS98p4.js.map +1 -0
  31. package/dist/index-ChgIdk3N.js +229 -0
  32. package/dist/index-ChgIdk3N.js.map +1 -0
  33. package/dist/{index-D8ifudJH.js → index-DjeWClO9.js} +601 -561
  34. package/dist/index-DjeWClO9.js.map +1 -0
  35. package/dist/index.core-C_-CFftD.js +167 -0
  36. package/dist/index.core-C_-CFftD.js.map +1 -0
  37. package/dist/index.d.ts +2 -0
  38. package/dist/math-Ddm2EZjj.js +85 -0
  39. package/dist/math-Ddm2EZjj.js.map +1 -0
  40. package/dist/plugins/analysis.js +132 -130
  41. package/dist/plugins/analysis.js.map +1 -1
  42. package/dist/plugins/anomaly-detection.d.ts +1 -0
  43. package/dist/plugins/anomaly-detection.js +221 -0
  44. package/dist/plugins/anomaly-detection.js.map +1 -0
  45. package/dist/plugins/broken-axis.d.ts +3 -0
  46. package/dist/plugins/broken-axis.js +262 -0
  47. package/dist/plugins/broken-axis.js.map +1 -0
  48. package/dist/plugins/caching.d.ts +3 -0
  49. package/dist/plugins/caching.js +182 -0
  50. package/dist/plugins/caching.js.map +1 -0
  51. package/dist/plugins/data-transform.d.ts +3 -0
  52. package/dist/plugins/data-transform.js +146 -0
  53. package/dist/plugins/data-transform.js.map +1 -0
  54. package/dist/plugins/debug.js +12 -11
  55. package/dist/plugins/debug.js.map +1 -1
  56. package/dist/plugins/forecasting.d.ts +1 -0
  57. package/dist/plugins/forecasting.js +236 -0
  58. package/dist/plugins/forecasting.js.map +1 -0
  59. package/dist/plugins/latex.d.ts +1 -0
  60. package/dist/plugins/latex.js +454 -0
  61. package/dist/plugins/latex.js.map +1 -0
  62. package/dist/plugins/lazy-load.d.ts +3 -0
  63. package/dist/plugins/lazy-load.js +189 -0
  64. package/dist/plugins/lazy-load.js.map +1 -0
  65. package/dist/plugins/ml-integration.d.ts +3 -0
  66. package/dist/plugins/ml-integration.js +355 -0
  67. package/dist/plugins/ml-integration.js.map +1 -0
  68. package/dist/plugins/offscreen.d.ts +3 -0
  69. package/dist/plugins/offscreen.js +169 -0
  70. package/dist/plugins/offscreen.js.map +1 -0
  71. package/dist/plugins/pattern-recognition.d.ts +3 -0
  72. package/dist/plugins/pattern-recognition.js +690 -0
  73. package/dist/plugins/pattern-recognition.js.map +1 -0
  74. package/dist/plugins/radar.d.ts +3 -0
  75. package/dist/plugins/radar.js +103 -0
  76. package/dist/plugins/radar.js.map +1 -0
  77. package/dist/plugins/regression.d.ts +3 -0
  78. package/dist/plugins/regression.js +634 -0
  79. package/dist/plugins/regression.js.map +1 -0
  80. package/dist/plugins/roi.d.ts +1 -0
  81. package/dist/plugins/roi.js +223 -0
  82. package/dist/plugins/roi.js.map +1 -0
  83. package/dist/plugins/snapshot/types.d.ts +1 -1
  84. package/dist/plugins/snapshot.d.ts +3 -0
  85. package/dist/plugins/snapshot.js +90 -0
  86. package/dist/plugins/snapshot.js.map +1 -0
  87. package/dist/plugins/sync/index.d.ts +2 -1
  88. package/dist/plugins/sync.js +12 -244
  89. package/dist/plugins/sync.js.map +1 -1
  90. package/dist/plugins/tools/tooltip/TooltipManager.d.ts +9 -1
  91. package/dist/plugins/tools/tooltip/format.d.ts +7 -0
  92. package/dist/plugins/tools/tooltip/types.d.ts +6 -8
  93. package/dist/plugins/tools.js +1 -1
  94. package/dist/plugins/video-recorder.d.ts +3 -0
  95. package/dist/plugins/video-recorder.js +104 -0
  96. package/dist/plugins/video-recorder.js.map +1 -0
  97. package/dist/plugins/virtualization.d.ts +3 -0
  98. package/dist/plugins/virtualization.js +6 -0
  99. package/dist/plugins/virtualization.js.map +1 -0
  100. package/dist/react/index.d.ts +2 -1
  101. package/dist/react/useStackedPlot.d.ts +17 -0
  102. package/dist/react.d.ts +1 -0
  103. package/dist/react.js +31 -0
  104. package/dist/react.js.map +1 -0
  105. package/dist/types.d.ts +21 -1
  106. package/dist/utils-BK5UUXxj.js +172 -0
  107. package/dist/utils-BK5UUXxj.js.map +1 -0
  108. package/dist/velo-plot.full.js +1000 -5576
  109. package/dist/velo-plot.full.js.map +1 -1
  110. package/dist/velo-plot.js +23 -22
  111. package/dist/velo-plot.js.map +1 -1
  112. package/package.json +17 -3
  113. package/dist/EventEmitter-DAbs2K1C.js +0 -60
  114. package/dist/EventEmitter-DAbs2K1C.js.map +0 -1
  115. package/dist/index-D8ifudJH.js.map +0 -1
  116. package/dist/index.core-CYu3tydL.js.map +0 -1
  117. package/dist/utils-Dbro9-qM.js +0 -254
  118. package/dist/utils-Dbro9-qM.js.map +0 -1
@@ -0,0 +1,120 @@
1
+ import { Chart } from '../chart/types';
2
+ import { ChartGroup, SyncAxis, SyncOptions } from '../sync';
3
+ import { ChartOptions as RootChartOptions, Range, SeriesOptions } from '../../types';
4
+ import { LayoutOptions } from '../layout';
5
+
6
+ /** Stack layout direction */
7
+ export type StackDirection = "vertical" | "horizontal";
8
+ /** Per-pane configuration (max 5 panes per stack) */
9
+ export interface StackedPaneConfig {
10
+ id: string;
11
+ /** Flex ratio (e.g. 0.6) or CSS length ("24%", "80px") — height ratio when vertical, width ratio when horizontal */
12
+ height: number | string;
13
+ /** Chart options excluding container/id (series added via chart API or `series`) */
14
+ chart?: Omit<RootChartOptions, "container" | "id">;
15
+ /** Series to add immediately after pane chart is created */
16
+ series?: SeriesOptions[];
17
+ /** Show native X axis (default: only bottom pane when vertical + sharedXAxis; each pane when horizontal) */
18
+ showXAxis?: boolean;
19
+ /** Show native Y axis (default: only first pane when horizontal + sharedYAxis) */
20
+ showYAxis?: boolean;
21
+ /** Receive pan/zoom (default: true on every pane) */
22
+ interactive?: boolean;
23
+ /** Lock Y range — skips auto fit on Y for this pane */
24
+ yRange?: Range | "auto";
25
+ }
26
+ export interface StackedChartOptions {
27
+ /** Root container (will be cleared and filled with pane layout) */
28
+ container: HTMLDivElement;
29
+ /** 1–5 stacked panes */
30
+ panes: StackedPaneConfig[];
31
+ /** Layout direction (default: vertical — panes top to bottom) */
32
+ direction?: StackDirection;
33
+ /** Pane that drives sync (default: first pane) */
34
+ masterPaneId?: string;
35
+ /** Shared date/time row on bottom pane only (vertical layout) */
36
+ sharedXAxis?: "bottom" | "none";
37
+ /** Shared Y axis on left pane only (horizontal layout) */
38
+ sharedYAxis?: "left" | "none";
39
+ /** Shared theme applied to every pane */
40
+ theme?: string | object;
41
+ devicePixelRatio?: number;
42
+ /** Gap between panes in CSS pixels (default: 0) */
43
+ gap?: number;
44
+ /** Enable VS Code–style drag resize between panes (default: false) */
45
+ resizable?: boolean | {
46
+ /** Min pane height as fraction of available stack height (default: 1/6) */
47
+ minPaneRatio?: number;
48
+ /** Absolute min pane height in px — overrides ratio when larger */
49
+ minPanePx?: number;
50
+ dividerSize?: number;
51
+ };
52
+ /** Show legend on panes (default: false — set true on stack or per-pane chart) */
53
+ showLegend?: boolean;
54
+ /**
55
+ * Pan/zoom sync between panes.
56
+ * Default: X-axis sync via master pane (`axis: 'x'`, Y independent).
57
+ * Pass `false` for fully independent panes.
58
+ */
59
+ sync?: boolean | StackedSyncOptions;
60
+ /** Shared margin overrides — left/right aligned automatically across panes */
61
+ layout?: Partial<LayoutOptions>;
62
+ }
63
+ export interface StackedChart {
64
+ readonly container: HTMLDivElement;
65
+ getPane(id: string): Chart | undefined;
66
+ getPanes(): Chart[];
67
+ getMaster(): Chart;
68
+ getGroup(): ChartGroup;
69
+ fitAll(options?: {
70
+ x?: Range;
71
+ padding?: number;
72
+ }): void;
73
+ resetAll(): void;
74
+ resize(): void;
75
+ /** Current flex ratios keyed by pane id */
76
+ getPaneRatios(): Record<string, number>;
77
+ /** Set flex ratios (same keys as pane ids); triggers resize */
78
+ setPaneRatios(ratios: Record<string, number>): void;
79
+ /** Sync axis mode: `x` (default), `y`, `xy`, or `none` */
80
+ setSyncAxis(axis: SyncAxis): void;
81
+ getSyncAxis(): SyncAxis;
82
+ /** Update pan/zoom/cursor sync options at runtime */
83
+ setSyncOptions(options: Partial<StackedSyncOptions>): void;
84
+ /** Resolves when all pane charts have started rendering */
85
+ whenReady(): Promise<void>;
86
+ /** Export the entire stack as one PNG/JPEG/WebP image (WYSIWYG layout) */
87
+ exportImage(options?: StackSnapshotOptions): Promise<string>;
88
+ /** Alias for exportImage */
89
+ snapshot(options?: StackSnapshotOptions): Promise<string>;
90
+ destroy(): void;
91
+ }
92
+ export declare const STACKED_MAX_PANES = 5;
93
+ /** Default minimum pane height as a fraction of available stack height (1/6). */
94
+ export declare const STACKED_DEFAULT_MIN_PANE_RATIO: number;
95
+ export declare const STACKED_COMPACT_MARGIN: {
96
+ top: number;
97
+ bottom: number;
98
+ left: number;
99
+ };
100
+ export declare const STACKED_FULL_X_MARGIN: {
101
+ bottom: number;
102
+ };
103
+ export declare const STACKED_FULL_Y_MARGIN: {
104
+ left: number;
105
+ };
106
+ /** Options for full-stack image export */
107
+ export type StackSnapshotFormat = "png" | "jpeg" | "webp";
108
+ export type StackSnapshotResolution = "standard" | "2k" | "4k" | "8k" | number;
109
+ export interface StackSnapshotOptions {
110
+ format?: StackSnapshotFormat;
111
+ quality?: number;
112
+ resolution?: StackSnapshotResolution;
113
+ includeBackground?: boolean;
114
+ includeDividers?: boolean;
115
+ transparent?: boolean;
116
+ download?: boolean;
117
+ fileName?: string;
118
+ }
119
+ /** Pan/zoom sync between stacked panes (Y stays independent when axis is `x`). */
120
+ export type StackedSyncOptions = Pick<SyncOptions, "axis" | "syncCursor" | "syncSelection" | "syncZoom" | "syncPan" | "bidirectional" | "debounce">;
@@ -2,66 +2,54 @@ import { Bounds, Range } from '../../types';
2
2
 
3
3
  export type SyncAxis = 'x' | 'y' | 'xy' | 'none';
4
4
  export interface SyncOptions {
5
- /** Synchronize axis (default: 'x') */
6
5
  axis?: SyncAxis;
7
- /** Synchronize cursor position (default: true) */
8
6
  syncCursor?: boolean;
9
- /** Synchronize selection state (default: false) */
10
7
  syncSelection?: boolean;
11
- /** Synchronize zoom level (default: true) */
12
8
  syncZoom?: boolean;
13
- /** Synchronize pan (default: true) */
14
9
  syncPan?: boolean;
15
- /** Debounce time for sync events in ms (default: 0) */
16
10
  debounce?: number;
17
- /** Enable bidirectional sync (default: true) */
18
11
  bidirectional?: boolean;
12
+ /** When set, used for fitAll; with bidirectional sync any pane can drive pan/zoom */
13
+ masterId?: string;
19
14
  }
20
15
  export interface ChartLike {
21
- /** Unique identifier for the chart */
22
16
  getId(): string;
23
- /** Get current view bounds */
24
17
  getViewBounds(): Bounds;
25
- /** Set view bounds (zoom) */
26
18
  zoom(options: {
27
19
  x?: Range;
28
20
  y?: Range;
29
21
  animate?: boolean;
30
22
  }): void;
31
- /** Pan the chart */
32
23
  pan(dx: number, dy: number): void;
33
- /** Get cursor position */
24
+ fit?(options?: {
25
+ x?: Range;
26
+ y?: Range;
27
+ padding?: number | {
28
+ x?: number;
29
+ y?: number;
30
+ };
31
+ }): void;
34
32
  getCursorPosition?(): {
35
33
  x: number;
36
34
  y: number;
37
35
  } | null;
38
- /** Set external cursor position */
39
36
  setExternalCursor?(x: number, y: number): void;
40
- /** Clear external cursor */
41
37
  clearExternalCursor?(): void;
42
- /** Get selected points */
43
38
  getSelectedPoints?(): {
44
39
  seriesId: string;
45
40
  indices: number[];
46
41
  }[];
47
- /** Set selection */
48
42
  selectPoints?(points: {
49
43
  seriesId: string;
50
44
  indices: number[];
51
45
  }[]): void;
52
- /** Clear selection */
53
46
  clearSelection?(): void;
54
- /** Subscribe to events */
55
47
  on(event: string, callback: (...args: unknown[]) => void): void;
56
- /** Unsubscribe from events */
57
48
  off(event: string, callback: (...args: unknown[]) => void): void;
58
49
  }
59
50
  export interface SyncEvent {
60
- /** Source chart ID */
61
51
  sourceId: string;
62
- /** Event type */
63
52
  type: 'zoom' | 'pan' | 'cursor' | 'selection' | 'bounds';
64
- /** Event data */
65
53
  data: unknown;
66
54
  }
67
55
  export declare class ChartGroup {
@@ -70,59 +58,34 @@ export declare class ChartGroup {
70
58
  private eventHandlers;
71
59
  private isUpdating;
72
60
  private debounceTimers;
61
+ private rafTimers;
73
62
  constructor(options?: SyncOptions);
74
- /**
75
- * Add a chart to the group
76
- */
77
63
  add(chart: ChartLike): this;
78
- /**
79
- * Add multiple charts at once
80
- */
81
64
  addAll(...charts: ChartLike[]): this;
82
- /**
83
- * Remove a chart from the group
84
- */
85
65
  remove(chart: ChartLike): this;
86
- /**
87
- * Get all charts in the group
88
- */
89
66
  getCharts(): ChartLike[];
90
- /**
91
- * Get chart count
92
- */
93
67
  size(): number;
94
- /**
95
- * Check if a chart is in the group
96
- */
97
68
  has(chart: ChartLike): boolean;
98
- /**
99
- * Set synchronization axis
100
- */
101
69
  syncAxis(axis: SyncAxis): this;
102
- /**
103
- * Enable/disable cursor synchronization
104
- */
70
+ syncZoom(enabled: boolean): this;
71
+ syncPan(enabled: boolean): this;
105
72
  syncCursor(enabled: boolean): this;
106
- /**
107
- * Enable/disable selection synchronization
108
- */
109
73
  syncSelection(enabled: boolean): this;
110
- /**
111
- * Synchronize all charts to a specific view
112
- */
74
+ /** Update sync options and re-bind event handlers on all charts */
75
+ updateOptions(partial: Partial<SyncOptions>): this;
76
+ getOptions(): Readonly<SyncOptions>;
113
77
  syncTo(bounds: Partial<Bounds>, excludeChartId?: string): void;
114
- /**
115
- * Reset all charts to auto-scale
116
- */
117
78
  resetAll(): void;
118
- /**
119
- * Clear all selections in the group
120
- */
79
+ fitAll(options?: {
80
+ x?: Range;
81
+ padding?: number;
82
+ }): void;
83
+ batch<T>(fn: () => T): T;
121
84
  clearAllSelections(): void;
122
- /**
123
- * Destroy the group and cleanup
124
- */
125
85
  destroy(): void;
86
+ private isSyncSource;
87
+ private canPropagateFrom;
88
+ private hasValidViewBounds;
126
89
  private attachEventHandlers;
127
90
  private detachEventHandlers;
128
91
  private handleZoom;
@@ -131,17 +94,9 @@ export declare class ChartGroup {
131
94
  private handleSelection;
132
95
  private propagateZoom;
133
96
  private propagatePan;
97
+ private scheduleSyncAction;
134
98
  private debounceAction;
135
99
  }
136
- /**
137
- * Create a chart group with specified charts
138
- */
139
100
  export declare function createChartGroup(charts: ChartLike[], options?: SyncOptions): ChartGroup;
140
- /**
141
- * Link two charts for synchronized viewing
142
- */
143
101
  export declare function linkCharts(chart1: ChartLike, chart2: ChartLike, options?: SyncOptions): ChartGroup;
144
- /**
145
- * Create a master-slave relationship (master controls slave)
146
- */
147
102
  export declare function createMasterSlave(master: ChartLike, slave: ChartLike, axis?: SyncAxis): ChartGroup;