{"version":3,"sources":["webpack:///../../../../../src/.internal/plugins/forceDirected/ForceDirectedLink.ts","webpack:///../../../../../src/.internal/plugins/forceDirected/ForceDirectedNode.ts","webpack:///../../../../../src/.internal/plugins/forceDirected/ForceDirectedSeries.ts","webpack:///../../../../../src/.internal/plugins/forceDirected/ForceDirectedTree.ts","webpack:///./plugins/forceDirected.js"],"names":["ForceDirectedLink_ForceDirectedLink","_super","ForceDirectedLink","_this","call","this","className","interfaceColors","InterfaceColorSet","fillOpacity","strokeOpacity","stroke","getFor","isMeasured","nonScalingStroke","interactionsEnabled","distance","strength","applyTheme","Object","tslib_es6","prototype","validate","source","target","path","Path","x","pixelX","y","pixelY","isHidden","isHiding","hide","show","defineProperty","_source","value","_disposers","push","events","on","invalidate","_target","_adapterO","isEnabled","apply","properties","setPropertyValue","getTooltipX","getPropertyValue","Percent","x1","getTooltipY","y1","Sprite","Registry","registeredClasses","ForceDirectedNode_ForceDirectedNode","ForceDirectedNode","applyOnClones","togglable","draggable","setStateOnChildren","isActive","expandAll","paddingRadius","linksWith","Dictionary","dataItem","component","nodeDragStarted","updateSimulation","outerCircle","createChild","Circle","shouldClone","strokeWidth","bgColor","fill","states","create","scale","outerActiveState","visible","circle","hiddenState","radius","addDisposer","updateLabelSize","label","Label","horizontalCenter","verticalCenter","textAlign","textValign","nonScaling","adapter","add","pixelRadius","text","dsRadius","defaultState","Type","width","height","copyFrom","setActive","children","dataItemsInvalid","childrenInited","initNode","updateNodeList","each","child","node","parentLink","dispatchVisibility","restartSimulation","linkWith","link","getKey","uid","links","parent","zIndex","nodeIndex","nodes","indexOf","childIndex","forceLinks","childLinks","setKey","unlinkWith","removeKey","Container","ForceDirectedSeries_ForceDirectedSeriesDataItem","ForceDirectedSeriesDataItem","hasChildren","List","duration","delay","fields","_visible","event_1","type","dispatchImmediately","toValue","event_2","values","setValue","_node","component_1","node_1","Disposer","removeValue","addSprite","itemsFocusable","role","focusable","once","ev","readerTitle","populateString","itemReaderText","undefined","hoverable","level","color","colors","getIndex","step","index","setProperty","hiddenInLegend","collapsed","fixed","handleFixed","createLegendMarker","marker","_legendDataItem","valueLabel","Series","ForceDirectedSeries_ForceDirectedSeries","ForceDirectedSeries","_tick","d3forceSimulation","src","maxRadius","minRadius","ColorSet","manyBodyStrength","centerStrength","showOnTick","updateRadiuses","dataItems","updateLinksAndNodes","w","utils_Math","innerWidth","h","innerHeight","force","alpha","restart","getMaxValue","max","cmax","validateDataItems","chart","__disabled","_dataDisposers","_maxValue","reset","Math","min","length","angle","xField","propertyFields","yField","dataContext","dataFields","processLinkWith","i","alphaDecay","pow","feedLegend","fx","Utils","fy","dragFixedNodes","di","_linkForce","_collisionForce","opacity","linkDatum","getDistance","getStrength","disabled","nodeDragEnded","alphaTarget","updateRadius","minSide","cursorOverStyle","Mouse","pointer","default","maxLevels","index_1","next","diColor","utils_Array","id","dataItemToConnect","getDataItemById","linkWithStrength","createDataItem","_nodes","createNode","_links","createLink","velocityDecay","RoundedRectangle","cornerRadius","legendDataItem","colorOrig","property","ForceDirectedTree_ForceDirectedTreeDataItem","ForceDirectedTreeDataItem","SerialChart","ForceDirectedTree_ForceDirectedTree","ForceDirectedTree","zoomDuration","zoomEasing","Ease","minZoomLevel","maxZoomLevel","seriesContainer","layout","mouseWheelBehavior","zoomStep","background","Color","zoomOutButton","ZoomOutButton","valign","Number","MAX_SAFE_INTEGER","marginTop","marginRight","dx","interaction","Interaction","body","event","zoomable","svgPoint","point","htmlContainer","svgContainer","dragStart","dragStop","createSeries","legend","legendData_1","series","legendSettings","labelText","labels","template","itemLabelText","valueText","valueLabels","itemValueText","data","name","applyInternalDefaults","language","translate","getExporting","exporting","info","format","handleWheel","zoomLevel","shift","zoomToPoint","center","container","maxWidth","maxHeight","animate","to","zoomToDataItem","zoomOut","pixelWidth","pixelHeight","resizable","dragWhileResize","_backgroundZoomoutDisposer","dispose","_mouseWheelDisposer","chartContainer","wheelable","_zoomOutButton","button","window","am4plugins_forceDirected","forceDirected_namespaceObject"],"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AAKiV,qBACRjV,KAAKiV,oBAAoBD,UAE1BhV,KAAKkV,eAAeC,WAAY,qCAoBnCrU,OAAAgB,eAAW6O,EAAA3P,UAAA,gBAOX,WACC,OAAOhB,KAAK6C,iBAAiB,iBAR9B,SAAoBb,GACnBhC,KAAK2C,iBAAiB,WAAYX,oCAkBnClB,OAAAgB,eAAW6O,EAAA3P,UAAA,qBAYX,WACC,OAAOhB,KAAKoV,oBAbb,SAAyBC,GAAzB,IAAAvV,EAAAE,KACCA,KAAKoV,eAAiBC,EAClBA,GACHA,EAAOlT,OAAOC,GAAG,MAAO,WACvBtC,EAAK4U,gBACH1K,GAAW,oCAUjB2G,EAzbA,CAAuCF,EAAA,GAicvCtN,EAAA,EAASC,kBAAqC,kBAAIsN,EAClDvN,EAAA,EAASC,kBAA6C,0BAAImN,EC1jB1D+E,OAAAC,yBAAkCC","file":"./plugins/forceDirected.js","sourcesContent":["/**\r\n * ForceDirectedLink module.\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite, ISpriteProperties, ISpriteAdapters, ISpriteEvents } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { ForceDirectedNode } from \"./ForceDirectedNode\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport { percent, Percent } from \"../../core/utils/Percent\";\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines properties for [[ForceDirectedLink]].\r\n */\r\nexport interface IForceDirectedLinkProperties extends ISpriteProperties {\r\n\r\n\t/**\r\n\t * Distance between centers of source and target nodes.\r\n\t */\r\n\tdistance?: number;\r\n\r\n\t/**\r\n\t * Strength of the \"traction\" between source and target nodes.\r\n\t */\r\n\tstrength?: number;\r\n\r\n}\r\n\r\n/**\r\n * Defines events for [[ForceDirectedLink]].\r\n */\r\nexport interface IForceDirectedLinkEvents extends ISpriteEvents { }\r\n\r\n/**\r\n * Defines adapters for [[ForceDirectedLink]].\r\n *\r\n * @see {@link Adapter}\r\n */\r\nexport interface IForceDirectedLinkAdapters extends ISpriteAdapters, IForceDirectedLinkProperties { }\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 class that builds links between [[ForceDirectedNode]] elements.\r\n *\r\n * @see {@link IForceDirectedLinkEvents} for a list of available events\r\n * @see {@link IForceDirectedLinkAdapters} for a list of available Adapters\r\n * @since 4.3.8\r\n * @important\r\n */\r\nexport class ForceDirectedLink extends Sprite {\r\n\r\n\t/**\r\n\t * Defines available properties.\r\n\t */\r\n\tpublic _properties!: IForceDirectedLinkProperties;\r\n\r\n\t/**\r\n\t * Defines available adapters.\r\n\t */\r\n\tpublic _adapter!: IForceDirectedLinkAdapters;\r\n\r\n\t/**\r\n\t * Defines available events.\r\n\t */\r\n\tpublic _events!: IForceDirectedLinkEvents;\r\n\r\n\t/**\r\n\t * Link source node\r\n\t */\r\n\tprotected _source: ForceDirectedNode;\r\n\r\n\t/**\r\n\t * Link parent node\r\n\t */\r\n\tprotected _target: ForceDirectedNode;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.className = \"ForceDirectedLink\";\r\n\r\n\t\tlet interfaceColors = new InterfaceColorSet();\r\n\r\n\t\tthis.fillOpacity = 0;\r\n\t\tthis.strokeOpacity = 0.5;\r\n\t\tthis.stroke = interfaceColors.getFor(\"grid\");\r\n\t\tthis.isMeasured = false;\r\n\t\tthis.nonScalingStroke = true;\r\n\r\n\t\tthis.interactionsEnabled = false;\r\n\r\n\t\tthis.distance = 1.5;\r\n\t\tthis.strength = 1;\r\n\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n\t/**\r\n\t * Validates element:\r\n\t * * Triggers events\r\n\t * * Redraws the element\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t */\r\n\tpublic validate() {\r\n\t\tsuper.validate();\r\n\t\tlet source = this.source;\r\n\t\tlet target = this.target;\r\n\t\tif (source && target) {\r\n\t\t\tthis.path = $path.moveTo({ x: source.pixelX, y: source.pixelY }) + $path.lineTo({ x: target.pixelX, y: target.pixelY });\r\n\r\n\t\t\tif (source.isHidden || target.isHidden || source.isHiding || target.isHiding) {\r\n\t\t\t\tthis.hide();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis.show();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Source node - a node link starts from.\r\n\t * \r\n\t * @param value Source node\r\n\t */\r\n\tpublic set source(value: ForceDirectedNode) {\r\n\t\tif (value) {\r\n\t\t\tthis._source = value;\r\n\t\t\tthis._disposers.push(value.events.on(\"positionchanged\", this.invalidate, this, false));\r\n\t\t\tthis._disposers.push(value.events.on(\"validated\", this.invalidate, this, false));\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Source node\r\n\t */\r\n\tpublic get source(): ForceDirectedNode {\r\n\t\treturn this._source;\r\n\t}\r\n\r\n\t/**\r\n\t * Target node - a node link ends at.\r\n\t * \r\n\t * @param value Target node\r\n\t */\r\n\tpublic set target(value: ForceDirectedNode) {\r\n\t\tif (value) {\r\n\t\t\tthis._target = value;\r\n\t\t\tthis._disposers.push(value.events.on(\"positionchanged\", this.invalidate, this, false));\r\n\t\t\tthis._disposers.push(value.events.on(\"validated\", this.invalidate, this, false));\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Target node\r\n\t */\r\n\tpublic get target(): ForceDirectedNode {\r\n\t\treturn this._target;\r\n\t}\r\n\r\n\t/**\r\n\t * Distance between centers of source and target nodes.\r\n\t *\r\n\t * This is relative to the radii to sum of both source and target nodes.\r\n\t *\r\n\t * E.g. if this would be set to `1` both nodes would be touching each other.\r\n\t *\r\n\t * @default 1.5\r\n\t * @param value Distance\r\n\t */\r\n\tpublic set distance(value: number) {\r\n\t\tthis.setPropertyValue(\"distance\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Distance\r\n\t */\r\n\tpublic get distance(): number {\r\n\t\tif (this._adapterO) {\r\n\t\t\tif (this._adapterO.isEnabled(\"distance\")) {\r\n\t\t\t\treturn this._adapterO.apply(\"distance\", this.properties.distance);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.properties.distance;\r\n\t}\r\n\r\n\t/**\r\n\t * Relative \"strength\" of the traction between linked nodes.\r\n\t *\r\n\t * Available values: 0 to XX.\r\n\t *\r\n\t * The bigger the number, the more rigid the link and the less it will\r\n\t * stretch when node is dragged.\r\n\t *\r\n\t * Carefully with very big numbers: nodes and links might start behaving\r\n\t * quite \"nerviously\".\r\n\t *\r\n\t * @default 1\r\n\t * @param value Strength\r\n\t */\r\n\tpublic set strength(value: number) {\r\n\t\tthis.setPropertyValue(\"strength\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Strength\r\n\t */\r\n\tpublic get strength(): number {\r\n\t\tif (this._adapterO) {\r\n\t\t\tif (this._adapterO.isEnabled(\"strength\")) {\r\n\t\t\t\treturn this._adapterO.apply(\"strength\", this.properties.strength);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.properties.strength;\r\n\t}\r\n\r\n\t/**\r\n\t * X coordinate for the slice tooltip.\r\n\t *\r\n\t * @ignore\r\n\t * @return X\r\n\t */\r\n\tpublic getTooltipX(): number {\r\n\t\tlet x = this.getPropertyValue(\"tooltipX\");\r\n\t\tif (!(x instanceof Percent)) {\r\n\t\t\tx = percent(50);\r\n\t\t}\r\n\t\tif (x instanceof Percent) {\r\n\t\t\tlet source = this.source;\r\n\t\t\tlet target = this.target;\r\n\t\t\tif (source && target) {\r\n\t\t\t\tlet x1 = source.pixelX;\r\n\t\t\t\tlet x2 = target.pixelX;\r\n\t\t\t\treturn x1 + (x2 - x1) * x.value;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn 0;\r\n\t}\r\n\r\n\t/**\r\n\t * Y coordinate for the slice tooltip.\r\n\t *\r\n\t * @ignore\r\n\t * @return Y\r\n\t */\r\n\tpublic getTooltipY(): number {\r\n\t\tlet y = this.getPropertyValue(\"tooltipY\");\r\n\t\tif (!(y instanceof Percent)) {\r\n\t\t\ty = percent(50);\r\n\t\t}\r\n\t\tif (y instanceof Percent) {\r\n\t\t\tlet source = this.source;\r\n\t\t\tlet target = this.target;\r\n\t\t\tif (source && target) {\r\n\t\t\t\tlet y1 = source.pixelY;\r\n\t\t\t\tlet y2 = target.pixelY;\r\n\t\t\t\treturn y1 + (y2 - y1) * y.value;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn 0;\r\n\t}\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[\"ForceDirectedLink\"] = ForceDirectedLink;\r\n\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/forceDirected/ForceDirectedLink.ts","/**\r\n * Module that defines everything related to building ForceDirectedNodes.\r\n * \r\n * It is a container which has ForceDirectedNode element which is a RoundedRectangle.\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container, IContainerProperties, IContainerAdapters, IContainerEvents } from \"../../core/Container\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { Circle } from \"../../core/elements/Circle\";\r\nimport { Label } from \"../../core/elements/Label\";\r\nimport { ForceDirectedSeriesDataItem } from \"./ForceDirectedSeries\";\r\nimport { ForceDirectedLink } from \"./ForceDirectedLink\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { Dictionary, DictionaryDisposer } from \"../../core/utils/Dictionary\";\r\n\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines properties for [[ForceDirectedNode]].\r\n */\r\nexport interface IForceDirectedNodeProperties extends IContainerProperties {\r\n\r\n\t/**\r\n\t * If set to `true` (default) toggling a node on will automatically expand\r\n\t * all nodes across the whole tree (all levels) of its descendants.\r\n\t *\r\n\t * Setting to `false` will only expand immediate children (one level).\r\n\t */\r\n\texpandAll?: boolean;\r\n\r\n\t/**\r\n\t * Padding of the nodes, in pixels.\r\n\t */\r\n\tpaddingRadius?: number;\r\n}\r\n\r\n/**\r\n * Defines events for [[ForceDirectedNode]].\r\n */\r\nexport interface IForceDirectedNodeEvents extends IContainerEvents { }\r\n\r\n/**\r\n * Defines adapters for [[ForceDirectedNode]].\r\n *\r\n * @see {@link Adapter}\r\n */\r\nexport interface IForceDirectedNodeAdapters extends IContainerAdapters, IForceDirectedNodeProperties { }\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 * Class used to creates [[ForceDirectedNode]] elements (circles).\r\n *\r\n * @see {@link IForceDirectedNodeEvents} for a list of available events\r\n * @see {@link IForceDirectedNodeAdapters} for a list of available Adapters\r\n * @since 4.3.8\r\n * @important\r\n */\r\nexport class ForceDirectedNode extends Container {\r\n\r\n\t/**\r\n\t * Defines available properties.\r\n\t */\r\n\tpublic _properties!: IForceDirectedNodeProperties;\r\n\r\n\t/**\r\n\t * Defines available adapters.\r\n\t */\r\n\tpublic _adapter!: IForceDirectedNodeAdapters;\r\n\r\n\t/**\r\n\t * Defines available events.\r\n\t */\r\n\tpublic _events!: IForceDirectedNodeEvents;\r\n\r\n\t/**\r\n\t * A node's [[Circle]] element.\r\n\t */\r\n\tpublic circle: Circle;\r\n\r\n\t/**\r\n\t * A [[Circle]] element for node's outline. This outline is used on nodes\r\n\t * that have children.\r\n\t */\r\n\tpublic outerCircle: Circle;\r\n\r\n\t/**\r\n\t * Related data item.\r\n\t */\r\n\tpublic _dataItem: ForceDirectedSeriesDataItem;\r\n\r\n\t/**\r\n\t * Node's [[Label]] element.\r\n\t */\r\n\tpublic label: Label;\r\n\r\n\t/**\r\n\t * A list of other [[ForceDirectedNode]] elements this node is linked with\r\n\t * using `linkWith`.\r\n\t *\r\n\t * @since 4.4.8\r\n\t */\r\n\tpublic linksWith: Dictionary;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.className = \"ForceDirectedNode\";\r\n\r\n\t\t//this.isMeasured = true; // for correct position of the tooltip\r\n\t\tthis.applyOnClones = true;\r\n\t\tthis.togglable = true;\r\n\t\tthis.draggable = true;\r\n\t\tthis.setStateOnChildren = true;\r\n\r\n\t\tthis.isActive = false;\r\n\t\tthis.expandAll = true;\r\n\t\tthis.paddingRadius = 0;\r\n\r\n\t\tthis.linksWith = new Dictionary()\r\n\t\tthis._disposers.push(new DictionaryDisposer(this.linksWith));\r\n\r\n\t\tthis.events.on(\"dragstart\", () => {\r\n\t\t\tif (this.dataItem.component) {\r\n\t\t\t\tthis.dataItem.component.nodeDragStarted();\r\n\t\t\t}\r\n\t\t}, this, false);\r\n\r\n\t\tthis.events.on(\"drag\", () => {\r\n\t\t\tthis.updateSimulation();\r\n\t\t}, this, false);\r\n\r\n\t\tlet outerCircle = this.createChild(Circle);\r\n\t\touterCircle.shouldClone = false;\r\n\t\touterCircle.strokeWidth = 2;\r\n\t\touterCircle.nonScalingStroke = true;\r\n\r\n\t\tlet bgColor = new InterfaceColorSet().getFor(\"background\");\r\n\t\touterCircle.fill = bgColor;\r\n\t\tthis.outerCircle = outerCircle;\r\n\r\n\t\tlet hoverState = outerCircle.states.create(\"hover\");\r\n\t\thoverState.properties.scale = 1.1;\r\n\r\n\t\tlet outerActiveState = outerCircle.states.create(\"active\");\r\n\t\touterActiveState.properties.scale = 1.1;\r\n\t\touterActiveState.properties.visible = true;\r\n\r\n\t\tlet activeHoverState = outerCircle.states.create(\"hoverActive\");\r\n\t\tactiveHoverState.properties.scale = 1;\r\n\r\n\t\tlet circle = this.createChild(Circle);\r\n\r\n\t\tlet activeState = circle.states.create(\"active\");\r\n\t\tactiveState.properties.visible = true;\r\n\r\n\t\tcircle.shouldClone = false;\r\n\t\tcircle.interactionsEnabled = false;\r\n\t\tcircle.hiddenState.properties.radius = 0.01;\r\n\t\tcircle.events.on(\"validated\", this.updateSimulation, this, false)\r\n\t\tcircle.hiddenState.properties.visible = true;\r\n\r\n\r\n\t\tthis.circle = circle;\r\n\r\n\t\tthis.addDisposer(circle.events.on(\"validated\", this.updateLabelSize, this, false));\r\n\r\n\t\tthis._disposers.push(this.circle);\r\n\r\n\t\tlet label = this.createChild(Label);\r\n\t\tlabel.shouldClone = false;\r\n\t\tlabel.horizontalCenter = \"middle\";\r\n\t\tlabel.verticalCenter = \"middle\";\r\n\t\tlabel.fill = bgColor;\r\n\t\tlabel.strokeOpacity = 0;\r\n\t\tlabel.interactionsEnabled = false;\r\n\t\tlabel.textAlign = \"middle\";\r\n\t\tlabel.textValign = \"middle\";\r\n\t\tlabel.nonScaling = true;\r\n\t\tthis.label = label;\r\n\r\n\t\tthis.adapter.add(\"tooltipY\", (y, target) => {\r\n\t\t\treturn -target.circle.pixelRadius;\r\n\t\t})\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected updateLabelSize() {\r\n\t\tif (this.label.text) {\r\n\t\t\tlet circle = this.circle;\r\n\t\t\tlet radius = circle.pixelRadius;\r\n\r\n\t\t\tlet ds = circle.defaultState;\r\n\t\t\tlet dsRadius = ds.properties.radius\r\n\t\t\tif ($type.isNumber(dsRadius)) {\r\n\t\t\t\tradius = dsRadius;\r\n\t\t\t}\r\n\r\n\t\t\tthis.label.width = 2 * radius;\r\n\t\t\tthis.label.height = 2 * radius;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Copies all parameters from another [[ForceDirectedNode]].\r\n\t *\r\n\t * @param source Source ForceDirectedNode\r\n\t */\r\n\tpublic copyFrom(source: this) {\r\n\t\tsuper.copyFrom(source);\r\n\t\tif (this.circle) {\r\n\t\t\tthis.circle.copyFrom(source.circle);\r\n\t\t}\r\n\t\tif (this.label) {\r\n\t\t\tthis.label.copyFrom(source.label);\r\n\t\t}\r\n\t\tif (this.outerCircle) {\r\n\t\t\tthis.outerCircle.copyFrom(source.outerCircle);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Sets node as \"active\" (expanded).\r\n\t * \r\n\t * @ignore\r\n\t * @param value Active or not?\r\n\t */\r\n\tpublic setActive(value: boolean) {\r\n\t\tsuper.setActive(value);\r\n\r\n\t\tlet dataItem = this.dataItem;\r\n\r\n\t\tif (dataItem) {\r\n\r\n\r\n\t\t\tlet children = dataItem.children;\r\n\t\t\tlet component = dataItem.component;\r\n\t\t\tif (!component.dataItemsInvalid) {\r\n\t\t\t\tif (value && children && !dataItem.childrenInited) {\r\n\t\t\t\t\tcomponent.initNode(dataItem);\r\n\t\t\t\t\tcomponent.updateNodeList();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (value) {\r\n\t\t\t\t\tthis.show();\r\n\t\t\t\t\tif (children) {\r\n\t\t\t\t\t\tchildren.each((child) => {\r\n\t\t\t\t\t\t\tchild.node.show();\r\n\t\t\t\t\t\t\tchild.node.interactionsEnabled = true;\r\n\t\t\t\t\t\t\tif (child.parentLink) {\r\n\t\t\t\t\t\t\t\tchild.parentLink.show();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (this.expandAll) {\r\n\t\t\t\t\t\t\t\tchild.node.isActive = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tchild.node.isActive = false;\r\n\t\t\t\t\t\t\t\t//child.node.hide(0)\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdataItem.dispatchVisibility(true);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tif (children) {\r\n\t\t\t\t\t\tchildren.each((child) => {\r\n\t\t\t\t\t\t\tif (child.parentLink) {\r\n\t\t\t\t\t\t\t\tchild.parentLink.hide();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tchild.node.isActive = false;\r\n\t\t\t\t\t\t\tchild.node.interactionsEnabled = false;\r\n\r\n\t\t\t\t\t\t\tchild.node.hide();\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdataItem.dispatchVisibility(false);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.updateSimulation();\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t * @todo description\r\n\t */\r\n\tprotected updateSimulation() {\r\n\t\tlet dataItem = this.dataItem;\r\n\t\tif (dataItem && dataItem.component) {\r\n\t\t\tdataItem.component.restartSimulation();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * If set to `true` (default) toggling a node on will automatically expand\r\n\t * all nodes across the whole tree (all levels) of its descendants.\r\n\t *\r\n\t * Setting to `false` will only expand immediate children (one level).\r\n\t * \r\n\t * @default true\r\n\t * @since 4.4.8\r\n\t * @param value Expand all?\r\n\t */\r\n\tpublic set expandAll(value: boolean) {\r\n\t\tthis.setPropertyValue(\"expandAll\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Expand all?\r\n\t */\r\n\tpublic get expandAll(): boolean {\r\n\t\treturn this.getPropertyValue(\"expandAll\");\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a new link between two nodes.\r\n\t *\r\n\t * Use this method to dynamically add links without requiring to revalidate\r\n\t * whole of the data.\r\n\t * \r\n\t * @since 4.4.8\r\n\t * @param node Target node\r\n\t * @param strength Link strength\r\n\t * @return New link\r\n\t */\r\n\tpublic linkWith(node: ForceDirectedNode, strength?: number): ForceDirectedLink {\r\n\t\tlet link = this.linksWith.getKey(node.uid);\r\n\t\tif (!link) {\r\n\t\t\tlink = node.linksWith.getKey(this.uid);\r\n\t\t}\r\n\r\n\t\tif (!link) {\r\n\t\t\tlet dataItem = this.dataItem;\r\n\t\t\tlet component = dataItem.component;\r\n\t\t\tlink = component.links.create();\r\n\t\t\tlink.parent = component;\r\n\t\t\tlink.zIndex = -1;\r\n\t\t\tlink.source = this;\r\n\t\t\tlink.target = node;\r\n\t\t\tlink.stroke = dataItem.node.fill;\r\n\r\n\t\t\tlink.dataItem = node.dataItem;\r\n\r\n\t\t\tif ($type.isNumber(strength)) {\r\n\t\t\t\tlink.strength = strength;\r\n\t\t\t}\r\n\r\n\t\t\tlet nodeIndex = component.nodes.indexOf(dataItem.node);\r\n\t\t\tlet childIndex = component.nodes.indexOf(node);\r\n\r\n\t\t\tcomponent.forceLinks.push({ source: nodeIndex, target: childIndex });\r\n\t\t\tcomponent.updateNodeList();\r\n\r\n\t\t\tdataItem.childLinks.push(link);\r\n\r\n\t\t\tthis.linksWith.setKey(node.uid, link);\r\n\t\t}\r\n\t\treturn link;\r\n\t}\r\n\r\n\t/**\r\n\t * Removes a link between two nodes.\r\n\t * \r\n\t * @since 4.4.8\r\n\t * @param node Target node\r\n\t */\r\n\tpublic unlinkWith(node: ForceDirectedNode) {\r\n\t\tthis.linksWith.removeKey(node.uid);\r\n\t}\r\n\r\n\t/**\r\n\t * Padding of the nodes, in pixels.\r\n\t * \r\n\t * @since 4.6.7\r\n\t * @default 0\r\n\t * @param value padding radius\r\n\t */\r\n\tpublic set paddingRadius(value: number) {\r\n\t\tthis.setPropertyValue(\"paddingRadius\", value);\r\n\t}\r\n\r\n\t/** \r\n\t * @return Padding radius\r\n\t */\r\n\tpublic get paddingRadius(): number {\r\n\t\treturn this.getPropertyValue(\"paddingRadius\");\r\n\t}\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[\"ForceDirectedNode\"] = ForceDirectedNode;\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/forceDirected/ForceDirectedNode.ts","/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\nimport { Series, SeriesDataItem, ISeriesDataFields, ISeriesProperties, ISeriesAdapters, ISeriesEvents } from \"../../charts/series/Series\";\r\nimport { ForceDirectedTree, ForceDirectedTreeDataItem } from \"./ForceDirectedTree\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { ListTemplate, ListDisposer, List } from \"../../core/utils/List\";\r\nimport { ForceDirectedNode } from \"./ForceDirectedNode\";\r\nimport { Disposer } from \"../../core/utils/Disposer\";\r\nimport { ForceDirectedLink } from \"./ForceDirectedLink\";\r\nimport { ColorSet } from \"../../core/utils/ColorSet\";\r\nimport * as d3force from \"d3-force\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport { Percent, percent } from \"../../core/utils/Percent\";\r\nimport { Color } from \"../../core/utils/Color\";\r\nimport { LinearGradient } from \"../../core/rendering/fills/LinearGradient\";\r\nimport { RadialGradient } from \"../../core/rendering/fills/RadialGradient\";\r\nimport { Pattern } from \"../../core/rendering/fills/Pattern\";\r\nimport { MouseCursorStyle } from \"../../core/interaction/Mouse\";\r\nimport { OrderedListTemplate } from \"../../core/utils/SortedList\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { LegendDataItem } from \"../../charts/Legend\";\r\nimport { RoundedRectangle } from \"../../core/elements/RoundedRectangle\";\r\nimport { Animation } from \"../../core/utils/Animation\";\r\nimport { AMEvent } from \"../../core/utils/EventDispatcher\";\r\nimport { IDataItemEvents } from \"../../core/DataItem\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines a [[DataItem]] for [[ForceDirectedSeries]].\r\n *\r\n * @see {@link DataItem}\r\n * @since 4.3.8\r\n */\r\nexport class ForceDirectedSeriesDataItem extends SeriesDataItem {\r\n\r\n\t/**\r\n\t * Defines a type of [[Component]] this data item is used for.\r\n\t */\r\n\tpublic _component!: ForceDirectedSeries;\r\n\r\n\t/**\r\n\t * A reference to a component of a data item.\r\n\t */\r\n\tpublic component: ForceDirectedSeries;\r\n\r\n\t/**\r\n\t * A type of node used for this series.\r\n\t */\r\n\tpublic _node: ForceDirectedNode;\r\n\r\n\t/**\r\n\t * A list of [[ForceDirectedLink]] elements of links to node's children.\r\n\t *\r\n\t * This list does not include a link to node's parent, which is available\r\n\t * through `parentLink`.\r\n\t */\r\n\tpublic childLinks: List;\r\n\r\n\t/**\r\n\t * A [[ForceDirectedLink]] to node's parent.\r\n\t */\r\n\tpublic parentLink: ForceDirectedLink;\r\n\r\n\t/**\r\n\t * A Legend's data item.\r\n\t */\r\n\tprotected _legendDataItem: LegendDataItem;\r\n\r\n\t/**\r\n\t * Have all children already been initialized?\r\n\t */\r\n\tpublic childrenInited: boolean = false;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.className = \"ForceDirectedSeriesDataItem\";\r\n\r\n\t\tthis.hasChildren.children = true;\r\n\r\n\t\tthis.childLinks = new List();\r\n\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n\t/**\r\n\t * Shows the Data Item and related visual elements.\r\n\t *\r\n\t * @param duration Animation duration (ms)\r\n\t * @param delay Delay animation (ms)\r\n\t * @param fields A list of fields to set values of\r\n\t */\r\n\tpublic show(duration?: number, delay?: number, fields?: string[]): $type.Optional {\r\n\t\tthis._visible = true;\r\n\r\n\t\tif (this.node) {\r\n\t\t\tthis.node.isActive = true;\r\n\t\t}\r\n\t\treturn;\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tpublic dispatchVisibility(visible: boolean) {\r\n\t\tif (this.events.isEnabled(\"visibilitychanged\")) {\r\n\t\t\tconst event: AMEvent[\"visibilitychanged\"] = {\r\n\t\t\t\ttype: \"visibilitychanged\",\r\n\t\t\t\ttarget: this,\r\n\t\t\t\tvisible: visible\r\n\t\t\t};\r\n\r\n\t\t\tthis.events.dispatchImmediately(\"visibilitychanged\", event);\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Hides the Data Item and related visual elements.\r\n\t *\r\n\t * @param duration Animation duration (ms)\r\n\t * @param delay Delay animation (ms)\r\n\t * @param toValue A value to set to `fields` when hiding\r\n\t * @param fields A list of data fields to set value to `toValue`\r\n\t */\r\n\tpublic hide(duration?: number, delay?: number, toValue?: number, fields?: string[]): $type.Optional {\r\n\t\tthis._visible = false;\r\n\r\n\t\tif (this.events.isEnabled(\"visibilitychanged\")) {\r\n\t\t\tconst event: AMEvent[\"visibilitychanged\"] = {\r\n\t\t\t\ttype: \"visibilitychanged\",\r\n\t\t\t\ttarget: this,\r\n\t\t\t\tvisible: false\r\n\t\t\t};\r\n\r\n\t\t\tthis.events.dispatchImmediately(\"visibilitychanged\", event);\r\n\t\t}\r\n\r\n\t\tif (this.node) {\r\n\t\t\tthis.node.isActive = false;\r\n\t\t}\r\n\t\treturn;\r\n\t}\r\n\r\n\t/**\r\n\t * Numeric value of the item.\r\n\t *\r\n\t * @param value Value\r\n\t */\r\n\tpublic set value(value: number) {\r\n\t\tthis.setValue(\"value\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Value\r\n\t */\r\n\tpublic get value(): number {\r\n\r\n\t\tlet value = this.values.value.value;\r\n\r\n\t\tif (!$type.isNumber(value)) {\r\n\t\t\tif (this.children) {\r\n\t\t\t\tvalue = 0;\r\n\t\t\t\tthis.children.each((child) => {\r\n\t\t\t\t\tvalue += child.value;\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn value;\r\n\t}\r\n\r\n\t/**\r\n\t * An element, related to this data item. (node)\r\n\t *\r\n\t * @readonly\r\n\t * @return node element\r\n\t */\r\n\tpublic get node(): ForceDirectedNode {\r\n\t\tif (!this._node) {\r\n\r\n\t\t\tlet component = this.component;\r\n\r\n\t\t\tlet node = component.nodes.create();\r\n\t\t\tnode.draggable = true;\r\n\t\t\tthis._node = node;\r\n\r\n\t\t\tthis._disposers.push(node);\r\n\r\n\t\t\tthis._disposers.push(new Disposer(() => {\r\n\t\t\t\tcomponent.nodes.removeValue(node);\r\n\t\t\t}));\r\n\r\n\t\t\tthis.addSprite(node);\r\n\t\t\tnode.visible = this.visible;\r\n\t\t\tnode.hiddenState.properties.visible = true;\r\n\r\n\t\t\t// Apply accessibility\r\n\t\t\tif (component.itemsFocusable()) {\r\n\t\t\t\tthis.component.role = \"menu\";\r\n\t\t\t\tnode.role = \"menuitem\";\r\n\t\t\t\tnode.focusable = true;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis.component.role = \"list\";\r\n\t\t\t\tnode.role = \"listitem\";\r\n\t\t\t\tnode.focusable = false;\r\n\t\t\t}\r\n\r\n\t\t\t// Apply screen reader label\r\n\t\t\tif (node.focusable) {\r\n\t\t\t\tnode.events.once(\"focus\", (ev) => {\r\n\t\t\t\t\tnode.readerTitle = component.populateString(component.itemReaderText, this);\r\n\t\t\t\t}, undefined, false);\r\n\t\t\t\tnode.events.once(\"blur\", (ev) => {\r\n\t\t\t\t\tnode.readerTitle = \"\";\r\n\t\t\t\t}, undefined, false);\r\n\t\t\t}\r\n\t\t\tif (node.hoverable) {\r\n\t\t\t\tnode.events.once(\"over\", (ev) => {\r\n\t\t\t\t\tnode.readerTitle = component.populateString(component.itemReaderText, this);\r\n\t\t\t\t}, undefined, false);\r\n\t\t\t\tnode.events.once(\"out\", (ev) => {\r\n\t\t\t\t\tnode.readerTitle = \"\";\r\n\t\t\t\t}, undefined, false);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this._node;\r\n\t}\r\n\r\n\t/**\r\n\t * Depth level in the series hierarchy.\r\n\t *\r\n\t * The top-level item will have level set at 0. Its children will have\r\n\t * level 1, and so on.\r\n\t *\r\n\t * @readonly\r\n\t * @return Level\r\n\t */\r\n\tpublic get level(): number {\r\n\t\tif (!this.parent) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn this.parent.level + 1;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Percent value of a node.\r\n\t *\r\n\t * @since 4.9.0\r\n\t * @return Percent\r\n\t */\r\n\tpublic get percent(): number {\r\n\t\tif (this.parent) {\r\n\t\t\treturn this.value / this.parent.value * 100;\r\n\t\t}\r\n\t\treturn 100;\r\n\t}\r\n\r\n\t/**\r\n\t * Item's color.\r\n\t *\r\n\t * If not set, will use parent's color, or, if that is not set either,\r\n\t * automatically assigned color from chart's color set. (`chart.colors`)\r\n\t *\r\n\t * @param value : Color | LinearGradient | RadialGradient | Pattern\r\n\t */\r\n\tpublic set color(value: Color | LinearGradient | RadialGradient | Pattern) {\r\n\t\tthis.setProperty(\"color\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Color\r\n\t */\r\n\tpublic get color(): Color | LinearGradient | RadialGradient | Pattern {\r\n\t\tlet color = this.properties.color;\r\n\r\n\t\tif (color == undefined) {\r\n\t\t\tif (this.parent) {\r\n\t\t\t\tcolor = this.parent.color;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (color == undefined) {\r\n\t\t\tif (this.component) {\r\n\t\t\t\tcolor = this.component.colors.getIndex(this.component.colors.step * this.index);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn color;\r\n\t}\r\n\r\n\t/**\r\n\t * An array of id's of other nodes outside of the child/parent tree to link\r\n\t * with.\r\n\t *\r\n\t * @param value Link list\r\n\t */\r\n\tpublic set linkWith(value: string[]) {\r\n\t\tthis.setProperty(\"linkWith\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Link list\r\n\t */\r\n\tpublic get linkWith(): string[] {\r\n\t\treturn this.properties.linkWith;\r\n\t}\r\n\r\n\t/**\r\n\t * Should dataItem (node) be hidden in legend?\r\n\t *\r\n\t * @param value Visible in legend?\r\n\t */\r\n\tpublic set hiddenInLegend(value: boolean) {\r\n\t\tthis.setProperty(\"hiddenInLegend\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Hidden in legend?\r\n\t */\r\n\tpublic get hiddenInLegend(): boolean {\r\n\t\treturn this.properties.hiddenInLegend;\r\n\t}\r\n\r\n\t/**\r\n\t * Indicates whether node should start off as collapsed.\r\n\t *\r\n\t * This can be used to specify whether node should start off as collapsed\r\n\t * via data.\r\n\t *\r\n\t * To toggle actual node, use its `isActive` property instead.\r\n\t *\r\n\t * @param value Collapsed?\r\n\t */\r\n\tpublic set collapsed(value: boolean) {\r\n\t\tthis.setProperty(\"collapsed\", value);\r\n\t\tthis.node.isActive = !value;\r\n\t}\r\n\r\n\t/**\r\n\t * @return Collapsed?\r\n\t */\r\n\tpublic get collapsed(): boolean {\r\n\t\treturn this.properties.collapsed;\r\n\t}\r\n\r\n\t/**\r\n\t * Is this node fixed (immovable)?\r\n\t *\r\n\t * @since 4.6.2\r\n\t * @param value Fixed?\r\n\t */\r\n\tpublic set fixed(value: boolean) {\r\n\t\tthis.setProperty(\"fixed\", value);\r\n\t\tif (this.component) {\r\n\t\t\tthis.component.handleFixed(this);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Fixed?\r\n\t */\r\n\tpublic get fixed(): boolean {\r\n\t\treturn this.properties.fixed;\r\n\t}\r\n\r\n\t/**\r\n\t * A list of item's sub-children.\r\n\t *\r\n\t * @param children Item's children\r\n\t */\r\n\tpublic set children(children: OrderedListTemplate) {\r\n\t\tthis.setProperty(\"children\", children);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Item's children\r\n\t */\r\n\tpublic get children(): OrderedListTemplate {\r\n\t\treturn this.properties.children;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a marker used in the legend for this slice.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t * @param marker Marker container\r\n\t */\r\n\tpublic createLegendMarker(marker: Container) {\r\n\t\tthis.component.createLegendMarker(marker, this);\r\n\t\tif (!this.node.isActive) {\r\n\t\t\tthis.hide();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * A legend's data item, that corresponds to this data item.\r\n\t *\r\n\t * @param value Legend data item\r\n\t */\r\n\tpublic set legendDataItem(value: LegendDataItem) {\r\n\t\tthis._legendDataItem = value;\r\n\t\tif (value.label) {\r\n\t\t\tvalue.label.dataItem = this;\r\n\t\t}\r\n\t\tif (value.valueLabel) {\r\n\t\t\tvalue.valueLabel.dataItem = this;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Legend data item\r\n\t */\r\n\tpublic get legendDataItem(): LegendDataItem {\r\n\t\treturn this._legendDataItem;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines data fields for [[ForceDirectedSeries]].\r\n *\r\n * @since 4.3.8\r\n */\r\nexport interface IForceDirectedSeriesDataFields extends ISeriesDataFields {\r\n\r\n\t/**\r\n\t * Name of the field in data that holds category.\r\n\t */\r\n\tcategory?: string;\r\n\r\n\t/**\r\n\t * A name of the field in data that holds item's sub-items.\r\n\t */\r\n\tchildren?: string;\r\n\r\n\t/**\r\n\t * A name of the field in data that holds item's name.\r\n\t */\r\n\tname?: string;\r\n\r\n\t/**\r\n\t * A name of the field tha holds an array of ids that node should link with\r\n\t * besides of it's own children or parent.\r\n\t */\r\n\tlinkWith?: string;\r\n\r\n\t/**\r\n\t * A name of the field in data that holds item's color.\r\n\t *\r\n\t * If not set, a new color will be automatically assigned to each item as\r\n\t * defined by theme.\r\n\t */\r\n\tcolor?: string;\r\n\r\n\t/**\r\n\t * Name of the field in data that holds boolean flag if item should be\r\n\t * hidden in legend.\r\n\t */\r\n\thiddenInLegend?: string;\r\n\r\n\t/**\r\n\t * A name of the field that holds boolean flag whether node should start\r\n\t * as collapsed. (nodes start as fully expanded by default)\r\n\t */\r\n\tcollapsed?: string;\r\n\r\n\t/**\r\n\t * name of the field that holds boolean flag indicating whether this node\r\n\t * is \"fixed\" (immobavle).\r\n\t *\r\n\t * @since 4.6.2\r\n\t */\r\n\tfixed?: string;\r\n}\r\n\r\n/**\r\n * Defines properties for [[ForceDirectedSeries]].\r\n *\r\n * @since 4.3.8\r\n */\r\nexport interface IForceDirectedSeriesProperties extends ISeriesProperties {\r\n\r\n\t/**\r\n\t * Smallest possible radius in pixels of the node circle.\r\n\t *\r\n\t * @default 5\r\n\t */\r\n\tminRadius?: number | Percent;\r\n\r\n\t/**\r\n\t * Biggest possible radius in pixels of the node circle.\r\n\t *\r\n\t * @default 70\r\n\t */\r\n\tmaxRadius?: number | Percent;\r\n\r\n\t/**\r\n\t * A color set to be used for coloring nodes.\r\n\t *\r\n\t * Each new top level will be assigned a new color from this list.\r\n\t */\r\n\tcolors?: ColorSet;\r\n\r\n\t/**\r\n\t * Number of levels to display initially.\r\n\t */\r\n\tmaxLevels?: number;\r\n\r\n\t/**\r\n\t * A relative strength with which nodes push or attract each other.\r\n\t */\r\n\tmanyBodyStrength?: number;\r\n\r\n\t/**\r\n\t * A relative strength with which nodes are pushed away or attracted to\r\n\t * center of the chart.\r\n\t */\r\n\tcenterStrength?: number;\r\n\r\n\t/**\r\n\t * Relative attraction strength between the nodes connected with `linkWith`.\r\n\t *\r\n\t * @since 4.4.8\r\n\t */\r\n\tlinkWithStrength?: number;\r\n\r\n\t/**\r\n\t * Specifies if user can drag fixed nodes\r\n\t *\r\n\t * @since 4.9.0\r\n\t */\r\n\tdragFixedNodes?: boolean;\r\n\r\n\t/**\r\n\t * The bigger the number the more slowly the nodes will move. Think of it as\r\n\t * friction.\r\n\t * \r\n\t * @default 0.4\r\n\t * @since 4.9.2\r\n\t */\r\n\tvelocityDecay?: number;\r\n\r\n\t/**\r\n\t * Renders series hidden until Xth tick.\r\n\t *\r\n\t * @default 10\r\n\t * @since 4.10.17\r\n\t */\r\n\tshowOnTick?: number;\r\n}\r\n\r\n/**\r\n * Defines events for [[ForceDirectedSeries]].\r\n *\r\n * @since 4.3.8\r\n */\r\nexport interface IForceDirectedSeriesEvents extends ISeriesEvents { }\r\n\r\n/**\r\n * Defines adapters for [[ForceDirectedSeries]].\r\n *\r\n * @see {@link Adapter}\r\n * @since 4.3.8\r\n */\r\nexport interface IForceDirectedSeriesAdapters extends ISeriesAdapters, IForceDirectedSeriesProperties { }\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 * Defines [[Series]] for a [[ForceDirectedTree]] chart.\r\n *\r\n * @see {@link IForceDirectedSeriesEvents} for a list of available Events\r\n * @see {@link IForceDirectedSeriesAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/ForceDirectedTree/} For more information\r\n * @todo Example\r\n * @since 4.3.8\r\n * @important\r\n */\r\nexport class ForceDirectedSeries extends Series {\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tpublic _node: ForceDirectedNode;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected _nodes: ListTemplate;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tpublic _link: ForceDirectedLink;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected _links: ListTemplate;\r\n\r\n\t/**\r\n\t * Defines the type of data fields used for the series.\r\n\t */\r\n\tpublic _dataFields: IForceDirectedSeriesDataFields;\r\n\r\n\t/**\r\n\t * Defines available properties.\r\n\t */\r\n\tpublic _properties!: IForceDirectedSeriesProperties;\r\n\r\n\t/**\r\n\t * Defines available adapters.\r\n\t */\r\n\tpublic _adapter!: IForceDirectedSeriesAdapters;\r\n\r\n\t/**\r\n\t * Defines available events.\r\n\t */\r\n\tpublic _events!: IForceDirectedSeriesEvents;\r\n\r\n\t/**\r\n\t * Defines the type of data item.\r\n\t */\r\n\tpublic _dataItem: ForceDirectedSeriesDataItem;\r\n\r\n\t/**\r\n\t * A chart series belongs to.\r\n\t */\r\n\tpublic _chart: ForceDirectedTree;\r\n\r\n\t/**\r\n\t * Parent data item of a series.\r\n\t */\r\n\tpublic parentDataItem: ForceDirectedTreeDataItem;\r\n\r\n\t/**\r\n\t * A reference to the `d3.Simulation` instance for fine-grained configuration\r\n\t * of node gravitational dynamics.\r\n\t *\r\n\t * @see {@link https://github.com/d3/d3-force#simulation} For more info\r\n\t */\r\n\tpublic d3forceSimulation: d3force.Simulation<{}, d3force.SimulationLinkDatum>;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected _maxValue: number;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tpublic forceLinks: d3force.SimulationLinkDatum[];\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected _linkForce: d3force.ForceLink>;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected _collisionForce: d3force.ForceCollide;\r\n\r\n\r\n\tprotected _tick = 0;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.className = \"ForceDirectedSeries\";\r\n\r\n\t\tthis.d3forceSimulation = d3force.forceSimulation();\r\n\r\n\t\tthis.maxRadius = percent(8);\r\n\t\tthis.minRadius = percent(1);\r\n\r\n\t\tthis.width = percent(100);\r\n\t\tthis.height = percent(100);\r\n\r\n\t\tthis.colors = new ColorSet();\r\n\t\tthis.colors.step = 2;\r\n\r\n\t\tthis.width = percent(100);\r\n\t\tthis.height = percent(100);\r\n\r\n\t\tthis.manyBodyStrength = -15;\r\n\t\tthis.centerStrength = 0.8;\r\n\r\n\t\tthis.showOnTick = 10;\r\n\r\n\t\tthis.setPropertyValue(\"dragFixedNodes\", false);\r\n\t\tthis.setPropertyValue(\"velocityDecay\", 0.4);\r\n\r\n\t\tthis.events.on(\"maxsizechanged\", () => {\r\n\t\t\tthis.updateRadiuses(this.dataItems);\r\n\t\t\tthis.updateLinksAndNodes();\r\n\r\n\t\t\tthis.dataItems.each((dataItem) => {\r\n\t\t\t\tthis.handleFixed(dataItem);\r\n\t\t\t})\r\n\r\n\t\t\tlet d3forceSimulation = this.d3forceSimulation;\r\n\r\n\t\t\tlet w = $math.max($math.max(50, this.innerWidth), this.innerWidth);\r\n\t\t\tlet h = $math.max($math.max(50, this.innerHeight), this.innerHeight);\r\n\r\n\t\t\tif (d3forceSimulation) {\r\n\t\t\t\td3forceSimulation.force(\"x\", d3force.forceX().x(w / 2).strength(this.centerStrength * 100 / w));\r\n\t\t\t\td3forceSimulation.force(\"y\", d3force.forceY().y(h / 2).strength(this.centerStrength * 100 / h));\r\n\t\t\t\tif (d3forceSimulation.alpha() < 0.4) {\r\n\t\t\t\t\td3forceSimulation.alpha(0.4);\r\n\t\t\t\t\td3forceSimulation.restart();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n\t/**\r\n\t * Returns maximum value from all supplied data items.\r\n\t *\r\n\t * @ignore\r\n\t * @param dataItems List of data items\r\n\t * @param max Default max\r\n\t * @return Max\r\n\t */\r\n\tprotected getMaxValue(dataItems: OrderedListTemplate, max: number): number {\r\n\t\tdataItems.each((dataItem) => {\r\n\t\t\tif (dataItem.value > max) {\r\n\t\t\t\tmax = dataItem.value;\r\n\t\t\t}\r\n\r\n\t\t\tif (dataItem.children) {\r\n\t\t\t\tlet cmax = this.getMaxValue(dataItem.children, max);\r\n\t\t\t\tif (cmax > max) {\r\n\t\t\t\t\tmax = cmax;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\t\treturn max;\r\n\t}\r\n\r\n\t/**\r\n\t * Validates (processes) data items.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t */\r\n\tpublic validateDataItems(): void {\r\n\r\n\t\tif (this.chart.__disabled) {\r\n\t\t\tsuper.validateDataItems();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis._dataDisposers.push(new ListDisposer(this.links));\r\n\r\n\t\tthis._maxValue = this.getMaxValue(this.dataItems, 0);\r\n\r\n\t\tthis.forceLinks = [];\r\n\r\n\t\tthis.colors.reset();\r\n\r\n\t\tlet index = 0;\r\n\r\n\t\tlet radius = Math.min(this.innerHeight / 3, this.innerWidth / 3);\r\n\r\n\t\tif (this.dataItems.length <= 1) {\r\n\t\t\tradius = 0;\r\n\t\t}\r\n\r\n\t\tthis.dataItems.each((dataItem) => {\r\n\r\n\t\t\tlet angle = index / this.dataItems.length * 360;\r\n\r\n\t\t\tlet node = dataItem.node;\r\n\r\n\t\t\tlet xField = node.propertyFields.x;\r\n\t\t\tlet yField = node.propertyFields.y;\r\n\r\n\t\t\tif (xField && $type.hasValue((dataItem.dataContext)[xField])) {\r\n\t\t\t\tnode.x = (dataItem.dataContext)[xField];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tnode.x = this.innerWidth / 2 + radius * $math.cos(angle);\r\n\t\t\t}\r\n\t\t\tif (yField && $type.hasValue((dataItem.dataContext)[yField])) {\r\n\t\t\t\tnode.y = (dataItem.dataContext)[yField];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tnode.y = this.innerHeight / 2 + radius * $math.sin(angle);\r\n\t\t\t}\r\n\r\n\t\t\tdataItem.node.fill = dataItem.color;\r\n\t\t\tdataItem.node.stroke = dataItem.color;\r\n\r\n\t\t\tindex++;\r\n\r\n\t\t\tthis.initNode(dataItem);\r\n\t\t})\r\n\r\n\t\tif (this.dataFields.linkWith) {\r\n\t\t\tthis.dataItems.each((dataItem) => {\r\n\t\t\t\tthis.processLinkWith(dataItem);\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tlet d3forceSimulation = this.d3forceSimulation;\r\n\r\n\t\td3forceSimulation.on(\"tick\", () => {\r\n\t\t\tthis.updateLinksAndNodes();\r\n\t\t});\r\n\r\n\t\t// helps to avoid initial scatter\r\n\t\tfor (let i = 0; i < 10; i++) {\r\n\t\t\t//d3forceSimulation.tick();\r\n\t\t}\r\n\t\td3forceSimulation.alphaDecay(1 - Math.pow(0.001, 1 / 600));\r\n\r\n\t\tthis.chart.feedLegend();\r\n\r\n\t\tsuper.validateDataItems();\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tpublic handleFixed(dataItem: this[\"_dataItem\"]) {\r\n\t\tlet node = dataItem.node;\r\n\r\n\t\tlet xField = node.propertyFields.x;\r\n\t\tlet yField = node.propertyFields.y;\r\n\r\n\t\tif (xField && $type.hasValue((dataItem.dataContext)[xField])) {\r\n\t\t\tnode.x = (dataItem.dataContext)[xField];\r\n\t\t}\r\n\r\n\t\tif (yField && $type.hasValue((dataItem.dataContext)[yField])) {\r\n\t\t\tnode.y = (dataItem.dataContext)[yField];\r\n\t\t}\r\n\r\n\t\tif (dataItem.fixed) {\r\n\r\n\t\t\tif (node.x instanceof Percent) {\r\n\t\t\t\t(node).fx = $utils.relativeToValue(node.x, this.innerWidth);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t(node).fx = node.x;\r\n\t\t\t}\r\n\r\n\t\t\tif (node.y instanceof Percent) {\r\n\t\t\t\t(node).fy = $utils.relativeToValue(node.y, this.innerHeight);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t(node).fy = node.y;\r\n\t\t\t}\r\n\r\n\t\t\tnode.draggable = this.dragFixedNodes;\r\n\r\n\t\t\tnode.validate(); // for links to redraw\r\n\t\t}\r\n\t\telse {\r\n\t\t\t(node).fx = undefined;\r\n\t\t\t(node).fy = undefined;\r\n\t\t\tnode.draggable = true;\r\n\t\t}\r\n\r\n\t\tif (dataItem && dataItem.children) {\r\n\t\t\tdataItem.children.each((di) => {\r\n\t\t\t\tthis.handleFixed(di)\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t * @todo description\r\n\t */\r\n\tpublic updateNodeList() {\r\n\t\tlet d3forceSimulation = this.d3forceSimulation;\r\n\t\td3forceSimulation.nodes(this.nodes.values);\r\n\t\tthis._linkForce = d3force.forceLink(this.forceLinks);\r\n\t\td3forceSimulation.force(\"link\", this._linkForce);\r\n\t\tthis._collisionForce = d3force.forceCollide();\r\n\t\td3forceSimulation.force(\"collision\", this._collisionForce);\r\n\r\n\t\tlet w = $math.max(50, this.innerWidth);\r\n\t\tlet h = $math.max(50, this.innerHeight);\r\n\r\n\t\td3forceSimulation.force(\"x\", d3force.forceX().x(w / 2).strength(this.centerStrength * 100 / w));\r\n\t\td3forceSimulation.force(\"y\", d3force.forceY().y(h / 2).strength(this.centerStrength * 100 / h));\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t * @todo description\r\n\t */\r\n\tpublic updateLinksAndNodes() {\r\n\t\tif (this._tick < this.showOnTick) {\r\n\t\t\tthis._tick++;\r\n\t\t\tthis.opacity = 0;\r\n\t\t}\r\n\t\telse if (this._tick == this.showOnTick) {\r\n\t\t\tthis.opacity = 1;\r\n\t\t\tthis._tick++;\r\n\t\t}\r\n\r\n\t\tif (this._linkForce) {\r\n\t\t\tthis._linkForce.distance((linkDatum) => {\r\n\t\t\t\treturn this.getDistance(linkDatum)\r\n\t\t\t});\r\n\t\t\tthis._linkForce.strength((linkDatum) => {\r\n\t\t\t\treturn this.getStrength(linkDatum)\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (this._collisionForce) {\r\n\t\t\tthis._collisionForce.radius(function(node) {\r\n\t\t\t\tif (node instanceof ForceDirectedNode) {\r\n\t\t\t\t\tlet radius = node.circle.pixelRadius;\r\n\t\t\t\t\tif (!node.outerCircle.__disabled && !node.outerCircle.disabled && node.outerCircle.visible) {\r\n\t\t\t\t\t\tradius = (radius + 3) * node.outerCircle.scale;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn radius + node.paddingRadius;\r\n\t\t\t\t}\r\n\t\t\t\treturn 1;\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tthis.d3forceSimulation.force(\"manybody\", d3force.forceManyBody().strength((node) => {\r\n\t\t\tif (node instanceof ForceDirectedNode) {\r\n\t\t\t\treturn node.circle.pixelRadius * this.manyBodyStrength;\r\n\t\t\t}\r\n\t\t\treturn this.manyBodyStrength;\r\n\t\t}));\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t * @todo description\r\n\t */\r\n\tprotected getDistance(linkDatum: d3force.SimulationLinkDatum) {\r\n\t\tlet source: ForceDirectedNode = linkDatum.source;\r\n\t\tlet target: ForceDirectedNode = linkDatum.target;\r\n\r\n\t\tlet distance = 0;\r\n\t\tif (target.dataItem && source.dataItem) {\r\n\r\n\r\n\t\t\tlet link = source.linksWith.getKey(target.uid);\r\n\r\n\t\t\tif (link) {\r\n\t\t\t\tdistance = link.distance;\r\n\t\t\t}\r\n\r\n\t\t\tif (!source.isActive) {\r\n\t\t\t\tdistance = 1;\r\n\t\t\t}\r\n\r\n\t\t\tif (target.isHidden) {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t\treturn (distance * (source.circle.pixelRadius + target.circle.pixelRadius));\r\n\t\t}\r\n\r\n\t\treturn distance;\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t * @todo description\r\n\t */\r\n\tprotected getStrength(linkDatum: d3force.SimulationLinkDatum) {\r\n\t\tlet source: ForceDirectedNode = linkDatum.source;\r\n\t\tlet target: ForceDirectedNode = linkDatum.target;\r\n\r\n\t\tlet strength = 0;\r\n\r\n\t\tlet link = source.linksWith.getKey(target.uid);\r\n\t\tif (link) {\r\n\t\t\tstrength = link.strength;\r\n\t\t}\r\n\r\n\t\tif (target.isHidden) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t\treturn strength;\r\n\t}\r\n\r\n\t/**\r\n\t * Handler for drag end event.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic nodeDragEnded(): void {\r\n\t\tthis.d3forceSimulation.alphaTarget(0);\r\n\t}\r\n\t/**\r\n\t * Handler for drag start event.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic nodeDragStarted(): void {\r\n\t\tthis.d3forceSimulation.alpha(0.1);\r\n\t\tthis.d3forceSimulation.restart();\r\n\t}\r\n\r\n\t/**\r\n\t * Resets positions of whole tree.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic restartSimulation(): void {\r\n\t\tif (this.d3forceSimulation.alpha() <= 0.3) {\r\n\t\t\tthis.d3forceSimulation.alpha(0.3);\r\n\t\t\tthis.d3forceSimulation.restart();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected updateRadiuses(dataItems: OrderedListTemplate) {\r\n\t\tdataItems.each((dataItem) => {\r\n\t\t\tthis.updateRadius(dataItem);\r\n\t\t\tif (dataItem.childrenInited) {\r\n\t\t\t\tthis.updateRadiuses(dataItem.children);\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected updateRadius(dataItem: ForceDirectedSeriesDataItem) {\r\n\t\tlet node = dataItem.node;\r\n\t\tlet minSide = (this.innerWidth + this.innerHeight) / 2;\r\n\t\tlet minRadius = $utils.relativeToValue(this.minRadius, minSide)\r\n\t\tlet maxRadius = $utils.relativeToValue(this.maxRadius, minSide)\r\n\r\n\t\tlet radius = minRadius + dataItem.value / this._maxValue * (maxRadius - minRadius);\r\n\r\n\t\tif (!$type.isNumber(radius)) {\r\n\t\t\tradius = minRadius;\r\n\t\t}\r\n\r\n\t\t//if(!node.circle.isHidden){\r\n\t\tnode.circle.radius = radius;\r\n\t\t//}\r\n\t\tnode.outerCircle.radius = radius + 3;\r\n\r\n\t\tnode.circle.states.getKey(\"active\").properties.radius = radius;\r\n\t\tnode.circle.defaultState.properties.radius = radius;\r\n\t}\r\n\r\n\t/**\r\n\t * Initializes node.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic initNode(dataItem: ForceDirectedSeriesDataItem): void {\r\n\r\n\t\tlet node = dataItem.node;\r\n\t\tnode.parent = this;\r\n\t\tthis.updateRadius(dataItem);\r\n\r\n\t\t//let nodeIndex = this.nodes.indexOf(dataItem.node);\r\n\r\n\t\tif (!dataItem.children || dataItem.children.length == 0) {\r\n\t\t\tnode.outerCircle.disabled = true;\r\n\t\t\tnode.circle.interactionsEnabled = true;\r\n\t\t\tnode.cursorOverStyle = MouseCursorStyle.default;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.cursorOverStyle = MouseCursorStyle.pointer;\r\n\t\t}\r\n\r\n\r\n\t\tif (this.dataItemsInvalid && (dataItem.level >= this.maxLevels - 1 || dataItem.collapsed)) {\r\n\t\t\tnode.isActive = false;\r\n\t\t\tthis.updateNodeList();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!node.isActive) {\r\n\t\t\tnode.hide(0);\r\n\t\t}\r\n\r\n\t\tthis.handleFixed(dataItem);\r\n\r\n\t\tif (dataItem.children) {\r\n\t\t\tlet index = 0;\r\n\t\t\tdataItem.childrenInited = true;\r\n\r\n\t\t\tif (this.dataItems.length == 1 && dataItem.level == 0) {\r\n\t\t\t\tthis.colors.next();\r\n\t\t\t}\r\n\r\n\t\t\tdataItem.children.each((child) => {\r\n\t\t\t\t/*\r\n\t\t\t\tlet link = this.links.create();\r\n\t\t\t\tlink.parent = this;\r\n\t\t\t\tlink.zIndex = -1;\r\n\t\t\t\tdataItem.childLinks.push(link);\r\n\t\t\t\tlink.source = dataItem.node;\r\n\t\t\t\tlet childIndex = this.nodes.indexOf(child.node);\r\n\t\t\t\tlink.target = child.node;\r\n\t\t\t\tchild.parentLink = link;\r\n\r\n\t\t\t\tthis._forceLinks.push({ source: nodeIndex, target: childIndex });\r\n\t\t\t\t*/\r\n\r\n\t\t\t\tlet link = node.linkWith(child.node);\r\n\t\t\t\tchild.parentLink = link;\r\n\r\n\t\t\t\tlet radius = 2 * node.circle.pixelRadius + child.node.circle.pixelRadius;\r\n\r\n\t\t\t\tlet angle = index / dataItem.children.length * 360;\r\n\r\n\t\t\t\tchild.node.x = node.pixelX + radius * $math.cos(angle);\r\n\t\t\t\tchild.node.y = node.pixelY + radius * $math.sin(angle);\r\n\r\n\t\t\t\tchild.node.circle.radius = 0;\r\n\r\n\t\t\t\tlet color: Color | LinearGradient | RadialGradient | Pattern;\r\n\r\n\t\t\t\tlet diColor = child.properties.color;\r\n\t\t\t\tif ($type.hasValue(diColor)) {\r\n\t\t\t\t\tcolor = diColor;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tif (this.dataItems.length == 1 && dataItem.level == 0) {\r\n\t\t\t\t\t\tcolor = this.colors.next();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tcolor = dataItem.color;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tchild.color = color;\r\n\t\t\t\tchild.node.fill = color;\r\n\t\t\t\tchild.node.stroke = color;\r\n\t\t\t\tchild.parentLink.stroke = color;\r\n\r\n\t\t\t\tchild.node.fill = child.node.fill;\r\n\t\t\t\tchild.node.stroke = child.node.stroke;\r\n\r\n\t\t\t\tthis.initNode(child);\r\n\r\n\t\t\t\tindex++;\r\n\t\t\t})\r\n\t\t}\r\n\t\tnode.isActive = true;\r\n\t\tnode.show(0);\r\n\t\tthis.updateNodeList();\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t * @todo description\r\n\t */\r\n\tprotected processLinkWith(dataItem: ForceDirectedSeriesDataItem) {\r\n\r\n\t\tif (dataItem.linkWith) {\r\n\t\t\t$array.each(dataItem.linkWith, (id, index) => {\r\n\t\t\t\tlet dataItemToConnect = this.getDataItemById(this.dataItems, id);\r\n\r\n\t\t\t\tif (dataItemToConnect) {\r\n\t\t\t\t\tdataItem.node.linkWith(dataItemToConnect.node, this.linkWithStrength);\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tif (dataItem.children) {\r\n\t\t\tdataItem.children.each((child) => {\r\n\t\t\t\tthis.processLinkWith(child);\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a [[ForceDirectedSeriesDataItem]] related to node by specific id.\r\n\t *\r\n\t * @param dataItems List of data items to search in\r\n\t * @param id Id to search for\r\n\t * @return Data item\r\n\t */\r\n\tpublic getDataItemById(dataItems: OrderedListTemplate, id: string): ForceDirectedSeriesDataItem {\r\n\t\tfor (let i = dataItems.length - 1; i >= 0; i--) {\r\n\t\t\tlet dataItem = dataItems.getIndex(i);\r\n\r\n\t\t\tif (dataItem.id == id) {\r\n\t\t\t\treturn dataItem;\r\n\t\t\t}\r\n\t\t\tif (dataItem.children) {\r\n\t\t\t\tlet di = this.getDataItemById(dataItem.children, id);\r\n\t\t\t\tif (di) {\r\n\t\t\t\t\treturn di;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a new/empty DataItem of the type appropriate for this object.\r\n\t *\r\n\t * @see {@link DataItem}\r\n\t * @return Data Item\r\n\t */\r\n\tprotected createDataItem(): this[\"_dataItem\"] {\r\n\t\treturn new ForceDirectedSeriesDataItem();\r\n\t}\r\n\r\n\t/**\r\n\t * A list of nodes in series.\r\n\t *\r\n\t * @return Node list\r\n\t */\r\n\tpublic get nodes(): ListTemplate {\r\n\t\tif (!this._nodes) {\r\n\t\t\tlet node = this.createNode();\r\n\r\n\t\t\tnode.applyOnClones = true;\r\n\t\t\tthis._disposers.push(node);\r\n\r\n\t\t\tthis._nodes = new ListTemplate(node);\r\n\t\t\tthis._disposers.push(new ListDisposer(this._nodes));\r\n\t\t}\r\n\t\treturn this._nodes;\r\n\t}\r\n\r\n\t/**\r\n\t * A list of links between nodes.\r\n\t *\r\n\t * @return Link list\r\n\t */\r\n\tpublic get links(): ListTemplate {\r\n\t\tif (!this._links) {\r\n\t\t\tlet link = this.createLink();\r\n\t\t\tlink.applyOnClones = true;\r\n\t\t\tthis._disposers.push(link);\r\n\r\n\t\t\tthis._links = new ListTemplate(link);\r\n\t\t\tthis._disposers.push(new ListDisposer(this._links));\r\n\t\t}\r\n\t\treturn this._links;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a new node.\r\n\t */\r\n\tprotected createNode(): this[\"_node\"] {\r\n\t\treturn new ForceDirectedNode();\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a new link.\r\n\t */\r\n\tprotected createLink(): this[\"_link\"] {\r\n\t\treturn new ForceDirectedLink();\r\n\t}\r\n\r\n\t/**\r\n\t * Smallest possible radius in pixels of the node circle.\r\n\t *\r\n\t * If set in percent, it radius will be calculated from average width and\r\n\t * height of series.\r\n\t *\r\n\t * @default Percent(1)\r\n\t * @param value Minimum radius (px or percent)\r\n\t */\r\n\tpublic set minRadius(value: number | Percent) {\r\n\t\tthis.setPropertyValue(\"minRadius\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Minimum radius (px or percent)\r\n\t */\r\n\tpublic get minRadius(): number | Percent {\r\n\t\treturn this.getPropertyValue(\"minRadius\");\r\n\t}\r\n\r\n\t/**\r\n\t * Biggest possible radius in pixels of the node circle.\r\n\t *\r\n\t * If set in percent, it radius will be calculated from average width and\r\n\t * height of series.\r\n\t *\r\n\t * @default Percent(8)\r\n\t * @param value Maximum radius (px or Percent)\r\n\t */\r\n\tpublic set maxRadius(value: number | Percent) {\r\n\t\tthis.setPropertyValue(\"maxRadius\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Maximum radius (px or Percent)\r\n\t */\r\n\tpublic get maxRadius(): number | Percent {\r\n\t\treturn this.getPropertyValue(\"maxRadius\");\r\n\t}\r\n\r\n\t/**\r\n\t * A color set to be used for nodes.\r\n\t *\r\n\t * iIt works like this:\r\n\t *\r\n\t * The first level with more than one node, assigns different colors to all\r\n\t * nodes in this list. Their child nodes inherit the color.\r\n\t *\r\n\t * For example, if the top level has one node with three children, the top\r\n\t * node will get first color, the first child will get second color, etc.\r\n\t *\r\n\t * If there are two top nodes, the first top node gets first color, the\r\n\t * second top node gets the second color. Their subsequent children inherit\r\n\t * colors.\r\n\t *\r\n\t * @param value Color set\r\n\t */\r\n\tpublic set colors(value: ColorSet) {\r\n\t\tthis.setPropertyValue(\"colors\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Color set\r\n\t */\r\n\tpublic get colors(): ColorSet {\r\n\t\treturn this.getPropertyValue(\"colors\");\r\n\t}\r\n\r\n\t/**\r\n\t * Number of levels to be displayed initially.\r\n\t *\r\n\t * @param value Number of levels\r\n\t */\r\n\tpublic set maxLevels(value: number) {\r\n\t\tthis.setPropertyValue(\"maxLevels\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Number of levels\r\n\t */\r\n\tpublic get maxLevels(): number {\r\n\t\treturn this.getPropertyValue(\"maxLevels\");\r\n\t}\r\n\r\n\t/**\r\n\t * Relative strength each node pushes (or attracts) other nodes (it is\r\n\t * multiplied by `node.circle.radius` for big nodes to push stronger).\r\n\t *\r\n\t * Positive value will make nodes attract each other, while negative will\r\n\t * push away each other. The bigger the negative number is, the more\r\n\t * scattered nodes will be.\r\n\t *\r\n\t * Available value range: `-XX` to `XX`.\r\n\t *\r\n\t * @default -15\r\n\t * @param value Body push/attrack strength\r\n\t */\r\n\tpublic set manyBodyStrength(value: number) {\r\n\t\tif (this.setPropertyValue(\"manyBodyStrength\", value)) {\r\n\t\t\tthis.restartSimulation();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Body push/attrack strength\r\n\t */\r\n\tpublic get manyBodyStrength(): number {\r\n\t\treturn this.getPropertyValue(\"manyBodyStrength\");\r\n\t}\r\n\r\n\t/**\r\n\t * Relative strength each child node is pushes (or attracted) to the center\r\n\t * of the chart.\r\n\t *\r\n\t * Positive value will make nodes to be attracted to center, while negative\r\n\t * will push them away.\r\n\t *\r\n\t * Available value range: `-50` to `50`.\r\n\t *\r\n\t * @default 0.8\r\n\t * @param value Stregth of attraction to center\r\n\t */\r\n\tpublic set centerStrength(value: number) {\r\n\t\tif (this.setPropertyValue(\"centerStrength\", value)) {\r\n\t\t\tthis.restartSimulation();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Stregth of attraction to center\r\n\t */\r\n\tpublic get centerStrength(): number {\r\n\t\treturn this.getPropertyValue(\"centerStrength\");\r\n\t}\r\n\r\n\t/**\r\n\t * Relative attraction strength between the nodes connected with `linkWith`.\r\n\t *\r\n\t * @since 4.4.8\r\n\t * @param value Strength\r\n\t * @default undefined\r\n\t */\r\n\tpublic set linkWithStrength(value: number) {\r\n\t\tif (this.setPropertyValue(\"linkWithStrength\", value)) {\r\n\t\t\tthis.restartSimulation();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Strength\r\n\t */\r\n\tpublic get linkWithStrength(): number {\r\n\t\treturn this.getPropertyValue(\"linkWithStrength\");\r\n\t}\r\n\r\n\t/**\r\n\t * The bigger the number the more slowly the nodes will move. Think of it as\r\n\t * friction.\r\n\t *\r\n\t * @since 4.9.2\r\n\t * @param value Velocity decay\r\n\t * @default 0.4\r\n\t */\r\n\tpublic set velocityDecay(value: number) {\r\n\t\tif (this.setPropertyValue(\"velocityDecay\", value)) {\r\n\t\t\tthis.d3forceSimulation.velocityDecay(value);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Velocity decay\r\n\t */\r\n\tpublic get velocityDecay(): number {\r\n\t\treturn this.getPropertyValue(\"velocityDecay\");\r\n\t}\r\n\r\n\t/**\r\n\t * Specifies if user can drag fixed nodes.\r\n\t *\r\n\t * @since 4.9.0\r\n\t * @default false\r\n\t * @param value Allow drag fixed nodes?\r\n\t */\r\n\tpublic set dragFixedNodes(value: boolean) {\r\n\t\tif (this.setPropertyValue(\"dragFixedNodes\", value)) {\r\n\t\t\tthis.dataItems.each((dataItem) => {\r\n\t\t\t\tthis.handleFixed(dataItem);\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Allow drag fixed nodes?\r\n\t */\r\n\tpublic get dragFixedNodes(): boolean {\r\n\t\treturn this.getPropertyValue(\"dragFixedNodes\");\r\n\t}\r\n\r\n\t/**\r\n\t * Binds related legend data item's visual settings to this series' visual\r\n\t * settings.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t * @param marker Container\r\n\t * @param dataItem Data item\r\n\t */\r\n\tpublic createLegendMarker(marker: Container, dataItem?: this[\"_dataItem\"]): void {\r\n\t\tmarker.children.each((child) => {\r\n\t\t\tlet node = dataItem.node;\r\n\r\n\t\t\tif (child instanceof RoundedRectangle) {\r\n\t\t\t\tchild.cornerRadius(40, 40, 40, 40);\r\n\t\t\t}\r\n\r\n\r\n\t\t\tchild.defaultState.properties.fill = node.fill;\r\n\t\t\tchild.defaultState.properties.stroke = node.stroke;\r\n\t\t\tchild.defaultState.properties.fillOpacity = node.fillOpacity;\r\n\t\t\tchild.defaultState.properties.strokeOpacity = node.strokeOpacity;\r\n\r\n\t\t\tchild.fill = node.fill;\r\n\t\t\tchild.stroke = node.stroke;\r\n\t\t\tchild.fillOpacity = node.fillOpacity;\r\n\t\t\tchild.strokeOpacity = node.strokeOpacity;\r\n\r\n\t\t\tif (child.fill == undefined) {\r\n\t\t\t\tchild.__disabled = true;\r\n\t\t\t}\r\n\r\n\t\t\tlet legendDataItem = marker.dataItem;\r\n\t\t\tlegendDataItem.color = node.fill;\r\n\t\t\tlegendDataItem.colorOrig = node.fill;\r\n\r\n\t\t\tnode.events.on(\"propertychanged\", (ev) => {\r\n\t\t\t\tif (ev.property == \"fill\") {\r\n\r\n\t\t\t\t\tchild.__disabled = false;\r\n\r\n\t\t\t\t\tif (!child.isActive) {\r\n\t\t\t\t\t\tchild.fill = node.fill;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tchild.defaultState.properties.fill = node.fill;\r\n\t\t\t\t\tlegendDataItem.color = node.fill;\r\n\t\t\t\t\tlegendDataItem.colorOrig = node.fill;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (ev.property == \"stroke\") {\r\n\t\t\t\t\tif (!child.isActive) {\r\n\t\t\t\t\t\tchild.stroke = node.stroke;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tchild.defaultState.properties.stroke = node.stroke;\r\n\t\t\t\t}\r\n\t\t\t}, undefined, false)\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Renders series hidden until Xth tick.\r\n\t *\r\n\t * @default 10\r\n\t * @since 4.10.17\r\n\t * @param value Number of ticks to delay rendering\r\n\t */\r\n\tpublic set showOnTick(value: number) {\r\n\t\tthis.setPropertyValue(\"showOnTick\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Number of ticks to delay rendering\r\n\t */\r\n\tpublic get showOnTick(): number {\r\n\t\treturn this.getPropertyValue(\"showOnTick\");\r\n\t}\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[\"ForceDirectedSeries\"] = ForceDirectedSeries;\r\nregistry.registeredClasses[\"ForceDirectedSeriesDataItem\"] = ForceDirectedSeriesDataItem;\r\n\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/forceDirected/ForceDirectedSeries.ts","/**\r\n * ForceDirectedTree chart module.\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { SerialChart, ISerialChartProperties, ISerialChartDataFields, ISerialChartAdapters, ISerialChartEvents, SerialChartDataItem } from \"../../charts/types/SerialChart\";\r\nimport { ForceDirectedSeries, ForceDirectedSeriesDataItem } from \"./ForceDirectedSeries\";\r\nimport { Export } from \"../../core/export/Export\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport { color } from \"../../core/utils/Color\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { IPoint } from \"../../core/defs/IPoint\";\r\nimport { Sprite, ISpriteEvents, AMEvent } from \"../../core/Sprite\";\r\nimport { IDisposer } from \"../../core/utils/Disposer\";\r\nimport * as $ease from \"../../core/utils/Ease\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport { ZoomOutButton } from \"../../core/elements/ZoomOutButton\";\r\nimport { getInteraction, IInteractionEvents } from \"../../core/interaction/Interaction\";\r\n\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines a [[DataItem]] for [[ForceDirectedTree]].\r\n *\r\n * @since 4.3.8\r\n * @see {@link DataItem}\r\n */\r\nexport class ForceDirectedTreeDataItem extends SerialChartDataItem { }\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines data fields for [[ForceDirectedTree]].\r\n *\r\n * @since 4.3.8\r\n */\r\nexport interface IForceDirectedTreeDataFields extends ISerialChartDataFields { }\r\n\r\n/**\r\n * Defines properties for [[ForceDirectedTree]].\r\n *\r\n * @since 4.3.8\r\n */\r\nexport interface IForceDirectedTreeProperties extends ISerialChartProperties {\r\n\r\n\t/**\r\n\t * Indicates whether chart can be zoomed/panned (via mouse, touch, or API).\r\n\t *\r\n\t * @since 4.10.0\r\n\t * @default false\r\n\t */\r\n\tzoomable?: boolean;\r\n\r\n\t/**\r\n\t * Specifies what should chart do if when mouse wheel is rotated.\r\n\t *\r\n\t * @since 4.10.0\r\n\t * @default none\r\n\t */\r\n\tmouseWheelBehavior?: \"zoom\" | \"none\";\r\n\r\n\t/**\r\n\t * When user zooms in or out current zoom level is multiplied or divided\r\n\t * by value of this setting.\r\n\t *\r\n\t * @since 4.10.0\r\n\t * @default 2\r\n\t */\r\n\tzoomStep?: number;\r\n}\r\n\r\n/**\r\n * Defines events for [[ForceDirectedTree]].\r\n *\r\n * @since 4.3.8\r\n */\r\nexport interface IForceDirectedTreeEvents extends ISerialChartEvents { }\r\n\r\n/**\r\n * Defines adapters for [[ForceDirectedTree]].\r\n *\r\n * @since 4.3.8\r\n * @see {@link Adapter}\r\n */\r\nexport interface IForceDirectedTreeAdapters extends ISerialChartAdapters, IForceDirectedTreeProperties { }\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 main class for [[ForceDirectedTree]] chart type.\r\n *\r\n * @see {@link IForceDirectedTreeEvents} for a list of available Events\r\n * @see {@link IForceDirectedTreeAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/force-directed/} For more information\r\n * @since 4.3.8\r\n * @important\r\n */\r\nexport class ForceDirectedTree extends SerialChart {\r\n\r\n\t/**\r\n\t * Defines the type of data item.\r\n\t */\r\n\tpublic _dataItem: ForceDirectedTreeDataItem;\r\n\r\n\t/**\r\n\t * Defines available data fields.\r\n\t */\r\n\tpublic _dataFields: IForceDirectedTreeDataFields;\r\n\r\n\t/**\r\n\t * Defines available properties.\r\n\t */\r\n\tpublic _properties!: IForceDirectedTreeProperties;\r\n\r\n\t/**\r\n\t * Defines available adapters.\r\n\t */\r\n\tpublic _adapter!: IForceDirectedTreeAdapters;\r\n\r\n\t/**\r\n\t * Defines available events.\r\n\t */\r\n\tpublic _events!: IForceDirectedTreeEvents;\r\n\r\n\t/**\r\n\t * Defines a type of series that this chart uses.\r\n\t */\r\n\tpublic _seriesType: ForceDirectedSeries;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected _mouseWheelDisposer: IDisposer;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tprotected _backgroundZoomoutDisposer: IDisposer;\r\n\r\n\t/**\r\n\t * Default duration of zoom animations (ms).\r\n\t */\r\n\tpublic zoomDuration: number = 1000;\r\n\r\n\r\n\t/**\r\n\t * Default zooming animation easing function.\r\n\t */\r\n\tpublic zoomEasing: (value: number) => number = $ease.cubicOut;\r\n\r\n\t/**\r\n\t * Smallest available zoom level. The chart will not allow to zoom out past\r\n\t * this setting.\r\n\t *\r\n\t * NOTE: Should be power of 2.\r\n\t *\r\n\t * @default 1\r\n\t */\r\n\tpublic minZoomLevel: number = 1;\r\n\r\n\t/**\r\n\t * Biggest available zoom level. The chart will not allow to zoom in past\r\n\t * this setting.\r\n\t *\r\n\t * NOTE: Should be power of 2.\r\n\t *\r\n\t * @default 32\r\n\t */\r\n\tpublic maxZoomLevel: number = 16;\r\n\r\n\t/**\r\n\t * A button which is used to zoom out the chart.\r\n\t */\r\n\tprotected _zoomOutButton: ZoomOutButton;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\r\n\t\t// Init\r\n\t\tsuper();\r\n\t\tthis.className = \"ForceDirectedTree\";\r\n\r\n\t\tthis.seriesContainer.isMeasured = true;\r\n\t\tthis.seriesContainer.layout = \"absolute\";\r\n\r\n\t\tthis.mouseWheelBehavior = \"none\";\r\n\t\tthis.zoomStep = 2;\r\n\r\n\t\tthis.seriesContainer.background.fillOpacity = 0;\r\n\t\tthis.seriesContainer.background.fill = color(\"#ffffff\")\r\n\r\n\t\tlet zoomOutButton = this.createChild(ZoomOutButton);\r\n\t\tzoomOutButton.shouldClone = false;\r\n\t\tzoomOutButton.x = percent(100);\r\n\t\tzoomOutButton.horizontalCenter = \"right\";\r\n\t\tzoomOutButton.valign = \"top\";\r\n\t\tzoomOutButton.zIndex = Number.MAX_SAFE_INTEGER;\r\n\t\tzoomOutButton.marginTop = 5;\r\n\t\tzoomOutButton.marginRight = 5;\r\n\t\tzoomOutButton.isMeasured = false;\r\n\r\n\t\tzoomOutButton.adapter.add(\"dx\", (dx, target) => {\r\n\t\t\treturn - zoomOutButton.marginRight;\r\n\t\t})\r\n\r\n\t\tzoomOutButton.hide(0);\r\n\t\tthis.zoomOutButton = zoomOutButton;\r\n\r\n\t\tthis.addDisposer(this.seriesContainer.events.on(\"sizechanged\", () => {\r\n\r\n\t\t\tif (this.seriesContainer.scale != 1) {\r\n\t\t\t\tthis.zoomOutButton.show();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis.zoomOutButton.hide();\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tconst interaction = getInteraction();\r\n\t\tthis._disposers.push(interaction.body.events.on(\"down\", (event: IInteractionEvents[\"down\"]) => {\r\n\t\t\tif (this.zoomable) {\r\n\t\t\t\tlet svgPoint = $utils.documentPointToSvg(event.pointer.point, this.htmlContainer);\r\n\t\t\t\tif (svgPoint.x > 0 && svgPoint.y > 0 && svgPoint.x < this.svgContainer.width && svgPoint.y < this.svgContainer.height) {\r\n\t\t\t\t\tthis.seriesContainer.dragStart(event.pointer);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, this));\r\n\t\tthis._disposers.push(interaction.body.events.on(\"up\", (event: IInteractionEvents[\"up\"]) => {\r\n\t\t\tif (this.zoomable) {\r\n\t\t\t\tthis.seriesContainer.dragStop(event.pointer, true);\r\n\t\t\t}\r\n\t\t}, this));\r\n\r\n\t\t// Apply theme\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n\t/**\r\n\t * Creates and returns a new series of the suitable type.\r\n\t *\r\n\t * @return New series\r\n\t */\r\n\tprotected createSeries(): this[\"_seriesType\"] {\r\n\t\treturn new ForceDirectedSeries();\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a new/empty DataItem of the type appropriate for this object.\r\n\t *\r\n\t * @see {@link DataItem}\r\n\t * @return Data Item\r\n\t */\r\n\tprotected createDataItem(): this[\"_dataItem\"] {\r\n\t\treturn new ForceDirectedTreeDataItem();\r\n\t}\r\n\r\n\t/**\r\n\t * Setups the legend to use the chart's data.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic feedLegend(): void {\r\n\t\tlet legend = this.legend;\r\n\t\tif (legend) {\r\n\r\n\t\t\tlet legendData: any[] = [];\r\n\r\n\t\t\tthis.series.each((series) => {\r\n\t\t\t\tif (!series.hiddenInLegend) {\r\n\r\n\t\t\t\t\tlet dataItems = series.dataItems;\r\n\t\t\t\t\tif (dataItems.length == 1) {\r\n\t\t\t\t\t\tlet children = series.dataItems.getIndex(0).children;\r\n\t\t\t\t\t\tif (children && children.length > 0) {\r\n\t\t\t\t\t\t\tdataItems = children;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdataItems.each((dataItem) => {\r\n\t\t\t\t\t\tif (!dataItem.hiddenInLegend) {\r\n\t\t\t\t\t\t\tlegendData.push(dataItem);\r\n\r\n\t\t\t\t\t\t\tlet legendSettings = series.legendSettings;\r\n\t\t\t\t\t\t\tif (legendSettings) {\r\n\t\t\t\t\t\t\t\tif (legendSettings.labelText) {\r\n\t\t\t\t\t\t\t\t\tlegend.labels.template.text = legendSettings.labelText;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (legendSettings.itemLabelText) {\r\n\t\t\t\t\t\t\t\t\tlegend.labels.template.text = legendSettings.itemLabelText;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (legendSettings.valueText) {\r\n\t\t\t\t\t\t\t\t\tlegend.valueLabels.template.text = legendSettings.valueText;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (legendSettings.itemValueText) {\r\n\t\t\t\t\t\t\t\t\tlegend.valueLabels.template.text = legendSettings.itemValueText;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tlegend.data = legendData;\r\n\t\t\tlegend.dataFields.name = \"name\";\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Sets defaults that instantiate some objects that rely on parent, so they\r\n\t * cannot be set in constructor.\r\n\t */\r\n\tprotected applyInternalDefaults(): void {\r\n\r\n\t\tsuper.applyInternalDefaults();\r\n\r\n\t\t// Add a default screen reader title for accessibility\r\n\t\t// This will be overridden in screen reader if there are any `titles` set\r\n\t\tif (!$type.hasValue(this.readerTitle)) {\r\n\t\t\tthis.readerTitle = this.language.translate(\"Force directed tree\");\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Since this chart uses hierarchical data, we need to remove childrent\r\n\t * dataField from export of non-hierarchical formats such as CSV and XSLX.\r\n\t *\r\n\t * @return Export\r\n\t */\r\n\tprotected getExporting(): Export {\r\n\t\tconst exporting = super.getExporting();\r\n\t\texporting.adapter.add(\"formatDataFields\", (info) => {\r\n\t\t\tif (info.format == \"csv\" || info.format == \"xlsx\") {\r\n\t\t\t\tthis.series.each((series) => {\r\n\t\t\t\t\tif ($type.hasValue(series.dataFields.children)) {\r\n\t\t\t\t\t\tdelete info.dataFields[series.dataFields.children];\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t\treturn info;\r\n\t\t})\r\n\t\treturn exporting;\r\n\t}\r\n\r\n\t/**\r\n\t * Handles mouse wheel event, e.g. user rotates mouse wheel while over the\r\n\t * map: zooms in or out depending on the direction of the wheel turn.\r\n\t *\r\n\t * @param event Original event\r\n\t */\r\n\tprotected handleWheel(event: AMEvent[\"wheel\"]) {\r\n\r\n\t\tlet point: IPoint = $utils.documentPointToSprite(event.point, this.seriesContainer);\r\n\r\n\t\tlet zoomLevel = this.seriesContainer.scale;\r\n\r\n\t\tif (event.shift.y < 0) {\r\n\t\t\tzoomLevel *= this.zoomStep;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tzoomLevel /= this.zoomStep;\r\n\t\t}\r\n\r\n\t\tzoomLevel = $math.fitToRange(zoomLevel, this.minZoomLevel, this.maxZoomLevel);\r\n\r\n\t\tthis.zoomToPoint(point, zoomLevel)\r\n\t}\r\n\r\n\t/**\r\n\t * Zooms the chart to particular point.\r\n\t *\r\n\t * @from 4.10.0\r\n\t * @param point A point to zoom to\r\n\t * @param zoomLevel Zoom level\r\n\t * @param center Should the chart center on the target point?\r\n\t */\r\n\tpublic zoomToPoint(point: IPoint, zoomLevel: number, center?: boolean): void {\r\n\r\n\t\tlet container = this.seriesContainer;\r\n\r\n\t\tlet svgPoint: IPoint\r\n\t\tif (center) {\r\n\t\t\tsvgPoint = { x: this.maxWidth / 2, y: this.maxHeight / 2 };\r\n\t\t}\r\n\t\telse {\r\n\t\t\tsvgPoint = $utils.spritePointToSvg(point, container)\r\n\t\t}\r\n\r\n\t\tlet x = svgPoint.x - point.x * zoomLevel;\r\n\t\tlet y = svgPoint.y - point.y * zoomLevel;\r\n\r\n\t\tcontainer.animate([{ property: \"scale\", to: zoomLevel }, { property: \"x\", to: x }, { property: \"y\", to: y }], this.zoomDuration, this.zoomEasing);\r\n\t}\r\n\r\n\t/**\r\n\t * Zooms the chart to particular data item (node).\r\n\t *\r\n\t * @from 4.10.0\r\n\t * @param dataItem A data item to zoom to\r\n\t * @param zoomLevel Zoom level\r\n\t * @param center Should the chart center on the target point?\r\n\t */\r\n\tpublic zoomToDataItem(dataItem: ForceDirectedSeriesDataItem, zoomLevel?: number, center?: boolean): void {\r\n\t\tlet x = dataItem.node.pixelX;\r\n\t\tlet y = dataItem.node.pixelY;\r\n\r\n\t\tif (!$type.isNumber(zoomLevel)) {\r\n\t\t\tzoomLevel = this.seriesContainer.scale * this.zoomStep;\r\n\t\t}\r\n\r\n\t\tthis.zoomToPoint({ x: x, y: y }, zoomLevel, center);\r\n\t}\r\n\r\n\t/**\r\n\t * Zooms out the chart to initial full view.\r\n\t *\r\n\t * @from 4.10.0\r\n\t */\r\n\tpublic zoomOut(): void {\r\n\t\tlet container = this.seriesContainer;\r\n\t\tthis.zoomToPoint({ x: container.pixelWidth / 2, y: container.pixelHeight / 2 }, 1, true);\r\n\t}\r\n\r\n\t/**\r\n\t * When user zooms in or out current zoom level is multiplied or divided\r\n\t * by value of this setting.\r\n\t *\r\n\t * @default false\r\n\t * @since 4.10.0\r\n\t * @see {@link https://www.amcharts.com/docs/v4/chart-types/force-directed/#Zooming} for more information about zooming ForceDirectedTree\r\n\t * @param value Zoomable\r\n\t */\r\n\tpublic set zoomable(value: boolean) {\r\n\t\tif (this.setPropertyValue(\"zoomable\", value)) {\r\n\t\t\tif (value) {\r\n\t\t\t\tthis.seriesContainer.resizable = true;\r\n\t\t\t\tthis.seriesContainer.draggable = true;\r\n\t\t\t\tthis.seriesContainer.dragWhileResize = true;\r\n\t\t\t\tthis.mouseWheelBehavior = \"zoom\";\r\n\r\n\t\t\t\tthis._backgroundZoomoutDisposer = this.seriesContainer.background.events.on(\"hit\", () => {\r\n\t\t\t\t\tthis.zoomOut();\r\n\t\t\t\t}, this, false);\r\n\t\t\t\tthis._disposers.push(this._backgroundZoomoutDisposer);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis.seriesContainer.resizable = false;\r\n\t\t\t\tthis.seriesContainer.draggable = false;\r\n\t\t\t\tthis.seriesContainer.dragWhileResize = false;\r\n\t\t\t\tthis.mouseWheelBehavior = \"none\";\r\n\t\t\t\tif (this._backgroundZoomoutDisposer) {\r\n\t\t\t\t\tthis._backgroundZoomoutDisposer.dispose();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Zoomable\r\n\t */\r\n\tpublic get zoomable(): boolean {\r\n\t\treturn this.getPropertyValue(\"zoomable\");\r\n\t}\r\n\r\n\t/**\r\n\t * Specifies what should chart do if when mouse wheel is rotated.\r\n\t *\r\n\t * @param Mouse wheel behavior\r\n\t * @since 4.10.0\r\n\t * @default none\r\n\t */\r\n\tpublic set mouseWheelBehavior(value: \"zoom\" | \"none\") {\r\n\r\n\t\tif (this.setPropertyValue(\"mouseWheelBehavior\", value)) {\r\n\t\t\tif (value != \"none\") {\r\n\t\t\t\tthis._mouseWheelDisposer = this.chartContainer.events.on(\"wheel\", this.handleWheel, this, false);\r\n\t\t\t\tthis._disposers.push(this._mouseWheelDisposer);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif (this._mouseWheelDisposer) {\r\n\t\t\t\t\tthis._mouseWheelDisposer.dispose();\r\n\t\t\t\t}\r\n\t\t\t\tthis.chartContainer.wheelable = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Mouse wheel behavior\r\n\t */\r\n\tpublic get mouseWheelBehavior(): \"zoom\" | \"none\" {\r\n\t\treturn this.getPropertyValue(\"mouseWheelBehavior\");\r\n\t}\r\n\r\n\t/**\r\n\t * When user zooms in or out current zoom level is multiplied or divided\r\n\t * by value of this setting.\r\n\t *\r\n\t * @since 4.10.0\r\n\t * @default 2\r\n\t * @param value Zoom factor\r\n\t */\r\n\tpublic set zoomStep(value: number) {\r\n\t\tthis.setPropertyValue(\"zoomStep\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Zoom factor\r\n\t */\r\n\tpublic get zoomStep(): number {\r\n\t\treturn this.getPropertyValue(\"zoomStep\");\r\n\t}\r\n\r\n\t/**\r\n\t * A [[Button]] element that is used for zooming out the chart.\r\n\t *\r\n\t * This button appears only when chart is zoomed in, and disappears\r\n\t * autoamatically when it is zoome dout.\r\n\t *\r\n\t * @param button Zoom out button\r\n\t */\r\n\tpublic set zoomOutButton(button: ZoomOutButton) {\r\n\t\tthis._zoomOutButton = button;\r\n\t\tif (button) {\r\n\t\t\tbutton.events.on(\"hit\", () => {\r\n\t\t\t\tthis.zoomOut();\r\n\t\t\t}, undefined, false);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Zoom out button\r\n\t */\r\n\tpublic get zoomOutButton(): ZoomOutButton {\r\n\t\treturn this._zoomOutButton;\r\n\t}\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[\"ForceDirectedTree\"] = ForceDirectedTree;\r\nregistry.registeredClasses[\"ForceDirectedTreeDataItem\"] = ForceDirectedTreeDataItem;\r\n\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/forceDirected/ForceDirectedTree.ts","import * as m from \"../../es2015/plugins/forceDirected\";\nwindow.am4plugins_forceDirected = m;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./plugins/forceDirected.js\n// module id = null\n// module chunks = "],"sourceRoot":""}