velo-plot 3.0.0 → 4.0.0-alpha.1
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 +22 -15
- package/dist/ChartCore-KYG2HTcK.js +7474 -0
- package/dist/ChartCore-KYG2HTcK.js.map +1 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js +75 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js.map +1 -0
- package/dist/{index.core-BmZe2jRQ.js → PluginRegistry-CDf_jcnp.js} +19 -33
- package/dist/PluginRegistry-CDf_jcnp.js.map +1 -0
- package/dist/SVGDocumentBuilder-C-uLkcFW.js +83 -0
- package/dist/SVGDocumentBuilder-C-uLkcFW.js.map +1 -0
- package/dist/angular-hooks.js +1 -1
- package/dist/angular.js +8 -8
- package/dist/{axisFormat-CzumxpCL.js → axisFormat-Sz4WIJfQ.js} +2 -2
- package/dist/{axisFormat-CzumxpCL.js.map → axisFormat-Sz4WIJfQ.js.map} +1 -1
- package/dist/{chartSyncBridge-DbWrwtyP.js → chartSyncBridge-C1uRy0ZS.js} +12 -11
- package/dist/{chartSyncBridge-DbWrwtyP.js.map → chartSyncBridge-C1uRy0ZS.js.map} +1 -1
- package/dist/core/ChartStatistics.d.ts +1 -1
- package/dist/core/chart/ChartCore.d.ts +19 -20
- package/dist/core/chart/ChartFeatureHooks.d.ts +7 -0
- package/dist/core/chart/ChartRenderLoop.d.ts +5 -0
- package/dist/core/chart/ChartRenderer.d.ts +9 -0
- package/dist/core/chart/ChartSetup.d.ts +1 -0
- package/dist/core/chart/chartExportPatch.d.ts +2 -0
- package/dist/core/chart/exporter/SVGExporter.d.ts +9 -7
- package/dist/core/chart/exporter/svg/SVGDocumentBuilder.d.ts +27 -0
- package/dist/core/chart/exporter/svg/SVGExportContext.d.ts +147 -0
- package/dist/core/chart/exporter/svg/SVGOrchestrator.d.ts +3 -0
- package/dist/core/chart/exporter/svg/SVGThemeAdapter.d.ts +22 -0
- package/dist/core/chart/exporter/svg/__tests__/testFixtures.d.ts +46 -0
- package/dist/core/chart/exporter/svg/__tests__/visualTestUtils.d.ts +12 -0
- package/dist/core/chart/exporter/svg/overlay/axes.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/border.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/errorBars.d.ts +7 -0
- package/dist/core/chart/exporter/svg/overlay/grid.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/index.d.ts +12 -0
- package/dist/core/chart/exporter/svg/overlay/legend.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/pluginCharts.d.ts +6 -0
- package/dist/core/chart/exporter/svg/overlay/polarGrid.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/specialChart.d.ts +15 -0
- package/dist/core/chart/exporter/svg/overlay/title.d.ts +4 -0
- package/dist/core/chart/exporter/svg/plugins/annotations.d.ts +5 -0
- package/dist/core/chart/exporter/svg/plugins/brokenAxis.d.ts +20 -0
- package/dist/core/chart/exporter/svg/plugins/latex.d.ts +9 -0
- package/dist/core/chart/exporter/svg/plugins/register.d.ts +8 -0
- package/dist/core/chart/exporter/svg/plugins/regression.d.ts +33 -0
- package/dist/core/chart/exporter/svg/plugins/roi.d.ts +12 -0
- package/dist/core/chart/exporter/svg/plugins/tradeMarkers.d.ts +3 -0
- package/dist/core/chart/exporter/svg/plugins/types.d.ts +28 -0
- package/dist/core/chart/exporter/svg/plugins/watermark.d.ts +13 -0
- package/dist/core/chart/exporter/svg/series/band.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/bar.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/boxplot.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/candlestick.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/finitePoints.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/gauge.d.ts +5 -0
- package/dist/core/chart/exporter/svg/series/heatmap.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/indicator.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/line.d.ts +12 -0
- package/dist/core/chart/exporter/svg/series/polar.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/radar.d.ts +5 -0
- package/dist/core/chart/exporter/svg/series/registry.d.ts +10 -0
- package/dist/core/chart/exporter/svg/series/sankey.d.ts +5 -0
- package/dist/core/chart/exporter/svg/series/scatter.d.ts +1 -0
- package/dist/core/chart/exporter/svg/series/ternary.d.ts +7 -0
- package/dist/core/chart/exporter/svg/series/waterfall.d.ts +6 -0
- package/dist/core/chart/exporter/svg/seriesAtTimestamp.d.ts +4 -0
- package/dist/core/chart/exporter/svg/seriesUtils.d.ts +3 -0
- package/dist/core/chart/exporter/svg/symbols.d.ts +5 -0
- package/dist/core/chart/exporter/svg/tickUtils.d.ts +9 -0
- package/dist/core/chart/mountSVGString.d.ts +5 -0
- package/dist/core/chart/overlaySeriesRegistry.d.ts +7 -0
- package/dist/core/chart/series/SeriesActions.d.ts +1 -0
- package/dist/core/chart/series/SeriesBufferLite.d.ts +13 -0
- package/dist/core/chart/series/seriesOptionsRegistry.d.ts +8 -0
- package/dist/core/chart/series/seriesTypeRegistry.d.ts +5 -0
- package/dist/core/chart/types.d.ts +2 -2
- package/dist/core/stacked/StackSVGComposer.d.ts +14 -0
- package/dist/core/stacked/index.d.ts +3 -2
- package/dist/core/stacked/types.d.ts +12 -4
- package/dist/createStackedChart-DjA3aJAu.js +2761 -0
- package/dist/createStackedChart-DjA3aJAu.js.map +1 -0
- package/dist/{hooks-CYPCxoZx.js → hooks-4wQH27r9.js} +7 -7
- package/dist/{hooks-CYPCxoZx.js.map → hooks-4wQH27r9.js.map} +1 -1
- package/dist/{index-qunX30Xu.js → index-B7PTX94B.js} +2133 -2133
- package/dist/index-B7PTX94B.js.map +1 -0
- package/dist/{index-BMiZoKmm.js → index-BgrvqltV.js} +67 -67
- package/dist/index-BgrvqltV.js.map +1 -0
- package/dist/index-Bj-xyXY6.js +582 -0
- package/dist/index-Bj-xyXY6.js.map +1 -0
- package/dist/index-qhscKTDy.js.map +1 -1
- package/dist/index.core.d.ts +8 -6
- package/dist/index.d.ts +1 -14
- package/dist/plugins/3d.js +3 -1
- package/dist/plugins/3d.js.map +1 -1
- package/dist/plugins/PluginManager.d.ts +5 -0
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/annotations.js +8 -7
- package/dist/plugins/annotations.js.map +1 -1
- package/dist/plugins/broken-axis.js +198 -152
- package/dist/plugins/broken-axis.js.map +1 -1
- package/dist/plugins/createPlugin.d.ts +8 -0
- package/dist/plugins/debug.js +32 -32
- package/dist/plugins/debug.js.map +1 -1
- package/dist/plugins/forecasting.js +273 -258
- package/dist/plugins/forecasting.js.map +1 -1
- package/dist/plugins/gpu.js +2033 -209
- package/dist/plugins/gpu.js.map +1 -1
- package/dist/plugins/i18n.js +286 -23
- package/dist/plugins/i18n.js.map +1 -1
- package/dist/plugins/latex.js +766 -207
- package/dist/plugins/latex.js.map +1 -1
- package/dist/plugins/loading/index.d.ts +1 -2
- package/dist/plugins/loading.js +3 -4
- package/dist/plugins/ml-integration.js +107 -93
- package/dist/plugins/ml-integration.js.map +1 -1
- package/dist/plugins/offscreen.js +11 -10
- package/dist/plugins/offscreen.js.map +1 -1
- package/dist/plugins/radar/types.d.ts +11 -0
- package/dist/plugins/radar.js +64 -53
- package/dist/plugins/radar.js.map +1 -1
- package/dist/plugins/regression.js +254 -256
- package/dist/plugins/regression.js.map +1 -1
- package/dist/plugins/roi/index.d.ts +2 -0
- package/dist/plugins/roi.js +184 -145
- package/dist/plugins/roi.js.map +1 -1
- package/dist/plugins/snapshot.js +20 -15
- package/dist/plugins/snapshot.js.map +1 -1
- package/dist/plugins/streaming.js +1 -1
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins/types.d.ts +4 -0
- package/dist/react.js +55 -58
- package/dist/react.js.map +1 -1
- package/dist/regression-HNdyk1Dm.js +28 -0
- package/dist/regression-HNdyk1Dm.js.map +1 -0
- package/dist/renderer/ChartSeriesRenderer.d.ts +3 -2
- package/dist/renderer/NativeWebGLRenderer.d.ts +2 -1
- package/dist/renderer/SVGChartRenderer.d.ts +15 -0
- package/dist/renderer/SankeyRenderer.d.ts +1 -0
- package/dist/renderer/native/NativeWebGLRenderer.d.ts +5 -1
- package/dist/renderer/native/draw.d.ts +2 -47
- package/dist/renderer/native/drawCore.d.ts +27 -0
- package/dist/renderer/native/drawExtended.d.ts +29 -0
- package/dist/renderer/native/frameRenderExtended.d.ts +1 -0
- package/dist/renderer/native/frameRenderRegistry.d.ts +27 -0
- package/dist/renderer/native/programFactoryCore.d.ts +6 -0
- package/dist/renderer/native/programFactoryExtended.d.ts +4 -0
- package/dist/renderer/native/utils.d.ts +3 -29
- package/dist/renderer/native/utilsCore.d.ts +14 -0
- package/dist/renderer/native/utilsExtended.d.ts +17 -0
- package/dist/renderer/overlaySeriesExtended.d.ts +1 -0
- package/dist/renderer/registerExtendedSeries.d.ts +1 -0
- package/dist/renderer/registerSVG.d.ts +5 -0
- package/dist/renderer/registerWebGPU.d.ts +2 -0
- package/dist/renderer/sankeyLayout.d.ts +29 -0
- package/dist/renderer/seriesBufferExtended.d.ts +4 -0
- package/dist/scientific/index.d.ts +1 -5
- package/dist/scientific/registerScientific.d.ts +1 -0
- package/dist/scientific.js +41 -41
- package/dist/solid.js +56 -59
- package/dist/solid.js.map +1 -1
- package/dist/svelte.js +26 -29
- package/dist/svelte.js.map +1 -1
- package/dist/tickUtils-B_X-ha13.js +41 -0
- package/dist/tickUtils-B_X-ha13.js.map +1 -0
- package/dist/trading/index.d.ts +1 -4
- package/dist/trading/registerTrading.d.ts +3 -0
- package/dist/trading.js +42 -42
- package/dist/types.d.ts +5 -4
- package/dist/velo-plot.full.js +1951 -1275
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +33 -28
- package/dist/velo-plot.js.map +1 -1
- package/dist/vue/VeloPlot.vue.d.ts +1 -1
- package/dist/vue/index.d.ts +33 -33
- package/dist/vue.js +17 -20
- package/dist/vue.js.map +1 -1
- package/package.json +14 -1
- package/dist/ChartCore-BpzRvN4Y.js +0 -8467
- package/dist/ChartCore-BpzRvN4Y.js.map +0 -1
- package/dist/createStackedChart-Dm-YqUT7.js +0 -756
- package/dist/createStackedChart-Dm-YqUT7.js.map +0 -1
- package/dist/gpuRenderer-BpaMYz-k.js +0 -1848
- package/dist/gpuRenderer-BpaMYz-k.js.map +0 -1
- package/dist/index-BMiZoKmm.js.map +0 -1
- package/dist/index-qunX30Xu.js.map +0 -1
- package/dist/index-x4stH3jD.js +0 -282
- package/dist/index-x4stH3jD.js.map +0 -1
- package/dist/index.core-BmZe2jRQ.js.map +0 -1
- package/dist/mockDatafeed-DHIDPcpX.js +0 -515
- package/dist/mockDatafeed-DHIDPcpX.js.map +0 -1
- package/dist/symbols-DT0eLlpW.js +0 -568
- package/dist/symbols-DT0eLlpW.js.map +0 -1
|
@@ -9,14 +9,15 @@ import { ResponsiveConfig, ResponsiveState } from '../responsive';
|
|
|
9
9
|
import { ChartState, SerializeOptions, DeserializeOptions } from '../../serialization';
|
|
10
10
|
import { Chart, ExportOptions } from './types';
|
|
11
11
|
import { ChartAnimationConfig } from '../animation';
|
|
12
|
-
import {
|
|
13
|
-
import { PriceAlertOptions } from './ChartAlerts';
|
|
14
|
-
import { PositionLineOptions } from './positionLines';
|
|
12
|
+
import { ChartFeatureHooks } from './ChartFeatureHooks';
|
|
15
13
|
|
|
16
14
|
export declare class ChartImpl implements Chart {
|
|
15
|
+
/** Optional hook for extended bundles (WebGPU, etc.). */
|
|
16
|
+
static afterConstruct: ((chart: ChartImpl, options: ChartOptions) => void) | null;
|
|
17
17
|
private container;
|
|
18
18
|
private webglCanvas;
|
|
19
19
|
private overlayCanvas;
|
|
20
|
+
private svgRoot;
|
|
20
21
|
private overlayCtx;
|
|
21
22
|
series: Map<string, Series>;
|
|
22
23
|
events: EventEmitter<ChartEventMap>;
|
|
@@ -35,7 +36,6 @@ export declare class ChartImpl implements Chart {
|
|
|
35
36
|
private plotAreaBackground;
|
|
36
37
|
private renderer;
|
|
37
38
|
private activeRendererType;
|
|
38
|
-
private rendererInitPromise;
|
|
39
39
|
private overlay;
|
|
40
40
|
private interaction;
|
|
41
41
|
private xScale;
|
|
@@ -103,9 +103,8 @@ export declare class ChartImpl implements Chart {
|
|
|
103
103
|
get animations(): ChartAnimationConfig;
|
|
104
104
|
private selectionManager;
|
|
105
105
|
private responsiveManager;
|
|
106
|
-
private
|
|
106
|
+
private featureHooks;
|
|
107
107
|
private timeScaleMapping;
|
|
108
|
-
private positionLineCounter;
|
|
109
108
|
constructor(options: ChartOptions);
|
|
110
109
|
/**
|
|
111
110
|
* Start the chart initialization (called by queue system)
|
|
@@ -142,7 +141,8 @@ export declare class ChartImpl implements Chart {
|
|
|
142
141
|
};
|
|
143
142
|
private getInteractedBounds;
|
|
144
143
|
exportImage(type?: "png" | "jpeg"): string;
|
|
145
|
-
|
|
144
|
+
setFeatureHooks(hooks: ChartFeatureHooks | null): void;
|
|
145
|
+
exportSVG(_options?: import('./exporter/SVGExporter').SVGExportOptions): string;
|
|
146
146
|
private getSeriesContext;
|
|
147
147
|
addSeries(options: SeriesOptions | HeatmapOptions): void;
|
|
148
148
|
addBar(options: Omit<SeriesOptions, "type">): void;
|
|
@@ -156,17 +156,14 @@ export declare class ChartImpl implements Chart {
|
|
|
156
156
|
* Add a line of best fit to a series
|
|
157
157
|
*/
|
|
158
158
|
addFitLine(seriesId: string, type: any, options?: any): string;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
addIndicator(preset: IndicatorPresetName, options?: AddIndicatorOptions): Promise<AddIndicatorResult>;
|
|
164
|
-
addAlert(options: PriceAlertOptions): string;
|
|
165
|
-
removeAlert(id: string): boolean;
|
|
159
|
+
private tradingRequired;
|
|
160
|
+
addIndicator(_preset: import('../indicator/addIndicator').IndicatorPresetName, _options?: import('../indicator/addIndicator').AddIndicatorOptions): Promise<import('../indicator/addIndicator').AddIndicatorResult>;
|
|
161
|
+
addAlert(_options: import('./ChartAlerts').PriceAlertOptions): string;
|
|
162
|
+
removeAlert(_id: string): boolean;
|
|
166
163
|
clearAlerts(): void;
|
|
167
|
-
getAlerts(): PriceAlertOptions[];
|
|
168
|
-
addPositionLine(
|
|
169
|
-
setDrawingMode(
|
|
164
|
+
getAlerts(): import('./ChartAlerts').PriceAlertOptions[];
|
|
165
|
+
addPositionLine(_options: import('./positionLines').PositionLineOptions): string;
|
|
166
|
+
setDrawingMode(_mode: import('../../plugins/drawing-tools').DrawingMode): void;
|
|
170
167
|
getSeries(id: string): Series | undefined;
|
|
171
168
|
getAllSeries(): Series[];
|
|
172
169
|
private getNavContext;
|
|
@@ -239,9 +236,11 @@ export declare class ChartImpl implements Chart {
|
|
|
239
236
|
* Get current device pixel ratio
|
|
240
237
|
*/
|
|
241
238
|
getDPR(): number;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
getActiveRenderer(): "webgl" | "webgpu" | "svg";
|
|
240
|
+
/** Series id hovered from the legend — affects draw order in canvas and live SVG. */
|
|
241
|
+
getHoveredSeriesId(): string | null;
|
|
242
|
+
/** @internal Vector frame for `renderer: 'svg'` — patched on extended bundles. */
|
|
243
|
+
buildSVGFrame(): string;
|
|
245
244
|
/**
|
|
246
245
|
* Set device pixel ratio and re-render
|
|
247
246
|
*/
|
|
@@ -50,6 +50,11 @@ export interface RenderLoopContext {
|
|
|
50
50
|
direction?: string;
|
|
51
51
|
}>;
|
|
52
52
|
get yScale(): Scale;
|
|
53
|
+
/** Live SVG renderer root (when `renderer: 'svg'`). */
|
|
54
|
+
svgRoot?: SVGSVGElement | null;
|
|
55
|
+
/** Produce full SVG document string for vector renderer mode. */
|
|
56
|
+
buildSVGFrame?: () => string;
|
|
57
|
+
getActiveRenderer?: () => "webgl" | "webgpu" | "svg";
|
|
53
58
|
}
|
|
54
59
|
export declare class ChartRenderLoop {
|
|
55
60
|
private ctx;
|
|
@@ -7,6 +7,10 @@ import { OverlayRenderer } from '../OverlayRenderer';
|
|
|
7
7
|
import { EventEmitter } from '../EventEmitter';
|
|
8
8
|
import { SelectionManager } from '../selection';
|
|
9
9
|
|
|
10
|
+
/** Match series/render ids related to a hovered legend entry (incl. candlestick splits). */
|
|
11
|
+
export declare function matchesHoveredSeriesId(id: string, hoveredSeriesId: string): boolean;
|
|
12
|
+
/** Move hovered series (and related ids) to the end so they paint on top. */
|
|
13
|
+
export declare function reorderForHoveredSeries<T>(items: T[], hoveredSeriesId: string | null, getId: (item: T) => string): T[];
|
|
10
14
|
export interface RenderContext {
|
|
11
15
|
webglCanvas: HTMLCanvasElement;
|
|
12
16
|
overlayCanvas: HTMLCanvasElement;
|
|
@@ -47,7 +51,12 @@ export interface RenderContext {
|
|
|
47
51
|
price: number;
|
|
48
52
|
direction?: string;
|
|
49
53
|
}>;
|
|
54
|
+
getActiveRenderer?: () => "webgl" | "webgpu" | "svg";
|
|
55
|
+
/** When true, overlay draws only interactive UI (cursor, tooltips, plugins). */
|
|
56
|
+
vectorOverlayOnly?: boolean;
|
|
50
57
|
}
|
|
58
|
+
/** Map view bounds to pixel ranges — required before SVG export / vector frame build. */
|
|
59
|
+
export declare function syncScalesForRender(plotArea: PlotArea, viewBounds: Bounds, xScale: Scale, yScales: Map<string, Scale>, yAxisOptionsMap: Map<string, AxisOptions>, xAxisOptions: AxisOptions, primaryYAxisId: string, layout: import('../layout').LayoutOptions): void;
|
|
51
60
|
/**
|
|
52
61
|
* Prepare series data for WebGL rendering
|
|
53
62
|
*/
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Series } from '../../Series';
|
|
2
|
-
import {
|
|
2
|
+
import { Bounds, PlotArea } from '../../../types';
|
|
3
3
|
import { Scale } from '../../../scales';
|
|
4
4
|
import { ChartTheme } from '../../../theme';
|
|
5
|
+
import { SVGExportOptions, SVGExportInput, captureLayoutSnapshot } from './svg/SVGExportContext';
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare function
|
|
7
|
+
export type { SVGExportOptions } from './svg/SVGExportContext';
|
|
8
|
+
export { captureLayoutSnapshot, buildSVGExportContext } from './svg/SVGExportContext';
|
|
9
|
+
export { renderSVG } from './svg/SVGOrchestrator';
|
|
10
|
+
/** @deprecated Use buildSVGExportContext + renderSVG */
|
|
11
|
+
export declare function exportToSVG(series: Series[], viewBounds: Bounds, plotArea: PlotArea, xAxis: Scale, yAxes: Map<string, Scale>, theme: ChartTheme, width: number, height: number, axisOptions?: SVGExportOptions): string;
|
|
12
|
+
export declare function exportChartToSVG(input: SVGExportInput): string;
|
|
13
|
+
export declare function exportChartSnapshot(chart: Parameters<typeof captureLayoutSnapshot>[0], options?: SVGExportOptions): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG document construction utilities — XML escape, defs, gradients, clipPaths.
|
|
3
|
+
*/
|
|
4
|
+
export declare function escapeXml(text: string): string;
|
|
5
|
+
export declare function fmt(n: number, decimals?: number): string;
|
|
6
|
+
export declare class SVGDocumentBuilder {
|
|
7
|
+
private width;
|
|
8
|
+
private height;
|
|
9
|
+
private fontFamily;
|
|
10
|
+
private defs;
|
|
11
|
+
private layers;
|
|
12
|
+
constructor(width: number, height: number, fontFamily: string);
|
|
13
|
+
resetGradientCounter(): void;
|
|
14
|
+
addDef(content: string): string;
|
|
15
|
+
registerLinearGradient(x1: number, y1: number, x2: number, y2: number, stops: Array<{
|
|
16
|
+
offset: string;
|
|
17
|
+
color: string;
|
|
18
|
+
opacity?: number;
|
|
19
|
+
}>): string;
|
|
20
|
+
registerClipPath(id: string, content: string): void;
|
|
21
|
+
registerArrowMarker(id: string, color: string): void;
|
|
22
|
+
push(layer: string, element: string): void;
|
|
23
|
+
pushRaw(element: string): void;
|
|
24
|
+
openGroup(layer: string, transform?: string, attrs?: Record<string, string>): string;
|
|
25
|
+
closeGroup(layer: string): void;
|
|
26
|
+
build(backgroundColor: string, ariaLabel?: string): string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Series } from '../../../Series';
|
|
2
|
+
import { Scale } from '../../../../scales';
|
|
3
|
+
import { ChartTheme } from '../../../../theme';
|
|
4
|
+
import { AxisOptions, Bounds, PlotArea } from '../../../../types';
|
|
5
|
+
import { ChartTitleOptions } from '../../../layout/types';
|
|
6
|
+
import { LayoutOptions } from '../../../layout';
|
|
7
|
+
import { BusinessDayMapping } from '../../../time/TimeScale';
|
|
8
|
+
import { SVGExportPluginContext } from './plugins/types';
|
|
9
|
+
|
|
10
|
+
export interface SVGExportOptions {
|
|
11
|
+
xAxis?: AxisOptions;
|
|
12
|
+
yAxis?: AxisOptions;
|
|
13
|
+
primaryYAxisId?: string;
|
|
14
|
+
/** Include plugin overlays (annotations, regression, etc.) */
|
|
15
|
+
includeOverlays?: boolean;
|
|
16
|
+
/** Include legend in SVG */
|
|
17
|
+
includeLegend?: boolean;
|
|
18
|
+
/** Include annotation plugin content */
|
|
19
|
+
includeAnnotations?: boolean;
|
|
20
|
+
/** Include crosshair at capture position */
|
|
21
|
+
includeCursor?: boolean;
|
|
22
|
+
/** Include selection rectangle */
|
|
23
|
+
includeSelection?: boolean;
|
|
24
|
+
/** Export state at specific timestamp (replay) */
|
|
25
|
+
at?: number;
|
|
26
|
+
/** Optional watermark text (snapshot / export) */
|
|
27
|
+
watermarkText?: string;
|
|
28
|
+
/** Embed web fonts in defs (P2) */
|
|
29
|
+
embedFonts?: boolean;
|
|
30
|
+
/** Accessible label for root SVG */
|
|
31
|
+
ariaLabel?: string;
|
|
32
|
+
/** 3D export mode — deferred */
|
|
33
|
+
svgExport3DMode?: "raster" | "project";
|
|
34
|
+
/** Legacy raster fallback during development */
|
|
35
|
+
svgExportMode?: "vector" | "legacy-raster";
|
|
36
|
+
}
|
|
37
|
+
export interface YAxisLayoutEntry {
|
|
38
|
+
id: string;
|
|
39
|
+
scale: Scale;
|
|
40
|
+
options?: AxisOptions;
|
|
41
|
+
position: "left" | "right";
|
|
42
|
+
offset: number;
|
|
43
|
+
}
|
|
44
|
+
export interface CursorSnapshot {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}
|
|
48
|
+
export interface SelectionSnapshot {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
}
|
|
54
|
+
export interface PriceAlertSnapshot {
|
|
55
|
+
price: number;
|
|
56
|
+
direction?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SVGExportContext {
|
|
59
|
+
series: Series[];
|
|
60
|
+
viewBounds: Bounds;
|
|
61
|
+
plotArea: PlotArea;
|
|
62
|
+
xScale: Scale;
|
|
63
|
+
yAxes: Map<string, Scale>;
|
|
64
|
+
yAxisLayouts: YAxisLayoutEntry[];
|
|
65
|
+
theme: ChartTheme;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
xAxisOptions?: AxisOptions;
|
|
69
|
+
yAxisOptionsMap: Map<string, AxisOptions>;
|
|
70
|
+
primaryYAxisId?: string;
|
|
71
|
+
titleOptions?: ChartTitleOptions;
|
|
72
|
+
layout: LayoutOptions;
|
|
73
|
+
businessDayMapping?: BusinessDayMapping | null;
|
|
74
|
+
showLegend: boolean;
|
|
75
|
+
legendSeries: Series[];
|
|
76
|
+
cursor?: CursorSnapshot | null;
|
|
77
|
+
selection?: SelectionSnapshot | null;
|
|
78
|
+
alerts?: PriceAlertSnapshot[];
|
|
79
|
+
options: SVGExportOptions;
|
|
80
|
+
pluginContexts: SVGExportPluginContext[];
|
|
81
|
+
pluginManager?: {
|
|
82
|
+
get: (name: string) => import('../../../../plugins/types').ChartPlugin | undefined;
|
|
83
|
+
notifyExportSVG?: (ctx: SVGExportPluginContext) => void;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface SVGExportInput {
|
|
87
|
+
series: Series[];
|
|
88
|
+
viewBounds: Bounds;
|
|
89
|
+
plotArea: PlotArea;
|
|
90
|
+
xScale: Scale;
|
|
91
|
+
yAxes: Map<string, Scale>;
|
|
92
|
+
theme: ChartTheme;
|
|
93
|
+
width: number;
|
|
94
|
+
height: number;
|
|
95
|
+
options?: SVGExportOptions;
|
|
96
|
+
xAxisOptions?: AxisOptions;
|
|
97
|
+
yAxisOptionsMap?: Map<string, AxisOptions>;
|
|
98
|
+
primaryYAxisId?: string;
|
|
99
|
+
titleOptions?: ChartTitleOptions;
|
|
100
|
+
layout?: LayoutOptions;
|
|
101
|
+
businessDayMapping?: BusinessDayMapping | null;
|
|
102
|
+
showLegend?: boolean;
|
|
103
|
+
cursor?: CursorSnapshot | null;
|
|
104
|
+
selection?: SelectionSnapshot | null;
|
|
105
|
+
alerts?: PriceAlertSnapshot[];
|
|
106
|
+
pluginContexts?: SVGExportPluginContext[];
|
|
107
|
+
pluginManager?: SVGExportContext["pluginManager"];
|
|
108
|
+
}
|
|
109
|
+
/** Build Y-axis layout entries with left/right offsets matching OverlayRenderer. */
|
|
110
|
+
export declare function buildYAxisLayouts(_plotArea: PlotArea, yAxes: Map<string, Scale>, yAxisOptionsMap: Map<string, AxisOptions>, primaryYAxisId?: string): YAxisLayoutEntry[];
|
|
111
|
+
export declare function buildSVGExportContext(input: SVGExportInput): SVGExportContext;
|
|
112
|
+
/** Capture layout snapshot from a live ChartImpl instance. */
|
|
113
|
+
export declare function captureLayoutSnapshot(chart: {
|
|
114
|
+
getAllSeries: () => Series[];
|
|
115
|
+
viewBounds: Bounds;
|
|
116
|
+
getPlotArea: () => PlotArea;
|
|
117
|
+
xScale: Scale;
|
|
118
|
+
yScales: Map<string, Scale>;
|
|
119
|
+
theme: ChartTheme;
|
|
120
|
+
container: HTMLElement;
|
|
121
|
+
xAxisOptions: AxisOptions;
|
|
122
|
+
yAxisOptionsMap: Map<string, AxisOptions>;
|
|
123
|
+
primaryYAxisId: string;
|
|
124
|
+
getLayout?: () => LayoutOptions;
|
|
125
|
+
getBusinessDayMapping?: () => BusinessDayMapping | null;
|
|
126
|
+
showLegend?: boolean;
|
|
127
|
+
getCursorPosition?: () => {
|
|
128
|
+
x: number;
|
|
129
|
+
y: number;
|
|
130
|
+
} | null;
|
|
131
|
+
selectionRect?: {
|
|
132
|
+
x: number;
|
|
133
|
+
y: number;
|
|
134
|
+
width: number;
|
|
135
|
+
height: number;
|
|
136
|
+
} | null;
|
|
137
|
+
getAlerts?: () => Array<{
|
|
138
|
+
price: number;
|
|
139
|
+
direction?: string;
|
|
140
|
+
}>;
|
|
141
|
+
getHoveredSeriesId?: () => string | null;
|
|
142
|
+
pluginManager?: {
|
|
143
|
+
get: (name: string) => unknown;
|
|
144
|
+
notifyExportSVG?: (ctx: SVGExportPluginContext) => void;
|
|
145
|
+
};
|
|
146
|
+
titleOptions?: ChartTitleOptions;
|
|
147
|
+
}, exportOptions?: SVGExportOptions): SVGExportContext;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChartTheme } from '../../../../theme';
|
|
2
|
+
|
|
3
|
+
export declare function dashArrayToSvg(dash: number[] | undefined): string | undefined;
|
|
4
|
+
export interface SvgStrokeStyle {
|
|
5
|
+
stroke: string;
|
|
6
|
+
strokeWidth: number;
|
|
7
|
+
strokeOpacity?: number;
|
|
8
|
+
strokeDasharray?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SvgTextStyle {
|
|
11
|
+
fill: string;
|
|
12
|
+
fontSize: number;
|
|
13
|
+
fontFamily: string;
|
|
14
|
+
fontWeight?: string | number;
|
|
15
|
+
}
|
|
16
|
+
export declare function gridMajorStyle(theme: ChartTheme): SvgStrokeStyle;
|
|
17
|
+
export declare function gridMinorStyle(theme: ChartTheme): SvgStrokeStyle;
|
|
18
|
+
export declare function axisLineStyle(theme: ChartTheme, orientation: "x" | "y"): SvgStrokeStyle;
|
|
19
|
+
export declare function axisTickStyle(theme: ChartTheme, orientation: "x" | "y"): SvgStrokeStyle;
|
|
20
|
+
export declare function axisLabelStyle(theme: ChartTheme, orientation: "x" | "y"): SvgTextStyle;
|
|
21
|
+
export declare function strokeAttrs(style: SvgStrokeStyle): string;
|
|
22
|
+
export declare function textAttrs(style: SvgTextStyle, anchor?: string, baseline?: string): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LinearScale } from '../../../../../scales';
|
|
2
|
+
import { Series } from '../../../../Series';
|
|
3
|
+
import { ChartTheme } from '../../../../../theme';
|
|
4
|
+
import { Annotation } from '../../../../annotations/types';
|
|
5
|
+
import { SVGExportInput } from '../SVGExportContext';
|
|
6
|
+
|
|
7
|
+
export declare const testTheme: ChartTheme;
|
|
8
|
+
export declare function testScales(): {
|
|
9
|
+
xScale: LinearScale;
|
|
10
|
+
yScale: LinearScale;
|
|
11
|
+
};
|
|
12
|
+
export declare function mockSeries(type: string, overrides?: Partial<{
|
|
13
|
+
id: string;
|
|
14
|
+
data: Record<string, Float32Array | Float32Array[]>;
|
|
15
|
+
style: Record<string, unknown>;
|
|
16
|
+
visible: boolean;
|
|
17
|
+
yAxisId: string;
|
|
18
|
+
heatmapData: {
|
|
19
|
+
xValues: Float32Array;
|
|
20
|
+
yValues: Float32Array;
|
|
21
|
+
zValues: Float32Array;
|
|
22
|
+
};
|
|
23
|
+
polarData: {
|
|
24
|
+
r: Float32Array;
|
|
25
|
+
theta: Float32Array;
|
|
26
|
+
};
|
|
27
|
+
gaugeData: {
|
|
28
|
+
value: number;
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
};
|
|
32
|
+
sankeyData: {
|
|
33
|
+
nodes: string[];
|
|
34
|
+
links: Array<{
|
|
35
|
+
source: string;
|
|
36
|
+
target: string;
|
|
37
|
+
value: number;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
indicatorOptions: Record<string, unknown>;
|
|
41
|
+
hasError: boolean;
|
|
42
|
+
markers: unknown[];
|
|
43
|
+
}>): Series;
|
|
44
|
+
export declare function seriesFixtures(): Record<string, Series>;
|
|
45
|
+
export declare function buildTestContext(series: Series[], extra?: Partial<SVGExportInput>): import('../SVGExportContext').SVGExportContext;
|
|
46
|
+
export declare const sampleAnnotations: Annotation[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function fixturesPath(name: string): string;
|
|
2
|
+
/** Normalize volatile SVG ids for golden string comparison. */
|
|
3
|
+
export declare function normalizeSvg(svg: string): string;
|
|
4
|
+
export declare function rasterizeSvg(svg: string, width?: number): Buffer;
|
|
5
|
+
export declare function readGoldenText(name: string): string;
|
|
6
|
+
export declare function readGoldenPng(name: string): Buffer;
|
|
7
|
+
export declare function writeGolden(name: string, data: string | Buffer): void;
|
|
8
|
+
export declare function updateGoldenEnabled(): boolean;
|
|
9
|
+
export declare function assertGoldenText(name: string, actual: string): void;
|
|
10
|
+
export declare function assertGoldenPng(name: string, actual: Buffer, maxDiffRatio?: number): void;
|
|
11
|
+
export declare function comparePngBuffers(actual: Buffer, expected: Buffer, maxDiffRatio?: number): number;
|
|
12
|
+
export declare function decodeDataUrlPng(dataUrl: string): Buffer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Series } from '../../../../Series';
|
|
2
|
+
import { Scale } from '../../../../../scales';
|
|
3
|
+
import { PlotArea } from '../../../../../types';
|
|
4
|
+
import { SVGDocumentBuilder } from '../SVGDocumentBuilder';
|
|
5
|
+
|
|
6
|
+
export declare function exportErrorBarsForSeries(series: Series, plotArea: PlotArea, xScale: Scale, yScale: Scale, builder: SVGDocumentBuilder): void;
|
|
7
|
+
export declare function exportErrorBars(ctx: import('../SVGExportContext').SVGExportContext, builder: SVGDocumentBuilder): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SVGExportContext } from '../SVGExportContext';
|
|
2
|
+
import { SVGDocumentBuilder } from '../SVGDocumentBuilder';
|
|
3
|
+
export { exportGrid } from './grid';
|
|
4
|
+
export { exportAxes } from './axes';
|
|
5
|
+
export { exportTitle } from './title';
|
|
6
|
+
export { exportPlotBorder } from './border';
|
|
7
|
+
export { exportLegend } from './legend';
|
|
8
|
+
export { exportErrorBars } from './errorBars';
|
|
9
|
+
export declare function exportCursor(ctx: SVGExportContext, builder: SVGDocumentBuilder): void;
|
|
10
|
+
export declare function exportSelection(ctx: SVGExportContext, builder: SVGDocumentBuilder): void;
|
|
11
|
+
export declare function exportPriceAlerts(ctx: SVGExportContext, builder: SVGDocumentBuilder): void;
|
|
12
|
+
export declare function exportAllOverlays(ctx: SVGExportContext, builder: SVGDocumentBuilder): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SVGExportContext } from '../SVGExportContext';
|
|
2
|
+
import { RadarSVGExportData } from '../../../../../plugins/radar/types';
|
|
3
|
+
|
|
4
|
+
export declare function getRadarSVGExportData(ctx: SVGExportContext): RadarSVGExportData | null;
|
|
5
|
+
export declare function hasActiveRadarPlugin(ctx: SVGExportContext): boolean;
|
|
6
|
+
export declare function shouldSkipCartesianOverlays(ctx: SVGExportContext, isSpecialSeriesChart: boolean): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SVGExportContext } from '../SVGExportContext';
|
|
2
|
+
import { SVGDocumentBuilder } from '../SVGDocumentBuilder';
|
|
3
|
+
|
|
4
|
+
export declare function exportPolarGrid(ctx: SVGExportContext, builder: SVGDocumentBuilder, radialDivisions: number, angularDivisions: number, angleMode: "degrees" | "radians"): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Series } from '../../../../Series';
|
|
2
|
+
import { SVGExportContext } from '../SVGExportContext';
|
|
3
|
+
|
|
4
|
+
export interface SpecialChartInfo {
|
|
5
|
+
isSpecialChart: boolean;
|
|
6
|
+
hasPolarSeries: boolean;
|
|
7
|
+
hasGaugeSeries: boolean;
|
|
8
|
+
hasSankeySeries: boolean;
|
|
9
|
+
maxRadius: number;
|
|
10
|
+
polarAngleMode: "degrees" | "radians";
|
|
11
|
+
polarRadialDivisions: number;
|
|
12
|
+
polarAngularDivisions: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function detectSpecialChart(series: Series[]): SpecialChartInfo;
|
|
15
|
+
export declare function detectSpecialChartFromContext(ctx: SVGExportContext): SpecialChartInfo;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Annotation } from '../../../../annotations/types';
|
|
2
|
+
import { SVGExportPluginContext } from './types';
|
|
3
|
+
|
|
4
|
+
export declare function exportAnnotationToSVG(annotation: Annotation, ctx: SVGExportPluginContext): string[];
|
|
5
|
+
export declare function exportAnnotations(ctx: SVGExportPluginContext, annotations: Annotation[]): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SVGExportPluginContext } from './types';
|
|
2
|
+
|
|
3
|
+
type BreakSymbol = "diagonal" | "zigzag" | "wave" | "simple";
|
|
4
|
+
export declare function exportBrokenAxisMarkers(ctx: SVGExportPluginContext, breaks: Array<{
|
|
5
|
+
axis: "x" | "y";
|
|
6
|
+
position: number;
|
|
7
|
+
style?: BreakSymbol;
|
|
8
|
+
color?: string;
|
|
9
|
+
}>): void;
|
|
10
|
+
/** Export breaks from PluginBrokenAxis config (data-space start/end). */
|
|
11
|
+
export declare function exportBrokenAxisFromConfig(ctx: SVGExportPluginContext, axes: Record<string, {
|
|
12
|
+
breaks: Array<{
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
symbol?: BreakSymbol;
|
|
16
|
+
}>;
|
|
17
|
+
defaultSymbol?: BreakSymbol;
|
|
18
|
+
symbolColor?: string;
|
|
19
|
+
}>): void;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SVGExportPluginContext } from './types';
|
|
2
|
+
|
|
3
|
+
/** LaTeX labels via foreignObject (phase 1 strategy per roadmap). */
|
|
4
|
+
export declare function exportLatexText(ctx: SVGExportPluginContext, text: string, x: number, y: number, options: {
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
}): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChartPlugin } from '../../../../../plugins/types';
|
|
2
|
+
import { SVGExportPluginContext } from './types';
|
|
3
|
+
|
|
4
|
+
/** Collect plugin overlay data from chart plugin manager during export. */
|
|
5
|
+
export declare function collectPluginSVGData(pluginManager: {
|
|
6
|
+
get: (name: string) => ChartPlugin | undefined;
|
|
7
|
+
notifyExportSVG?: (ctx: SVGExportPluginContext) => void;
|
|
8
|
+
}, ctx: SVGExportPluginContext): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SVGExportPluginContext } from './types';
|
|
2
|
+
|
|
3
|
+
export interface RegressionOverlay {
|
|
4
|
+
points: Array<{
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}>;
|
|
8
|
+
color?: string;
|
|
9
|
+
band?: {
|
|
10
|
+
upper: Array<{
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}>;
|
|
14
|
+
lower: Array<{
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function exportRegressionOverlay(ctx: SVGExportPluginContext, overlay: RegressionOverlay): void;
|
|
21
|
+
export declare function exportForecastOverlay(ctx: SVGExportPluginContext, forecast: Array<{
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}>, ci?: {
|
|
25
|
+
upper: Array<{
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}>;
|
|
29
|
+
lower: Array<{
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}>;
|
|
33
|
+
}, color?: string): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SVGExportPluginContext } from './types';
|
|
2
|
+
|
|
3
|
+
export interface RoiExportRegion {
|
|
4
|
+
tool: "rectangle" | "circle" | "polygon" | "lasso";
|
|
5
|
+
points: Array<{
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}>;
|
|
9
|
+
color?: string;
|
|
10
|
+
fill?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function exportRoiRegions(ctx: SVGExportPluginContext, regions: RoiExportRegion[]): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Series } from '../../../../Series';
|
|
2
|
+
import { Scale } from '../../../../../scales';
|
|
3
|
+
import { ChartTheme } from '../../../../../theme';
|
|
4
|
+
import { Bounds, PlotArea } from '../../../../../types';
|
|
5
|
+
import { SVGDocumentBuilder } from '../SVGDocumentBuilder';
|
|
6
|
+
import { SVGExportContext } from '../SVGExportContext';
|
|
7
|
+
|
|
8
|
+
export interface SVGExportPluginContext {
|
|
9
|
+
series: Series[];
|
|
10
|
+
viewBounds: Bounds;
|
|
11
|
+
plotArea: PlotArea;
|
|
12
|
+
xScale: Scale;
|
|
13
|
+
yScales: Map<string, Scale>;
|
|
14
|
+
theme: ChartTheme;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
builder?: SVGDocumentBuilder;
|
|
18
|
+
exportContext?: SVGExportContext;
|
|
19
|
+
pushElements?: (layer: string, elements: string[]) => void;
|
|
20
|
+
/** @internal */
|
|
21
|
+
_layer?: string;
|
|
22
|
+
/** @internal */
|
|
23
|
+
_elements?: string[];
|
|
24
|
+
}
|
|
25
|
+
export type SVGPluginExporter = (ctx: SVGExportPluginContext) => void;
|
|
26
|
+
export declare function registerSVGPluginExporter(pluginName: string, exporter: SVGPluginExporter): void;
|
|
27
|
+
export declare function getSVGPluginExporters(): Map<string, SVGPluginExporter>;
|
|
28
|
+
export declare function runSVGPluginExporters(ctx: SVGExportPluginContext, builder: SVGDocumentBuilder): void;
|