{"version":3,"sources":["webpack:///../../../../../src/.internal/plugins/sliceGrouper/SliceGrouper.ts","webpack:///./plugins/sliceGrouper.js"],"names":["SliceGrouper_SliceGrouper","_super","SliceGrouper","_this","call","this","smallSlices","List","bigSlices","groupName","groupProperties","syncLegend","_threshold","_clickDisposers","_clickBehavior","_ignoreDataUpdate","_closed","Object","tslib_es6","prototype","init","processSeries","series","target","chart","dataProvider","data","length","_dataProvider","event","Options","queue","onlyShowOnViewport","inited","_disposers","push","events","on","ev","groupSlice","undefined","clear","groupSliceItem","groupValue","dataItems","each","item","index","value","values","percent","dataContext","sliceGrouperOther","limit","threshold","hiddenInLegend","hide","hidden","label","slice","dataFields","validateRawData","groupData","category","addData","slices","dataItem","initSlices","utils_Object","key","val","clickBehavior","has","toggleGroupOn","once","toggleGroupOff","show","baseSprite","feedLegend","zoomOutButton","disableType","enableType","defineProperty","_limit","_zoomOutButton","tooltipContainer","createChild","ZoomOutButton","shouldClone","align","valign","zIndex","Number","MAX_SAFE_INTEGER","marginTop","marginRight","dispose","disposeClickEvents","Type","i","splice","invalidateData","a","shift","Plugin","Registry","registeredClasses","window","am4plugins_sliceGrouper","sliceGrouper_namespaceObject"],"mappings":";;;;;;;;;;;;;;;;;;;gRA8EAA,EAAA,SAAAC,GAmFC,SAAAC,IAAA,IAAAC,EAECF,EAAAG,KAAAC,OAAOA,YAtEDF,EAAAG,YAAkD,IAAIC,EAAA,EAKtDJ,EAAAK,UAAgD,IAAID,EAAA,EAOpDJ,EAAAM,UAAoB,QAQpBN,EAAAO,mBAQAP,EAAAQ,YAAsB,EAKnBR,EAAAS,WAAqB,EAgBrBT,EAAAU,mBAKAV,EAAAW,eAA4C,OAE5CX,EAAAY,mBAA6B,EAK7BZ,EAAAa,SAAmB,IAkW9B,OA9akCC,OAAAC,EAAA,EAAAD,CAAAf,EAAAD,GAwF1BC,EAAAiB,UAAAC,KAAP,WACCnB,EAAAkB,UAAMC,KAAIhB,KAAAC,MACVA,KAAKgB,iBAOEnB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CvB/B,OAAAiE,eAAWhF,EAAAiB,UAAA,qBAUX,WACC,OAAOd,KAAKS,oBAXb,SAAyBkC,GACpB3C,KAAKS,gBAAkBkC,IAC1B3C,KAAKS,eAAiBkC,EACtB3C,KAAK8D,+CAcAjE,EAAAiB,UAAA6E,QAAP,WAKC,GAJA3F,KAAK4F,qBACL5F,KAAKkC,gBAAaC,EAClBnC,KAAKC,YAAYmC,QACjBpC,KAAKG,UAAUiC,QACXpC,KAAKuB,eAAiBsE,EAAA,QAAc7F,KAAKuB,cAAcF,MAC1D,IAAI,IAAIyE,EAAI,EAAGA,EAAI9F,KAAKuB,cAAcF,KAAKC,OAAQwE,IAAK,CAEvD,GADY9F,KAAKuB,cAAcF,KAAKyE,GAC5B/C,kBAAmB,CAC1B/C,KAAKuB,cAAcF,KAAK0E,OAAOD,EAAG,GAClC9F,KAAKuB,cAAcyE,iBACnB,OAIHpG,EAAAkB,UAAM6E,QAAO5F,KAAAC,OAGNH,EAAAiB,UAAA8E,mBAAR,WACC,IAAMK,EAAIjG,KAAKQ,gBAEf,IADAR,KAAKQ,gBAAuB,KACR,IAAbyF,EAAE3E,QAAc,CACL2E,EAAEC,QACVP,YAIZ9F,EA9aA,CAAkCsG,EAAA,GAsblCC,EAAA,EAASC,kBAAgC,aAAI1G,ECngB7C2G,OAAAC,wBAAiCC","file":"./plugins/sliceGrouper.js","sourcesContent":["/**\r\n * Plugin for automatically grouping small chart slices into single group.\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Plugin } from \"../../core/utils/Plugin\";\r\nimport { PercentSeries } from \"../../charts/series/PercentSeries\";\r\nimport { FunnelSlice, IFunnelSliceProperties } from \"../../charts/elements/FunnelSlice\";\r\nimport { PercentChart } from \"../../charts/types/PercentChart\";\r\nimport { IDisposer } from \"../../core/utils/Disposer\";\r\nimport { List } from \"../../core/utils/List\";\r\nimport { Slice } from \"../../core/elements/Slice\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { Optional } from \"../../core/utils/Type\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { ZoomOutButton } from \"../../core/elements/ZoomOutButton\";\r\nimport { Component } from \"../../core/Component\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { options } from \"../../core/Options\";\r\n\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * A plugin which automatically groups [[PercenSeries]] slices that are smaller\r\n * than certain percent into one \"Other\" slice.\r\n *\r\n * By pushing an instance of [[SliceGrouper]] into `plugin` list of\r\n * any [[PercentSeries]], it automatically applies the functionality.\r\n *\r\n * Example:\r\n *\r\n * ```TypeScript\r\n * let series = chart.series.push(new am4charts.PieSeries());\r\n * series.dataFields.valueY = \"value\";\r\n * series.dataFields.dateX = \"date\";\r\n *\r\n * let grouper = series.plugins.push(new am4plugins_sliceGrouper.SliceGrouper());\r\n * ```\r\n * ```JavaScript\r\n * var series = chart.series.push(new am4charts.PieSeries());\r\n * series.dataFields.valueY = \"value\";\r\n * series.dataFields.dateX = \"date\";\r\n *\r\n * var grouper = series.plugins.push(new am4plugins_sliceGrouper.SliceGrouper());\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * // ...\r\n * }, {\r\n * \"type\": \"PieSeries\",\r\n * \"dataFields\": {\r\n * \"valueY\": \"value\",\r\n * \"dateX\": \"date\"\r\n * },\r\n * \"plugins\": [{\r\n * \"type\": \"SliceGrouper\"\r\n * }]\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @since 4.3.11\r\n */\r\nexport class SliceGrouper extends Plugin {\r\n\r\n\t/**\r\n\t * A series object that will need its slices grouped.\r\n\t */\r\n\tpublic target: Optional;\r\n\r\n\t/**\r\n\t * A reference to \"Other\" slice.\r\n\t */\r\n\tpublic groupSlice: Sprite;\r\n\r\n\t/**\r\n\t * A list of small slices that do not satisfy `threshold`.\r\n\t */\r\n\tpublic smallSlices: List = new List();\r\n\r\n\t/**\r\n\t * A list of big slices that do not satisfy `threshold`.\r\n\t */\r\n\tpublic bigSlices: List = new List();\r\n\r\n\t/**\r\n\t * A name to use for the \"Other\" slice.\r\n\t *\r\n\t * @default \"Other\"\r\n\t */\r\n\tpublic groupName: string = \"Other\";\r\n\r\n\t/**\r\n\t * Custom properties to apply to the \"Other\" slice.\r\n\t *\r\n\t * @since 4.5.3\r\n\t * @type {IFunnelSliceProperties}\r\n\t */\r\n\tpublic groupProperties: IFunnelSliceProperties = {};\r\n\r\n\t/**\r\n\t * If set to `true` the legend will be synced to show currently visible\r\n\t * slices only.\r\n\t *\r\n\t * @defaylt false\r\n\t */\r\n\tpublic syncLegend: boolean = false;\r\n\r\n\t/**\r\n\t * Threshold percent.\r\n\t */\r\n\tprotected _threshold: number = 5;\r\n\r\n\t/**\r\n\t * Maximum number of slices.\r\n\t */\r\n\tprotected _limit: Optional;\r\n\r\n\t/**\r\n\t * Zoom out button. Shown when \"Other\" slice is broken down to zoom back\r\n\t * out to \"Other\".\r\n\t */\r\n\tprotected _zoomOutButton: ZoomOutButton;\r\n\r\n\t/**\r\n\t * Disposer for click events.\r\n\t */\r\n\tprotected _clickDisposers: Array = [];\r\n\r\n\t/**\r\n\t * What happens when \"Other\" slice is cicked.\r\n\t */\r\n\tprotected _clickBehavior: \"none\" | \"break\" | \"zoom\" = \"none\";\r\n\r\n\tprotected _ignoreDataUpdate: boolean = false;\r\n\r\n\t/**\r\n\t * Is group slice currently closed or expanded?\r\n\t */\r\n\tprotected _closed: boolean = true;\r\n\r\n\tprotected _dataProvider: Component;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\t// Nothing to do here\r\n\t\tsuper();\r\n\t}\r\n\r\n\tpublic init() {\r\n\t\tsuper.init();\r\n\t\tthis.processSeries();\r\n\t}\r\n\r\n\t/**\r\n\t * Decorates series with required events and adapters used to hijack its\r\n\t * data.\r\n\t */\r\n\tprivate processSeries(): void {\r\n\r\n\t\tconst series = this.target;\r\n\t\tconst chart = series.chart;\r\n\t\tconst dataProvider: Component = series.data && series.data.length ? series : chart;\r\n\t\tthis._dataProvider = dataProvider;\r\n\r\n\t\t// Invalidate calculated data whenever data updates\r\n\t\tconst event = (options.queue || options.onlyShowOnViewport) && !chart.inited ? \"inited\" : \"datavalidated\";\r\n\t\tthis._disposers.push(dataProvider.events.on(event, (ev) => {\r\n\r\n\r\n\t\t\tif (this._ignoreDataUpdate) {\r\n\t\t\t\tthis._ignoreDataUpdate = false;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tthis.groupSlice = undefined;\r\n\t\t\tthis.smallSlices.clear();\r\n\t\t\tthis.bigSlices.clear();\r\n\r\n\t\t\t// Collect and prepare small slices\r\n\t\t\tlet groupValue = 0;\r\n\t\t\tlet groupSliceItem;\r\n\t\t\tseries.dataItems.each((item, index) => {\r\n\t\t\t\tlet value = item.values.value.percent;\r\n\t\t\t\tif ((item.dataContext).sliceGrouperOther) {\r\n\t\t\t\t\tgroupSliceItem = item.dataContext;\r\n\t\t\t\t}\r\n\t\t\t\telse if ((this.limit && (index >= this.limit)) || (!this.limit && (value <= this.threshold))) {\r\n\t\t\t\t\tgroupValue += item.value;\r\n\t\t\t\t\titem.hiddenInLegend = true;\r\n\t\t\t\t\titem.hide();\r\n\t\t\t\t\titem.hidden = true;\r\n\r\n\t\t\t\t\t// We need this in order to handle conflict with responsive\r\n\t\t\t\t\t// functionality\r\n\t\t\t\t\titem.label.events.on(\"transitionended\", (ev) => {\r\n\t\t\t\t\t\tif (this._closed) {\r\n\t\t\t\t\t\t\titem.hide();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tthis.smallSlices.push(item.slice);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthis.bigSlices.push(item.slice);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// Create \"Other\" slice\r\n\t\t\tif (groupValue > 0) {\r\n\t\t\t\tif (groupSliceItem) {\r\n\t\t\t\t\t(groupSliceItem)[series.dataFields.value] = groupValue;\r\n\t\t\t\t\tthis._ignoreDataUpdate = true;\r\n\t\t\t\t\tdataProvider.validateRawData();\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tlet groupData: any = {\r\n\t\t\t\t\t\tsliceGrouperOther: true\r\n\t\t\t\t\t};\r\n\t\t\t\t\tgroupData[series.dataFields.category] = this.groupName;\r\n\t\t\t\t\tgroupData[series.dataFields.value] = groupValue;\r\n\t\t\t\t\tthis._ignoreDataUpdate = true;\r\n\t\t\t\t\tdataProvider.addData(groupData);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._disposers.push(series.events.on(\"validated\", (ev) => {\r\n\t\t\tseries.slices.each((slice) => {\r\n\t\t\t\tif ((slice.dataItem.dataContext).sliceGrouperOther) {\r\n\t\t\t\t\tif (!this.groupSlice) {\r\n\t\t\t\t\t\tthis.groupSlice = slice;\r\n\t\t\t\t\t\tthis.initSlices();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}));\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Initializes group slice.\r\n\t */\r\n\tprivate initSlices(): void {\r\n\r\n\t\tif (!this.groupSlice) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Apply custom peroperties\r\n\t\t$object.each(this.groupProperties, (key, val) => {\r\n\t\t\t(this.groupSlice)[key] = val;\r\n\t\t});\r\n\r\n\t\t// Set up click\r\n\t\tif (this.clickBehavior != \"none\") {\r\n\r\n\t\t\tif (!this.groupSlice.events.has(\"hit\", this.toggleGroupOn, this)) {\r\n\t\t\t\tthis._clickDisposers.push(this.groupSlice.events.on(\"hit\", this.toggleGroupOn, this));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Toggles group on.\r\n\t */\r\n\tprivate toggleGroupOn(): void {\r\n\r\n\t\tif (this.clickBehavior == \"none\") {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis._closed = false;\r\n\r\n\t\t// Hide \"Other\" slice\r\n\t\tthis.groupSlice.dataItem.hide();\r\n\t\tif (this.syncLegend) {\r\n\t\t\t(this.groupSlice.dataItem).hiddenInLegend = true;\r\n\t\t}\r\n\r\n\t\tthis._clickDisposers.push(this.groupSlice.events.once(\"shown\", (ev) => {\r\n\t\t\tthis.toggleGroupOff();\r\n\t\t}));\r\n\r\n\t\t// Unhide hidden slices\r\n\t\tthis.smallSlices.each((slice) => {\r\n\t\t\tslice.dataItem.hidden = false;\r\n\t\t\tslice.dataItem.show();\r\n\t\t\tif (this.syncLegend) {\r\n\t\t\t\t(slice.dataItem).hiddenInLegend = false;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\r\n\t\t// Maybe hide big slices\r\n\t\tif (this.clickBehavior == \"zoom\") {\r\n\t\t\tthis.bigSlices.each((slice) => {\r\n\t\t\t\tslice.dataItem.hide();\r\n\t\t\t\tif (this.syncLegend) {\r\n\t\t\t\t\t(slice.dataItem).hiddenInLegend = true;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (this.syncLegend) {\r\n\t\t\t(this.target.baseSprite).feedLegend();\r\n\t\t}\r\n\r\n\t\t// Show zoomout button\r\n\t\tthis.zoomOutButton.show();\r\n\t}\r\n\r\n\t/**\r\n\t * Toggles group off.\r\n\t */\r\n\tprivate toggleGroupOff(): void {\r\n\r\n\t\tif (this.clickBehavior == \"none\") {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis._closed = true;\r\n\r\n\t\t// Toggle \"Other\" slice back on\r\n\t\tthis.groupSlice.events.disableType(\"shown\")\r\n\t\tthis.groupSlice.dataItem.show();\r\n\t\tthis.groupSlice.events.enableType(\"shown\");\r\n\t\tif (this.syncLegend) {\r\n\t\t\t(this.groupSlice.dataItem).hiddenInLegend = false;\r\n\t\t}\r\n\r\n\r\n\t\t// Maybe unhide big slices\r\n\t\tif (this.clickBehavior == \"zoom\") {\r\n\t\t\tthis.bigSlices.each((slice) => {\r\n\t\t\t\tslice.dataItem.hidden = false;\r\n\t\t\t\tslice.dataItem.show();\r\n\t\t\t\tif (this.syncLegend) {\r\n\t\t\t\t\t(slice.dataItem).hiddenInLegend = false;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Hide small slices\r\n\t\tthis.smallSlices.each((slice) => {\r\n\t\t\tslice.dataItem.hide();\r\n\t\t\tif (this.syncLegend) {\r\n\t\t\t\t(slice.dataItem).hiddenInLegend = true;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif (this.syncLegend) {\r\n\t\t\t(this.target.baseSprite).feedLegend();\r\n\t\t}\r\n\r\n\t\t// Hide zoomout button\r\n\t\tthis.zoomOutButton.hide();\r\n\t}\r\n\r\n\t/**\r\n\t * Percent threshold which slices to group. If a slice is less than\r\n\t * `threshold` percent, it will be moved into \"Other\" group.\r\n\t *\r\n\t * @default 5\r\n\t * @param value Threshold\r\n\t */\r\n\tpublic set threshold(value: number) {\r\n\t\tif (this._threshold != value) {\r\n\t\t\tthis._threshold = value;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Threshold\r\n\t */\r\n\tpublic get threshold(): number {\r\n\t\treturn this._threshold;\r\n\t}\r\n\r\n\t/**\r\n\t * Maximum number of ungrouped slices to show. Any slice beyond `limit` will\r\n\t * go into the \"Other\" group.\r\n\t *\r\n\t * NOTE: if `limit` is set, `threshold` setting will be ignored.\r\n\t *\r\n\t * @default undefined\r\n\t * @since 4.9.14\r\n\t * @param value Limit\r\n\t */\r\n\tpublic set limit(value: number) {\r\n\t\tif (this._limit != value) {\r\n\t\t\tthis._limit = value;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Limit\r\n\t */\r\n\tpublic get limit(): number {\r\n\t\treturn this._limit;\r\n\t}\r\n\r\n\t/**\r\n\t * An instance of [[ZoomOutButton]] that is shown when \"Other\" slice is\r\n\t * broken down, to get back to grouped state.\r\n\t *\r\n\t * @param value Button\r\n\t */\r\n\tpublic set zoomOutButton(value: ZoomOutButton) {\r\n\t\tthis._zoomOutButton = value;\r\n\t}\r\n\r\n\t/**\r\n\t * @return Button\r\n\t */\r\n\tpublic get zoomOutButton(): ZoomOutButton {\r\n\t\tif (!this._zoomOutButton) {\r\n\t\t\tconst chart = this.target.baseSprite;\r\n\t\t\tlet zoomOutButton = chart.tooltipContainer.createChild(ZoomOutButton);\r\n\t\t\tzoomOutButton.shouldClone = false;\r\n\t\t\tzoomOutButton.align = \"right\";\r\n\t\t\tzoomOutButton.valign = \"top\";\r\n\t\t\tzoomOutButton.zIndex = Number.MAX_SAFE_INTEGER;\r\n\t\t\tzoomOutButton.marginTop = 5;\r\n\t\t\tzoomOutButton.marginRight = 5;\r\n\r\n\t\t\tzoomOutButton.hide(0);\r\n\t\t\tthis.zoomOutButton = zoomOutButton;\r\n\t\t\tthis._disposers.push(this._zoomOutButton);\r\n\r\n\t\t\tzoomOutButton.events.on(\"hit\", () => {\r\n\t\t\t\tthis.toggleGroupOff();\r\n\t\t\t}, this);\r\n\t\t}\r\n\t\treturn this._zoomOutButton;\r\n\t}\r\n\r\n\t/**\r\n\t * What happens when \"Other\" slice is clicked/tapped:\r\n\t *\r\n\t * * \"none\": nothing (default)\r\n\t * * \"break\": the slice is broken down into actual slices it consists of\r\n\t * * \"zoom\": actual small slices are shown and the rest of the slices are hidden\r\n\t *\r\n\t * @param value Click behavior\r\n\t */\r\n\tpublic set clickBehavior(value: \"none\" | \"break\" | \"zoom\") {\r\n\t\tif (this._clickBehavior != value) {\r\n\t\t\tthis._clickBehavior = value;\r\n\t\t\tthis.initSlices();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @returns Click behavior\r\n\t */\r\n\tpublic get clickBehavior(): \"none\" | \"break\" | \"zoom\" {\r\n\t\treturn this._clickBehavior;\r\n\t}\r\n\r\n\t/**\r\n\t * Disposes the element\r\n\t */\r\n\tpublic dispose(): void {\r\n\t\tthis.disposeClickEvents();\r\n\t\tthis.groupSlice = undefined;\r\n\t\tthis.smallSlices.clear();\r\n\t\tthis.bigSlices.clear();\r\n\t\tif (this._dataProvider && $type.isArray(this._dataProvider.data)) {\r\n\t\t\tfor(let i = 0; i < this._dataProvider.data.length; i++) {\r\n\t\t\t\tconst row = this._dataProvider.data[i];\r\n\t\t\t\tif (row.sliceGrouperOther) {\r\n\t\t\t\t\tthis._dataProvider.data.splice(i, 1);\r\n\t\t\t\t\tthis._dataProvider.invalidateData();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tsuper.dispose();\r\n\t}\r\n\r\n\tprivate disposeClickEvents(): void {\r\n\t\tconst a = this._clickDisposers;\r\n\t\tthis._clickDisposers = null;\r\n\t\twhile (a.length !== 0) {\r\n\t\t\tconst disposer = a.shift();\r\n\t\t\tdisposer.dispose();\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"SliceGrouper\"] = SliceGrouper;\r\n\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/sliceGrouper/SliceGrouper.ts","import * as m from \"../../es2015/plugins/sliceGrouper\";\nwindow.am4plugins_sliceGrouper = m;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./plugins/sliceGrouper.js\n// module id = null\n// module chunks = "],"sourceRoot":""}