UNPKG

@gooddata/react-components

Version:

GoodData.UI - A powerful JavaScript library for building analytical applications

57 lines (56 loc) 2.14 kB
/** * Highcharts extension that overwrites 'axis.adjustTickAmount' of Highcharts * Original code snippet * https://github.com/highcharts/highcharts/blob/b54fe33d91c0d1fd7da009aaa84af694f15cffad/js/parts/Axis.js#L4214 * * Modified by binh.nguyen@gooddata.com to support zero alignment */ import { IHighchartsAxisExtend } from "../../../../../interfaces/HighchartsExtend"; export declare const ALIGNED = 0; export declare const MOVE_ZERO_LEFT = -1; export declare const MOVE_ZERO_RIGHT = 1; export declare const Y_AXIS_SCORE: { NO_DATA: number; ONLY_NEGATIVE_OR_POSITIVE_DATA: number; NEGATIVE_AND_POSITIVE_DATA: number; }; /** * Get direction to make secondary axis align to primary axis * @param primaryAxis * @param secondaryAxis * @return * -1: move zero index to left * 0: it aligns * 1: move zero index to right */ export declare function getDirection(primaryAxis: IHighchartsAxisExtend, secondaryAxis: IHighchartsAxisExtend): number; /** * Add or reduce ticks * @param axis */ export declare function adjustTicks(axis: IHighchartsAxisExtend): void; export declare function getSelectionRange(axis: IHighchartsAxisExtend): number[]; /** * Get axis score that increase 1 for data having positive and negative values * @param Y axis * @return Y axis score */ export declare function getYAxisScore(axis: IHighchartsAxisExtend): number; export declare function alignToBaseAxis(yAxis: IHighchartsAxisExtend, baseYAxis: IHighchartsAxisExtend): void; /** * Prevent data is cut off by increasing tick interval to zoom out axis * Only apply to chart without user-input min/max * @param axis */ export declare function preventDataCutOff(axis: IHighchartsAxisExtend): void; /** * Copy and modify Highcharts behavior */ export declare function customAdjustTickAmount(): void; /** * Decide whether run default or custom behavior * @param axis * @return true as leaving to HC, otherwise false as running custom behavior */ export declare function shouldBeHandledByHighcharts(axis: IHighchartsAxisExtend): boolean; export declare const adjustTickAmount: (HighchartsInstance: any) => void;