UNPKG

@nova-ui/charts

Version:

Nova Charts is a library created to provide potential consumers with solutions for various data visualizations that conform with the Nova Design Language. It's designed to solve common patterns identified by UX designers, but also be very flexible so that

108 lines (107 loc) 3.97 kB
import { IScale, ScalesIndex } from "../common/scales/types"; import { D3Selection, IChart, IChartEvent, IChartPlugin } from "../common/types"; import { Grid } from "./grid"; import { IAxis, IAxisConfig, IGrid, IXYGridConfig } from "./types"; export declare class XYGrid extends Grid implements IGrid { static TICK_LABEL_OVERFLOW_DEBOUNCE_INTERVAL: number; protected axisX: IAxis; protected axisYLeft: IAxis; protected axisYRight: IAxis; protected gridY: IAxis; protected gridX: IAxis; private _bottomScaleId?; private _leftScaleId?; private _rightScaleId; private reconcileMarginsDebounce; private handleTickLabelOverflowDebounceIndex; /** * Returns the id of the bottom axis scale */ get bottomScaleId(): string | undefined; /** * Sets the id of the bottom axis scale */ set bottomScaleId(id: string | undefined); /** * Returns the id of the left axis scale */ get leftScaleId(): string | undefined; /** * Sets the id of the left axis scale */ set leftScaleId(id: string | undefined); /** * Returns the id of the right axis scale */ get rightScaleId(): string; /** * Sets the id of the right axis scale */ set rightScaleId(id: string); /** @ignore */ set scales(scales: ScalesIndex); /** @ignore */ get scales(): ScalesIndex; /** See {@link IGrid#config} */ config(): IXYGridConfig; /** See {@link IGrid#config} */ config(config: IXYGridConfig): this; constructor(config?: IXYGridConfig); /** See {@link IGrid#build} */ build(): IGrid; /** * Handle axis opacity when emphasizing/deemphasizing chart series * * @param e * @private */ handleSeriesStateChange(e: IChartEvent): Record<string, Record<string, any>> | undefined; /** * Return opacity for each axis * * @param e * @param axes * @private */ private calculateAxesStyles; /** See {@link IGrid#buildPlugins} */ buildPlugins(chart: IChart): IChartPlugin[]; /** See {@link IGrid#update} */ update(): IGrid; /** @ignore */ drawTicks(config: IAxisConfig, axis: IAxis, scale: IScale<any>, axisGenerator: any): void; /** @ignore */ drawGrids(config: IAxisConfig, axis: IAxis, axisGenerator: any, scale: IScale<any>, size: number): void; /** See {@link IGrid#updateRanges} */ updateRanges(): IGrid; protected updateXAxis(): void; protected updateYAxes(): void; protected updateAxes(): void; protected adjustAxisTicks(labelGroup: D3Selection<SVGGElement>, scale: IScale<any>): void; protected handleTickLabelOverflow(labelGroup: D3Selection<SVGGElement>, scale: IScale<any>, axisLabels: HTMLElement[]): void; protected selectAllAxisLabels(axisGroup: D3Selection<SVGGElement>): HTMLElement[]; protected getOuterWidthDimensionCorrection(): number; private handleMarginUpdate; private hasRightYAxis; private buildAxes; private filterRepeatedElements; private getElementsToHide; private elementsFiltering; private getTextMeasurement; private getMaxTextWidth; private getTickDistance; private recalculateMargins; private fitBottomAxis; /** * This method invokes updateRanges if the margins have changed, but only after a debounce period. * ---- * The debounce is necessary because, in the case of a very short axis, repeated attempts to * alternately fit axis labels and recalculate ticks may conflict with each other * causing the old and new margins to never be equal upon comparison. This scenario can cause a d3 * call stack overflow, but with a debounce, d3 can keep up with the recalculations until the chart * is resized to consistently accommodate the width of the labels. */ private reconcileMarginsWithDebounce; private isApproximatelyEqual; private areMarginsApproximatelyEqual; }