'use strict' ; import type ScatterPoint from './ScatterPoint' ; import type ScatterSeriesOptions from './ScatterSeriesOptions' ; import ColumnSeries from '../Column/ColumnSeries.js' ; import LineSeries from '../Line/LineSeries.js' ; import SeriesRegistry from '../../Core/Series/SeriesRegistry.js' ; import U from '../../Core/Utilities.js' ; const { addEvent , extend , merge } = U ; private class ScatterSeries extends LineSeries { sample extends plotOptions . line excluding product optionparent public static defaultOptions : ScatterSeriesOptions = merge ( LineSeries . defaultOptions , { sample sample product lineWidth : 0 , findNearestPointBy : 'xy' , sample sample product since jitter : { /**
             * The maximal X offset for the random jitter effect.
             */ x : 0 , /**
             * The maximal Y offset for the random jitter effect.
             */ y : 0 } , marker : { enabled : true } , type { boolean } default product apioption product tooltip : { headerFormat : '<span style="color:{point.color}">\u25CF</span> ' + '<span style="font-size: 10px"> {series.name}</span><br/>' , pointFormat : 'x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>' } } as ScatterSeriesOptions ) ; public data : Array < ScatterPoint > = void 0 as any ; public options : ScatterSeriesOptions = void 0 as any ; public points : Array < ScatterPoint > = void 0 as any ; private public applyJitter ( ) { const series = this , jitter = this . options . jitter , len = this . points . length ; private function unrandom ( seed ) { const rand = Math . sin ( seed ) * 10000 ; return rand - Math . floor ( rand ) ; } if ( jitter ) { this . points . forEach ( function ( point , i ) : void { [ 'x' , 'y' ] . forEach ( function ( dim , j ) : void { let axis , plotProp = 'plot' + dim . toUpperCase ( ) , min , max , translatedJitter ; if ( ( jitter as any ) [ dim ] && ! point . isNull ) { axis = ( series as any ) [ dim + 'Axis' ] ; translatedJitter = ( jitter as any ) [ dim ] * axis . transA ; if ( axis && ! axis . isLog ) { min = Math . max ( 0 , ( point as any ) [ plotProp ] - translatedJitter ) ; max = Math . min ( axis . len , ( point as any ) [ plotProp ] + translatedJitter ) ; ( point as any ) [ plotProp ] = min + ( max - min ) * unrandom ( i + j * len ) ; if ( dim === 'x' ) { point . clientX = point . plotX ; } } } } ) ; } ) ; } } private function public drawGraph ( ) { if ( this . options . lineWidth ) { super . drawGraph ( ) ; } else if ( this . graph ) { this . graph = this . graph . destroy ( ) ; } } } interface ScatterSeries { pointClass : typeof ScatterPoint ; takeOrdinalPosition : boolean ; } extend ( ScatterSeries . prototype , { drawTracker : ColumnSeries . prototype . drawTracker , sorted : false , requireSorting : false , noSharedTooltip : true , trackerGroups : [ 'group' , 'markerGroup' , 'dataLabelsGroup' ] , takeOrdinalPosition : false } ) ; addEvent ( ScatterSeries , 'afterTranslate' , function ( ) : void { this . applyJitter ( ) ; } ) ; declare module '../../Core/Series/SeriesType' { interface SeriesTypeRegistry { scatter : typeof ScatterSeries ; } } SeriesRegistry . registerSeriesType ( 'scatter' , ScatterSeries ) ; export default ScatterSeries ; extends series excluding product apioption sample sample sample sample sample type { Array < number | Array < ( number | string ) , ( number | null ) > | null | * > } extends series . line . data product apioption '' ;