chartgpu 0.2.2 → 0.2.3
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 +21 -3
- package/dist/core/createRenderCoordinator.d.ts.map +1 -1
- package/dist/core/renderCoordinator/animation/animationHelpers.d.ts +183 -0
- package/dist/core/renderCoordinator/animation/animationHelpers.d.ts.map +1 -0
- package/dist/core/renderCoordinator/annotations/processAnnotations.d.ts +88 -0
- package/dist/core/renderCoordinator/annotations/processAnnotations.d.ts.map +1 -0
- package/dist/core/renderCoordinator/axis/axisLabelHelpers.d.ts +91 -0
- package/dist/core/renderCoordinator/axis/axisLabelHelpers.d.ts.map +1 -0
- package/dist/core/renderCoordinator/axis/computeAxisTicks.d.ts +53 -0
- package/dist/core/renderCoordinator/axis/computeAxisTicks.d.ts.map +1 -0
- package/dist/core/renderCoordinator/data/computeVisibleSlice.d.ts +68 -0
- package/dist/core/renderCoordinator/data/computeVisibleSlice.d.ts.map +1 -0
- package/dist/core/renderCoordinator/gpu/textureManager.d.ts +69 -0
- package/dist/core/renderCoordinator/gpu/textureManager.d.ts.map +1 -0
- package/dist/core/renderCoordinator/interaction/interactionHelpers.d.ts +160 -0
- package/dist/core/renderCoordinator/interaction/interactionHelpers.d.ts.map +1 -0
- package/dist/core/renderCoordinator/render/renderAnnotationLabels.d.ts +36 -0
- package/dist/core/renderCoordinator/render/renderAnnotationLabels.d.ts.map +1 -0
- package/dist/core/renderCoordinator/render/renderAxisLabels.d.ts +40 -0
- package/dist/core/renderCoordinator/render/renderAxisLabels.d.ts.map +1 -0
- package/dist/core/renderCoordinator/render/renderOverlays.d.ts +70 -0
- package/dist/core/renderCoordinator/render/renderOverlays.d.ts.map +1 -0
- package/dist/core/renderCoordinator/render/renderSeries.d.ts +146 -0
- package/dist/core/renderCoordinator/render/renderSeries.d.ts.map +1 -0
- package/dist/core/renderCoordinator/renderers/rendererPool.d.ts +112 -0
- package/dist/core/renderCoordinator/renderers/rendererPool.d.ts.map +1 -0
- package/dist/core/renderCoordinator/types.d.ts +19 -0
- package/dist/core/renderCoordinator/types.d.ts.map +1 -0
- package/dist/core/renderCoordinator/ui/tooltipLegendHelpers.d.ts +104 -0
- package/dist/core/renderCoordinator/ui/tooltipLegendHelpers.d.ts.map +1 -0
- package/dist/core/renderCoordinator/utils/axisUtils.d.ts +122 -0
- package/dist/core/renderCoordinator/utils/axisUtils.d.ts.map +1 -0
- package/dist/core/renderCoordinator/utils/boundsComputation.d.ts +69 -0
- package/dist/core/renderCoordinator/utils/boundsComputation.d.ts.map +1 -0
- package/dist/core/renderCoordinator/utils/canvasUtils.d.ts +52 -0
- package/dist/core/renderCoordinator/utils/canvasUtils.d.ts.map +1 -0
- package/dist/core/renderCoordinator/utils/dataPointUtils.d.ts +71 -0
- package/dist/core/renderCoordinator/utils/dataPointUtils.d.ts.map +1 -0
- package/dist/core/renderCoordinator/utils/index.d.ts +12 -0
- package/dist/core/renderCoordinator/utils/index.d.ts.map +1 -0
- package/dist/core/renderCoordinator/utils/timeAxisUtils.d.ts +149 -0
- package/dist/core/renderCoordinator/utils/timeAxisUtils.d.ts.map +1 -0
- package/dist/core/renderCoordinator/zoom/zoomHelpers.d.ts +129 -0
- package/dist/core/renderCoordinator/zoom/zoomHelpers.d.ts.map +1 -0
- package/dist/index.js +5726 -5347
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zoom helper utilities for domain calculations and zoom state checks.
|
|
3
|
+
*
|
|
4
|
+
* Provides pure functions for computing visible domains from zoom ranges,
|
|
5
|
+
* checking full-span zoom states, and other zoom-related calculations.
|
|
6
|
+
*
|
|
7
|
+
* @module zoomHelpers
|
|
8
|
+
*/
|
|
9
|
+
import type { ZoomRange } from '../../../interaction/createZoomState';
|
|
10
|
+
/**
|
|
11
|
+
* Domain boundaries with min and max values.
|
|
12
|
+
*/
|
|
13
|
+
export interface DomainBounds {
|
|
14
|
+
readonly min: number;
|
|
15
|
+
readonly max: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Visible domain with span fraction for performance optimization hints.
|
|
19
|
+
*/
|
|
20
|
+
export interface VisibleDomain extends DomainBounds {
|
|
21
|
+
/**
|
|
22
|
+
* Fraction of the base domain that is visible (0 to 1).
|
|
23
|
+
* Used to determine if full-resolution data can be used.
|
|
24
|
+
*/
|
|
25
|
+
readonly spanFraction: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Computes the visible X domain from base domain and zoom range.
|
|
29
|
+
*
|
|
30
|
+
* Converts a percent-space zoom range [0-100] to actual domain coordinates.
|
|
31
|
+
* Returns the full base domain when zoom is null/undefined or full-span.
|
|
32
|
+
*
|
|
33
|
+
* @param baseDomain - The complete data domain (unzoomed)
|
|
34
|
+
* @param zoomRange - Zoom window in percent space [0-100], or null for full view
|
|
35
|
+
* @returns Visible domain with min, max, and span fraction
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const baseDomain = { min: 0, max: 1000 };
|
|
40
|
+
* const zoomRange = { start: 25, end: 75 };
|
|
41
|
+
* const visible = computeVisibleDomain(baseDomain, zoomRange);
|
|
42
|
+
* // Returns: { min: 250, max: 750, spanFraction: 0.5 }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function computeVisibleDomain(baseDomain: DomainBounds, zoomRange?: ZoomRange | null): VisibleDomain;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a zoom range represents a full-span (unzoomed) view.
|
|
48
|
+
*
|
|
49
|
+
* A zoom is considered full-span if:
|
|
50
|
+
* - Range is null/undefined
|
|
51
|
+
* - Start is at or before 0% AND end is at or after 100%
|
|
52
|
+
*
|
|
53
|
+
* Small tolerance (0.5%) is applied to account for floating-point arithmetic
|
|
54
|
+
* and UI imprecision (e.g., slider at edge).
|
|
55
|
+
*
|
|
56
|
+
* @param zoomRange - Zoom window to check, or null
|
|
57
|
+
* @returns True if the zoom represents a full-span view
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* isFullSpanZoom(null); // true
|
|
62
|
+
* isFullSpanZoom({ start: 0, end: 100 }); // true
|
|
63
|
+
* isFullSpanZoom({ start: -0.1, end: 100.1 }); // true (tolerance)
|
|
64
|
+
* isFullSpanZoom({ start: 25, end: 75 }); // false
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function isFullSpanZoom(zoomRange: ZoomRange | null | undefined): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Computes a buffer zone around the visible domain for data caching.
|
|
70
|
+
*
|
|
71
|
+
* Adds a percentage buffer on each side of the visible domain to cache
|
|
72
|
+
* extra data points for smooth panning. This reduces resampling frequency
|
|
73
|
+
* when the user pans slightly beyond the current view.
|
|
74
|
+
*
|
|
75
|
+
* @param visibleDomain - Current visible domain
|
|
76
|
+
* @param bufferPercent - Buffer percentage (0 to 1), default 0.1 (10%)
|
|
77
|
+
* @returns Buffered domain bounds
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const visible = { min: 100, max: 200 };
|
|
82
|
+
* const buffered = computeBufferedDomain(visible, 0.1);
|
|
83
|
+
* // Returns: { min: 90, max: 210 } (±10% buffer)
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function computeBufferedDomain(visibleDomain: DomainBounds, bufferPercent?: number): DomainBounds;
|
|
87
|
+
/**
|
|
88
|
+
* Converts a domain coordinate to percent-space relative to base domain.
|
|
89
|
+
*
|
|
90
|
+
* Useful for converting mouse positions or data coordinates to zoom range
|
|
91
|
+
* percentages for zoom/pan operations.
|
|
92
|
+
*
|
|
93
|
+
* @param value - Domain coordinate to convert
|
|
94
|
+
* @param baseDomain - Base domain for reference
|
|
95
|
+
* @returns Percent value [0-100]
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const percent = domainValueToPercent(500, { min: 0, max: 1000 });
|
|
100
|
+
* // Returns: 50
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function domainValueToPercent(value: number, baseDomain: DomainBounds): number;
|
|
104
|
+
/**
|
|
105
|
+
* Converts a percent-space value to domain coordinate.
|
|
106
|
+
*
|
|
107
|
+
* Inverse of `domainValueToPercent`. Useful for converting zoom range
|
|
108
|
+
* percentages back to domain coordinates.
|
|
109
|
+
*
|
|
110
|
+
* @param percent - Percent value [0-100]
|
|
111
|
+
* @param baseDomain - Base domain for reference
|
|
112
|
+
* @returns Domain coordinate
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* const value = percentToDomainValue(50, { min: 0, max: 1000 });
|
|
117
|
+
* // Returns: 500
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function percentToDomainValue(percent: number, baseDomain: DomainBounds): number;
|
|
121
|
+
/**
|
|
122
|
+
* Calculates the zoom span (in percent) from a domain window.
|
|
123
|
+
*
|
|
124
|
+
* @param windowDomain - The zoomed window domain
|
|
125
|
+
* @param baseDomain - The full base domain
|
|
126
|
+
* @returns Span in percent [0-100]
|
|
127
|
+
*/
|
|
128
|
+
export declare function calculateZoomSpan(windowDomain: DomainBounds, baseDomain: DomainBounds): number;
|
|
129
|
+
//# sourceMappingURL=zoomHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoomHelpers.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/zoom/zoomHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,YAAY,EACxB,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,GAC3B,aAAa,CAsBf;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAS/E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,YAAY,EAC3B,aAAa,GAAE,MAAY,GAC1B,YAAY,CAWd;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,GAAG,MAAM,CAMpF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,GAAG,MAAM,CAGtF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,GAAG,MAAM,CAQ9F"}
|