UNPKG

@actinc/dls

Version:

Design Language System (DLS) for ACT & Encoura front-end projects.

50 lines 3.04 kB
/** * Copyright (c) ACT, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import { ScatterPlotData } from "../../types"; import { CustomDomain, ICoordinate, IGroupDataPoint, IMinMaxData, IOffsets, IPixelConversions, IScatterDomain } from './types'; export declare function calculateRadius(groupSize?: number): number; /** * Iterates through the data points and merges them if they are within a specified distance of each other. */ export declare function buildDataPoints(data: Array<ScatterPlotData>, pxConversionDimensions: IPixelConversions): IGroupDataPoint[]; /** * Returns if any data labels should be hidden. First, it calculates where the labels are approx. going to * appear, then returns marks them as set up to be hidden. * * Return an object with the data point labels as keys, and a boolean. True if it should be hidden, * False if it should not. * * pxConversionDimension is the ratio between the data domain, and the panel width in pixel. * Since we only have each datapoint's X and Y data value, we use the conversion dimensions to * calculate where in the panel (in actual pixel coordinates) the datapoints are. */ export declare function evaluateLabels(data: IGroupDataPoint[], pxConversionDimensions: IPixelConversions): Record<string, boolean>; /** * Returns data min and max for x and y axis. */ export declare function getMinMax(data: Array<ScatterPlotData>): IMinMaxData; /** * This function calculates domain based on the data, but adds a bit of bleed to each side. * It will mainly be used if no domain prop is specified, or when zooming. */ export declare function getDomain(data: Array<ScatterPlotData>, [maxXSpread, maxYSpread]: [number, number]): IScatterDomain; /** * This function handles the domain should it come from the Component's props */ export declare function consolidateDomain(domain: CustomDomain, data: ScatterPlotData[], isY?: boolean): [number, number]; export declare function fixDecimal(num: number, decimals: number): number; /** * Find new domain based on zoom. Finds the amount the domains should shift based on zoom amount and current domain * values - but also hard stops the zoom from going beyond a certain domain limit. * * This stops the chart from zooming out past the point of initial zoom, or zooming in past the boundaries of the current * zoom. */ export declare function calculateDomainAfterZoom(currDomain: IScatterDomain, zoomAmount: number, limitDomain: IScatterDomain, clientX: number, clientY: number, pxConversionDimensions: IPixelConversions, plotHeight: number, plotWidth: number, offsets?: IOffsets): IScatterDomain; export declare function filterDataByDomain(data: ScatterPlotData[], domain: IScatterDomain): ScatterPlotData[]; export declare function dragDomain(dragAnchor: ICoordinate, newCoordinate: ICoordinate, currDomain: IScatterDomain, initialDomain: IScatterDomain): IScatterDomain; //# sourceMappingURL=processing.d.ts.map