import { LegendItem } from '../../../../common/legend' ; import { getDistance , Rotation } from '../../../../utils/common' ; import { Point } from '../../../../utils/point' ; import { BasicSeriesSpec , SeriesType } from '../../utils/specs' ; import { GeometriesCounts } from './types' ; internal export const MAX_ANIMATABLE_BARS = 300 ; internal export const MAX_ANIMATABLE_LINES_AREA_POINTS = 600 ; internal export function isHorizontalRotation ( chartRotation ) { return chartRotation === 0 || chartRotation === 180 ; } internal export function isVerticalRotation ( chartRotation ) { return chartRotation === - 90 || chartRotation === 90 ; } param specs internal export function isLineAreaOnlyChart ( specs ) { return ! specs . some ( ( spec ) => spec . seriesType === SeriesType . Bar ) ; } internal export function isChartAnimatable ( geometriesCounts , animationEnabled ) { if ( ! animationEnabled ) { return false ; } const { bars , linePoints , areasPoints } = geometriesCounts ; const isBarsAnimatable = bars <= MAX_ANIMATABLE_BARS ; const isLinesAndAreasAnimatable = linePoints + areasPoints <= MAX_ANIMATABLE_LINES_AREA_POINTS ; return isBarsAnimatable && isLinesAndAreasAnimatable ; } internal export function isAllSeriesDeselected ( legendItems ) { for ( const legendItem of legendItems ) { if ( ! legendItem . isSeriesHidden ) { return false ; } } return true ; } internal export const sortClosestToPoint = ( cursor ) => ( a , b ) : number => { return getDistance ( cursor , a ) - getDistance ( cursor , b ) ; } ;