chartgpu 0.1.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/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/ChartGPU.d.ts +74 -0
- package/dist/ChartGPU.d.ts.map +1 -0
- package/dist/components/createDataZoomSlider.d.ts +14 -0
- package/dist/components/createDataZoomSlider.d.ts.map +1 -0
- package/dist/components/createLegend.d.ts +9 -0
- package/dist/components/createLegend.d.ts.map +1 -0
- package/dist/components/createTextOverlay.d.ts +17 -0
- package/dist/components/createTextOverlay.d.ts.map +1 -0
- package/dist/components/createTooltip.d.ts +12 -0
- package/dist/components/createTooltip.d.ts.map +1 -0
- package/dist/components/formatTooltip.d.ts +12 -0
- package/dist/components/formatTooltip.d.ts.map +1 -0
- package/dist/config/OptionResolver.d.ts +97 -0
- package/dist/config/OptionResolver.d.ts.map +1 -0
- package/dist/config/defaults.d.ts +33 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/types.d.ts +224 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/core/GPUContext.d.ts +210 -0
- package/dist/core/GPUContext.d.ts.map +1 -0
- package/dist/core/RenderScheduler.d.ts +132 -0
- package/dist/core/RenderScheduler.d.ts.map +1 -0
- package/dist/core/createAnimationController.d.ts +15 -0
- package/dist/core/createAnimationController.d.ts.map +1 -0
- package/dist/core/createRenderCoordinator.d.ts +71 -0
- package/dist/core/createRenderCoordinator.d.ts.map +1 -0
- package/dist/data/createDataStore.d.ts +33 -0
- package/dist/data/createDataStore.d.ts.map +1 -0
- package/dist/data/createStreamBuffer.d.ts +20 -0
- package/dist/data/createStreamBuffer.d.ts.map +1 -0
- package/dist/data/lttbSample.d.ts +5 -0
- package/dist/data/lttbSample.d.ts.map +1 -0
- package/dist/data/sampleSeries.d.ts +3 -0
- package/dist/data/sampleSeries.d.ts.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5977 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/createChartSync.d.ts +12 -0
- package/dist/interaction/createChartSync.d.ts.map +1 -0
- package/dist/interaction/createEventManager.d.ts +24 -0
- package/dist/interaction/createEventManager.d.ts.map +1 -0
- package/dist/interaction/createHoverState.d.ts +20 -0
- package/dist/interaction/createHoverState.d.ts.map +1 -0
- package/dist/interaction/createInsideZoom.d.ts +14 -0
- package/dist/interaction/createInsideZoom.d.ts.map +1 -0
- package/dist/interaction/createZoomState.d.ts +37 -0
- package/dist/interaction/createZoomState.d.ts.map +1 -0
- package/dist/interaction/findNearestPoint.d.ts +61 -0
- package/dist/interaction/findNearestPoint.d.ts.map +1 -0
- package/dist/interaction/findPieSlice.d.ts +36 -0
- package/dist/interaction/findPieSlice.d.ts.map +1 -0
- package/dist/interaction/findPointsAtX.d.ts +37 -0
- package/dist/interaction/findPointsAtX.d.ts.map +1 -0
- package/dist/renderers/createAreaRenderer.d.ts +18 -0
- package/dist/renderers/createAreaRenderer.d.ts.map +1 -0
- package/dist/renderers/createAxisRenderer.d.ts +19 -0
- package/dist/renderers/createAxisRenderer.d.ts.map +1 -0
- package/dist/renderers/createBarRenderer.d.ts +20 -0
- package/dist/renderers/createBarRenderer.d.ts.map +1 -0
- package/dist/renderers/createCrosshairRenderer.d.ts +43 -0
- package/dist/renderers/createCrosshairRenderer.d.ts.map +1 -0
- package/dist/renderers/createGridRenderer.d.ts +44 -0
- package/dist/renderers/createGridRenderer.d.ts.map +1 -0
- package/dist/renderers/createHighlightRenderer.d.ts +39 -0
- package/dist/renderers/createHighlightRenderer.d.ts.map +1 -0
- package/dist/renderers/createLineRenderer.d.ts +18 -0
- package/dist/renderers/createLineRenderer.d.ts.map +1 -0
- package/dist/renderers/createPieRenderer.d.ts +18 -0
- package/dist/renderers/createPieRenderer.d.ts.map +1 -0
- package/dist/renderers/createScatterRenderer.d.ts +19 -0
- package/dist/renderers/createScatterRenderer.d.ts.map +1 -0
- package/dist/renderers/rendererUtils.d.ts +100 -0
- package/dist/renderers/rendererUtils.d.ts.map +1 -0
- package/dist/themes/darkTheme.d.ts +11 -0
- package/dist/themes/darkTheme.d.ts.map +1 -0
- package/dist/themes/index.d.ts +8 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/lightTheme.d.ts +11 -0
- package/dist/themes/lightTheme.d.ts.map +1 -0
- package/dist/themes/types.d.ts +14 -0
- package/dist/themes/types.d.ts.map +1 -0
- package/dist/utils/checkWebGPU.d.ts +39 -0
- package/dist/utils/checkWebGPU.d.ts.map +1 -0
- package/dist/utils/colors.d.ts +14 -0
- package/dist/utils/colors.d.ts.map +1 -0
- package/dist/utils/easing.d.ts +9 -0
- package/dist/utils/easing.d.ts.map +1 -0
- package/dist/utils/scales.d.ts +79 -0
- package/dist/utils/scales.d.ts.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartGPU } from '../ChartGPU';
|
|
2
|
+
export type DisconnectCharts = () => void;
|
|
3
|
+
/**
|
|
4
|
+
* Connects multiple charts so pointer movement in one chart drives crosshair/tooltip x
|
|
5
|
+
* in the other charts (domain x sync). Returns a `disconnect()` function.
|
|
6
|
+
*
|
|
7
|
+
* Notes:
|
|
8
|
+
* - Syncs interaction only (crosshair + tooltip x), not zoom/options.
|
|
9
|
+
* - Uses a per-connection loop guard to prevent feedback.
|
|
10
|
+
*/
|
|
11
|
+
export declare function connectCharts(charts: ChartGPU[]): DisconnectCharts;
|
|
12
|
+
//# sourceMappingURL=createChartSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createChartSync.d.ts","sourceRoot":"","sources":["../../src/interaction/createChartSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAgC,MAAM,aAAa,CAAC;AAE1E,MAAM,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAE1C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CA0ClE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { GridArea } from '../renderers/createGridRenderer';
|
|
2
|
+
export type ChartGPUEventName = 'mousemove' | 'click' | 'mouseleave';
|
|
3
|
+
export type ChartGPUEventPayload = {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
readonly gridX: number;
|
|
7
|
+
readonly gridY: number;
|
|
8
|
+
/** Plot (grid) width in CSS pixels. */
|
|
9
|
+
readonly plotWidthCss: number;
|
|
10
|
+
/** Plot (grid) height in CSS pixels. */
|
|
11
|
+
readonly plotHeightCss: number;
|
|
12
|
+
readonly isInGrid: boolean;
|
|
13
|
+
readonly originalEvent: PointerEvent;
|
|
14
|
+
};
|
|
15
|
+
export type ChartGPUEventCallback = (payload: ChartGPUEventPayload) => void;
|
|
16
|
+
export interface EventManager {
|
|
17
|
+
readonly canvas: HTMLCanvasElement;
|
|
18
|
+
on(event: ChartGPUEventName, callback: ChartGPUEventCallback): void;
|
|
19
|
+
off(event: ChartGPUEventName, callback: ChartGPUEventCallback): void;
|
|
20
|
+
updateGridArea(gridArea: GridArea): void;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function createEventManager(canvas: HTMLCanvasElement, initialGridArea: GridArea): EventManager;
|
|
24
|
+
//# sourceMappingURL=createEventManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEventManager.d.ts","sourceRoot":"","sources":["../../src/interaction/createEventManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,OAAO,GAAG,YAAY,CAAC;AAErE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,wCAAwC;IACxC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;AAE5E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACpE,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACrE,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzC,OAAO,IAAI,IAAI,CAAC;CACjB;AAcD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,EAAE,eAAe,EAAE,QAAQ,GAAG,YAAY,CA6KrG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type HoverTarget = Readonly<{
|
|
2
|
+
seriesIndex: number;
|
|
3
|
+
dataIndex: number;
|
|
4
|
+
}>;
|
|
5
|
+
export type HoverChangeCallback = (hovered: HoverTarget | null) => void;
|
|
6
|
+
export interface HoverState {
|
|
7
|
+
setHovered(seriesIndex: number, dataIndex: number): void;
|
|
8
|
+
clearHovered(): void;
|
|
9
|
+
getHovered(): HoverTarget | null;
|
|
10
|
+
onChange(callback: HoverChangeCallback): () => void;
|
|
11
|
+
destroy?: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Tracks hovered series/data indices and notifies listeners on changes.
|
|
15
|
+
*
|
|
16
|
+
* - Updates are debounced to avoid spamming downstream work during rapid pointer movement.
|
|
17
|
+
* - Listeners fire only when the hovered target actually changes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createHoverState(): HoverState;
|
|
20
|
+
//# sourceMappingURL=createHoverState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createHoverState.d.ts","sourceRoot":"","sources":["../../src/interaction/createHoverState.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;AAExE,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzD,YAAY,IAAI,IAAI,CAAC;IACrB,UAAU,IAAI,WAAW,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAmBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAgE7C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EventManager } from './createEventManager';
|
|
2
|
+
import type { ZoomState } from './createZoomState';
|
|
3
|
+
export type InsideZoom = Readonly<{
|
|
4
|
+
enable(): void;
|
|
5
|
+
disable(): void;
|
|
6
|
+
dispose(): void;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Internal “inside” zoom interaction:
|
|
10
|
+
* - wheel zoom centered at cursor-x (only when inside grid)
|
|
11
|
+
* - shift+left drag OR middle-mouse drag pans left/right (only when inside grid)
|
|
12
|
+
*/
|
|
13
|
+
export declare function createInsideZoom(eventManager: EventManager, zoomState: ZoomState): InsideZoom;
|
|
14
|
+
//# sourceMappingURL=createInsideZoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInsideZoom.d.ts","sourceRoot":"","sources":["../../src/interaction/createInsideZoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAwB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,IAAI,IAAI,CAAC;CACjB,CAAC,CAAC;AAsCH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,CAgH7F"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type ZoomRange = Readonly<{
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
}>;
|
|
5
|
+
export type ZoomRangeChangeCallback = (range: ZoomRange) => void;
|
|
6
|
+
export interface ZoomState {
|
|
7
|
+
/**
|
|
8
|
+
* Returns the current zoom window in percent space, clamped to [0, 100].
|
|
9
|
+
*/
|
|
10
|
+
getRange(): ZoomRange;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the zoom window in percent space.
|
|
13
|
+
*/
|
|
14
|
+
setRange(start: number, end: number): void;
|
|
15
|
+
/**
|
|
16
|
+
* Zooms in around `center` by shrinking the span by `factor`.
|
|
17
|
+
*
|
|
18
|
+
* `factor <= 1` is treated as a no-op.
|
|
19
|
+
*/
|
|
20
|
+
zoomIn(center: number, factor: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Zooms out around `center` by growing the span by `factor`.
|
|
23
|
+
*
|
|
24
|
+
* `factor <= 1` is treated as a no-op.
|
|
25
|
+
*/
|
|
26
|
+
zoomOut(center: number, factor: number): void;
|
|
27
|
+
/**
|
|
28
|
+
* Pans the zoom window by `delta` percent points (preserving span).
|
|
29
|
+
*/
|
|
30
|
+
pan(delta: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Subscribes to changes. Returns an unsubscribe function.
|
|
33
|
+
*/
|
|
34
|
+
onChange(callback: ZoomRangeChangeCallback): () => void;
|
|
35
|
+
}
|
|
36
|
+
export declare function createZoomState(initialStart: number, initialEnd: number): ZoomState;
|
|
37
|
+
//# sourceMappingURL=createZoomState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createZoomState.d.ts","sourceRoot":"","sources":["../../src/interaction/createZoomState.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEjE,MAAM,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;AAEjE,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,IAAI,SAAS,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,IAAI,CAAC;CACzD;AAYD,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CA4JnF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { DataPoint } from '../config/types';
|
|
2
|
+
import type { ResolvedBarSeriesConfig, ResolvedSeriesConfig } from '../config/OptionResolver';
|
|
3
|
+
import type { LinearScale } from '../utils/scales';
|
|
4
|
+
export type NearestPointMatch = Readonly<{
|
|
5
|
+
seriesIndex: number;
|
|
6
|
+
dataIndex: number;
|
|
7
|
+
point: DataPoint;
|
|
8
|
+
/** Euclidean distance in range units. */
|
|
9
|
+
distance: number;
|
|
10
|
+
}>;
|
|
11
|
+
export type BarBounds = {
|
|
12
|
+
left: number;
|
|
13
|
+
right: number;
|
|
14
|
+
top: number;
|
|
15
|
+
bottom: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function isPointInBar(x: number, y: number, barBounds: BarBounds): boolean;
|
|
18
|
+
export type BarClusterSlots = Readonly<{
|
|
19
|
+
clusterIndexBySeries: ReadonlyArray<number>;
|
|
20
|
+
clusterCount: number;
|
|
21
|
+
stackIdBySeries: ReadonlyArray<string>;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function computeBarClusterSlots(seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>): BarClusterSlots;
|
|
24
|
+
export declare function computeBarCategoryStep(seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>): number;
|
|
25
|
+
export declare function computeCategoryWidthPx(seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, xScale: LinearScale, categoryStep: number): number;
|
|
26
|
+
export type BarLayoutPx = Readonly<{
|
|
27
|
+
categoryStep: number;
|
|
28
|
+
categoryWidthPx: number;
|
|
29
|
+
barWidthPx: number;
|
|
30
|
+
gapPx: number;
|
|
31
|
+
clusterWidthPx: number;
|
|
32
|
+
clusterSlots: BarClusterSlots;
|
|
33
|
+
}>;
|
|
34
|
+
export declare function computeBarLayoutPx(seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, xScale: LinearScale): BarLayoutPx;
|
|
35
|
+
export declare function inferPlotHeightPxForBarHitTesting(seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, yScale: LinearScale): number;
|
|
36
|
+
export declare function computeBaselineDomainAndPx(seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, yScale: LinearScale, plotHeightPx: number): Readonly<{
|
|
37
|
+
baselineDomain: number;
|
|
38
|
+
baselinePx: number;
|
|
39
|
+
}>;
|
|
40
|
+
export declare function bucketStackedXKey(xCenterPx: number, categoryWidthPx: number, xDomain: number, categoryStep: number): number;
|
|
41
|
+
/**
|
|
42
|
+
* Finds the nearest data point to the given cursor position across all series.
|
|
43
|
+
*
|
|
44
|
+
* Coordinate system contract:
|
|
45
|
+
* - `x`/`y` MUST be in the same units as `xScale`/`yScale` **range**.
|
|
46
|
+
* - If you pass **grid-local CSS pixels** (e.g. `payload.gridX` / `payload.gridY` from `createEventManager`),
|
|
47
|
+
* then `xScale.range()` / `yScale.range()` must also be in **CSS pixels**.
|
|
48
|
+
* - If your scales are in **clip space** (e.g. \([-1, 1]\)), pass cursor coordinates in clip space too.
|
|
49
|
+
*
|
|
50
|
+
* DPR/WebGPU note:
|
|
51
|
+
* - Pointer events are naturally in CSS pixels; WebGPU rendering often uses device pixels or clip space.
|
|
52
|
+
* This helper stays agnostic and only computes Euclidean distance in the provided **range-space**.
|
|
53
|
+
*
|
|
54
|
+
* Performance notes:
|
|
55
|
+
* - Assumes each series is sorted by increasing x in domain space.
|
|
56
|
+
* - Uses per-series lower-bound binary search on x, then expands outward while x-distance alone can still win.
|
|
57
|
+
* - Uses squared distance comparisons and computes `sqrt` only for the final match.
|
|
58
|
+
* - Skips non-finite points and any points whose scaled coordinates are NaN.
|
|
59
|
+
*/
|
|
60
|
+
export declare function findNearestPoint(series: ReadonlyArray<ResolvedSeriesConfig>, x: number, y: number, xScale: LinearScale, yScale: LinearScale, maxDistance?: number): NearestPointMatch | null;
|
|
61
|
+
//# sourceMappingURL=findNearestPoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findNearestPoint.d.ts","sourceRoot":"","sources":["../../src/interaction/findNearestPoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAqC,MAAM,iBAAiB,CAAC;AACpF,OAAO,KAAK,EACV,uBAAuB,EAEvB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAWnD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAKH,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAErF,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAShF;AAkHD,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACxC,CAAC,CAAC;AAEH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,aAAa,CAAC,uBAAuB,CAAC,GACpD,eAAe,CAgCjB;AAED,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,aAAa,CAAC,uBAAuB,CAAC,GAAG,MAAM,CAmBpG;AAED,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,aAAa,CAAC,uBAAuB,CAAC,EACrD,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM,CA+BR;AAyBD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC,CAAC;AAEH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,aAAa,CAAC,uBAAuB,CAAC,EACrD,MAAM,EAAE,WAAW,GAClB,WAAW,CAuCb;AAqBD,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,aAAa,CAAC,uBAAuB,CAAC,EACrD,MAAM,EAAE,WAAW,GAClB,MAAM,CAeR;AAED,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,aAAa,CAAC,uBAAuB,CAAC,EACrD,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,MAAM,GACnB,QAAQ,CAAC;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAgC1D;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAWR;AAgCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAC3C,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,WAAW,GAAE,MAAgC,GAC5C,iBAAiB,GAAG,IAAI,CAuY1B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ResolvedPieSeriesConfig } from '../config/OptionResolver';
|
|
2
|
+
export type PieSliceMatch = Readonly<{
|
|
3
|
+
seriesIndex: number;
|
|
4
|
+
dataIndex: number;
|
|
5
|
+
slice: ResolvedPieSeriesConfig['data'][number];
|
|
6
|
+
}>;
|
|
7
|
+
export type PieHitTestConfig = Readonly<{
|
|
8
|
+
seriesIndex: number;
|
|
9
|
+
series: ResolvedPieSeriesConfig;
|
|
10
|
+
}>;
|
|
11
|
+
export type PieCenterCssPx = Readonly<{
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}>;
|
|
15
|
+
export type PieRadiusCssPx = Readonly<{
|
|
16
|
+
inner: number;
|
|
17
|
+
outer: number;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Finds the pie slice under a given pointer position.
|
|
21
|
+
*
|
|
22
|
+
* Coordinate contract:
|
|
23
|
+
* - `x`/`y` are plot/grid-local CSS pixels (origin at plot top-left, +y down).
|
|
24
|
+
* - `center` is plot-local CSS pixels.
|
|
25
|
+
* - `radius` is CSS pixels (inner/outer). Points within the donut hole are not hoverable.
|
|
26
|
+
*
|
|
27
|
+
* Angle conventions:
|
|
28
|
+
* - Uses +y up for polar angle (to match `pie.wgsl` atan2(p.y, p.x)).
|
|
29
|
+
* - Wraps angles to [0, 2π).
|
|
30
|
+
* - Matches `createPieRenderer.ts` start angle default (90°).
|
|
31
|
+
*
|
|
32
|
+
* Value conventions:
|
|
33
|
+
* - Ignores non-finite and non-positive slice values (mirrors renderer).
|
|
34
|
+
*/
|
|
35
|
+
export declare function findPieSlice(x: number, y: number, pieConfig: PieHitTestConfig, center: PieCenterCssPx, radius: PieRadiusCssPx): PieSliceMatch | null;
|
|
36
|
+
//# sourceMappingURL=findPieSlice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findPieSlice.d.ts","sourceRoot":"","sources":["../../src/interaction/findPieSlice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAUxE,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;CAChD,CAAC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,uBAAuB,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,GACrB,aAAa,GAAG,IAAI,CA+EtB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DataPoint } from '../config/types';
|
|
2
|
+
import type { ResolvedSeriesConfig } from '../config/OptionResolver';
|
|
3
|
+
import type { LinearScale } from '../utils/scales';
|
|
4
|
+
export type PointsAtXMatch = Readonly<{
|
|
5
|
+
seriesIndex: number;
|
|
6
|
+
dataIndex: number;
|
|
7
|
+
point: DataPoint;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Finds (at most) one nearest point per series at a given x position.
|
|
11
|
+
*
|
|
12
|
+
* Coordinate system contract (mirrors `findNearestPoint`):
|
|
13
|
+
* - `xValue` and optional `tolerance` MUST be in the same units as `xScale` **range**.
|
|
14
|
+
* (Example: if your `xScale.range()` is in grid-local CSS pixels, pass `payload.gridX` from `createEventManager`.)
|
|
15
|
+
* Note: ChartGPU's internal renderer scales are currently in clip space (NDC, typically \[-1, 1\]); in that case
|
|
16
|
+
* convert your pointer x into clip space before calling this helper.
|
|
17
|
+
*
|
|
18
|
+
* Behavior:
|
|
19
|
+
* - Assumes each series is sorted by increasing x in domain space.
|
|
20
|
+
* - Uses a lower-bound binary search in domain-x, then expands outward while x-distance alone can still improve.
|
|
21
|
+
* - Skips points with non-finite domain x or non-finite scaled x. If a series contains any NaN x values, this helper
|
|
22
|
+
* falls back to an O(n) scan for correctness (NaN breaks total ordering for binary search).
|
|
23
|
+
* - Stable tie-breaking: for equal distance, chooses the smaller `dataIndex`.
|
|
24
|
+
*
|
|
25
|
+
* If `tolerance` is provided, it is interpreted in **xScale range units**. Matches beyond tolerance are omitted.
|
|
26
|
+
* If `tolerance` is omitted (or non-finite), the nearest point per series is returned when possible.
|
|
27
|
+
*
|
|
28
|
+
* Bar series special-case:
|
|
29
|
+
* - Bars occupy x-intervals \([left, right)\) in **xScale range units** (grid-local CSS px for interaction scales),
|
|
30
|
+
* using the same shared layout math as the bar renderer (grouping + stacking slots).
|
|
31
|
+
* - If `tolerance` is finite, a bar match is only returned when `xValue` falls inside the bar interval expanded by
|
|
32
|
+
* `tolerance` on both sides: \([left - tolerance, right + tolerance)\).
|
|
33
|
+
* - If `tolerance` is omitted / non-finite, we first attempt an exact interval hit (no expansion) and otherwise fall
|
|
34
|
+
* back to the existing nearest-x behavior (so axis-trigger tooltips still work away from bars).
|
|
35
|
+
*/
|
|
36
|
+
export declare function findPointsAtX(series: ReadonlyArray<ResolvedSeriesConfig>, xValue: number, xScale: LinearScale, tolerance?: number): ReadonlyArray<PointsAtXMatch>;
|
|
37
|
+
//# sourceMappingURL=findPointsAtX.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findPointsAtX.d.ts","sourceRoot":"","sources":["../../src/interaction/findPointsAtX.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAA2B,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC,CAAC;AA6GH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAC3C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,aAAa,CAAC,cAAc,CAAC,CA6P/B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ResolvedAreaSeriesConfig } from '../config/OptionResolver';
|
|
2
|
+
import type { LinearScale } from '../utils/scales';
|
|
3
|
+
export interface AreaRenderer {
|
|
4
|
+
prepare(seriesConfig: ResolvedAreaSeriesConfig, data: ResolvedAreaSeriesConfig['data'], xScale: LinearScale, yScale: LinearScale, baseline?: number): void;
|
|
5
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
6
|
+
dispose(): void;
|
|
7
|
+
}
|
|
8
|
+
export interface AreaRendererOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
11
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
14
|
+
*/
|
|
15
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
16
|
+
}
|
|
17
|
+
export declare function createAreaRenderer(device: GPUDevice, options?: AreaRendererOptions): AreaRenderer;
|
|
18
|
+
//# sourceMappingURL=createAreaRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAreaRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createAreaRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,WAAW,YAAY;IAC3B,OAAO,CACL,YAAY,EAAE,wBAAwB,EACtC,IAAI,EAAE,wBAAwB,CAAC,MAAM,CAAC,EACtC,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAAC;IACR,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAuGD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAyKjG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AxisConfig } from '../config/types';
|
|
2
|
+
import type { LinearScale } from '../utils/scales';
|
|
3
|
+
import type { GridArea } from './createGridRenderer';
|
|
4
|
+
export interface AxisRenderer {
|
|
5
|
+
prepare(axisConfig: AxisConfig, scale: LinearScale, orientation: 'x' | 'y', gridArea: GridArea, axisLineColor?: string, axisTickColor?: string): void;
|
|
6
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface AxisRendererOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
12
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
13
|
+
*
|
|
14
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
15
|
+
*/
|
|
16
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
17
|
+
}
|
|
18
|
+
export declare function createAxisRenderer(device: GPUDevice, options?: AxisRendererOptions): AxisRenderer;
|
|
19
|
+
//# sourceMappingURL=createAxisRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAxisRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createAxisRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,MAAM,WAAW,YAAY;IAC3B,OAAO,CACL,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,WAAW,EAClB,WAAW,EAAE,GAAG,GAAG,GAAG,EACtB,QAAQ,EAAE,QAAQ,EAClB,aAAa,CAAC,EAAE,MAAM,EACtB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CAAC;IACR,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AA6HD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,YAAY,CA8KjG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ResolvedBarSeriesConfig } from '../config/OptionResolver';
|
|
2
|
+
import type { LinearScale } from '../utils/scales';
|
|
3
|
+
import type { GridArea } from './createGridRenderer';
|
|
4
|
+
import type { DataStore } from '../data/createDataStore';
|
|
5
|
+
export interface BarRenderer {
|
|
6
|
+
prepare(seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, dataStore: DataStore, xScale: LinearScale, yScale: LinearScale, gridArea: GridArea): void;
|
|
7
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
8
|
+
dispose(): void;
|
|
9
|
+
}
|
|
10
|
+
export interface BarRendererOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
13
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
14
|
+
*
|
|
15
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
16
|
+
*/
|
|
17
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
18
|
+
}
|
|
19
|
+
export declare function createBarRenderer(device: GPUDevice, options?: BarRendererOptions): BarRenderer;
|
|
20
|
+
//# sourceMappingURL=createBarRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBarRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createBarRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGzD,MAAM,WAAW,WAAW;IAC1B,OAAO,CACL,aAAa,EAAE,aAAa,CAAC,uBAAuB,CAAC,EACrD,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,QAAQ,GACjB,IAAI,CAAC;IACR,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAsGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,WAAW,CAmY9F"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GridArea } from './createGridRenderer';
|
|
2
|
+
export interface CrosshairRenderOptions {
|
|
3
|
+
/** Whether to render the vertical crosshair line. */
|
|
4
|
+
readonly showX: boolean;
|
|
5
|
+
/** Whether to render the horizontal crosshair line. */
|
|
6
|
+
readonly showY: boolean;
|
|
7
|
+
/** CSS color string for the crosshair lines. */
|
|
8
|
+
readonly color: string;
|
|
9
|
+
/**
|
|
10
|
+
* Desired line width in CSS pixels.
|
|
11
|
+
*
|
|
12
|
+
* Note: WebGPU wide lines are not reliably supported; the renderer emulates thickness by
|
|
13
|
+
* drawing multiple 1px lines in device-pixel offsets (best-effort, deterministic).
|
|
14
|
+
*/
|
|
15
|
+
readonly lineWidth: number;
|
|
16
|
+
}
|
|
17
|
+
export interface CrosshairRenderer {
|
|
18
|
+
/**
|
|
19
|
+
* Positions the crosshair for rendering.
|
|
20
|
+
*
|
|
21
|
+
* Coordinate contract:
|
|
22
|
+
* - `x`, `y` are CANVAS-LOCAL CSS pixels (e.g. eventManager payload x/y)
|
|
23
|
+
* - `gridArea` margins are CSS pixels; `gridArea.canvasWidth/Height` are device pixels
|
|
24
|
+
*/
|
|
25
|
+
prepare(x: number, y: number, gridArea: GridArea, options: CrosshairRenderOptions): void;
|
|
26
|
+
/** Draws the crosshair (if visible) clipped to the plot rect. */
|
|
27
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
28
|
+
/** Shows/hides the crosshair without destroying GPU resources. */
|
|
29
|
+
setVisible(visible: boolean): void;
|
|
30
|
+
/** Cleans up GPU resources (best-effort). */
|
|
31
|
+
dispose(): void;
|
|
32
|
+
}
|
|
33
|
+
export interface CrosshairRendererOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
36
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
37
|
+
*
|
|
38
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
39
|
+
*/
|
|
40
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
41
|
+
}
|
|
42
|
+
export declare function createCrosshairRenderer(device: GPUDevice, options?: CrosshairRendererOptions): CrosshairRenderer;
|
|
43
|
+
//# sourceMappingURL=createCrosshairRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCrosshairRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createCrosshairRenderer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACzF,iEAAiE;IACjE,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,kEAAkE;IAClE,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,6CAA6C;IAC7C,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AA8MD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,iBAAiB,CA+IhH"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface GridRenderer {
|
|
2
|
+
/**
|
|
3
|
+
* Backward compatible:
|
|
4
|
+
* - `prepare(gridArea, lineCount)` where `lineCount` is `{ horizontal?, vertical? }`
|
|
5
|
+
*
|
|
6
|
+
* Preferred:
|
|
7
|
+
* - `prepare(gridArea, { lineCount, color })`
|
|
8
|
+
*/
|
|
9
|
+
prepare(gridArea: GridArea, lineCountOrOptions?: GridLineCount | GridPrepareOptions): void;
|
|
10
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
}
|
|
13
|
+
export interface GridArea {
|
|
14
|
+
readonly left: number;
|
|
15
|
+
readonly right: number;
|
|
16
|
+
readonly top: number;
|
|
17
|
+
readonly bottom: number;
|
|
18
|
+
readonly canvasWidth: number;
|
|
19
|
+
readonly canvasHeight: number;
|
|
20
|
+
}
|
|
21
|
+
export interface GridLineCount {
|
|
22
|
+
readonly horizontal?: number;
|
|
23
|
+
readonly vertical?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface GridPrepareOptions {
|
|
26
|
+
readonly lineCount?: GridLineCount;
|
|
27
|
+
/**
|
|
28
|
+
* CSS color string used for grid lines.
|
|
29
|
+
*
|
|
30
|
+
* Expected formats: `#rgb`, `#rrggbb`, `#rrggbbaa`, `rgb(r,g,b)`, `rgba(r,g,b,a)`.
|
|
31
|
+
*/
|
|
32
|
+
readonly color?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface GridRendererOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
37
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
38
|
+
*
|
|
39
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
40
|
+
*/
|
|
41
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
42
|
+
}
|
|
43
|
+
export declare function createGridRenderer(device: GPUDevice, options?: GridRendererOptions): GridRenderer;
|
|
44
|
+
//# sourceMappingURL=createGridRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGridRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createGridRenderer.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EAAE,aAAa,GAAG,kBAAkB,GAAG,IAAI,CAAC;IAC3F,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAmFD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAmLjG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type HighlightPoint = Readonly<{
|
|
2
|
+
/** Center in *device pixels* (same coordinate space as fragment `@builtin(position)`). */
|
|
3
|
+
centerDeviceX: number;
|
|
4
|
+
centerDeviceY: number;
|
|
5
|
+
/** Canvas dimensions in *device pixels* (used to reset scissor). */
|
|
6
|
+
canvasWidth: number;
|
|
7
|
+
canvasHeight: number;
|
|
8
|
+
/** Plot scissor rect in *device pixels*. */
|
|
9
|
+
scissor: Readonly<{
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
w: number;
|
|
13
|
+
h: number;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
16
|
+
export interface HighlightRenderer {
|
|
17
|
+
/**
|
|
18
|
+
* Prepares the highlight ring.
|
|
19
|
+
*
|
|
20
|
+
* Coordinate contract:
|
|
21
|
+
* - `point.centerDeviceX/Y` are device pixels in the same space as fragment `@builtin(position)`.
|
|
22
|
+
* - `size` is specified in CSS pixels; the renderer will scale it by DPR.
|
|
23
|
+
*/
|
|
24
|
+
prepare(point: HighlightPoint, color: string, size: number): void;
|
|
25
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
26
|
+
setVisible(visible: boolean): void;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
}
|
|
29
|
+
export interface HighlightRendererOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
32
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
33
|
+
*
|
|
34
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
35
|
+
*/
|
|
36
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
37
|
+
}
|
|
38
|
+
export declare function createHighlightRenderer(device: GPUDevice, options?: HighlightRendererOptions): HighlightRenderer;
|
|
39
|
+
//# sourceMappingURL=createHighlightRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createHighlightRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createHighlightRenderer.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,0FAA0F;IAC1F,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IAEtB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IAErB,4CAA4C;IAC5C,OAAO,EAAE,QAAQ,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE,CAAC,CAAC;AAEH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAClE,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAmBD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,iBAAiB,CA4IhH"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ResolvedLineSeriesConfig } from '../config/OptionResolver';
|
|
2
|
+
import type { LinearScale } from '../utils/scales';
|
|
3
|
+
export interface LineRenderer {
|
|
4
|
+
prepare(seriesConfig: ResolvedLineSeriesConfig, dataBuffer: GPUBuffer, xScale: LinearScale, yScale: LinearScale): void;
|
|
5
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
6
|
+
dispose(): void;
|
|
7
|
+
}
|
|
8
|
+
export interface LineRendererOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
11
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
14
|
+
*/
|
|
15
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
16
|
+
}
|
|
17
|
+
export declare function createLineRenderer(device: GPUDevice, options?: LineRendererOptions): LineRenderer;
|
|
18
|
+
//# sourceMappingURL=createLineRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLineRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createLineRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,YAAY,EAAE,wBAAwB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACvH,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAqFD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAmHjG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ResolvedPieSeriesConfig } from '../config/OptionResolver';
|
|
2
|
+
import type { GridArea } from './createGridRenderer';
|
|
3
|
+
export interface PieRenderer {
|
|
4
|
+
prepare(seriesConfig: ResolvedPieSeriesConfig, gridArea: GridArea): void;
|
|
5
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
6
|
+
dispose(): void;
|
|
7
|
+
}
|
|
8
|
+
export interface PieRendererOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
11
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
14
|
+
*/
|
|
15
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
16
|
+
}
|
|
17
|
+
export declare function createPieRenderer(device: GPUDevice, options?: PieRendererOptions): PieRenderer;
|
|
18
|
+
//# sourceMappingURL=createPieRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPieRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createPieRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAGxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,YAAY,EAAE,uBAAuB,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzE,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAiID,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,WAAW,CAqR9F"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ResolvedScatterSeriesConfig } from '../config/OptionResolver';
|
|
2
|
+
import type { LinearScale } from '../utils/scales';
|
|
3
|
+
import type { GridArea } from './createGridRenderer';
|
|
4
|
+
export interface ScatterRenderer {
|
|
5
|
+
prepare(seriesConfig: ResolvedScatterSeriesConfig, data: ResolvedScatterSeriesConfig['data'], xScale: LinearScale, yScale: LinearScale, gridArea?: GridArea): void;
|
|
6
|
+
render(passEncoder: GPURenderPassEncoder): void;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface ScatterRendererOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Must match the canvas context format used for the render pass color attachment.
|
|
12
|
+
* Usually this is `gpuContext.preferredFormat`.
|
|
13
|
+
*
|
|
14
|
+
* Defaults to `'bgra8unorm'` for backward compatibility.
|
|
15
|
+
*/
|
|
16
|
+
readonly targetFormat?: GPUTextureFormat;
|
|
17
|
+
}
|
|
18
|
+
export declare function createScatterRenderer(device: GPUDevice, options?: ScatterRendererOptions): ScatterRenderer;
|
|
19
|
+
//# sourceMappingURL=createScatterRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createScatterRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/createScatterRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,MAAM,WAAW,eAAe;IAC9B,OAAO,CACL,YAAY,EAAE,2BAA2B,EACzC,IAAI,EAAE,2BAA2B,CAAC,MAAM,CAAC,EACzC,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,QAAQ,CAAC,EAAE,QAAQ,GAClB,IAAI,CAAC;IACR,MAAM,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAiID,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,eAAe,CA6O1G"}
|