chartgpu 0.2.2 → 0.2.4

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 (80) hide show
  1. package/README.md +38 -11
  2. package/dist/ChartGPU.d.ts +23 -6
  3. package/dist/ChartGPU.d.ts.map +1 -1
  4. package/dist/config/OptionResolver.d.ts.map +1 -1
  5. package/dist/config/types.d.ts +26 -1
  6. package/dist/config/types.d.ts.map +1 -1
  7. package/dist/core/GPUContext.d.ts +2 -2
  8. package/dist/core/GPUContext.d.ts.map +1 -1
  9. package/dist/core/createRenderCoordinator.d.ts +3 -2
  10. package/dist/core/createRenderCoordinator.d.ts.map +1 -1
  11. package/dist/core/renderCoordinator/animation/animationHelpers.d.ts +183 -0
  12. package/dist/core/renderCoordinator/animation/animationHelpers.d.ts.map +1 -0
  13. package/dist/core/renderCoordinator/annotations/processAnnotations.d.ts +88 -0
  14. package/dist/core/renderCoordinator/annotations/processAnnotations.d.ts.map +1 -0
  15. package/dist/core/renderCoordinator/axis/axisLabelHelpers.d.ts +91 -0
  16. package/dist/core/renderCoordinator/axis/axisLabelHelpers.d.ts.map +1 -0
  17. package/dist/core/renderCoordinator/axis/computeAxisTicks.d.ts +53 -0
  18. package/dist/core/renderCoordinator/axis/computeAxisTicks.d.ts.map +1 -0
  19. package/dist/core/renderCoordinator/data/computeVisibleSlice.d.ts +66 -0
  20. package/dist/core/renderCoordinator/data/computeVisibleSlice.d.ts.map +1 -0
  21. package/dist/core/renderCoordinator/gpu/textureManager.d.ts +69 -0
  22. package/dist/core/renderCoordinator/gpu/textureManager.d.ts.map +1 -0
  23. package/dist/core/renderCoordinator/interaction/interactionHelpers.d.ts +160 -0
  24. package/dist/core/renderCoordinator/interaction/interactionHelpers.d.ts.map +1 -0
  25. package/dist/core/renderCoordinator/render/renderAnnotationLabels.d.ts +36 -0
  26. package/dist/core/renderCoordinator/render/renderAnnotationLabels.d.ts.map +1 -0
  27. package/dist/core/renderCoordinator/render/renderAxisLabels.d.ts +40 -0
  28. package/dist/core/renderCoordinator/render/renderAxisLabels.d.ts.map +1 -0
  29. package/dist/core/renderCoordinator/render/renderOverlays.d.ts +70 -0
  30. package/dist/core/renderCoordinator/render/renderOverlays.d.ts.map +1 -0
  31. package/dist/core/renderCoordinator/render/renderSeries.d.ts +146 -0
  32. package/dist/core/renderCoordinator/render/renderSeries.d.ts.map +1 -0
  33. package/dist/core/renderCoordinator/renderers/rendererPool.d.ts +112 -0
  34. package/dist/core/renderCoordinator/renderers/rendererPool.d.ts.map +1 -0
  35. package/dist/core/renderCoordinator/types.d.ts +19 -0
  36. package/dist/core/renderCoordinator/types.d.ts.map +1 -0
  37. package/dist/core/renderCoordinator/ui/tooltipLegendHelpers.d.ts +104 -0
  38. package/dist/core/renderCoordinator/ui/tooltipLegendHelpers.d.ts.map +1 -0
  39. package/dist/core/renderCoordinator/utils/axisUtils.d.ts +122 -0
  40. package/dist/core/renderCoordinator/utils/axisUtils.d.ts.map +1 -0
  41. package/dist/core/renderCoordinator/utils/boundsComputation.d.ts +69 -0
  42. package/dist/core/renderCoordinator/utils/boundsComputation.d.ts.map +1 -0
  43. package/dist/core/renderCoordinator/utils/canvasUtils.d.ts +52 -0
  44. package/dist/core/renderCoordinator/utils/canvasUtils.d.ts.map +1 -0
  45. package/dist/core/renderCoordinator/utils/dataPointUtils.d.ts +71 -0
  46. package/dist/core/renderCoordinator/utils/dataPointUtils.d.ts.map +1 -0
  47. package/dist/core/renderCoordinator/utils/index.d.ts +12 -0
  48. package/dist/core/renderCoordinator/utils/index.d.ts.map +1 -0
  49. package/dist/core/renderCoordinator/utils/timeAxisUtils.d.ts +149 -0
  50. package/dist/core/renderCoordinator/utils/timeAxisUtils.d.ts.map +1 -0
  51. package/dist/core/renderCoordinator/zoom/zoomHelpers.d.ts +129 -0
  52. package/dist/core/renderCoordinator/zoom/zoomHelpers.d.ts.map +1 -0
  53. package/dist/data/cartesianData.d.ts +67 -0
  54. package/dist/data/cartesianData.d.ts.map +1 -0
  55. package/dist/data/createDataStore.d.ts +4 -12
  56. package/dist/data/createDataStore.d.ts.map +1 -1
  57. package/dist/data/sampleSeries.d.ts +19 -2
  58. package/dist/data/sampleSeries.d.ts.map +1 -1
  59. package/dist/index.cjs +1270 -0
  60. package/dist/index.cjs.map +1 -0
  61. package/dist/index.d.ts +2 -1
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +6068 -5643
  64. package/dist/index.js.map +1 -1
  65. package/dist/interaction/createAnnotationAuthoring.d.ts.map +1 -1
  66. package/dist/interaction/createAnnotationDragHandler.d.ts.map +1 -1
  67. package/dist/interaction/createAnnotationHitTester.d.ts.map +1 -1
  68. package/dist/interaction/createChartSync.d.ts +17 -2
  69. package/dist/interaction/createChartSync.d.ts.map +1 -1
  70. package/dist/interaction/findNearestPoint.d.ts.map +1 -1
  71. package/dist/interaction/findPointsAtX.d.ts.map +1 -1
  72. package/dist/renderers/createAreaRenderer.d.ts +2 -1
  73. package/dist/renderers/createAreaRenderer.d.ts.map +1 -1
  74. package/dist/renderers/createBarRenderer.d.ts.map +1 -1
  75. package/dist/renderers/createHighlightRenderer.d.ts +1 -1
  76. package/dist/renderers/createHighlightRenderer.d.ts.map +1 -1
  77. package/dist/renderers/createLineRenderer.d.ts.map +1 -1
  78. package/dist/renderers/createScatterRenderer.d.ts +2 -1
  79. package/dist/renderers/createScatterRenderer.d.ts.map +1 -1
  80. package/package.json +5 -3
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Bounds computation utilities for the RenderCoordinator.
3
+ *
4
+ * These pure functions compute xMin/xMax/yMin/yMax bounds from data arrays
5
+ * and aggregate bounds across series. They handle edge cases like empty data,
6
+ * NaN/Infinity values, and zero-span domains.
7
+ *
8
+ * @module boundsComputation
9
+ */
10
+ import type { DataPoint, OHLCDataPoint } from '../../../config/types';
11
+ import type { ResolvedChartGPUOptions } from '../../../config/OptionResolver';
12
+ /**
13
+ * Bounds type for min/max x and y values.
14
+ */
15
+ export type Bounds = Readonly<{
16
+ xMin: number;
17
+ xMax: number;
18
+ yMin: number;
19
+ yMax: number;
20
+ }>;
21
+ /**
22
+ * Computes xMin/xMax/yMin/yMax bounds from cartesian data array.
23
+ * Skips non-finite values. Returns null if no finite points found.
24
+ * Ensures xMin !== xMax and yMin !== yMax for scale derivation.
25
+ *
26
+ * @param data - Array of data points (tuple or object format)
27
+ * @returns Bounds object or null if no finite points
28
+ */
29
+ export declare const computeRawBoundsFromData: (data: ReadonlyArray<DataPoint>) => Bounds | null;
30
+ /**
31
+ * Extends existing bounds with new cartesian data points.
32
+ * If bounds is null and points are valid, seeds bounds from points.
33
+ *
34
+ * @param bounds - Existing bounds or null
35
+ * @param points - New points to extend bounds with
36
+ * @returns Updated bounds or null if no finite points
37
+ */
38
+ export declare const extendBoundsWithDataPoints: (bounds: Bounds | null, points: ReadonlyArray<DataPoint>) => Bounds | null;
39
+ /**
40
+ * Extends bounds with OHLC candlestick data using low/high values.
41
+ * If bounds is null, initializes bounds from OHLC points.
42
+ *
43
+ * @param bounds - Existing bounds or null
44
+ * @param points - OHLC points (timestamp, open, high, low, close)
45
+ * @returns Updated bounds or original bounds if no finite points
46
+ */
47
+ export declare const extendBoundsWithOHLCDataPoints: (bounds: Bounds | null, points: ReadonlyArray<OHLCDataPoint>) => Bounds | null;
48
+ /**
49
+ * Aggregates bounds across all series, handling pie/candlestick special cases.
50
+ * Prefers precomputed rawBounds from OptionResolver when available to avoid O(n) scans.
51
+ *
52
+ * @param series - Resolved series configurations
53
+ * @param runtimeRawBoundsByIndex - Optional runtime bounds (used for streaming appends)
54
+ * @returns Global bounds across all series, defaults to (0,1) x (0,1) if no finite data
55
+ */
56
+ export declare const computeGlobalBounds: (series: ResolvedChartGPUOptions["series"], runtimeRawBoundsByIndex?: ReadonlyArray<Bounds | null> | null) => Bounds;
57
+ /**
58
+ * Ensures min ≤ max, handles infinities with defaults (0,1), handles zero-span domains.
59
+ * Returns a usable domain for scale derivation.
60
+ *
61
+ * @param minCandidate - Candidate minimum value
62
+ * @param maxCandidate - Candidate maximum value
63
+ * @returns Normalized domain with min ≤ max, both finite
64
+ */
65
+ export declare const normalizeDomain: (minCandidate: number, maxCandidate: number) => {
66
+ readonly min: number;
67
+ readonly max: number;
68
+ };
69
+ //# sourceMappingURL=boundsComputation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundsComputation.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/utils/boundsComputation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAI9E;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE1F;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,MAAM,aAAa,CAAC,SAAS,CAAC,KAAG,MAAM,GAAG,IAwBlF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,MAAM,GAAG,IAAI,EAAE,QAAQ,aAAa,CAAC,SAAS,CAAC,KAAG,MAAM,GAAG,IA8B7G,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,GAAI,QAAQ,MAAM,GAAG,IAAI,EAAE,QAAQ,aAAa,CAAC,aAAa,CAAC,KAAG,MAAM,GAAG,IA8BrH,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,uBAAuB,CAAC,QAAQ,CAAC,EACzC,0BAA0B,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,KAC5D,MAuGF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,cAAc,MAAM,EACpB,cAAc,MAAM,KACnB;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAkB9C,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Canvas sizing and measurement utilities for the RenderCoordinator.
3
+ *
4
+ * These pure functions handle canvas dimension retrieval with special handling
5
+ * for device pixel ratio and GPU overlay coordinate conversions.
6
+ *
7
+ * @module canvasUtils
8
+ */
9
+ /**
10
+ * Gets canvas CSS width - clientWidth for HTMLCanvasElement.
11
+ *
12
+ * @param canvas - The canvas element to measure, or null
13
+ * @returns CSS width in pixels, or 0 if canvas is null
14
+ */
15
+ export declare function getCanvasCssWidth(canvas: HTMLCanvasElement | null): number;
16
+ /**
17
+ * Gets canvas CSS height - clientHeight for HTMLCanvasElement.
18
+ *
19
+ * @param canvas - The canvas element to measure, or null
20
+ * @returns CSS height in pixels, or 0 if canvas is null
21
+ */
22
+ export declare function getCanvasCssHeight(canvas: HTMLCanvasElement | null): number;
23
+ /**
24
+ * Gets canvas CSS size derived strictly from device-pixel dimensions and DPR.
25
+ *
26
+ * This is intentionally different from `getCanvasCssWidth/Height(...)`:
27
+ * - HTMLCanvasElement: `clientWidth/clientHeight` reflect DOM layout and can diverge (rounding, zoom, async resize)
28
+ * from the WebGPU render target size (`canvas.width/height` in device pixels).
29
+ * - For GPU overlays that round-trip CSS↔device pixels in-shader, we must derive CSS size from
30
+ * `canvas.width/height` + DPR to keep transforms consistent with the render target.
31
+ *
32
+ * NOTE: Use this for GPU overlay coordinate conversion only (reference lines, markers).
33
+ * Keep DOM overlays (labels/tooltips) using `clientWidth/clientHeight` for layout correctness.
34
+ *
35
+ * @param canvas - The canvas element to measure, or null
36
+ * @param devicePixelRatio - The device pixel ratio (defaults to window.devicePixelRatio or 1)
37
+ * @returns Object with width and height in CSS pixels derived from device pixels
38
+ */
39
+ export declare function getCanvasCssSizeFromDevicePixels(canvas: HTMLCanvasElement | null, devicePixelRatio?: number): Readonly<{
40
+ width: number;
41
+ height: number;
42
+ }>;
43
+ /**
44
+ * Clamps a value to an integer within [lo, hi] range.
45
+ *
46
+ * @param v - Value to clamp
47
+ * @param lo - Lower bound (inclusive)
48
+ * @param hi - Upper bound (inclusive)
49
+ * @returns Clamped integer value
50
+ */
51
+ export declare function clampInt(v: number, lo: number, hi: number): number;
52
+ //# sourceMappingURL=canvasUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvasUtils.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/utils/canvasUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAM1E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAM3E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAChC,gBAAgB,GAAE,MAAoE,GACrF,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAK7C;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAElE"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Data point type guards and utilities for the RenderCoordinator.
3
+ *
4
+ * These pure functions handle the dual data format system (tuple vs object)
5
+ * and provide type-safe access to point coordinates.
6
+ *
7
+ * @module dataPointUtils
8
+ */
9
+ import type { DataPoint, DataPointTuple, OHLCDataPoint, OHLCDataPointTuple } from '../../../config/types';
10
+ /**
11
+ * Validates that a number is finite, returning the number or null.
12
+ *
13
+ * @param v - Value to validate
14
+ * @returns The number if finite, otherwise null
15
+ */
16
+ export declare const finiteOrNull: (v: number | null | undefined) => number | null;
17
+ /**
18
+ * Validates that a number is finite, returning the number or undefined.
19
+ *
20
+ * @param v - Value to validate
21
+ * @returns The number if finite, otherwise undefined
22
+ */
23
+ export declare const finiteOrUndefined: (v: number | undefined) => number | undefined;
24
+ /**
25
+ * Compile-time exhaustiveness check for error handling.
26
+ * Used in switch statements to ensure all cases are handled.
27
+ *
28
+ * @param value - The value that should be of type `never` if all cases are handled
29
+ * @throws Always throws an error if called
30
+ */
31
+ export declare const assertUnreachable: (value: never) => never;
32
+ /**
33
+ * Type guard: checks if a DataPoint is in tuple form `[x, y]`.
34
+ *
35
+ * @param p - The data point to check
36
+ * @returns True if the point is a tuple, false if it's an object
37
+ */
38
+ export declare const isTupleDataPoint: (p: DataPoint) => p is DataPointTuple;
39
+ /**
40
+ * Extracts x,y coordinates from either tuple or object point format.
41
+ *
42
+ * @param p - The data point (either tuple or object format)
43
+ * @returns Object with x and y properties
44
+ */
45
+ export declare const getPointXY: (p: DataPoint) => {
46
+ readonly x: number;
47
+ readonly y: number;
48
+ };
49
+ /**
50
+ * Type guard: checks if a data point is in tuple OHLC form `[timestamp, open, high, low, close]`.
51
+ *
52
+ * @param p - The OHLC data point to check
53
+ * @returns True if the point is a tuple, false if it's an object
54
+ */
55
+ export declare const isTupleOHLCDataPoint: (p: OHLCDataPoint) => p is OHLCDataPointTuple;
56
+ /**
57
+ * Type guard: checks if a data point is in tuple form `[x, y]` (for individual points).
58
+ *
59
+ * @param p - The point to check
60
+ * @returns True if the point is a tuple array
61
+ */
62
+ export declare const isTuplePoint: (p: unknown) => p is readonly [number, number];
63
+ /**
64
+ * Type guard: checks if entire data array is in tuple format.
65
+ * Only checks the first element for performance.
66
+ *
67
+ * @param data - Array of data points to check
68
+ * @returns True if first element (and therefore likely all) is a tuple
69
+ */
70
+ export declare const isTupleDataArray: (data: ReadonlyArray<DataPoint>) => data is ReadonlyArray<DataPointTuple>;
71
+ //# sourceMappingURL=dataPointUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataPointUtils.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/utils/dataPointUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE1G;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,IACb,CAAC;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,GAAG,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SACN,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,KAAG,KAGhD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,KAAG,CAAC,IAAI,cAAkC,CAAC;AAExF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,SAAS,KAAG;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAGjF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,GAAG,aAAa,KAAG,CAAC,IAAI,kBAAsC,CAAC;AAEpG;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,MAAM,CAAqB,CAAC;AAE7F;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,aAAa,CAAC,SAAS,CAAC,KAAG,IAAI,IAAI,aAAa,CAAC,cAAc,CACxD,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Utility functions for the RenderCoordinator.
3
+ * Pure, stateless helper functions organized by category.
4
+ *
5
+ * @module utils
6
+ */
7
+ export * from './canvasUtils';
8
+ export * from './dataPointUtils';
9
+ export * from './boundsComputation';
10
+ export * from './axisUtils';
11
+ export * from './timeAxisUtils';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,eAAe,CAAC;AAG9B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,aAAa,CAAC;AAG5B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Time axis and formatting utilities for the RenderCoordinator.
3
+ *
4
+ * These pure functions handle time-based tick generation, adaptive label formatting,
5
+ * and number/percentage parsing for pie chart configuration.
6
+ *
7
+ * @module timeAxisUtils
8
+ */
9
+ import type { LinearScale } from '../../../utils/scales';
10
+ import type { PieCenter, PieRadius } from '../../../config/types';
11
+ /**
12
+ * Time constants for axis formatting decisions.
13
+ */
14
+ export declare const MS_PER_DAY: number;
15
+ export declare const MS_PER_MONTH_APPROX: number;
16
+ export declare const MS_PER_YEAR_APPROX: number;
17
+ /**
18
+ * Tick configuration constants.
19
+ */
20
+ export declare const MAX_TIME_X_TICK_COUNT = 9;
21
+ export declare const MIN_TIME_X_TICK_COUNT = 1;
22
+ export declare const MIN_X_LABEL_GAP_CSS_PX = 6;
23
+ export declare const DEFAULT_MAX_TICK_FRACTION_DIGITS = 6;
24
+ export declare const DEFAULT_TICK_COUNT = 5;
25
+ /**
26
+ * English month abbreviations for time axis labels.
27
+ */
28
+ export declare const MONTH_SHORT_EN: readonly string[];
29
+ /**
30
+ * Parses value as number or percentage string, returns null if invalid.
31
+ * Used for pie chart center and radius configuration.
32
+ *
33
+ * @param value - Number or percentage string (e.g. "50%", "120", 120)
34
+ * @param basis - Basis value for percentage calculation
35
+ * @returns Parsed number or null if invalid
36
+ */
37
+ export declare const parseNumberOrPercent: (value: number | string, basis: number) => number | null;
38
+ /**
39
+ * Resolves pie center from mixed number/string/percent format.
40
+ * Defaults to center of plot area (50%, 50%).
41
+ *
42
+ * @param center - Pie center configuration or undefined
43
+ * @param plotWidthCss - Plot area width in CSS pixels
44
+ * @param plotHeightCss - Plot area height in CSS pixels
45
+ * @returns Resolved center coordinates in CSS pixels
46
+ */
47
+ export declare const resolvePieCenterPlotCss: (center: PieCenter | undefined, plotWidthCss: number, plotHeightCss: number) => {
48
+ readonly x: number;
49
+ readonly y: number;
50
+ };
51
+ /**
52
+ * Type guard for pie radius tuple format `[inner, outer]`.
53
+ *
54
+ * @param radius - Pie radius configuration
55
+ * @returns True if radius is a tuple
56
+ */
57
+ export declare const isPieRadiusTuple: (radius: PieRadius) => radius is readonly [inner: number | string, outer: number | string];
58
+ /**
59
+ * Resolves pie inner/outer radii with defaults, bounds checking.
60
+ * Default outer radius is 70% of max, inner radius is 0 (full pie).
61
+ *
62
+ * @param radius - Pie radius configuration or undefined
63
+ * @param maxRadiusCss - Maximum radius in CSS pixels
64
+ * @returns Resolved inner and outer radii in CSS pixels
65
+ */
66
+ export declare const resolvePieRadiiCss: (radius: PieRadius | undefined, maxRadiusCss: number) => {
67
+ readonly inner: number;
68
+ readonly outer: number;
69
+ };
70
+ /**
71
+ * Calculates decimal precision needed for clean tick formatting from tick step.
72
+ * Prefers "clean" decimal representations (e.g. 2.5, 0.25, 0.125) without relying on magnitude alone.
73
+ *
74
+ * @param tickStep - Step size between ticks
75
+ * @param cap - Maximum fraction digits to return (default 6)
76
+ * @returns Number of fraction digits for formatting
77
+ */
78
+ export declare const computeMaxFractionDigitsFromStep: (tickStep: number, cap?: number) => number;
79
+ /**
80
+ * Creates Intl.NumberFormat instance for consistent tick formatting.
81
+ * Automatically computes appropriate fraction digits from tick step.
82
+ *
83
+ * @param tickStep - Step size between ticks
84
+ * @returns NumberFormat instance
85
+ */
86
+ export declare const createTickFormatter: (tickStep: number) => Intl.NumberFormat;
87
+ /**
88
+ * Formats numeric value using NumberFormat, handles -0 and NaN edge cases.
89
+ *
90
+ * @param nf - NumberFormat instance
91
+ * @param v - Value to format
92
+ * @returns Formatted string or null if invalid
93
+ */
94
+ export declare const formatTickValue: (nf: Intl.NumberFormat, v: number) => string | null;
95
+ /**
96
+ * Pads single-digit numbers with leading zero (used by time formatting).
97
+ *
98
+ * @param n - Number to pad
99
+ * @returns Zero-padded string (minimum 2 digits)
100
+ */
101
+ export declare const pad2: (n: number) => string;
102
+ /**
103
+ * Formats millisecond timestamps with adaptive precision based on visible range.
104
+ * Format tiers:
105
+ * - < 1 day: HH:mm
106
+ * - 1-7 days: MM/DD HH:mm
107
+ * - 1-12 weeks (up to ~3 months): MM/DD
108
+ * - 3-12 months: MMM DD
109
+ * - > 1 year: YYYY/MM
110
+ *
111
+ * @param timestampMs - Timestamp in milliseconds
112
+ * @param visibleRangeMs - Visible range width in milliseconds
113
+ * @returns Formatted time string or null if invalid
114
+ */
115
+ export declare const formatTimeTickValue: (timestampMs: number, visibleRangeMs: number) => string | null;
116
+ /**
117
+ * Generates evenly-spaced tick values across domain.
118
+ *
119
+ * @param domainMin - Domain minimum value
120
+ * @param domainMax - Domain maximum value
121
+ * @param tickCount - Number of ticks to generate
122
+ * @returns Array of tick values
123
+ */
124
+ export declare const generateLinearTicks: (domainMin: number, domainMax: number, tickCount: number) => number[];
125
+ /**
126
+ * Computes optimal tick count + values to avoid label overlap on time x-axis.
127
+ * Uses text measurement context to test label widths.
128
+ * Tries tick counts from MAX (9) down to MIN (1) until labels fit without overlap.
129
+ *
130
+ * @param params - Configuration object with axis, scale, canvas, and measurement settings
131
+ * @returns Object with tickCount and tickValues
132
+ */
133
+ export declare const computeAdaptiveTimeXAxisTicks: (params: {
134
+ readonly axisMin: number | null;
135
+ readonly axisMax: number | null;
136
+ readonly xScale: LinearScale;
137
+ readonly plotClipLeft: number;
138
+ readonly plotClipRight: number;
139
+ readonly canvasCssWidth: number;
140
+ readonly visibleRangeMs: number;
141
+ readonly measureCtx: CanvasRenderingContext2D | null;
142
+ readonly measureCache?: Map<string, number>;
143
+ readonly fontSize: number;
144
+ readonly fontFamily: string;
145
+ }) => {
146
+ readonly tickCount: number;
147
+ readonly tickValues: readonly number[];
148
+ };
149
+ //# sourceMappingURL=timeAxisUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeAxisUtils.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/utils/timeAxisUtils.ts"],"names":[],"mappings":"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"}
@@ -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"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Internal cartesian data abstraction for CartesianSeriesData.
3
+ *
4
+ * Provides high-performance, allocation-minimizing primitives to support all three cartesian formats:
5
+ * - ReadonlyArray<DataPoint> (tuple or object)
6
+ * - XYArraysData (separate x/y/size arrays)
7
+ * - InterleavedXYData (typed array view with [x0,y0,x1,y1,...] layout)
8
+ *
9
+ * DO NOT export from public entrypoint (src/index.ts). This is internal-only.
10
+ *
11
+ * @module cartesianData
12
+ * @internal
13
+ */
14
+ import type { CartesianSeriesData } from '../config/types';
15
+ /**
16
+ * Bounds type for min/max x and y values.
17
+ */
18
+ export type Bounds = Readonly<{
19
+ xMin: number;
20
+ xMax: number;
21
+ yMin: number;
22
+ yMax: number;
23
+ }>;
24
+ /**
25
+ * Returns the number of points in the CartesianSeriesData.
26
+ */
27
+ export declare function getPointCount(data: CartesianSeriesData): number;
28
+ /**
29
+ * Returns the x-coordinate of the point at index i.
30
+ */
31
+ export declare function getX(data: CartesianSeriesData, i: number): number;
32
+ /**
33
+ * Returns the y-coordinate of the point at index i.
34
+ */
35
+ export declare function getY(data: CartesianSeriesData, i: number): number;
36
+ /**
37
+ * Returns the size value of the point at index i, or undefined if not available.
38
+ * Note: InterleavedXYData does NOT support interleaved size (use XYArraysData.size if needed).
39
+ */
40
+ export declare function getSize(data: CartesianSeriesData, i: number): number | undefined;
41
+ /**
42
+ * Packs XY coordinates from CartesianSeriesData into a Float32Array in interleaved layout.
43
+ *
44
+ * Writes `pointCount` points starting at `srcPointOffset` in the source data
45
+ * into `out` starting at `outFloatOffset` (measured in float32 elements, not bytes).
46
+ *
47
+ * Each point writes 2 floats: [x - xOffset, y].
48
+ * Size dimension is NOT packed (use getSize() separately if needed).
49
+ *
50
+ * @param out - Target Float32Array to write into
51
+ * @param outFloatOffset - Starting offset in `out` (in float32 elements)
52
+ * @param src - Source CartesianSeriesData
53
+ * @param srcPointOffset - Starting point index in source
54
+ * @param pointCount - Number of points to pack
55
+ * @param xOffset - Value to subtract from x coordinates (for Float32 precision preservation)
56
+ */
57
+ export declare function packXYInto(out: Float32Array, outFloatOffset: number, src: CartesianSeriesData, srcPointOffset: number, pointCount: number, xOffset: number): void;
58
+ /**
59
+ * Computes xMin/xMax/yMin/yMax bounds from CartesianSeriesData.
60
+ * Skips non-finite x or y values. Returns null if no finite points found.
61
+ * Ensures xMin !== xMax and yMin !== yMax for scale derivation (expands max by +1 if needed).
62
+ *
63
+ * @param data - CartesianSeriesData in any supported format
64
+ * @returns Bounds object or null if no finite points
65
+ */
66
+ export declare function computeRawBoundsFromCartesianData(data: CartesianSeriesData): Bounds | null;
67
+ //# sourceMappingURL=cartesianData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartesianData.d.ts","sourceRoot":"","sources":["../../src/data/cartesianData.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAA8C,MAAM,iBAAiB,CAAC;AAEvG;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAqD1F;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAmB/D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,mBAAmB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAgBjE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,mBAAmB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAgBjE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAahF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,YAAY,EACjB,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,mBAAmB,EACxB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,IAAI,CAsDN;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CAkE1F"}
@@ -1,6 +1,6 @@
1
- import type { DataPoint } from '../config/types';
1
+ import type { CartesianSeriesData } from '../config/types';
2
2
  export interface DataStore {
3
- setSeries(index: number, data: ReadonlyArray<DataPoint>, options?: Readonly<{
3
+ setSeries(index: number, data: CartesianSeriesData, options?: Readonly<{
4
4
  xOffset?: number;
5
5
  }>): void;
6
6
  /**
@@ -8,11 +8,11 @@ export interface DataStore {
8
8
  *
9
9
  * - Reuses the same geometric growth policy as `setSeries`.
10
10
  * - When no reallocation is needed, writes only the appended byte range via `queue.writeBuffer(...)`.
11
- * - Maintains `pointCount` and a CPU-side combined data array so `getSeriesData(...)` remains correct.
11
+ * - Maintains `pointCount` for render path queries.
12
12
  *
13
13
  * Throws if the series has not been set yet.
14
14
  */
15
- appendSeries(index: number, newPoints: ReadonlyArray<DataPoint>): void;
15
+ appendSeries(index: number, newPoints: CartesianSeriesData): void;
16
16
  removeSeries(index: number): void;
17
17
  getSeriesBuffer(index: number): GPUBuffer;
18
18
  /**
@@ -21,14 +21,6 @@ export interface DataStore {
21
21
  * Throws if the series has not been set yet.
22
22
  */
23
23
  getSeriesPointCount(index: number): number;
24
- /**
25
- * Returns the last CPU-side data set for the given series index.
26
- *
27
- * This is intended for internal metadata/hit-testing paths that need the same
28
- * input array that was packed into the GPU buffer (without re-threading it
29
- * through other state). Throws if the series has not been set yet.
30
- */
31
- getSeriesData(index: number): ReadonlyArray<DataPoint>;
32
24
  dispose(): void;
33
25
  }
34
26
  export declare function createDataStore(device: GPUDevice): DataStore;
@@ -1 +1 @@
1
- {"version":3,"file":"createDataStore.d.ts","sourceRoot":"","sources":["../../src/data/createDataStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAGjE,MAAM,WAAW,SAAS;IACxB,SAAS,CACP,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,EAC9B,OAAO,CAAC,EAAE,QAAQ,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GACvC,IAAI,CAAC;IACR;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACvE,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C;;;;OAIG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,OAAO,IAAI,IAAI,CAAC;CACjB;AAsDD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAgP5D"}
1
+ {"version":3,"file":"createDataStore.d.ts","sourceRoot":"","sources":["../../src/data/createDataStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,MAAM,WAAW,SAAS;IACxB,SAAS,CACP,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE,QAAQ,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GACvC,IAAI,CAAC;IACR;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClE,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C;;;;OAIG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C,OAAO,IAAI,IAAI,CAAC;CACjB;AAyDD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CA2O5D"}
@@ -1,3 +1,20 @@
1
- import type { DataPoint, SeriesSampling } from '../config/types';
2
- export declare function sampleSeriesDataPoints(data: ReadonlyArray<DataPoint>, sampling: SeriesSampling, samplingThreshold: number): ReadonlyArray<DataPoint>;
1
+ import type { CartesianSeriesData, SeriesSampling } from '../config/types';
2
+ /**
3
+ * Samples CartesianSeriesData using the specified sampling strategy.
4
+ *
5
+ * Returns the ORIGINAL data reference when:
6
+ * - `sampling === 'none'`
7
+ * - `samplingThreshold` is invalid/non-positive
8
+ * - Point count <= threshold
9
+ *
10
+ * When sampling occurs:
11
+ * - For `lttb`:
12
+ * - Float32Array interleaved → returns sampled Float32Array
13
+ * - Other interleaved typed array → packs to Float32Array, returns sampled Float32Array
14
+ * - DataPoint[] → returns sampled DataPoint[]
15
+ * - XYArraysData → packs to Float32Array, returns sampled Float32Array
16
+ * - For `average`/`max`/`min`:
17
+ * - Returns DataPointTuple[] for all input formats
18
+ */
19
+ export declare function sampleSeriesDataPoints(data: CartesianSeriesData, sampling: SeriesSampling, samplingThreshold: number): CartesianSeriesData;
3
20
  //# sourceMappingURL=sampleSeries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sampleSeries.d.ts","sourceRoot":"","sources":["../../src/data/sampleSeries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAkB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA+GjF,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,EAC9B,QAAQ,EAAE,cAAc,EACxB,iBAAiB,EAAE,MAAM,GACxB,aAAa,CAAC,SAAS,CAAC,CAsB1B"}
1
+ {"version":3,"file":"sampleSeries.d.ts","sourceRoot":"","sources":["../../src/data/sampleSeries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAoM3F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,cAAc,EACxB,iBAAiB,EAAE,MAAM,GACxB,mBAAmB,CA8CrB"}