uplot-plus 0.3.1 → 0.4.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 +107 -225
- package/dist/index.cjs +1 -1
- package/dist/index.js +2583 -2314
- package/dist/src/annotations.d.ts.map +1 -1
- package/dist/src/axes/layout.d.ts.map +1 -1
- package/dist/src/components/Axis.d.ts +0 -3
- package/dist/src/components/Axis.d.ts.map +1 -1
- package/dist/src/components/BoxWhisker.d.ts +24 -0
- package/dist/src/components/BoxWhisker.d.ts.map +1 -0
- package/dist/src/components/Candlestick.d.ts +18 -0
- package/dist/src/components/Candlestick.d.ts.map +1 -0
- package/dist/src/components/Chart.d.ts +1 -1
- package/dist/src/components/Chart.d.ts.map +1 -1
- package/dist/src/components/FloatingLegend.d.ts.map +1 -1
- package/dist/src/components/Heatmap.d.ts +14 -0
- package/dist/src/components/Heatmap.d.ts.map +1 -0
- package/dist/src/components/Scale.d.ts +0 -3
- package/dist/src/components/Scale.d.ts.map +1 -1
- package/dist/src/components/Series.d.ts +0 -3
- package/dist/src/components/Series.d.ts.map +1 -1
- package/dist/src/components/Sparkline.d.ts.map +1 -1
- package/dist/src/components/Vector.d.ts +16 -0
- package/dist/src/components/Vector.d.ts.map +1 -0
- package/dist/src/components/ZoomRanger.d.ts.map +1 -1
- package/dist/src/components/annotations/HLine.d.ts.map +1 -1
- package/dist/src/components/annotations/Region.d.ts.map +1 -1
- package/dist/src/components/annotations/VLine.d.ts.map +1 -1
- package/dist/src/components/annotations/useAnnotationDraw.d.ts +8 -0
- package/dist/src/components/annotations/useAnnotationDraw.d.ts.map +1 -0
- package/dist/src/core/CursorManager.d.ts +0 -5
- package/dist/src/core/CursorManager.d.ts.map +1 -1
- package/dist/src/core/DataStore.d.ts.map +1 -1
- package/dist/src/core/Scale.d.ts +5 -0
- package/dist/src/core/Scale.d.ts.map +1 -1
- package/dist/src/core/ScaleManager.d.ts.map +1 -1
- package/dist/src/hooks/useChartStore.d.ts +6 -4
- package/dist/src/hooks/useChartStore.d.ts.map +1 -1
- package/dist/src/hooks/useInteraction.d.ts +1 -2
- package/dist/src/hooks/useInteraction.d.ts.map +1 -1
- package/dist/src/hooks/useRegisterConfig.d.ts +16 -0
- package/dist/src/hooks/useRegisterConfig.d.ts.map +1 -0
- package/dist/src/index.d.ts +10 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/paths/bars.d.ts +2 -0
- package/dist/src/paths/bars.d.ts.map +1 -1
- package/dist/src/paths/linear.d.ts.map +1 -1
- package/dist/src/paths/points.d.ts.map +1 -1
- package/dist/src/paths/spline.d.ts.map +1 -1
- package/dist/src/paths/stepped.d.ts.map +1 -1
- package/dist/src/paths/types.d.ts +10 -1
- package/dist/src/paths/types.d.ts.map +1 -1
- package/dist/src/paths/utils.d.ts +0 -5
- package/dist/src/paths/utils.d.ts.map +1 -1
- package/dist/src/rendering/CanvasRenderer.d.ts +3 -33
- package/dist/src/rendering/CanvasRenderer.d.ts.map +1 -1
- package/dist/src/rendering/drawCursor.d.ts.map +1 -1
- package/dist/src/rendering/drawRangeBox.d.ts +29 -0
- package/dist/src/rendering/drawRangeBox.d.ts.map +1 -0
- package/dist/src/time/timeIncrs.d.ts.map +1 -1
- package/dist/src/time/timeSplits.d.ts +1 -1
- package/dist/src/time/timeSplits.d.ts.map +1 -1
- package/dist/src/types/chart.d.ts +6 -31
- package/dist/src/types/chart.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +3 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/interaction.d.ts +62 -0
- package/dist/src/types/interaction.d.ts.map +1 -0
- package/package.json +2 -3
- package/dist/src/paths/candlestick.d.ts +0 -35
- package/dist/src/paths/candlestick.d.ts.map +0 -1
|
@@ -17,43 +17,11 @@ export declare class CanvasRenderer {
|
|
|
17
17
|
private ctx;
|
|
18
18
|
private pxRatio;
|
|
19
19
|
private pathCache;
|
|
20
|
-
private pathCacheSize;
|
|
21
20
|
private bandCache;
|
|
22
21
|
private scaleStamp;
|
|
23
|
-
private lruHead;
|
|
24
|
-
private lruTail;
|
|
25
|
-
private lruMap;
|
|
26
|
-
private lruKey;
|
|
27
|
-
/** Unlink a node from the doubly-linked list */
|
|
28
|
-
private lruUnlink;
|
|
29
|
-
/** Append a node to the tail (most-recently-used) */
|
|
30
|
-
private lruAppend;
|
|
31
22
|
private snapshotCanvas;
|
|
32
23
|
private snapshotValid;
|
|
33
|
-
private cachedFillStyle;
|
|
34
|
-
private cachedStrokeStyle;
|
|
35
|
-
private cachedLineWidth;
|
|
36
|
-
private cachedFont;
|
|
37
|
-
private cachedTextAlign;
|
|
38
|
-
private cachedTextBaseline;
|
|
39
|
-
private cachedGlobalAlpha;
|
|
40
24
|
setContext(ctx: CanvasRenderingContext2D, pxRatio: number): void;
|
|
41
|
-
/** Reset cached property values (after context change) */
|
|
42
|
-
private resetPropertyCache;
|
|
43
|
-
/** Set fillStyle only if changed */
|
|
44
|
-
setFillStyle(ctx: CanvasRenderingContext2D, val: string): void;
|
|
45
|
-
/** Set strokeStyle only if changed */
|
|
46
|
-
setStrokeStyle(ctx: CanvasRenderingContext2D, val: string): void;
|
|
47
|
-
/** Set lineWidth only if changed */
|
|
48
|
-
setLineWidth(ctx: CanvasRenderingContext2D, val: number): void;
|
|
49
|
-
/** Set font only if changed */
|
|
50
|
-
setFont(ctx: CanvasRenderingContext2D, val: string): void;
|
|
51
|
-
/** Set textAlign only if changed */
|
|
52
|
-
setTextAlign(ctx: CanvasRenderingContext2D, val: CanvasTextAlign): void;
|
|
53
|
-
/** Set textBaseline only if changed */
|
|
54
|
-
setTextBaseline(ctx: CanvasRenderingContext2D, val: CanvasTextBaseline): void;
|
|
55
|
-
/** Set globalAlpha only if changed */
|
|
56
|
-
setGlobalAlpha(ctx: CanvasRenderingContext2D, val: number): void;
|
|
57
25
|
/** Save a snapshot of the current canvas using an offscreen canvas (much cheaper than getImageData) */
|
|
58
26
|
saveSnapshot(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
59
27
|
/** Restore a previously saved snapshot. Returns false if no snapshot exists. */
|
|
@@ -62,7 +30,9 @@ export declare class CanvasRenderer {
|
|
|
62
30
|
invalidateSnapshot(): void;
|
|
63
31
|
/** Compare current scale ranges to cached stamp; clear path cache if scales changed (zoom). */
|
|
64
32
|
checkScaleStamp(renderList: RenderableSeriesInfo[]): void;
|
|
65
|
-
private
|
|
33
|
+
private cacheKey;
|
|
34
|
+
/** Promote a key to most-recently-used (delete + re-insert preserves Map insertion order) */
|
|
35
|
+
private promote;
|
|
66
36
|
/** Get cached paths for a series, promoting to most-recently-used.
|
|
67
37
|
* Falls back to a superset window match if exact key misses. */
|
|
68
38
|
getCachedPaths(group: number, index: number, i0: number, i1: number): SeriesPaths | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasRenderer.d.ts","sourceRoot":"","sources":["../../../src/rendering/CanvasRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"CanvasRenderer.d.ts","sourceRoot":"","sources":["../../../src/rendering/CanvasRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1B;AAKD;;;;GAIG;AACH,qBAAa,cAA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AE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI1G,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1G;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAuD5E;;OAEG;IACH,IAAI,CACF,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,IAAI,EACb,UAAU,EAAE,oBAAoB,EAAE,GACjC,IAAI;CAoBR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawCursor.d.ts","sourceRoot":"","sources":["../../../src/rendering/drawCursor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"drawCursor.d.ts","sourceRoot":"","sources":["../../../src/rendering/drawCursor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAUpD,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAWD;;GAEG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,wBAAwB,EAC7B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,YAAY,EAAE,EAC7B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,EAChD,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC3D,MAAM,CAAC,EAAE,gBAAgB,EACzB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,GAC1C,IAAI,CA4FN"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style options for a range box (box-whisker / candlestick).
|
|
3
|
+
*/
|
|
4
|
+
export interface RangeBoxStyle {
|
|
5
|
+
/** Wick/whisker line color */
|
|
6
|
+
wickColor?: string;
|
|
7
|
+
/** Wick/whisker line width (CSS px, default 1) */
|
|
8
|
+
wickWidth?: number;
|
|
9
|
+
/** Body fill color */
|
|
10
|
+
bodyFill: string;
|
|
11
|
+
/** Body stroke color (undefined = no stroke) */
|
|
12
|
+
bodyStroke?: string;
|
|
13
|
+
/** Body stroke width (CSS px, default 1.5) */
|
|
14
|
+
bodyStrokeWidth?: number;
|
|
15
|
+
/** Horizontal cap line width at wick ends (0 or undefined = no caps) */
|
|
16
|
+
capWidth?: number;
|
|
17
|
+
/** Median/highlight line color (undefined = no line) */
|
|
18
|
+
midColor?: string;
|
|
19
|
+
/** Median/highlight line width (CSS px, default 2.5) */
|
|
20
|
+
midWidth?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Draw a single range box: vertical wick + filled body + optional caps + optional median line.
|
|
24
|
+
* Used by both BoxWhisker and Candlestick components.
|
|
25
|
+
*
|
|
26
|
+
* All coordinates are in CSS pixels (not scaled by pxRatio — the caller handles that via valToX/valToY).
|
|
27
|
+
*/
|
|
28
|
+
export declare function drawRangeBox(ctx: CanvasRenderingContext2D, cx: number, wickLo: number, wickHi: number, boxLo: number, boxHi: number, boxWidth: number, mid: number | null, style: RangeBoxStyle): void;
|
|
29
|
+
//# sourceMappingURL=drawRangeBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawRangeBox.d.ts","sourceRoot":"","sources":["../../../src/rendering/drawRangeBox.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,wBAAwB,EAC7B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,KAAK,EAAE,aAAa,GACnB,IAAI,CA+CN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeIncrs.d.ts","sourceRoot":"","sources":["../../../src/time/timeIncrs.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"timeIncrs.d.ts","sourceRoot":"","sources":["../../../src/time/timeIncrs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,GAAG,IAAI,CAAC;AACrB,eAAO,MAAM,GAAG,KAAK,CAAC;AACtB,eAAO,MAAM,IAAI,OAAO,CAAC;AACzB,eAAO,MAAM,GAAG,QAAQ,CAAC;AACzB,eAAO,MAAM,IAAI,SAAS,CAAC;AAC3B,eAAO,MAAM,KAAK,UAAU,CAAC;AAC7B,eAAO,MAAM,IAAI,WAAW,CAAC;AAE7B;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAiCtC,CAAC"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Generate tick split positions for a time axis.
|
|
3
3
|
* Aligns splits to round time boundaries (midnight, hour starts, etc.).
|
|
4
4
|
*/
|
|
5
|
-
export declare function timeAxisSplits(minSec: number, maxSec: number, incr: number
|
|
5
|
+
export declare function timeAxisSplits(minSec: number, maxSec: number, incr: number): number[];
|
|
6
6
|
//# sourceMappingURL=timeSplits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeSplits.d.ts","sourceRoot":"","sources":["../../../src/time/timeSplits.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"timeSplits.d.ts","sourceRoot":"","sources":["../../../src/time/timeSplits.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,MAAM,EAAE,CAsEV"}
|
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
import type { DataInput } from './data';
|
|
2
2
|
import type { DrawCallback, CursorDrawCallback } from './hooks';
|
|
3
3
|
import type { ChartEventInfo, SelectEventInfo, ScaleChangeCallback } from './events';
|
|
4
|
-
|
|
5
|
-
export interface FocusConfig {
|
|
6
|
-
/** Alpha opacity for non-focused series (default: 0.15) */
|
|
7
|
-
alpha?: number;
|
|
8
|
-
}
|
|
9
|
-
/** Modifier key for axis-specific wheel zoom */
|
|
10
|
-
export interface WheelZoomAxisConfig {
|
|
11
|
-
/** Modifier key required to activate zoom on this axis. If omitted, no modifier needed. */
|
|
12
|
-
key?: 'shift' | 'alt' | 'ctrl';
|
|
13
|
-
}
|
|
14
|
-
/** Object form of wheelZoom: configure each axis independently with optional modifier keys */
|
|
15
|
-
export interface WheelZoomConfig {
|
|
16
|
-
x?: boolean | WheelZoomAxisConfig;
|
|
17
|
-
y?: boolean | WheelZoomAxisConfig;
|
|
18
|
-
}
|
|
19
|
-
/** Cursor/interaction configuration */
|
|
20
|
-
export interface CursorConfig {
|
|
21
|
-
/**
|
|
22
|
-
* Enable mouse wheel zoom (default: false).
|
|
23
|
-
* - `true` or `'x'`: zoom x-axis only (no modifier key needed)
|
|
24
|
-
* - `'y'`: zoom y-axis only
|
|
25
|
-
* - `'xy'`: zoom both axes simultaneously
|
|
26
|
-
* - `{ x, y }`: configure each axis independently with optional modifier keys
|
|
27
|
-
* e.g. `{ x: { key: 'shift' }, y: { key: 'alt' } }`
|
|
28
|
-
*/
|
|
29
|
-
wheelZoom?: boolean | 'x' | 'y' | 'xy' | WheelZoomConfig;
|
|
30
|
-
/** Focus mode: dims non-closest series on hover */
|
|
31
|
-
focus?: FocusConfig;
|
|
32
|
-
}
|
|
4
|
+
import type { ActionList } from './interaction';
|
|
33
5
|
/** Props for the Chart component */
|
|
34
6
|
export interface ChartProps {
|
|
35
7
|
/** Width in CSS pixels */
|
|
@@ -56,8 +28,11 @@ export interface ChartProps {
|
|
|
56
28
|
xlabel?: string;
|
|
57
29
|
/** Y-axis label for the default axis (default: 'Y Axis') */
|
|
58
30
|
ylabel?: string;
|
|
59
|
-
/**
|
|
60
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Action overrides: array of [action, reaction] tuples merged with defaults.
|
|
33
|
+
* Example: `actions={[['wheel', 'zoomXY'], ['leftDblclick', 'none']]}`
|
|
34
|
+
*/
|
|
35
|
+
actions?: ActionList;
|
|
61
36
|
/** Fires on click within the plot area, with resolved nearest point */
|
|
62
37
|
onClick?: (info: ChartEventInfo) => void;
|
|
63
38
|
/** Fires on right-click within the plot area */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/types/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/types/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,oCAAoC;AACpC,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,MAAM,EAAE,MAA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Config, GradientConfig, ColorValue } from './series';
|
|
6
6
|
export type { AxisConfig, AxisState, GridConfig, TickConfig, BorderConfig } from './axes';
|
|
7
7
|
export type { CursorState, SelectState } from './cursor';
|
|
8
|
-
export type { ChartProps
|
|
8
|
+
export type { ChartProps } from './chart';
|
|
9
|
+
export type { ActionList, ActionEntry, ActionKey, ReactionValue, ActionContext, DragContinuation } from './interaction';
|
|
10
|
+
export { DEFAULT_ACTIONS } from './interaction';
|
|
9
11
|
export type { DrawContext, DrawCallback, CursorDrawCallback } from './hooks';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7G,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzG,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAChF,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACpG,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC1F,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7G,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzG,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAChF,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACpG,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC1F,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ChartStore } from '../hooks/useChartStore';
|
|
2
|
+
import type { Orientation } from './common';
|
|
3
|
+
/**
|
|
4
|
+
* Context computed by the interaction hook, passed to action matchers and reaction handlers.
|
|
5
|
+
*/
|
|
6
|
+
export interface ActionContext {
|
|
7
|
+
/** Plot-relative x coordinate (CSS px from plot left edge) */
|
|
8
|
+
cx: number;
|
|
9
|
+
/** Plot-relative y coordinate (CSS px from plot top edge) */
|
|
10
|
+
cy: number;
|
|
11
|
+
/** Whether (cx, cy) is inside the plot area */
|
|
12
|
+
inPlot: boolean;
|
|
13
|
+
/** For gutter hits: the scale ID that was hit */
|
|
14
|
+
scaleId?: string;
|
|
15
|
+
/** For gutter hits: the axis orientation */
|
|
16
|
+
ori?: Orientation;
|
|
17
|
+
/** The classified action string (e.g. 'leftClick', 'shiftLeftDrag'). Set by the hook before dispatch. */
|
|
18
|
+
action?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Continuation for multi-event gestures (drag, pan, gutter drag).
|
|
22
|
+
* Returned by reaction handlers that need to track mousemove/mouseup.
|
|
23
|
+
*/
|
|
24
|
+
export interface DragContinuation {
|
|
25
|
+
onMove: (store: ChartStore, e: Event, ctx: ActionContext) => void;
|
|
26
|
+
onEnd: (store: ChartStore, e: Event, ctx: ActionContext) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Action key: a built-in string name or a custom matcher function.
|
|
30
|
+
*
|
|
31
|
+
* Built-in strings follow the pattern `{modifier?}{Button}{Type}`:
|
|
32
|
+
* - Drag: left/middle/rightDrag, shift/alt/ctrlLeft/Middle/RightDrag
|
|
33
|
+
* - Click: left/middle/rightClick, shift/alt/ctrlLeft/Middle/RightClick
|
|
34
|
+
* - Dblclick: leftDblclick, shift/alt/ctrlLeftDblclick
|
|
35
|
+
* - Gutter: xGutterDrag, yGutterDrag
|
|
36
|
+
* - Wheel: wheel, shiftWheel, altWheel, ctrlWheel
|
|
37
|
+
* - Hover: hover (fired on cursor position change, not when stationary)
|
|
38
|
+
* - Touch: touchDrag, pinch
|
|
39
|
+
* - Keyboard: key{Key}, shift/alt/ctrlKey{Key} — e.g. shiftKeyX, ctrlKeyS, keyEscape
|
|
40
|
+
*/
|
|
41
|
+
export type ActionKey = string | ((e: Event, ctx: ActionContext) => boolean);
|
|
42
|
+
/**
|
|
43
|
+
* Reaction value: a built-in string name or a custom handler function.
|
|
44
|
+
*
|
|
45
|
+
* Built-in reaction strings: 'zoomX', 'zoomY', 'zoomXY', 'panX', 'panY', 'panXY', 'reset', 'none'
|
|
46
|
+
*
|
|
47
|
+
* Custom handlers return a DragContinuation for multi-event gestures, or void for one-shot.
|
|
48
|
+
*/
|
|
49
|
+
export type ReactionValue = string | ((store: ChartStore, e: Event, ctx: ActionContext) => DragContinuation | void);
|
|
50
|
+
/** A single action→reaction binding. */
|
|
51
|
+
export type ActionEntry = [ActionKey, ReactionValue];
|
|
52
|
+
/** User-facing actions list: array of [action, reaction] tuples (merged with defaults). */
|
|
53
|
+
export type ActionList = ActionEntry[];
|
|
54
|
+
/**
|
|
55
|
+
* Focus reaction factory: dims non-nearest series to the given alpha.
|
|
56
|
+
* Use as a reaction for the 'hover' action:
|
|
57
|
+
* `actions={[['hover', focus(0.15)]]}`
|
|
58
|
+
*/
|
|
59
|
+
export declare function focus(alpha?: number): ReactionValue;
|
|
60
|
+
/** Default actions — standard charting interactions out of the box. */
|
|
61
|
+
export declare const DEFAULT_ACTIONS: ActionList;
|
|
62
|
+
//# sourceMappingURL=interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../src/types/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,MAAM,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,yGAAyG;IACzG,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;IAClE,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;CAClE;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,KAAK,gBAAgB,GAAG,IAAI,CAAC,CAAC;AAEnF,wCAAwC;AACxC,MAAM,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AAErD,2FAA2F;AAC3F,MAAM,MAAM,UAAU,GAAG,WAAW,EAAE,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,SAAO,GAAG,aAAa,CAIjD;AAED,uEAAuE;AACvE,eAAO,MAAM,eAAe,EAAE,UAQ7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uplot-plus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "High-performance React charting library with multi-x-axis support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
"lint": "eslint src/ demo/",
|
|
33
33
|
"typecheck": "tsc --noEmit",
|
|
34
34
|
"test": "vitest run",
|
|
35
|
-
"build:demo": "vite build demo"
|
|
36
|
-
"bench": "vite serve bench --config bench/vite.config.ts"
|
|
35
|
+
"build:demo": "vite build demo"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
38
|
"react": ">=18.0.0",
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { DrawCallback } from '../types/hooks';
|
|
2
|
-
import type { ScaleState } from '../types';
|
|
3
|
-
export interface CandlestickOpts {
|
|
4
|
-
/** X values array */
|
|
5
|
-
xValues: ArrayLike<number>;
|
|
6
|
-
/** Open values array */
|
|
7
|
-
open: ArrayLike<number | null>;
|
|
8
|
-
/** High values array */
|
|
9
|
-
high: ArrayLike<number | null>;
|
|
10
|
-
/** Low values array */
|
|
11
|
-
low: ArrayLike<number | null>;
|
|
12
|
-
/** Close values array */
|
|
13
|
-
close: ArrayLike<number | null>;
|
|
14
|
-
/** X scale state — must have min/max set */
|
|
15
|
-
xScale: ScaleState;
|
|
16
|
-
/** Y scale state — must have min/max set */
|
|
17
|
-
yScale: ScaleState;
|
|
18
|
-
/** Color for up candles (close >= open) */
|
|
19
|
-
upColor?: string;
|
|
20
|
-
/** Color for down candles (close < open) */
|
|
21
|
-
downColor?: string;
|
|
22
|
-
/** Body width as fraction of available space (default 0.6) */
|
|
23
|
-
bodyWidth?: number;
|
|
24
|
-
/** Wick width in CSS pixels (default 1) */
|
|
25
|
-
wickWidth?: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Creates a DrawCallback that renders candlestick (OHLC) candles.
|
|
29
|
-
* Use with the Chart's `onDraw` prop or `useDrawHook`.
|
|
30
|
-
*
|
|
31
|
-
* The caller must provide the data arrays and scale states directly
|
|
32
|
-
* since DrawCallback only receives { ctx, plotBox, pxRatio }.
|
|
33
|
-
*/
|
|
34
|
-
export declare function drawCandlesticks(opts: CandlestickOpts): DrawCallback;
|
|
35
|
-
//# sourceMappingURL=candlestick.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"candlestick.d.ts","sourceRoot":"","sources":["../../../src/paths/candlestick.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,wBAAwB;IACxB,IAAI,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/B,wBAAwB;IACxB,IAAI,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/B,uBAAuB;IACvB,GAAG,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9B,yBAAyB;IACzB,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAChC,4CAA4C;IAC5C,MAAM,EAAE,UAAU,CAAC;IACnB,4CAA4C;IAC5C,MAAM,EAAE,UAAU,CAAC;IACnB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,YAAY,CAyDpE"}
|