recharts
Version:
React charts
28 lines (27 loc) • 1.41 kB
TypeScript
import { Coordinate } from '../types';
import { AxisViewport } from './viewport';
type PlotArea = {
x: number;
y: number;
width: number;
height: number;
};
type ZoomStateLike = {
x: AxisViewport;
y: AxisViewport;
};
export declare function resizeViewportAroundCenter(viewport: AxisViewport, targetWidth: number): AxisViewport;
export declare function getUniformZoomState(zoom: ZoomStateLike): ZoomStateLike;
/**
* Returns the render-time viewport projection for a camera-zoom chart, or `undefined` for charts
* whose x/y scales already apply zoom. This never mutates or normalizes the public/store viewport.
*/
export declare function getCameraZoomState(chartName: string | undefined, zoom: ZoomStateLike): ZoomStateLike | undefined;
export declare function getZoomTransformForPlot(plot: PlotArea, zoom: ZoomStateLike): string | null;
export declare function transformCoordinateByZoom(coordinate: Coordinate | undefined, plot: PlotArea, zoom: ZoomStateLike): Coordinate | undefined;
/**
* Projects a raw SVG coordinate into wrapper/screen space for camera-zoom charts. Scale-based
* cartesian charts are returned unchanged because their coordinates already include range zoom.
*/
export declare function transformCoordinateByCameraZoom(coordinate: Coordinate | undefined, plot: PlotArea, chartName: string | undefined, zoom: ZoomStateLike): Coordinate | undefined;
export {};