recharts
Version:
React charts
29 lines (28 loc) • 1.4 kB
TypeScript
import { Reducer } from '@reduxjs/toolkit';
import { AxisViewport } from '../util/zoom/viewport';
/**
* The two spatial dimensions a cartesian chart can be zoomed along.
* `x` is shared by every horizontal axis, `y` by every vertical axis.
*/
export type ZoomDimension = 'x' | 'y';
/**
* Live zoom/pan state for a cartesian chart, expressed as a normalized {@link AxisViewport}
* per dimension.
*
* The default value is the full viewport on both dimensions, i.e. no zoom, which is why this
* slice is completely inert until something dispatches a zoom action: every selector derived
* from it sees "not zoomed" and the chart renders exactly as it does today.
*
* This slice intentionally holds only the *geometric* state. Configuration that comes from
* props (whether zoom is enabled, min/max scale, drag-to-zoom, ...) lives elsewhere so the
* runtime state and the user configuration stay decoupled.
*/
export type ZoomState = {
x: AxisViewport;
y: AxisViewport;
};
export declare const setAxisViewport: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
dimension: ZoomDimension;
viewport: AxisViewport;
}, "zoom/setAxisViewport">, setZoom: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZoomState, "zoom/setZoom">, resetZoom: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"zoom/resetZoom">;
export declare const zoomReducer: Reducer<ZoomState>;