'use strict' ; import type { AlignObject , AlignValue , VerticalAlignValue } from '../Renderer/AlignObject' ; import type AnimationOptions from '../Animation/AnimationOptions' ; import type AxisOptions from '../Axis/AxisOptions' ; import type AxisType from '../Axis/AxisType' ; import type BBoxObject from '../Renderer/BBoxObject' ; import type { CSSObject , CursorValue } from '../Renderer/CSSObject' ; import type { EventCallback } from '../Callback' ; import type { LabelsItemsOptions , NumberFormatterCallbackFunction , Options } from '../Options' ; import type ChartLike from './ChartLike' ; import type ChartOptions from './ChartOptions' ; import type { ChartPanningOptions } from './ChartOptions' ; import type ColorAxis from '../Axis/Color/ColorAxis' ; import type Oldie from '../../Extensions/Oldie/Oldie' ; import type Point from '../Series/Point' ; import type PointerEvent from '../PointerEvent' ; import type Series from '../Series/Series' ; import type SeriesOptions from '../Series/SeriesOptions' ; import type { SeriesTypeOptions , SeriesTypePlotOptions } from '../Series/SeriesType' ; import type { HTMLDOMElement } from '../Renderer/DOMElementType' ; import type SVGAttributes from '../Renderer/SVG/SVGAttributes' ; import type SVGElement from '../Renderer/SVG/SVGElement' ; import A from '../Animation/AnimationUtilities.js' ; const { animate , animObject , setAnimation } = A ; import Axis from '../Axis/Axis.js' ; import FormatUtilities from '../FormatUtilities.js' ; const { numberFormat } = FormatUtilities ; import Foundation from '../Foundation.js' ; const { registerEventOptions } = Foundation ; import H from '../Globals.js' ; const { charts , doc , marginNames , svg , win } = H ; import Legend from '../Legend/Legend.js' ; import MSPointer from '../MSPointer.js' ; import D from '../DefaultOptions.js' ; const { defaultOptions , defaultTime } = D ; import { Palette } from '../../Core/Color/Palettes.js' ; import Pointer from '../Pointer.js' ; import RendererRegistry from '../Renderer/RendererRegistry.js' ; import SeriesRegistry from '../Series/SeriesRegistry.js' ; const { seriesTypes } = SeriesRegistry ; import SVGRenderer from '../Renderer/SVG/SVGRenderer.js' ; import Time from '../Time.js' ; import U from '../Utilities.js' ; import AST from '../Renderer/HTML/AST.js' ; const { addEvent , attr , cleanRecursively , createElement , css , defined , discardElement , erase , error , extend , find , fireEvent , getStyle , isArray , isFunction , isNumber , isObject , isString , merge , objectEach , pick , pInt , relativeLength , removeEvent , splat , syncTimeout , uniqueKey } = U ; declare module '../Axis/AxisLike' { interface AxisLike { extKey ? : string ; index ? : number ; touched ? : boolean ; } } declare module '../Axis/AxisOptions' { interface AxisOptions { index ? : number ; } } declare module './ChartLike' { interface ChartLike { resetZoomButton ? : SVGElement ; pan ( e , panning ) : void ; showResetZoom ( ) : void ; zoom ( event ) : void ; zoomOut ( ) : void ; } } declare module './ChartOptions' { interface ChartOptions { forExport ? : boolean ; renderer ? : string ; skipClone ? : boolean ; } } declare module '../Options' { interface Options { chart : ChartOptions ; caption ? : Chart . CaptionOptions ; credits ? : Chart . CreditsOptions ; subtitle ? : Chart . SubtitleOptions ; series ? : Array < SeriesTypeOptions > ; title ? : Chart . TitleOptions ; } } declare module '../Series/PointLike' { interface PointLike { touched ? : boolean ; } } declare module '../Series/SeriesLike' { interface SeriesLike { index ? : number ; touched ? : boolean ; } } /**
 * The Chart class. The recommended constructor is  Highcharts .
 *
 *  example class name param { string | Highcharts . HTMLDOMElement } renderTo param { Highcharts . Options } options param { Highcharts . ChartCallbackFunction } callback class Chart { public static chart ( options , callback ? ) ; public static chart ( renderTo , options , callback ? ) ; example function param { string | Highcharts . HTMLDOMElement } renderTo param { Highcharts . Options } options param { Highcharts . ChartCallbackFunction } callback return { Highcharts . Chart } public static chart ( a , b ? , c ? ) { return new Chart ( a as any , b as any , c ) ; } public constructor ( options , callback ? ) ; public constructor ( renderTo , options , callback ? ) ; public constructor ( a , b ? , c ? ) { this . getArgs ( a , b , c ) ; } public _cursor ? : ( CursorValue | null ) ; public axes : Array < AxisType > = void 0 as any ; public axisOffset : Array < number > = void 0 as any ; public bounds : Record < string , Record < string , number > > = void 0 as any ; public callback ? : Chart . CallbackFunction ; public chartBackground ? : SVGElement ; public chartHeight : number = void 0 as any ; public chartWidth : number = void 0 as any ; public clipBox : BBoxObject = void 0 as any ; public clipOffset ? : Array < number > ; public clipRect ? : SVGElement ; public colorCounter : number = void 0 as any ; public container : globalThis . HTMLElement = void 0 as any ; public containerHeight ? : string ; public containerWidth ? : string ; public credits ? : SVGElement ; public caption ? : SVGElement ; public eventOptions : Record < string , EventCallback < Series , Event > > = void 0 as any ; public hasCartesianSeries ? : boolean ; public hasLoaded ? : boolean ; public hasRendered ? : boolean ; public index : number = void 0 as any ; public isDirtyBox ? : boolean ; public isDirtyLegend ? : boolean ; public isResizing : number = void 0 as any ; public labelCollectors : Array < Chart . LabelCollectorFunction > = void 0 as any ; public legend : Legend = void 0 as any ; public loadingDiv ? : HTMLDOMElement ; public loadingShown ? : boolean ; public loadingSpan ? : HTMLDOMElement ; public margin : Array < number > = void 0 as any ; public marginBottom ? : number ; public numberFormatter : NumberFormatterCallbackFunction = void 0 as any ; public oldChartHeight ? : number ; public oldChartWidth ? : number ; public options : Options = void 0 as any ; public plotBackground ? : SVGElement ; public plotBGImage ? : SVGElement ; public plotBorder ? : SVGElement ; public plotBorderWidth ? : number ; public plotBox : BBoxObject = void 0 as any ; public plotHeight : number = void 0 as any ; public plotLeft : number = void 0 as any ; public plotSizeX ? : number ; public plotSizeY ? : number ; public plotTop : number = void 0 as any ; public plotWidth : number = void 0 as any ; public pointCount : number = void 0 as any ; public pointer : Pointer = void 0 as any ; public reflowTimeout ? : number ; public renderer : Chart . Renderer = void 0 as any ; public renderTo : globalThis . HTMLElement = void 0 as any ; public series : Array < Series > = void 0 as any ; public seriesGroup ? : SVGElement ; public sharedClips : Record < string , ( SVGElement | undefined ) > = { } ; public spacing : Array < number > = void 0 as any ; public spacingBox : BBoxObject = void 0 as any ; public styledMode ? : boolean ; public subtitle ? : SVGElement ; public symbolCounter : number = void 0 as any ; public time : Time = void 0 as any ; public title ? : SVGElement ; public titleOffset : Array < number > = void 0 as any ; public unbindReflow ? : Function ; public userOptions : Partial < Options > = void 0 as any ; public xAxis : Array < AxisType > = void 0 as any ; public yAxis : Array < AxisType > = void 0 as any ; private function param { ... Array < * > } arguments emits emits public getArgs ( a , b ? , c ? ) { if ( isString ( a ) || ( a as any ) . nodeName ) { this . renderTo = a as any ; this . init ( b as any , c ) ; } else { this . init ( a as any , b as any ) ; } } function param { Highcharts . Options } userOptions param { Function } callback emits emits public init ( userOptions , callback ? ) { const userPlotOptions = userOptions . plotOptions || { } as SeriesTypePlotOptions ; fireEvent ( this , 'init' , { args : arguments } , function ( ) : void { const options = merge ( defaultOptions , userOptions ) ; const optionsChart = options . chart ; objectEach ( options . plotOptions , function ( typeOptions , type ) : void { if ( isObject ( typeOptions ) ) { typeOptions . tooltip = ( userPlotOptions [ type ] && merge ( ( userPlotOptions [ type ] as any ) . tooltip ) ) || void 0 ; } } ) ; ( options . tooltip as any ) . userOptions = ( userOptions . chart && userOptions . chart . forExport && ( userOptions . tooltip as any ) . userOptions ) || userOptions . tooltip ; /**
             * The original options given to the constructor or a chart factory
             * like  Highcharts . chart and  Highcharts . stockChart .
             *
             *  name type { Highcharts . Options } this . userOptions = userOptions ; this . margin = [ ] ; this . spacing = [ ] ; this . bounds = { h : { } , v : { } } ; this . labelCollectors = [ ] ; this . callback = callback ; this . isResizing = 0 ; /**
             * The options structure for the chart after merging
             *  {@link #defaultOptions} and  {@link #userOptions} . It contains
             * members for the sub elements like series, legend, tooltip etc.
             *
             *  name type { Highcharts . Options } this . options = options ; see Highcharts . Chart . xAxis see Highcharts . Chart . yAxis name type { Array < Highcharts . Axis > } this . axes = [ ] ; name type { Array < Highcharts . Series > } this . series = [ ] ; name type { Highcharts . Time } this . time = userOptions . time && Object . keys ( userOptions . time ) . length ? new Time ( userOptions . time ) : H . time ; name type { Highcharts . NumberFormatterCallbackFunction } this . numberFormatter = optionsChart . numberFormatter || numberFormat ; name type { boolean } this . styledMode = optionsChart . styledMode ; this . hasCartesianSeries = optionsChart . showAxes ; const chart = this ; /**
             * Index position of the chart in the  Highcharts * property.
             *
             *  name type { number } readonly chart . index = charts . length ; charts . push ( chart ) ; H . chartCount ++ ; registerEventOptions ( this , optionsChart ) ; name type { Array < Highcharts . Axis > } chart . xAxis = [ ] ; name type { Array < Highcharts . Axis > } todo chart . yAxis = [ ] ; chart . pointCount = chart . colorCounter = chart . symbolCounter = 0 ; fireEvent ( chart , 'afterInit' ) ; chart . firstRender ( ) ; } ) ; } private function public initSeries ( options ) { const chart = this , optionsChart = chart . options . chart , type = ( options . type || optionsChart . type || optionsChart . defaultSeriesType ) as string , SeriesClass = seriesTypes [ type ] ; if ( ! SeriesClass ) { error ( 17 , true , chart as any , { missingModuleFor : type } ) ; } const series = new SeriesClass ( ) ; if ( typeof series . init === 'function' ) { series . init ( chart , options ) ; } return series ; } private function public setSeriesData ( ) { this . getSeriesOrderByLinks ( ) . forEach ( function ( series ) : void { if ( ! series . points && ! series . data && series . enabledDataSorting ) { series . setData ( series . options . data as any , false ) ; } } ) ; } private function public getSeriesOrderByLinks ( ) { return this . series . concat ( ) . sort ( function ( a , b ) : number { if ( a . linkedSeries . length || b . linkedSeries . length ) { return b . linkedSeries . length - a . linkedSeries . length ; } return 0 ; } ) ; } private function param { number } fromIndex public orderSeries ( fromIndex ? ) { const series = this . series ; for ( let i = ( fromIndex || 0 ) , iEnd = series . length ; i < iEnd ; ++ i ) { if ( series [ i ] ) { name type { number } readonly series [ i ] . index = i ; series [ i ] . name = series [ i ] . getName ( ) ; } } } function param { number } plotX param { number } plotY param { Highcharts . ChartIsInsideOptionsObject } options return { boolean } public isInsidePlot ( plotX , plotY , options = { } ) { const { inverted , plotBox , plotLeft , plotTop , scrollablePlotBox } = this ; let scrollLeft = 0 , scrollTop = 0 ; if ( options . visiblePlotOnly && this . scrollingContainer ) { ( { scrollLeft , scrollTop } = this . scrollingContainer ) ; } const series = options . series , box = ( options . visiblePlotOnly && scrollablePlotBox ) || plotBox , x = options . inverted ? plotY : plotX , y = options . inverted ? plotX : plotY , e = { x , y , isInsidePlot : true } ; if ( ! options . ignoreX ) { const xAxis = ( series && ( inverted ? series . yAxis : series . xAxis ) ) || { pos : plotLeft , len : Infinity } ; const chartX = options . paneCoordinates ? xAxis . pos + x : plotLeft + x ; if ( ! ( chartX >= Math . max ( scrollLeft + plotLeft , xAxis . pos ) && chartX <= Math . min ( scrollLeft + plotLeft + box . width , xAxis . pos + xAxis . len ) ) ) { e . isInsidePlot = false ; } } if ( ! options . ignoreY && e . isInsidePlot ) { const yAxis = ( series && ( inverted ? series . xAxis : series . yAxis ) ) || { pos : plotTop , len : Infinity } ; const chartY = options . paneCoordinates ? yAxis . pos + y : plotTop + y ; if ( ! ( chartY >= Math . max ( scrollTop + plotTop , yAxis . pos ) && chartY <= Math . min ( scrollTop + plotTop + box . height , yAxis . pos + yAxis . len ) ) ) { e . isInsidePlot = false ; } } fireEvent ( this , 'afterIsInsidePlot' , e ) ; return e . isInsidePlot ; } function param { boolean | Partial < Highcharts . AnimationOptionsObject > } animation emits emits emits emits emits emits public redraw ( animation ? ) { fireEvent ( this , 'beforeRedraw' ) ; const chart = this , axes = chart . hasCartesianSeries ? chart . axes : chart . colorAxis || [ ] , series = chart . series , pointer = chart . pointer , legend = chart . legend , legendUserOptions = chart . userOptions . legend , renderer = chart . renderer , isHiddenChart = renderer . isHidden ( ) , afterRedraw = [ ] as Array < Function > ; let hasDirtyStacks , hasStackedSeries , i , isDirtyBox = chart . isDirtyBox , redrawLegend = chart . isDirtyLegend , serie ; if ( chart . setResponsive ) { chart . setResponsive ( false ) ; } setAnimation ( chart . hasRendered ? animation : false , chart ) ; if ( isHiddenChart ) { chart . temporaryDisplay ( ) ; } chart . layOutTitles ( ) ; i = series . length ; while ( i -- ) { serie = series [ i ] ; if ( serie . options . stacking || serie . options . centerInCategory ) { hasStackedSeries = true ; if ( serie . isDirty ) { hasDirtyStacks = true ; break ; } } } if ( hasDirtyStacks ) { i = series . length ; while ( i -- ) { serie = series [ i ] ; if ( serie . options . stacking ) { serie . isDirty = true ; } } } series . forEach ( function ( serie ) : void { if ( serie . isDirty ) { if ( serie . options . legendType === 'point' ) { if ( typeof serie . updateTotals === 'function' ) { serie . updateTotals ( ) ; } redrawLegend = true ; } else if ( legendUserOptions && ( legendUserOptions . labelFormatter || legendUserOptions . labelFormat ) ) { redrawLegend = true ; } } if ( serie . isDirtyData ) { fireEvent ( serie , 'updatedData' ) ; } } ) ; if ( redrawLegend && legend && legend . options . enabled ) { legend . render ( ) ; chart . isDirtyLegend = false ; } if ( hasStackedSeries ) { chart . getStacks ( ) ; } axes . forEach ( function ( axis ) : void { axis . updateNames ( ) ; axis . setScale ( ) ; } ) ; chart . getMargins ( ) ; axes . forEach ( function ( axis ) : void { if ( axis . isDirty ) { isDirtyBox = true ; } } ) ; axes . forEach ( function ( axis ) : void { const key = axis . min + ',' + axis . max ; if ( axis . extKey !== key ) { axis . extKey = key ; afterRedraw . push ( function ( ) : void { fireEvent ( axis , 'afterSetExtremes' , extend ( axis . eventArgs , axis . getExtremes ( ) ) ) ; delete axis . eventArgs ; } ) ; } if ( isDirtyBox || hasStackedSeries ) { axis . redraw ( ) ; } } ) ; if ( isDirtyBox ) { chart . drawChartBox ( ) ; } fireEvent ( chart , 'predraw' ) ; series . forEach ( function ( serie ) : void { if ( ( isDirtyBox || serie . isDirty ) && serie . visible ) { serie . redraw ( ) ; } serie . isDirtyData = false ; } ) ; if ( pointer ) { pointer . reset ( true ) ; } renderer . draw ( ) ; fireEvent ( chart , 'redraw' ) ; fireEvent ( chart , 'render' ) ; if ( isHiddenChart ) { chart . temporaryDisplay ( true ) ; } afterRedraw . forEach ( function ( callback ) : void { ( callback . call as any ) ( ) ; } ) ; } sample function param { string } id return { Highcharts . Axis | Highcharts . Series | Highcharts . Point | undefined } public get ( id ) { const series = this . series ; private function itemById ( item ) { return ( ( item as Series ) . id === id || ( item . options && item . options . id === id ) ) ; } let ret = find ( this . axes , itemById ) || find ( this . series , itemById ) ; for ( let i = 0 ; ! ret && i < series . length ; i ++ ) { ret = find ( ( series [ i ] . points as any ) || [ ] , itemById ) ; } return ret ; } private function emits emits public getAxes ( ) { const chart = this , options = this . options , xAxisOptions = options . xAxis = splat ( options . xAxis || { } ) , yAxisOptions = options . yAxis = splat ( options . yAxis || { } ) ; fireEvent ( this , 'getAxes' ) ; xAxisOptions . forEach ( function ( axis , i ) : void { axis . index = i ; axis . isX = true ; } ) ; yAxisOptions . forEach ( function ( axis , i ) : void { axis . index = i ; } ) ; const optionsArray = xAxisOptions . concat ( yAxisOptions ) ; optionsArray . forEach ( function ( axisOptions ) : void { new Axis ( chart , axisOptions ) ; } ) ; fireEvent ( this , 'afterGetAxes' ) ; } /**
     * Returns an array of all currently selected points in the chart. Points
     * can be selected by clicking or programmatically by the
     *  Highcharts . Point * function.
     *
     *  sample function return { Array < Highcharts . Point > } public getSelectedPoints ( ) { return this . series . reduce ( ( acc , series ) : Point [ ] => { series . getPointsCollection ( ) . forEach ( ( point ) : void => { if ( pick ( point . selectedStaging , point . selected ) ) { acc . push ( point ) ; } } ) ; return acc ; } , [ ] ) ; } /**
     * Returns an array of all currently selected series in the chart. Series
     * can be selected either programmatically by the
     *  Highcharts . Series * function or by checking the checkbox next to the legend item if
     * [series.showCheckBox](https://api.highcharts.com/highcharts/plotOptions.series.showCheckbox)
     * is true.
     *
     *  sample function return { Array < Highcharts . Series > } public getSelectedSeries ( ) { return this . series . filter ( function ( serie ) : ( boolean | undefined ) { return serie . selected ; } ) ; } sample function param { Highcharts . TitleOptions } titleOptions param { Highcharts . SubtitleOptions } subtitleOptions param { boolean } redraw public setTitle ( titleOptions ? , subtitleOptions ? , redraw ? ) { this . applyDescription ( 'title' , titleOptions ) ; this . applyDescription ( 'subtitle' , subtitleOptions ) ; this . applyDescription ( 'caption' , void 0 ) ; this . layOutTitles ( redraw ) ; } private function param name { string } param { Highcharts . TitleOptions | Highcharts . SubtitleOptions | Highcharts . CaptionOptions | undefined } explicitOptions public applyDescription ( name , explicitOptions ? ) { const chart = this ; const style = name === 'title' ? { color : Palette . neutralColor80 , fontSize : this . options . isStock ? '16px' : '18px' } : { color : Palette . neutralColor60 } ; const options = this . options [ name ] = merge ( ( ! this . styledMode && { style } ) as Chart . DescriptionOptionsType , this . options [ name ] , explicitOptions ) ; let elem = this [ name ] ; if ( elem && explicitOptions ) { this [ name ] = elem = ( elem as any ) . destroy ( ) ; } if ( options && ! elem ) { elem = this . renderer . text ( options . text as any , 0 , 0 , options . useHTML ) . attr ( { align : options . align , 'class' : 'highcharts-' + name , zIndex : ( options as any ) . zIndex || 4 } ) . add ( ) ; elem . update = function ( updateOptions ) : void { const fn = { title : 'setTitle' , subtitle : 'setSubtitle' , caption : 'setCaption' } [ name ] ; ( chart as any ) [ fn ] ( updateOptions ) ; } ; if ( ! this . styledMode ) { elem . css ( ( options as any ) . style ) ; } sample name type { Highcharts . TitleObject } name type { Highcharts . SubtitleObject } this [ name ] = elem ; } } private function param { boolean } redraw emits public layOutTitles ( redraw ? ) { const titleOffset = [ 0 , 0 , 0 ] , renderer = this . renderer , spacingBox = this . spacingBox ; [ 'title' , 'subtitle' , 'caption' ] . forEach ( function ( key ) : void { const title = ( this as any ) [ key ] , titleOptions = ( ( this as any ) . options [ key ] ) , verticalAlign = titleOptions . verticalAlign || 'top' , offset = key === 'title' ? verticalAlign === 'top' ? - 3 : 0 : verticalAlign === 'top' ? titleOffset [ 0 ] + 2 : 0 ; let titleSize , height ; if ( title ) { if ( ! this . styledMode ) { titleSize = ( titleOptions . style && titleOptions . style . fontSize ) ; } titleSize = renderer . fontMetrics ( titleSize , title ) . b ; title . css ( { width : ( ( titleOptions as any ) . width || spacingBox . width + ( titleOptions . widthAdjust || 0 ) ) + 'px' } ) ; height = Math . round ( title . getBBox ( titleOptions . useHTML ) . height ) ; title . align ( extend ( { y : verticalAlign === 'bottom' ? titleSize : offset + titleSize , height } , titleOptions ) , false , 'spacingBox' ) ; if ( ! titleOptions . floating ) { if ( verticalAlign === 'top' ) { titleOffset [ 0 ] = Math . ceil ( titleOffset [ 0 ] + height ) ; } else if ( verticalAlign === 'bottom' ) { titleOffset [ 2 ] = Math . ceil ( titleOffset [ 2 ] + height ) ; } } } } , this ) ; if ( titleOffset [ 0 ] && ( ( this . options . title as any ) . verticalAlign || 'top' ) === 'top' ) { titleOffset [ 0 ] += ( this . options . title as any ) . margin ; } if ( titleOffset [ 2 ] && ( this . options . caption as any ) . verticalAlign === 'bottom' ) { titleOffset [ 2 ] += ( this . options . caption as any ) . margin ; } const requiresDirtyBox = ( ! this . titleOffset || this . titleOffset . join ( ',' ) !== titleOffset . join ( ',' ) ) ; this . titleOffset = titleOffset ; fireEvent ( this , 'afterLayOutTitles' ) ; if ( ! this . isDirtyBox && requiresDirtyBox ) { this . isDirtyBox = this . isDirtyLegend = requiresDirtyBox ; if ( this . hasRendered && pick ( redraw , true ) && this . isDirtyBox ) { this . redraw ( ) ; } } } /**
     * Internal function to get the chart width and height according to options
     * and container size. Sets  Chart . chartWidth and
     *  Chart . chartHeight .
     *
     *  private function public getChartSize ( ) { const chart = this , optionsChart = chart . options . chart , widthOption = optionsChart . width , heightOption = optionsChart . height , renderTo = chart . renderTo ; if ( ! defined ( widthOption ) ) { chart . containerWidth = getStyle ( renderTo , 'width' ) as any ; } if ( ! defined ( heightOption ) ) { chart . containerHeight = getStyle ( renderTo , 'height' ) as any ; } name type { number } chart . chartWidth = Math . max ( 0 , widthOption || ( chart . containerWidth as any ) || 600 ) ; name type { number } chart . chartHeight = Math . max ( 0 , relativeLength ( heightOption as any , chart . chartWidth ) || ( ( chart . containerHeight as any ) > 1 ? ( chart . containerHeight as any ) : 400 ) ) ; } private function param { boolean } revert public temporaryDisplay ( revert ? ) { let node = this . renderTo , tempStyle ; if ( ! revert ) { while ( node && node . style ) { if ( ! doc . body . contains ( node ) && ! node . parentNode ) { ( node as any ) . hcOrigDetached = true ; doc . body . appendChild ( node ) ; } if ( getStyle ( node , 'display' , false ) === 'none' || ( node as any ) . hcOricDetached ) { ( node as any ) . hcOrigStyle = { display : node . style . display , height : node . style . height , overflow : node . style . overflow } ; tempStyle = { display : 'block' , overflow : 'hidden' } ; if ( node !== this . renderTo ) { tempStyle . height = 0 ; } css ( node , tempStyle ) ; if ( ! node . offsetWidth ) { node . style . setProperty ( 'display' , 'block' , 'important' ) ; } } node = node . parentNode as any ; if ( node === doc . body ) { break ; } } } else { while ( node && node . style ) { if ( ( node as any ) . hcOrigStyle ) { css ( node , ( node as any ) . hcOrigStyle ) ; delete ( node as any ) . hcOrigStyle ; } if ( ( node as any ) . hcOrigDetached ) { doc . body . removeChild ( node ) ; ( node as any ) . hcOrigDetached = false ; } node = node . parentNode as any ; } } } /**
     * Set the  Chart . container class name, in
     * addition to `highcharts-container`.
     *
     *  function param { string } className public setClassName ( className ? ) { this . container . className = 'highcharts-container ' + ( className || '' ) ; } private function emits public getContainer ( ) { const chart = this , options = chart . options , optionsChart = options . chart , indexAttrName = 'data-highcharts-chart' , containerId = uniqueKey ( ) ; let containerStyle , renderTo = chart . renderTo ; if ( ! renderTo ) { chart . renderTo = renderTo = optionsChart . renderTo as HTMLDOMElement ; } if ( isString ( renderTo ) ) { chart . renderTo = renderTo = doc . getElementById ( renderTo as any ) as any ; } if ( ! renderTo ) { error ( 13 , true , chart ) ; } const oldChartIndex = pInt ( attr ( renderTo , indexAttrName ) ) ; if ( isNumber ( oldChartIndex ) && charts [ oldChartIndex ] && ( charts [ oldChartIndex ] as any ) . hasRendered ) { ( charts [ oldChartIndex ] as any ) . destroy ( ) ; } attr ( renderTo , indexAttrName , chart . index ) ; renderTo . innerHTML = AST . emptyHTML ; if ( ! optionsChart . skipClone && ! renderTo . offsetWidth ) { chart . temporaryDisplay ( ) ; } chart . getChartSize ( ) ; const chartWidth = chart . chartWidth ; const chartHeight = chart . chartHeight ; css ( renderTo , { overflow : 'hidden' } ) ; if ( ! chart . styledMode ) { containerStyle = extend < CSSObject > ( { position : 'relative' , overflow : 'hidden' , width : chartWidth + 'px' , height : chartHeight + 'px' , textAlign : 'left' , lineHeight : 'normal' , zIndex : 0 , '-webkit-tap-highlight-color' : 'rgba(0,0,0,0)' , userSelect : 'none' , 'touch-action' : 'manipulation' , outline : 'none' } , optionsChart . style || { } ) ; } /**
         * The containing HTML element of the chart. The container is
         * dynamically inserted into the element given as the `renderTo`
         * parameter in the  Highcharts constructor.
         *
         *  name type { Highcharts . HTMLDOMElement } const container = createElement ( 'div' , { id : containerId } , containerStyle , renderTo ) ; chart . container = container ; chart . _cursor = container . style . cursor as CursorValue ; const Renderer = optionsChart . renderer || ! svg ? RendererRegistry . getRendererType ( optionsChart . renderer ) : SVGRenderer ; name type { Highcharts . SVGRenderer } chart . renderer = new Renderer ( container , chartWidth , chartHeight , void 0 , optionsChart . forExport , options . exporting && options . exporting . allowHTML , chart . styledMode ) as Chart . Renderer ; setAnimation ( void 0 , chart ) ; chart . setClassName ( optionsChart . className ) ; if ( ! chart . styledMode ) { chart . renderer . setStyle ( optionsChart . style as any ) ; } else { for ( const key in options . defs ) { this . renderer . definition ( ( options . defs as any ) [ key ] ) ; } } chart . renderer . chartIndex = chart . index ; fireEvent ( this , 'afterGetContainer' ) ; } private function emits public getMargins ( skipAxes ? ) { const { spacing , margin , titleOffset } = this ; this . resetMargins ( ) ; if ( titleOffset [ 0 ] && ! defined ( margin [ 0 ] ) ) { this . plotTop = Math . max ( this . plotTop , titleOffset [ 0 ] + spacing [ 0 ] ) ; } if ( titleOffset [ 2 ] && ! defined ( margin [ 2 ] ) ) { this . marginBottom = Math . max ( this . marginBottom as any , titleOffset [ 2 ] + spacing [ 2 ] ) ; } if ( this . legend && this . legend . display ) { this . legend . adjustMargins ( margin , spacing ) ; } fireEvent ( this , 'getMargins' ) ; if ( ! skipAxes ) { this . getAxisMargins ( ) ; } } private function public getAxisMargins ( ) { const chart = this , axisOffset = chart . axisOffset = [ 0 , 0 , 0 , 0 ] , colorAxis = chart . colorAxis , margin = chart . margin , getOffset = function ( axes ) : void { axes . forEach ( function ( axis ) : void { if ( axis . visible ) { axis . getOffset ( ) ; } } ) ; } ; if ( chart . hasCartesianSeries ) { getOffset ( chart . axes ) ; } else if ( colorAxis && colorAxis . length ) { getOffset ( colorAxis ) ; } marginNames . forEach ( function ( m , side ) : void { if ( ! defined ( margin [ side ] ) ) { ( chart as any ) [ m ] += axisOffset [ side ] ; } } ) ; chart . setChartSize ( ) ; } sample sample function param { global . Event } e public reflow ( e ? ) { const chart = this , optionsChart = chart . options . chart , renderTo = chart . renderTo , hasUserSize = ( defined ( optionsChart . width ) && defined ( optionsChart . height ) ) , width = optionsChart . width || getStyle ( renderTo , 'width' ) , height = optionsChart . height || getStyle ( renderTo , 'height' ) , target = e ? e . target : win ; delete chart . pointer . chartPosition ; if ( ! hasUserSize && ! chart . isPrinting && width && height && ( target === win || target === doc ) ) { if ( width !== chart . containerWidth || height !== chart . containerHeight ) { U . clearTimeout ( chart . reflowTimeout as any ) ; chart . reflowTimeout = syncTimeout ( function ( ) : void { if ( chart . container ) { chart . setSize ( void 0 , void 0 , false ) ; } } , e ? 100 : 0 ) ; } chart . containerWidth = width as any ; chart . containerHeight = height as any ; } } private function public setReflow ( reflow ? ) { const chart = this ; if ( reflow !== false && ! this . unbindReflow ) { this . unbindReflow = addEvent ( win , 'resize' , function ( e ) : void { if ( chart . options ) { chart . reflow ( e ) ; } } ) ; addEvent ( this , 'destroy' , this . unbindReflow ) ; } else if ( reflow === false && this . unbindReflow ) { this . unbindReflow = this . unbindReflow ( ) ; } } sample sample sample function param { number | null } width param { number | null } height param { boolean | Partial < Highcharts . AnimationOptionsObject > } animation emits emits public setSize ( width ? , height ? , animation ? ) { const chart = this , renderer = chart . renderer ; chart . isResizing += 1 ; setAnimation ( animation , chart ) ; const globalAnimation = renderer . globalAnimation ; chart . oldChartHeight = chart . chartHeight ; chart . oldChartWidth = chart . chartWidth ; if ( typeof width !== 'undefined' ) { chart . options . chart . width = width ; } if ( typeof height !== 'undefined' ) { chart . options . chart . height = height ; } chart . getChartSize ( ) ; if ( ! chart . styledMode ) { ( globalAnimation ? animate : css ) ( chart . container , { width : chart . chartWidth + 'px' , height : chart . chartHeight + 'px' } , globalAnimation ) ; } chart . setChartSize ( true ) ; renderer . setSize ( chart . chartWidth , chart . chartHeight , globalAnimation ) ; chart . axes . forEach ( function ( axis ) : void { axis . isDirty = true ; axis . setScale ( ) ; } ) ; chart . isDirtyLegend = true ; chart . isDirtyBox = true ; chart . layOutTitles ( ) ; chart . getMargins ( ) ; chart . redraw ( globalAnimation ) ; chart . oldChartHeight = null as any ; fireEvent ( chart , 'resize' ) ; syncTimeout ( function ( ) : void { if ( chart ) { fireEvent ( chart , 'endResize' , null as any , function ( ) : void { chart . isResizing -= 1 ; } ) ; } } , animObject ( globalAnimation ) . duration ) ; } private function emits public setChartSize ( skipAxes ? ) { const chart = this , inverted = chart . inverted , renderer = chart . renderer , chartWidth = chart . chartWidth , chartHeight = chart . chartHeight , optionsChart = chart . options . chart , spacing = chart . spacing , clipOffset = chart . clipOffset ; let plotLeft , plotTop , plotWidth , plotHeight ; name type { number } chart . plotLeft = plotLeft = Math . round ( chart . plotLeft ) ; name type { number } chart . plotTop = plotTop = Math . round ( chart . plotTop ) ; name type { number } chart . plotWidth = plotWidth = Math . max ( 0 , Math . round ( ( chartWidth as any ) - plotLeft - ( chart . marginRight as any ) ) ) ; name type { number } chart . plotHeight = plotHeight = Math . max ( 0 , Math . round ( ( chartHeight as any ) - plotTop - ( chart . marginBottom as any ) ) ) ; chart . plotSizeX = inverted ? plotHeight : plotWidth ; chart . plotSizeY = inverted ? plotWidth : plotHeight ; chart . plotBorderWidth = optionsChart . plotBorderWidth || 0 ; chart . spacingBox = renderer . spacingBox = { x : spacing [ 3 ] , y : spacing [ 0 ] , width : ( chartWidth as any ) - spacing [ 3 ] - spacing [ 1 ] , height : ( chartHeight as any ) - spacing [ 0 ] - spacing [ 2 ] } ; chart . plotBox = renderer . plotBox = { x : plotLeft , y : plotTop , width : plotWidth , height : plotHeight } ; const plotBorderWidth = 2 * Math . floor ( chart . plotBorderWidth / 2 ) , clipX = Math . ceil ( Math . max ( plotBorderWidth , ( clipOffset as any ) [ 3 ] ) / 2 ) , clipY = Math . ceil ( Math . max ( plotBorderWidth , ( clipOffset as any ) [ 0 ] ) / 2 ) ; chart . clipBox = { x : clipX , y : clipY , width : Math . floor ( chart . plotSizeX - Math . max ( plotBorderWidth , ( clipOffset as any ) [ 1 ] ) / 2 - clipX ) , height : Math . max ( 0 , Math . floor ( chart . plotSizeY - Math . max ( plotBorderWidth , ( clipOffset as any ) [ 2 ] ) / 2 - clipY ) ) } ; if ( ! skipAxes ) { chart . axes . forEach ( function ( axis ) : void { axis . setAxisSize ( ) ; axis . setAxisTranslation ( ) ; } ) ; renderer . alignElements ( ) ; } fireEvent ( chart , 'afterSetChartSize' , { skipAxes : skipAxes } ) ; } private function public resetMargins ( ) { fireEvent ( this , 'resetMargins' ) ; const chart = this , chartOptions = chart . options . chart ; [ 'margin' , 'spacing' ] . forEach ( function splashArrays ( target ) : void { const value = ( chartOptions as any ) [ target ] , values = isObject ( value ) ? value : [ value , value , value , value ] ; [ 'Top' , 'Right' , 'Bottom' , 'Left' ] . forEach ( function ( sideName , side ) : void { ( chart as any ) [ target ] [ side ] = pick ( ( chartOptions as any ) [ target + sideName ] , values [ side ] ) ; } ) ; } ) ; marginNames . forEach ( function ( m , side ) : void { ( chart as any ) [ m ] = pick ( chart . margin [ side ] , chart . spacing [ side ] ) ; } ) ; chart . axisOffset = [ 0 , 0 , 0 , 0 ] ; chart . clipOffset = [ 0 , 0 , 0 , 0 ] ; } private function emits public drawChartBox ( ) { const chart = this , optionsChart = chart . options . chart , renderer = chart . renderer , chartWidth = chart . chartWidth , chartHeight = chart . chartHeight , styledMode = chart . styledMode , plotBGImage = chart . plotBGImage , chartBackgroundColor = optionsChart . backgroundColor , plotBackgroundColor = optionsChart . plotBackgroundColor , plotBackgroundImage = optionsChart . plotBackgroundImage , plotLeft = chart . plotLeft , plotTop = chart . plotTop , plotWidth = chart . plotWidth , plotHeight = chart . plotHeight , plotBox = chart . plotBox , clipRect = chart . clipRect , clipBox = chart . clipBox ; let chartBackground = chart . chartBackground , plotBackground = chart . plotBackground , plotBorder = chart . plotBorder , chartBorderWidth , mgn , bgAttr , verb = 'animate' ; if ( ! chartBackground ) { chart . chartBackground = chartBackground = renderer . rect ( ) . addClass ( 'highcharts-background' ) . add ( ) ; verb = 'attr' ; } if ( ! styledMode ) { chartBorderWidth = optionsChart . borderWidth || 0 ; mgn = chartBorderWidth + ( optionsChart . shadow ? 8 : 0 ) ; bgAttr = { fill : chartBackgroundColor || 'none' } ; if ( chartBorderWidth || chartBackground [ 'stroke-width' ] ) { bgAttr . stroke = optionsChart . borderColor ; bgAttr [ 'stroke-width' ] = chartBorderWidth ; } chartBackground . attr ( bgAttr ) . shadow ( optionsChart . shadow ) ; } else { chartBorderWidth = mgn = chartBackground . strokeWidth ( ) ; } chartBackground [ verb ] ( { x : mgn / 2 , y : mgn / 2 , width : ( chartWidth as any ) - mgn - chartBorderWidth % 2 , height : ( chartHeight as any ) - mgn - chartBorderWidth % 2 , r : optionsChart . borderRadius } ) ; verb = 'animate' ; if ( ! plotBackground ) { verb = 'attr' ; chart . plotBackground = plotBackground = renderer . rect ( ) . addClass ( 'highcharts-plot-background' ) . add ( ) ; } plotBackground [ verb ] ( plotBox ) ; if ( ! styledMode ) { plotBackground . attr ( { fill : plotBackgroundColor || 'none' } ) . shadow ( optionsChart . plotShadow ) ; if ( plotBackgroundImage ) { if ( ! plotBGImage ) { chart . plotBGImage = renderer . image ( plotBackgroundImage , plotLeft , plotTop , plotWidth , plotHeight ) . add ( ) ; } else { if ( plotBackgroundImage !== plotBGImage . attr ( 'href' ) ) { plotBGImage . attr ( 'href' , plotBackgroundImage ) ; } plotBGImage . animate ( plotBox as SVGAttributes ) ; } } } if ( ! clipRect ) { chart . clipRect = renderer . clipRect ( clipBox ) ; } else { clipRect . animate ( { width : clipBox . width , height : clipBox . height } ) ; } verb = 'animate' ; if ( ! plotBorder ) { verb = 'attr' ; chart . plotBorder = plotBorder = renderer . rect ( ) . addClass ( 'highcharts-plot-border' ) . attr ( { zIndex : 1 } ) . add ( ) ; } if ( ! styledMode ) { plotBorder . attr ( { stroke : optionsChart . plotBorderColor , 'stroke-width' : optionsChart . plotBorderWidth || 0 , fill : 'none' } ) ; } plotBorder [ verb ] ( plotBorder . crisp ( { x : plotLeft , y : plotTop , width : plotWidth , height : plotHeight } , - plotBorder . strokeWidth ( ) ) ) ; chart . isDirtyBox = false ; fireEvent ( this , 'afterDrawChartBox' ) ; } private function public propFromSeries ( ) { const chart = this , optionsChart = chart . options . chart , seriesOptions = chart . options . series as any ; let i , klass , value ; name type { boolean | undefined } [ 'inverted' , 'angular' , 'polar' ] . forEach ( function ( key ) : void { klass = seriesTypes [ ( optionsChart . type || optionsChart . defaultSeriesType ) as any ] ; value = ( optionsChart as any ) [ key ] || ( klass && ( klass . prototype as any ) [ key ] ) ; i = seriesOptions && seriesOptions . length ; while ( ! value && i -- ) { klass = seriesTypes [ seriesOptions [ i ] . type as any ] ; if ( klass && ( klass . prototype as any ) [ key ] ) { value = true ; } } ( chart as any ) [ key ] = value ; } ) ; } private function emits public linkSeries ( ) { const chart = this , chartSeries = chart . series ; chartSeries . forEach ( function ( series ) : void { series . linkedSeries . length = 0 ; } ) ; chartSeries . forEach ( function ( series ) : void { let linkedTo = series . options . linkedTo ; if ( isString ( linkedTo ) ) { if ( linkedTo === ':previous' ) { linkedTo = chart . series [ ( series . index as any ) - 1 ] as any ; } else { linkedTo = chart . get ( linkedTo as any ) as any ; } if ( linkedTo && ( linkedTo as any ) . linkedParent !== series ) { ( linkedTo as any ) . linkedSeries . push ( series ) ; series . linkedParent = linkedTo as any ; if ( ( linkedTo as any ) . enabledDataSorting ) { series . setDataSortingOptions ( ) ; } series . visible = pick ( series . options . visible , ( linkedTo as any ) . options . visible , series . visible ) ; } } } ) ; fireEvent ( this , 'afterLinkSeries' ) ; } private function public renderSeries ( ) { this . series . forEach ( function ( serie ) : void { serie . translate ( ) ; serie . render ( ) ; } ) ; } private function public renderLabels ( ) { const chart = this , labels = chart . options . labels as Oldie . LabelsOptions ; if ( labels . items ) { labels . items . forEach ( function ( label ) : void { const style = extend ( labels . style as any , label . style as any ) , x = pInt ( style . left ) + chart . plotLeft , y = pInt ( style . top ) + chart . plotTop + 12 ; delete style . left ; delete style . top ; chart . renderer . text ( label . html as any , x , y ) . attr ( { zIndex : 2 } ) . css ( style ) . add ( ) ; } ) ; } } private function public render ( ) { const chart = this , axes = chart . axes , colorAxis = chart . colorAxis , renderer = chart . renderer , options = chart . options , renderAxes = function ( axes ) : void { axes . forEach ( function ( axis ) : void { if ( axis . visible ) { axis . render ( ) ; } } ) ; } ; let correction = 0 ; chart . setTitle ( ) ; name type { Highcharts . Legend } chart . legend = new Legend ( chart , options . legend as any ) ; if ( chart . getStacks ) { chart . getStacks ( ) ; } chart . getMargins ( true ) ; chart . setChartSize ( ) ; const tempWidth = chart . plotWidth ; axes . some ( function ( axis ) : ( boolean | undefined ) { if ( axis . horiz && axis . visible && axis . options . labels . enabled && axis . series . length ) { correction = 21 ; return true ; } } as any ) ; chart . plotHeight = Math . max ( chart . plotHeight - correction , 0 ) ; const tempHeight = chart . plotHeight ; axes . forEach ( function ( axis ) : void { axis . setScale ( ) ; } ) ; chart . getAxisMargins ( ) ; const redoHorizontal = tempWidth / chart . plotWidth > 1.1 ; const redoVertical = tempHeight / chart . plotHeight > 1.05 ; if ( redoHorizontal || redoVertical ) { axes . forEach ( function ( axis ) : void { if ( ( axis . horiz && redoHorizontal ) || ( ! axis . horiz && redoVertical ) ) { axis . setTickInterval ( true ) ; } } ) ; chart . getMargins ( ) ; } chart . drawChartBox ( ) ; if ( chart . hasCartesianSeries ) { renderAxes ( axes ) ; } else if ( colorAxis && colorAxis . length ) { renderAxes ( colorAxis ) ; } if ( ! chart . seriesGroup ) { chart . seriesGroup = renderer . g ( 'series-group' ) . attr ( { zIndex : 3 } ) . add ( ) ; } chart . renderSeries ( ) ; chart . renderLabels ( ) ; chart . addCredits ( ) ; if ( chart . setResponsive ) { chart . setResponsive ( ) ; } chart . hasRendered = true ; } sample function param { Highcharts . CreditsOptions } credits public addCredits ( credits ? ) { const chart = this , creds = merge ( true , this . options . credits as Chart . CreditsOptions , credits ) ; if ( creds . enabled && ! this . credits ) { name type { Highcharts . SVGElement } this . credits = this . renderer . text ( creds . text + ( this . mapCredits || '' ) , 0 , 0 ) . addClass ( 'highcharts-credits' ) . on ( 'click' , function ( ) : void { if ( creds . href ) { win . location . href = creds . href ; } } ) . attr ( { align : ( creds . position as any ) . align , zIndex : 8 } ) ; if ( ! chart . styledMode ) { this . credits . css ( creds . style as any ) ; } this . credits . add ( ) . align ( creds . position ) ; this . credits . update = function ( options ) : void { chart . credits = ( chart . credits as any ) . destroy ( ) ; chart . addCredits ( options ) ; } ; } } sample sample function emits public destroy ( ) { const chart = this , axes = chart . axes , series = chart . series , container = chart . container , parentNode = container && container . parentNode ; let i ; fireEvent ( chart , 'destroy' ) ; if ( chart . renderer . forExport ) { erase ( charts , chart ) ; } else { charts [ chart . index ] = void 0 ; } H . chartCount -- ; chart . renderTo . removeAttribute ( 'data-highcharts-chart' ) ; removeEvent ( chart ) ; i = axes . length ; while ( i -- ) { axes [ i ] = axes [ i ] . destroy ( ) as any ; } if ( this . scroller && this . scroller . destroy ) { this . scroller . destroy ( ) ; } i = series . length ; while ( i -- ) { series [ i ] = series [ i ] . destroy ( ) as any ; } [ 'title' , 'subtitle' , 'chartBackground' , 'plotBackground' , 'plotBGImage' , 'plotBorder' , 'seriesGroup' , 'clipRect' , 'credits' , 'pointer' , 'rangeSelector' , 'legend' , 'resetZoomButton' , 'tooltip' , 'renderer' ] . forEach ( function ( name ) : void { const prop = ( chart as any ) [ name ] ; if ( prop && prop . destroy ) { ( chart as any ) [ name ] = prop . destroy ( ) ; } } ) ; if ( container ) { container . innerHTML = AST . emptyHTML ; removeEvent ( container ) ; if ( parentNode ) { discardElement ( container ) ; } } objectEach ( chart , function ( val , key ) : void { delete ( chart as any ) [ key ] ; } ) ; } private function emits public firstRender ( ) { const chart = this , options = chart . options ; if ( chart . isReadyToRender && ! chart . isReadyToRender ( ) ) { return ; } chart . getContainer ( ) ; chart . resetMargins ( ) ; chart . setChartSize ( ) ; chart . propFromSeries ( ) ; chart . getAxes ( ) ; ( isArray ( options . series ) ? options . series : [ ] ) . forEach ( function ( serieOptions ) : void { chart . initSeries ( serieOptions ) ; } ) ; chart . linkSeries ( ) ; chart . setSeriesData ( ) ; fireEvent ( chart , 'beforeRender' ) ; if ( Pointer ) { if ( MSPointer . isRequired ( ) ) { chart . pointer = new MSPointer ( chart , options ) ; } else { memberof name type { Highcharts . Pointer } instance chart . pointer = new Pointer ( chart , options ) ; } } chart . render ( ) ; chart . pointer . getChartPosition ( ) ; if ( ! chart . renderer . imgCount && ! chart . hasLoaded ) { chart . onload ( ) ; } chart . temporaryDisplay ( true ) ; } private function emits emits public onload ( ) { this . callbacks . concat ( [ this . callback as any ] ) . forEach ( function ( this , fn ) : void { if ( fn && typeof this . index !== 'undefined' ) { fn . apply ( this , [ this ] ) ; } } , this ) ; fireEvent ( this , 'load' ) ; fireEvent ( this , 'render' ) ; if ( defined ( this . index ) ) { this . setReflow ( this . options . chart . reflow ) ; } this . hasLoaded = true ; } sample sample function param { Highcharts . SeriesOptionsType } options param { boolean } redraw param { boolean | Partial < Highcharts . AnimationOptionsObject > } animation return { Highcharts . Series } emits emits public addSeries ( options , redraw ? , animation ? ) { const chart = this ; let series ; if ( options ) { redraw = pick ( redraw , true ) ; fireEvent ( chart , 'addSeries' , { options : options } , function ( ) : void { series = chart . initSeries ( options ) ; chart . isDirtyLegend = true ; chart . linkSeries ( ) ; if ( series . enabledDataSorting ) { series . setData ( options . data as any , false ) ; } fireEvent ( chart , 'afterAddSeries' , { series : series } ) ; if ( redraw ) { chart . redraw ( animation ) ; } } ) ; } return series as any ; } sample function param { Highcharts . AxisOptions } options param { boolean } isX param { boolean } redraw param { boolean | Partial < Highcharts . AnimationOptionsObject > } animation return { Highcharts . Axis } public addAxis ( options , isX ? , redraw ? , animation ? ) { return this . createAxis ( isX ? 'xAxis' : 'yAxis' , { axis : options , redraw : redraw , animation : animation } ) ; } sample function param { Highcharts . ColorAxisOptions } options param { boolean } redraw param { boolean | Partial < Highcharts . AnimationOptionsObject > } animation return { Highcharts . ColorAxis } public addColorAxis ( options , redraw ? , animation ? ) { return this . createAxis ( 'colorAxis' , { axis : options , redraw : redraw , animation : animation } ) ; } private function param { string } type param { ... Array < * > } arguments return { Highcharts . Axis | Highcharts . ColorAxis } public createAxis ( type , options ) { const axis = new Axis ( this , merge ( options . axis , { index : ( this as AnyRecord ) [ type ] . length , isX : type === 'xAxis' } ) ) ; if ( pick ( options . redraw , true ) ) { this . redraw ( options . animation ) ; } return axis ; } /**
     * Dim the chart and show a loading text or symbol. Options for the loading
     * screen are defined in  {@link
     * https://api.highcharts.com/highcharts/loading|the loading options} .
     *
     *  sample sample sample function param { string } str public showLoading ( str ? ) { const chart = this , options = chart . options , loadingOptions = options . loading , setLoadingSize = function ( ) : void { if ( loadingDiv ) { css ( loadingDiv , { left : chart . plotLeft + 'px' , top : chart . plotTop + 'px' , width : chart . plotWidth + 'px' , height : chart . plotHeight + 'px' } ) ; } } ; let loadingDiv = chart . loadingDiv , loadingSpan = chart . loadingSpan ; if ( ! loadingDiv ) { chart . loadingDiv = loadingDiv = createElement ( 'div' , { className : 'highcharts-loading highcharts-loading-hidden' } , null as any , chart . container ) ; } if ( ! loadingSpan ) { chart . loadingSpan = loadingSpan = createElement ( 'span' , { className : 'highcharts-loading-inner' } , null as any , loadingDiv ) ; addEvent ( chart , 'redraw' , setLoadingSize ) ; } loadingDiv . className = 'highcharts-loading' ; AST . setElementHTML ( loadingSpan , pick ( str , options . lang . loading , '' ) ) ; if ( ! chart . styledMode ) { css ( loadingDiv , extend ( ( loadingOptions as any ) . style , { zIndex : 10 } ) ) ; css ( loadingSpan , ( loadingOptions as any ) . labelStyle ) ; if ( ! chart . loadingShown ) { css ( loadingDiv , { opacity : 0 , display : '' } ) ; animate ( loadingDiv , { opacity : ( loadingOptions as any ) . style . opacity || 0.5 } , { duration : ( loadingOptions as any ) . showDuration || 0 } ) ; } } chart . loadingShown = true ; setLoadingSize ( ) ; } see Highcharts . Chart sample sample function public hideLoading ( ) { const options = this . options , loadingDiv = this . loadingDiv ; if ( loadingDiv ) { loadingDiv . className = 'highcharts-loading highcharts-loading-hidden' ; if ( ! this . styledMode ) { animate ( loadingDiv , { opacity : 0 } , { duration : ( options . loading as any ) . hideDuration || 100 , complete : function ( ) : void { css ( loadingDiv as any , { display : 'none' } ) ; } } ) ; } } this . loadingShown = false ; } sample function param { Highcharts . Options } options param { boolean } redraw param { boolean } oneToOne param { boolean | Partial < Highcharts . AnimationOptionsObject > } animation emits emits public update ( options , redraw ? , oneToOne ? , animation ? ) { const chart = this , adders = { credits : 'addCredits' , title : 'setTitle' , subtitle : 'setSubtitle' , caption : 'setCaption' } as Record < string , string > , isResponsiveOptions = options . isResponsiveOptions , itemsForRemoval = [ ] as Array < string > ; let updateAllAxes , updateAllSeries , runSetSize ; fireEvent ( chart , 'update' , { options : options } ) ; if ( ! isResponsiveOptions ) { chart . setResponsive ( false , true ) ; } options = cleanRecursively ( options , chart . options ) ; chart . userOptions = merge ( chart . userOptions , options ) ; const optionsChart = options . chart ; if ( optionsChart ) { merge ( true , chart . options . chart , optionsChart ) ; if ( 'className' in optionsChart ) { chart . setClassName ( optionsChart . className ) ; } if ( 'reflow' in optionsChart ) { chart . setReflow ( optionsChart . reflow ) ; } if ( 'inverted' in optionsChart || 'polar' in optionsChart || 'type' in optionsChart ) { chart . propFromSeries ( ) ; updateAllAxes = true ; } if ( 'alignTicks' in optionsChart ) { updateAllAxes = true ; } if ( 'events' in optionsChart ) { registerEventOptions ( this , optionsChart ) ; } objectEach ( optionsChart , function ( val , key ) : void { if ( chart . propsRequireUpdateSeries . indexOf ( 'chart.' + key ) !== - 1 ) { updateAllSeries = true ; } if ( chart . propsRequireDirtyBox . indexOf ( key ) !== - 1 ) { chart . isDirtyBox = true ; } if ( chart . propsRequireReflow . indexOf ( key ) !== - 1 ) { if ( isResponsiveOptions ) { chart . isDirtyBox = true ; } else { runSetSize = true ; } } } ) ; if ( ! chart . styledMode && optionsChart . style ) { chart . renderer . setStyle ( chart . options . chart . style || { } ) ; } } if ( ! chart . styledMode && options . colors ) { this . options . colors = options . colors ; } if ( options . time ) { if ( this . time === defaultTime ) { this . time = new Time ( options . time ) ; } merge ( true , chart . options . time , options . time ) ; } objectEach ( options , function ( val , key ) : void { if ( ( chart as any ) [ key ] && typeof ( chart as any ) [ key ] . update === 'function' ) { ( chart as any ) [ key ] . update ( val , false ) ; } else if ( typeof ( chart as any ) [ adders [ key ] ] === 'function' ) { ( chart as any ) [ adders [ key ] ] ( val ) ; } else if ( key !== 'colors' && chart . collectionsWithUpdate . indexOf ( key ) === - 1 ) { merge ( true , ( chart . options as any ) [ key ] , ( options as any ) [ key ] ) ; } if ( key !== 'chart' && chart . propsRequireUpdateSeries . indexOf ( key ) !== - 1 ) { updateAllSeries = true ; } } ) ; this . collectionsWithUpdate . forEach ( function ( coll ) : void { let indexMap ; if ( ( options as any ) [ coll ] ) { indexMap = [ ] ; ( chart as any ) [ coll ] . forEach ( function ( s , i ) : void { if ( ! s . options . isInternal ) { indexMap . push ( pick ( s . options . index , i ) ) ; } } ) ; splat ( ( options as any ) [ coll ] ) . forEach ( function ( newOptions , i ) : void { const hasId = defined ( newOptions . id ) ; let item ; if ( hasId ) { item = chart . get ( newOptions . id ) ; } if ( ! item && ( chart as any ) [ coll ] ) { item = ( chart as any ) [ coll ] [ indexMap ? indexMap [ i ] : i ] ; if ( item && hasId && defined ( item . options . id ) ) { item = void 0 ; } } if ( item && ( item as any ) . coll === coll ) { item . update ( newOptions , false ) ; if ( oneToOne ) { item . touched = true ; } } if ( ! item && oneToOne && chart . collectionsWithInit [ coll ] ) { chart . collectionsWithInit [ coll ] [ 0 ] . apply ( chart , [ newOptions ] . concat ( chart . collectionsWithInit [ coll ] [ 1 ] || [ ] ) . concat ( [ false ] ) ) . touched = true ; } } ) ; if ( oneToOne ) { ( chart as any ) [ coll ] . forEach ( function ( item ) : void { if ( ! item . touched && ! item . options . isInternal ) { itemsForRemoval . push ( item ) ; } else { delete item . touched ; } } ) ; } } } ) ; itemsForRemoval . forEach ( function ( item ) : void { if ( item . chart && item . remove ) { item . remove ( false ) ; } } ) ; if ( updateAllAxes ) { chart . axes . forEach ( function ( axis ) : void { axis . update ( { } , false ) ; } ) ; } if ( updateAllSeries ) { chart . getSeriesOrderByLinks ( ) . forEach ( function ( series ) : void { if ( series . chart ) { series . update ( { } , false ) ; } } , this ) ; } const newWidth = optionsChart && optionsChart . width ; const newHeight = optionsChart && ( isString ( optionsChart . height ) ? relativeLength ( optionsChart . height , newWidth || chart . chartWidth ) : optionsChart . height ) ; if ( runSetSize || ( isNumber ( newWidth ) && newWidth !== chart . chartWidth ) || ( isNumber ( newHeight ) && newHeight !== chart . chartHeight ) ) { chart . setSize ( newWidth as number , newHeight as number , animation ) ; } else if ( pick ( redraw , true ) ) { chart . redraw ( animation ) ; } fireEvent ( chart , 'afterUpdate' , { options : options , redraw : redraw , animation : animation } ) ; } /**
     * Shortcut to set the subtitle options. This can also be done from  {@link
     * Chart#update} or  Chart .
     *
     *  function param { Highcharts . SubtitleOptions } options public setSubtitle ( options , redraw ? ) { this . applyDescription ( 'subtitle' , options ) ; this . layOutTitles ( redraw ) ; } /**
     * Set the caption options. This can also be done from  {@link
     * Chart#update} .
     *
     *  function param { Highcharts . CaptionOptions } options public setCaption ( options , redraw ? ) { this . applyDescription ( 'caption' , options ) ; this . layOutTitles ( redraw ) ; } function emits emits public showResetZoom ( ) { const chart = this , lang = defaultOptions . lang , btnOptions = chart . options . chart . resetZoomButton as any , theme = btnOptions . theme , states = theme . states , alignTo = ( btnOptions . relativeTo === 'chart' || btnOptions . relativeTo === 'spacingBox' ? null : 'scrollablePlotBox' ) ; private function zoomOut ( ) { chart . zoomOut ( ) ; } fireEvent ( this , 'beforeShowResetZoom' , null as any , function ( ) : void { chart . resetZoomButton = chart . renderer . button ( lang . resetZoom , null as any , null as any , zoomOut , theme , states && states . hover ) . attr ( { align : btnOptions . position . align , title : lang . resetZoomTitle } ) . addClass ( 'highcharts-reset-zoom' ) . add ( ) . align ( btnOptions . position , false , alignTo as any ) ; } ) ; fireEvent ( this , 'afterShowResetZoom' ) ; } function emits public zoomOut ( ) { fireEvent ( this , 'selection' , { resetSelection : true } , this . zoom ) ; } private function param { Highcharts . SelectEventObject } event public zoom ( event ) { const chart = this , pointer = chart . pointer , mouseDownPos = chart . inverted ? pointer . mouseDownX : pointer . mouseDownY ; let displayButton = false , hasZoomed ; if ( ! event || ( event as any ) . resetSelection ) { chart . axes . forEach ( function ( axis ) : void { hasZoomed = ( axis . zoom as any ) ( ) ; } ) ; pointer . initiated = false ; } else { event . xAxis . concat ( event . yAxis ) . forEach ( function ( axisData ) : void { const axis = axisData . axis , axisStartPos = chart . inverted ? axis . left : axis . top , axisEndPos = chart . inverted ? axisStartPos + axis . width : axisStartPos + axis . height , isXAxis = axis . isXAxis ; let isWithinPane = false ; if ( ( ! isXAxis && ( mouseDownPos as any ) >= axisStartPos && ( mouseDownPos as any ) <= axisEndPos ) || isXAxis || ! defined ( mouseDownPos ) ) { isWithinPane = true ; } if ( pointer [ isXAxis ? 'zoomX' : 'zoomY' ] && isWithinPane ) { hasZoomed = axis . zoom ( axisData . min , axisData . max ) ; if ( axis . displayBtn ) { displayButton = true ; } } } ) ; } const resetZoomButton = chart . resetZoomButton ; if ( displayButton && ! resetZoomButton ) { chart . showResetZoom ( ) ; } else if ( ! displayButton && isObject ( resetZoomButton ) ) { chart . resetZoomButton = resetZoomButton . destroy ( ) ; } if ( hasZoomed ) { chart . redraw ( pick ( chart . options . chart . animation , event && ( event as any ) . animation , chart . pointCount < 100 ) ) ; } } private function param { Highcharts . PointerEventObject } e param { string } panning public pan ( e , panning ) { const chart = this , hoverPoints = chart . hoverPoints , panningOptions = ( typeof panning === 'object' ? panning : { enabled : panning , type : 'x' } ) , chartOptions = chart . options . chart , hasMapNavigation = chart . options . mapNavigation && chart . options . mapNavigation . enabled ; if ( chartOptions && chartOptions . panning ) { chartOptions . panning = panningOptions ; } const type = panningOptions . type ; let doRedraw ; fireEvent ( this , 'pan' , { originalEvent : e } , function ( ) : void { if ( hoverPoints ) { hoverPoints . forEach ( function ( point ) : void { point . setState ( ) ; } ) ; } let axes = chart . xAxis ; if ( type === 'xy' ) { axes = axes . concat ( chart . yAxis ) ; } else if ( type === 'y' ) { axes = chart . yAxis ; } const nextMousePos = { } ; axes . forEach ( function ( axis ) : void { if ( ! axis . options . panningEnabled || axis . options . isInternal ) { return ; } const horiz = axis . horiz , mousePos = e [ horiz ? 'chartX' : 'chartY' ] , mouseDown = horiz ? 'mouseDownX' : 'mouseDownY' , startPos = ( chart as any ) [ mouseDown ] , halfPointRange = axis . minPointOffset || 0 , pointRangeDirection = ( axis . reversed && ! chart . inverted ) || ( ! axis . reversed && chart . inverted ) ? - 1 : 1 , extremes = axis . getExtremes ( ) , panMin = axis . toValue ( startPos - mousePos , true ) + halfPointRange * pointRangeDirection , panMax = axis . toValue ( startPos + axis . len - mousePos , true ) - ( ( halfPointRange * pointRangeDirection ) || ( axis . isXAxis && axis . pointRangePadding ) || 0 ) , flipped = panMax < panMin , hasVerticalPanning = axis . hasVerticalPanning ( ) ; let newMin = flipped ? panMax : panMin , newMax = flipped ? panMin : panMax , panningState = axis . panningState , spill ; if ( hasVerticalPanning && ! axis . isXAxis && ( ! panningState || panningState . isDirty ) ) { axis . series . forEach ( function ( series ) : void { const processedData = series . getProcessedData ( true ) , dataExtremes = series . getExtremes ( processedData . yData , true ) ; if ( ! panningState ) { panningState = { startMin : Number . MAX_VALUE , startMax : - Number . MAX_VALUE } ; } if ( isNumber ( dataExtremes . dataMin ) && isNumber ( dataExtremes . dataMax ) ) { panningState . startMin = Math . min ( pick ( series . options . threshold , Infinity ) , dataExtremes . dataMin , panningState . startMin ) ; panningState . startMax = Math . max ( pick ( series . options . threshold , - Infinity ) , dataExtremes . dataMax , panningState . startMax ) ; } } ) ; } const paddedMin = Math . min ( pick ( panningState && panningState . startMin , extremes . dataMin ) , halfPointRange ? extremes . min : axis . toValue ( axis . toPixels ( extremes . min ) - axis . minPixelPadding ) ) ; const paddedMax = Math . max ( pick ( panningState && panningState . startMax , extremes . dataMax ) , halfPointRange ? extremes . max : axis . toValue ( axis . toPixels ( extremes . max ) + axis . minPixelPadding ) ) ; axis . panningState = panningState ; if ( ! axis . isOrdinal ) { spill = paddedMin - newMin ; if ( spill > 0 ) { newMax += spill ; newMin = paddedMin ; } spill = newMax - paddedMax ; if ( spill > 0 ) { newMax = paddedMax ; newMin -= spill ; } if ( axis . series . length && newMin !== extremes . min && newMax !== extremes . max && newMin >= paddedMin && newMax <= paddedMax ) { axis . setExtremes ( newMin , newMax , false , false , { trigger : 'pan' } ) ; if ( ! chart . resetZoomButton && ! hasMapNavigation && newMin !== paddedMin && newMax !== paddedMax && type . match ( 'y' ) ) { chart . showResetZoom ( ) ; axis . displayBtn = false ; } doRedraw = true ; } nextMousePos [ mouseDown ] = mousePos ; } } ) ; objectEach ( nextMousePos , ( pos , down ) : void => { ( chart as any ) [ down ] = pos ; } ) ; if ( doRedraw ) { chart . redraw ( false ) ; } css ( chart . container , { cursor : 'move' } ) ; } ) ; } } interface Chart extends ChartLike { callbacks : Array < Chart . CallbackFunction > ; collectionsWithInit : Record < string , [ Function , Array < any > ? ] > ; collectionsWithUpdate : Array < string > ; propsRequireDirtyBox : Array < string > ; propsRequireReflow : Array < string > ; propsRequireUpdateSeries : Array < string > ; } extend ( Chart . prototype , { callbacks : [ ] , /**
     * These collections (arrays) implement `Chart.addSomethig` method used in
     * chart.update() to create new object in the collection. Equivalent for
     * deleting is resolved by simple `Somethig.remove()`.
     *
     * Note: We need to define these references after initializers are bound to
     * chart's prototype.
     */ collectionsWithInit : { xAxis : [ Chart . prototype . addAxis , [ true ] ] , yAxis : [ Chart . prototype . addAxis , [ false ] ] , series : [ Chart . prototype . addSeries ] } , /**
     * These collections (arrays) implement update() methods with support for
     * one-to-one option.
     */ collectionsWithUpdate : [ 'xAxis' , 'yAxis' , 'series' ] , /**
     * These properties cause isDirtyBox to be set to true when updating. Can be
     * extended from plugins.
     */ propsRequireDirtyBox : [ 'backgroundColor' , 'borderColor' , 'borderWidth' , 'borderRadius' , 'plotBackgroundColor' , 'plotBackgroundImage' , 'plotBorderColor' , 'plotBorderWidth' , 'plotShadow' , 'shadow' ] , type { Array } propsRequireReflow : [ 'margin' , 'marginTop' , 'marginRight' , 'marginBottom' , 'marginLeft' , 'spacing' , 'spacingTop' , 'spacingRight' , 'spacingBottom' , 'spacingLeft' ] , /**
     * These properties cause all series to be updated when updating. Can be
     * extended from plugins.
     */ propsRequireUpdateSeries : [ 'chart.inverted' , 'chart.polar' , 'chart.ignoreHiddenSeries' , 'chart.type' , 'colors' , 'plotOptions' , 'time' , 'tooltip' ] } ) ; namespace Chart { export interface AfterUpdateEventObject { animation : ( boolean | Partial < AnimationOptions > ) ; options : Options ; redraw : boolean ; } export interface CallbackFunction { ( this , chart ) : void ; } export interface CaptionOptions { align ? : AlignValue ; floating ? : boolean ; margin ? : number ; style ? : CSSObject ; text ? : string ; useHTML ? : boolean ; verticalAlign ? : VerticalAlignValue ; widthAdjust ? : number ; x ? : number ; y ? : number ; } export interface CreateAxisOptionsObject { animation : ( undefined | boolean | Partial < AnimationOptions > ) ; axis : ( DeepPartial < AxisOptions > | DeepPartial < ColorAxis . Options > ) ; redraw : ( undefined | boolean ) ; } export interface CreditsOptions { enabled ? : boolean ; href ? : string ; mapText ? : string ; mapTextFull ? : string ; position ? : AlignObject ; style ? : CSSObject ; text ? : string ; } export type DescriptionOptionsType = ( TitleOptions | SubtitleOptions | CaptionOptions ) ; export interface IsInsideOptionsObject { ignoreX ? : boolean ; ignoreY ? : boolean ; inverted ? : boolean ; paneCoordinates ? : boolean ; series ? : Series ; visiblePlotOnly ? : boolean ; } export interface LabelCollectorFunction { ( ) : ( Array < ( SVGElement | undefined ) > | undefined ) ; } export interface Renderer extends SVGRenderer { plotBox : BBoxObject ; spacingBox : BBoxObject ; } export interface SubtitleOptions { align ? : AlignValue ; floating ? : boolean ; style ? : CSSObject ; text ? : string ; useHTML ? : boolean ; verticalAlign ? : VerticalAlignValue ; widthAdjust ? : number ; x ? : number ; y ? : number ; } export interface TitleOptions { align ? : AlignValue ; floating ? : boolean ; margin ? : number ; style ? : CSSObject ; text ? : string ; useHTML ? : boolean ; verticalAlign ? : VerticalAlignValue ; widthAdjust ? : number ; x ? : number ; y ? : number ; } } export default Chart ; callback Highcharts . ChartCallbackFunction param { Highcharts . Chart } chart callback Highcharts . NumberFormatterCallbackFunction param { number } number param { number } decimals param { string } decimalPoint param { string } thousandsSep return { string } interface extends Highcharts . SVGElement function param { Highcharts . TitleOptions } titleOptions param { boolean } redraw Whether to redraw the chart after the title is altered. If doing more
*        operations on the chart, it is a good idea to set redraw to false and
*        call  Chart after.
 interface extends Highcharts . SVGElement function param { Highcharts . SubtitleOptions } subtitleOptions param { boolean } redraw Whether to redraw the chart after the subtitle is altered. If doing
*        more operations on the chart, it is a good idea to set redraw to false
*        and call  Chart after.
 interface extends Highcharts . SVGElement function param { Highcharts . CaptionOptions } captionOptions param { boolean } redraw Whether to redraw the chart after the caption is altered. If doing
*        more operations on the chart, it is a good idea to set redraw to false
*        and call  Chart after.
 interface name type { boolean | undefined } name type { boolean | undefined } name type { boolean | undefined } name type { boolean | undefined } name type { Highcharts . Series | undefined } name type { boolean | undefined } '' ;