` element reference\r\n */\r\n Label.prototype.getHTMLLineElement = function (text) {\r\n // Create the
element\r\n var div = document.createElement(\"div\");\r\n div.innerHTML = text;\r\n // Set text alignment\r\n switch (this.textAlign) {\r\n case \"middle\":\r\n div.style.textAlign = \"center\";\r\n break;\r\n case \"end\":\r\n div.style.textAlign = \"right\";\r\n break;\r\n }\r\n // Disable or enable wrapping\r\n if (this.wrap) {\r\n div.style.wordWrap = \"break-word\";\r\n }\r\n else {\r\n div.style.whiteSpace = \"nowrap\";\r\n }\r\n // Don't let labels bleed out of the alotted area\r\n // Moved to `draw()` because setting \"hidden\" kills all measuring\r\n /*if (this.truncate) {\r\n div.style.overflow = \"hidden\";\r\n }*/\r\n // Set RTL-related styles\r\n if (this.rtl) {\r\n div.style.direction = \"rtl\";\r\n //div.style.unicodeBidi = \"bidi-override\";\r\n }\r\n // Translate some of the SVG styles into CSS\r\n if ($type.hasValue(this.fill)) {\r\n div.style.color = this.fill.toString();\r\n }\r\n return div;\r\n };\r\n /**\r\n * Applies specific styles to text to make it not selectable, unless it is\r\n * explicitly set as `selectable`.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Set styles via AMElement\r\n */\r\n Label.prototype.setStyles = function () {\r\n var group = this.element;\r\n if (!this.selectable || this.draggable || this.resizable || this.swipeable) {\r\n group.addStyle({\r\n \"webkitUserSelect\": \"none\",\r\n \"msUserSelect\": \"none\"\r\n });\r\n }\r\n else if (this.selectable) {\r\n group.removeStyle(\"webkitUserSelect\");\r\n group.removeStyle(\"msUserSelect\");\r\n }\r\n };\r\n /**\r\n * Hides unused lines\r\n */\r\n Label.prototype.hideUnused = function (index) {\r\n this.initLineCache();\r\n var lines = this.getCache(\"lineInfo\");\r\n if (lines.length >= index) {\r\n for (var i = index; i < lines.length; i++) {\r\n var line = lines[i];\r\n if (line && line.element) {\r\n line.element.attr({ \"display\": \"none\" });\r\n }\r\n }\r\n }\r\n };\r\n Object.defineProperty(Label.prototype, \"text\", {\r\n /**\r\n * @return SVG text\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"text\");\r\n },\r\n /**\r\n * An SVG text.\r\n *\r\n * Please note that setting `html` will override this setting if browser\r\n * supports `foreignObject` in SGV, such as most modern browsers excluding\r\n * IEs.\r\n *\r\n * @param value SVG Text\r\n */\r\n set: function (value) {\r\n //this.setPropertyValue(\"html\", undefined);\r\n this.setPropertyValue(\"text\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"path\", {\r\n /**\r\n * @return Path\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"path\");\r\n },\r\n /**\r\n * An SVG path string to position text along. If set, the text will follow\r\n * the curvature of the path.\r\n *\r\n * Location along the path can be set using `locationOnPath`.\r\n *\r\n * IMPORTANT: Only SVG text can be put on path. If you are using HTML text\r\n * this setting will be ignored.\r\n *\r\n * @since 4.1.2\r\n * @param value Path\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"path\", value, true)) {\r\n if (this.pathElement) {\r\n this.pathElement.dispose();\r\n }\r\n if (this.textPathElement) {\r\n this.textPathElement.dispose();\r\n }\r\n this.pathElement = this.paper.add(\"path\");\r\n this.pathElement.attr({ \"d\": value });\r\n this.pathElement.attr({ \"id\": \"text-path-\" + this.uid });\r\n this._disposers.push(this.pathElement);\r\n this.textPathElement = this.paper.addGroup(\"textPath\");\r\n this.textPathElement.attrNS($dom.XLINK, \"xlink:href\", \"#text-path-\" + this.uid);\r\n // TODO remove after https://bugzilla.mozilla.org/show_bug.cgi?id=455986 is fixed\r\n this.textPathElement.attr({ \"path\": value });\r\n this._disposers.push(this.textPathElement);\r\n this.hardInvalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"locationOnPath\", {\r\n /**\r\n * @return Relatvie location on path\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"locationOnPath\");\r\n },\r\n /**\r\n * Relative label location on `path`. Value range is from 0 (beginning)\r\n * to 1 (end).\r\n *\r\n * Works only if you set `path` setting to an SVG path.\r\n *\r\n * @since 4.1.2\r\n * @default 0\r\n * @param value Relatvie location on path\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"locationOnPath\", value);\r\n if (this.textPathElement) {\r\n this.textPathElement.attr({ \"startOffset\": (value * 100) + \"%\" });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"baseLineRatio\", {\r\n /**\r\n * @return Base line ratio\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"baseLineRatio\");\r\n },\r\n /**\r\n * A ratio to calculate text baseline. Ralative distance from the bottom of\r\n * the label.\r\n *\r\n * @since 4.4.2\r\n * @default -0.27\r\n * @param value Base line ratio\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"baseLineRatio\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"wrap\", {\r\n /**\r\n * @return Auto-wrap enabled or not\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"wrap\");\r\n },\r\n /**\r\n * Enables or disables autowrapping of text.\r\n *\r\n * @param value Auto-wrapping enabled\r\n */\r\n set: function (value) {\r\n this.resetBBox();\r\n this.setPropertyValue(\"wrap\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"truncate\", {\r\n /**\r\n * @return Truncate text?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"truncate\");\r\n },\r\n /**\r\n * Indicates if text lines need to be truncated if they do not fit, using\r\n * configurable `ellipsis` string.\r\n *\r\n * `truncate` overrides `wrap` if both are set to `true`.\r\n *\r\n * NOTE: For HTML text, this setting **won't** trigger a parser and actual\r\n * line truncation with ellipsis. It will just hide everything that goes\r\n * outside the label.\r\n *\r\n * @param value trincate text?\r\n */\r\n set: function (value) {\r\n this.resetBBox();\r\n this.setPropertyValue(\"truncate\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"fullWords\", {\r\n /**\r\n * @return Truncate on full words?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"fullWords\");\r\n },\r\n /**\r\n * If `truncate` is enabled, should Label try to break only on full words\r\n * (`true`), or whenever needed, including middle of the word. (`false`)\r\n *\r\n * @default true\r\n * @param value Truncate on full words?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"fullWords\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"ellipsis\", {\r\n /**\r\n * @return Ellipsis string\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"ellipsis\");\r\n },\r\n /**\r\n * Ellipsis character to use if `truncate` is enabled.\r\n *\r\n * @param value Ellipsis string\r\n * @default \"...\"\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"ellipsis\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"selectable\", {\r\n /**\r\n * @return Text selectable?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"selectable\");\r\n },\r\n /**\r\n * Forces the text to be selectable. This setting will be ignored if the\r\n * object has some kind of interaction attached to it, such as it is\r\n * `draggable`, `swipeable`, `resizable`.\r\n *\r\n * @param value Text selectable?\r\n * @default false\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"selectable\", value, true);\r\n this.setStyles();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"textAlign\", {\r\n /**\r\n * @return Alignment\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"textAlign\");\r\n },\r\n /**\r\n * Horizontal text alignment.\r\n *\r\n * Available choices:\r\n * * \"start\"\r\n * * \"middle\"\r\n * * \"end\"\r\n *\r\n * @param value Alignment\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"textAlign\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"textValign\", {\r\n /**\r\n * @ignore Exclude from docs (not used)\r\n * @return Alignment\r\n * @deprecated\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"textValign\");\r\n },\r\n /**\r\n * Vertical text alignment.\r\n *\r\n * @ignore Exclude from docs (not used)\r\n * @param value Alignment\r\n * @deprecated\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"textValign\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"html\", {\r\n /**\r\n * @return HTML content\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"html\");\r\n },\r\n /**\r\n * Raw HTML to be used as text.\r\n *\r\n * NOTE: HTML text is subject to browser support. It relies on browsers\r\n * supporting SVG `foreignObject` nodes. Some browsers (read IEs) do not\r\n * support it. On those browsers, the text will fall back to basic SVG text,\r\n * striping out all HTML markup and styling that goes with it.\r\n *\r\n * For more information about `foreignObject` and its browser compatibility\r\n * refer to [this page](https://developer.mozilla.org/en/docs/Web/SVG/Element/foreignObject#Browser_compatibility).\r\n *\r\n * @param value HTML text\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"html\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"hideOversized\", {\r\n /**\r\n * @return Hide if text does not fit?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"hideOversized\");\r\n },\r\n /**\r\n * Indicates whether the whole text should be hidden if it does not fit into\r\n * its allotted space.\r\n *\r\n * @param value Hide if text does not fit?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"hideOversized\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"ignoreFormatting\", {\r\n /**\r\n * @return Ignore formatting?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"ignoreFormatting\");\r\n },\r\n /**\r\n * If set to `true` square-bracket formatting blocks will be treated as\r\n * regular text.\r\n *\r\n * @default false\r\n * @param value Ignore formatting?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"ignoreFormatting\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Override `mesaureElement` so it does not get measure again, because\r\n * internal `_bbox` is being updated by measuring routines in Text itself.\r\n */\r\n Label.prototype.measureElement = function () { };\r\n /**\r\n * Returns information about a line element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param index Line index\r\n * @return Line info object\r\n */\r\n Label.prototype.getLineInfo = function (index) {\r\n this.initLineCache();\r\n var lines = this.getCache(\"lineInfo\");\r\n return lines.length > index ? lines[index] : undefined;\r\n };\r\n /**\r\n * Adds a line to line info cache.\r\n *\r\n * @ignore Exclude from docs\r\n * @param line Line info object\r\n * @param index Insert at specified index\r\n */\r\n Label.prototype.addLineInfo = function (line, index) {\r\n this.initLineCache();\r\n this.getCache(\"lineInfo\")[index] = line;\r\n };\r\n /**\r\n * Checks if line cache is initialized and initializes it.\r\n */\r\n Label.prototype.initLineCache = function () {\r\n if (!$type.hasValue(this.getCache(\"lineInfo\"))) {\r\n this.setCache(\"lineInfo\", [], 0);\r\n }\r\n };\r\n /**\r\n * Sets a [[DataItem]] to use for populating dynamic sections of the text.\r\n *\r\n * Check the description for [[Text]] class, for data binding.\r\n *\r\n * @param dataItem Data item\r\n */\r\n Label.prototype.setDataItem = function (dataItem) {\r\n if (this._sourceDataItemEvents) {\r\n this._sourceDataItemEvents.dispose();\r\n }\r\n if (dataItem) {\r\n this._sourceDataItemEvents = new MultiDisposer([\r\n dataItem.events.on(\"valuechanged\", this.invalidate, this, false),\r\n dataItem.events.on(\"workingvaluechanged\", this.invalidate, this, false),\r\n dataItem.events.on(\"calculatedvaluechanged\", this.invalidate, this, false),\r\n dataItem.events.on(\"propertychanged\", this.invalidate, this, false)\r\n ]);\r\n }\r\n _super.prototype.setDataItem.call(this, dataItem);\r\n };\r\n Object.defineProperty(Label.prototype, \"availableWidth\", {\r\n /**\r\n * Returns available horizontal space.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Available width (px)\r\n */\r\n get: function () {\r\n return $type.hasValue(this.maxWidth) ? this.maxWidth : this.pixelWidth;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Label.prototype, \"availableHeight\", {\r\n /**\r\n * Returns available vertical space.\r\n *\r\n * @return Available height (px)\r\n */\r\n get: function () {\r\n return $type.hasValue(this.maxHeight) ? this.maxHeight : this.pixelHeight;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // temp, replacing textFormatter method\r\n Label.prototype.getSvgElement = function (text, style) {\r\n var element = this.paper.add(\"tspan\");\r\n element.textContent = text;\r\n if (style) {\r\n element.node.setAttribute(\"style\", style);\r\n }\r\n return element;\r\n };\r\n /**\r\n * Invalidates the whole element, including layout AND all its child\r\n * elements.\r\n */\r\n Label.prototype.deepInvalidate = function () {\r\n _super.prototype.deepInvalidate.call(this);\r\n this.hardInvalidate();\r\n };\r\n Object.defineProperty(Label.prototype, \"readerTitle\", {\r\n /**\r\n * @return Title\r\n */\r\n get: function () {\r\n var title = this.getPropertyValue(\"readerTitle\");\r\n if (!title) {\r\n title = this.populateString($utils.plainText($utils.isNotEmpty(this.html)\r\n ? this.html\r\n : this.text));\r\n }\r\n return title;\r\n },\r\n /**\r\n * Screen reader title of the element.\r\n *\r\n * @param value Title\r\n */\r\n set: function (value) {\r\n value = $type.toText(value);\r\n if (this.setPropertyValue(\"readerTitle\", value)) {\r\n this.applyAccessibility();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Label;\r\n}(Container));\r\nexport { Label };\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[\"Label\"] = Label;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Hide labels added directly to chart, like titles if chart is short.\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.heightXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Label && target.parent && target.parent.isBaseSprite) {\r\n var state = target.states.create(stateId);\r\n state.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=Label.js.map","/**\r\n * Rounded rectangle module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $math from \"../utils/Math\";\r\nimport * as $type from \"../utils/Type\";\r\nimport * as $utils from \"../utils/Utils\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a rectangle with rounded corners.\r\n *\r\n * @see {@link IRoundedRectangleEvents} for a list of available events\r\n * @see {@link IRoundedRectangleAdapters} for a list of available Adapters\r\n */\r\nvar RoundedRectangle = /** @class */ (function (_super) {\r\n __extends(RoundedRectangle, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RoundedRectangle() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"RoundedRectangle\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.cornerRadius(3, 3, 3, 3);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n RoundedRectangle.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var w = this.innerWidth;\r\n var h = this.innerHeight;\r\n if ($type.isNumber(w) && $type.isNumber(h)) {\r\n var minSide = $math.min(w, h) / 2;\r\n var cornerRadiusTopLeft = $utils.relativeToValue(this.cornerRadiusTopLeft, minSide);\r\n var cornerRadiusTopRight = $utils.relativeToValue(this.cornerRadiusTopRight, minSide);\r\n var cornerRadiusBottomRight = $utils.relativeToValue(this.cornerRadiusBottomRight, minSide);\r\n var cornerRadiusBottomLeft = $utils.relativeToValue(this.cornerRadiusBottomLeft, minSide);\r\n var maxcr = $math.min(Math.abs(w / 2), Math.abs(h / 2));\r\n var crtl = $math.fitToRange(cornerRadiusTopLeft, 0, maxcr);\r\n var crtr = $math.fitToRange(cornerRadiusTopRight, 0, maxcr);\r\n var crbr = $math.fitToRange(cornerRadiusBottomRight, 0, maxcr);\r\n var crbl = $math.fitToRange(cornerRadiusBottomLeft, 0, maxcr);\r\n var lineT = \"M\" + crtl + \",0 L\" + (w - crtr) + \",0\";\r\n var lineB = \" L\" + crbl + \",\" + h;\r\n var lineL = \" L0,\" + crtl;\r\n var lineR = \" L\" + w + \",\" + (h - crbr);\r\n var arcTR = \" a\" + crtr + \",\" + crtr + \" 0 0 1 \" + crtr + \",\" + crtr;\r\n var arcBR = \" a\" + crbr + \",\" + crbr + \" 0 0 1 -\" + crbr + \",\" + crbr;\r\n var arcBL = \" a\" + crbl + \",\" + crbl + \" 0 0 1 -\" + crbl + \",-\" + crbl;\r\n var arcTL = \" a\" + crtl + \",\" + crtl + \" 0 0 1 \" + crtl + \",-\" + crtl;\r\n var path = lineT + arcTR + lineR + arcBR + lineB + arcBL + lineL + arcTL + \" Z\";\r\n this.path = path;\r\n }\r\n };\r\n /**\r\n * Sets radius for all four corners at ones.\r\n *\r\n * All numbers are in pixels.\r\n *\r\n * @param tl Top-left corner\r\n * @param tr Top-right corner\r\n * @param bl Bottom-left corner\r\n * @param br Bottom-right corner\r\n */\r\n RoundedRectangle.prototype.cornerRadius = function (tl, tr, bl, br) {\r\n this.cornerRadiusTopLeft = tl;\r\n this.cornerRadiusTopRight = tr;\r\n this.cornerRadiusBottomLeft = bl;\r\n this.cornerRadiusBottomRight = br;\r\n };\r\n Object.defineProperty(RoundedRectangle.prototype, \"cornerRadiusTopLeft\", {\r\n /**\r\n * @return Radius (px or Percent)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cornerRadiusTopLeft\");\r\n },\r\n /**\r\n * Radius of the top-left corner in pixels.\r\n *\r\n * @default 3\r\n * @param value Radius (px or Percent)\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"cornerRadiusTopLeft\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RoundedRectangle.prototype, \"cornerRadiusTopRight\", {\r\n /**\r\n * @return Radius (px or Percent)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cornerRadiusTopRight\");\r\n },\r\n /**\r\n * Radius of the top-right corner in pixels.\r\n *\r\n * @default 3\r\n * @param value Radius (px or Percent)\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"cornerRadiusTopRight\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RoundedRectangle.prototype, \"cornerRadiusBottomRight\", {\r\n /**\r\n * @return Radius (px or Percent)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cornerRadiusBottomRight\");\r\n },\r\n /**\r\n * Radius of the bottom-right corner in pixels.\r\n *\r\n * @default 3\r\n * @param value Radius (px or Percent)\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"cornerRadiusBottomRight\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RoundedRectangle.prototype, \"cornerRadiusBottomLeft\", {\r\n /**\r\n * @return Radius (px or Percent)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cornerRadiusBottomLeft\");\r\n },\r\n /**\r\n * Radius of the bottom-left corner in pixels.\r\n *\r\n * @default 3\r\n * @param value Radius (px or Percent)\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"cornerRadiusBottomLeft\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Measures the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n RoundedRectangle.prototype.measureElement = function () {\r\n };\r\n Object.defineProperty(RoundedRectangle.prototype, \"bbox\", {\r\n /**\r\n * Returns bounding box (square) for this element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n get: function () {\r\n if (this.definedBBox) {\r\n return this.definedBBox;\r\n }\r\n if (this.isMeasured) {\r\n return {\r\n x: 0,\r\n y: 0,\r\n width: this.innerWidth,\r\n height: this.innerHeight\r\n };\r\n }\r\n else {\r\n return { x: 0, y: 0, width: 0, height: 0 };\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return RoundedRectangle;\r\n}(Sprite));\r\nexport { RoundedRectangle };\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[\"RoundedRectangle\"] = RoundedRectangle;\r\n//# sourceMappingURL=RoundedRectangle.js.map","/**\r\n * Functionality for drawing simple buttons.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../Container\";\r\nimport { Label } from \"./Label\";\r\nimport { RoundedRectangle } from \"../elements/RoundedRectangle\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { registry } from \"../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Button class is capable of drawing a simple rectangular button with\r\n * optionally rounded corners and an icon in it.\r\n *\r\n * @see {@link IButtonEvents} for a list of available events\r\n * @see {@link IButtonAdapters} for a list of available Adapters\r\n */\r\nvar Button = /** @class */ (function (_super) {\r\n __extends(Button, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Button() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"Button\";\r\n _this.tooltipY = 0;\r\n // Set defaults\r\n _this.iconPosition = \"left\";\r\n _this.layout = \"horizontal\";\r\n _this.contentAlign = \"center\";\r\n _this.contentValign = \"middle\";\r\n _this.padding(8, 16, 8, 16);\r\n _this.setStateOnChildren = true;\r\n var interfaceColors = new InterfaceColorSet();\r\n // Create background\r\n var background = _this.background;\r\n background.fill = interfaceColors.getFor(\"secondaryButton\");\r\n background.stroke = interfaceColors.getFor(\"secondaryButtonStroke\");\r\n background.fillOpacity = 1;\r\n background.strokeOpacity = 1;\r\n background.cornerRadius(3, 3, 3, 3);\r\n // Create the label element\r\n _this.label = new Label();\r\n _this.label.fill = interfaceColors.getFor(\"secondaryButtonText\");\r\n ;\r\n _this.label.shouldClone = false;\r\n // Create default states\r\n var hoverState = background.states.create(\"hover\");\r\n hoverState.properties.fillOpacity = 1;\r\n hoverState.properties.fill = interfaceColors.getFor(\"secondaryButtonHover\");\r\n var downState = background.states.create(\"down\");\r\n downState.transitionDuration = 100;\r\n downState.properties.fill = interfaceColors.getFor(\"secondaryButtonDown\");\r\n downState.properties.fillOpacity = 1;\r\n // Set up accessibility\r\n // A button should be always focusable\r\n _this.role = \"button\";\r\n _this.focusable = true;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(Button.prototype, \"icon\", {\r\n /**\r\n * @return Icon Sprite\r\n */\r\n get: function () {\r\n return this._icon;\r\n },\r\n /**\r\n * A [[Sprite]] to be used as an icon on button.\r\n *\r\n * @param icon Icon Sprite\r\n */\r\n set: function (icon) {\r\n var currentIcon = this._icon;\r\n if (currentIcon) {\r\n //this._icon.dispose();\r\n //this.removeDispose(currentIcon);\r\n currentIcon.parent = undefined;\r\n }\r\n if (icon) {\r\n this._icon = icon;\r\n icon.parent = this;\r\n icon.interactionsEnabled = false;\r\n icon.shouldClone = false;\r\n this.iconPosition = this.iconPosition;\r\n this._disposers.push(icon);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Button.prototype, \"iconPosition\", {\r\n /**\r\n * @return Icon position\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"iconPosition\");\r\n },\r\n /**\r\n * Icon position: \"left\" or \"right\".\r\n *\r\n * @default \"left\"\r\n * @param position Icon position\r\n */\r\n set: function (position) {\r\n this.setPropertyValue(\"iconPosition\", position);\r\n if (this.icon) {\r\n if (position == \"left\") {\r\n this.icon.toBack();\r\n }\r\n else {\r\n this.icon.toFront();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Button.prototype, \"label\", {\r\n /**\r\n * @return Label element\r\n */\r\n get: function () {\r\n return this._label;\r\n },\r\n /**\r\n * [[Label]] element to be used for text.\r\n *\r\n * @param label element\r\n */\r\n set: function (label) {\r\n if (this._label) {\r\n //this._label.dispose();\r\n this.removeDispose(this._label);\r\n }\r\n this._label = label;\r\n if (label) {\r\n label.parent = this;\r\n label.interactionsEnabled = false;\r\n this._disposers.push(this._label);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a background element for the button.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Background element\r\n */\r\n Button.prototype.createBackground = function () {\r\n return new RoundedRectangle();\r\n };\r\n /**\r\n * Copies properties and other attributes.\r\n *\r\n * @param source Source\r\n */\r\n Button.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (source.label) {\r\n this.label.copyFrom(source.label);\r\n }\r\n if (source.icon) {\r\n this.icon = source.icon.clone();\r\n }\r\n };\r\n return Button;\r\n}(Container));\r\nexport { Button };\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[\"Button\"] = Button;\r\n//# sourceMappingURL=Button.js.map","/**\r\n * Functionality for drawing circles.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport { percent } from \"../utils/Percent\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $utils from \"../utils/Utils\";\r\nimport * as $math from \"../utils/Math\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to create a circle\r\n * @see {@link ICircleEvents} for a list of available events\r\n * @see {@link ICircleAdapters} for a list of available Adapters\r\n */\r\nvar Circle = /** @class */ (function (_super) {\r\n __extends(Circle, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Circle() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Circle\";\r\n _this.element = _this.paper.add(\"circle\");\r\n _this.setPercentProperty(\"radius\", percent(100));\r\n _this.setPropertyValue(\"horizontalCenter\", \"middle\");\r\n _this.setPropertyValue(\"verticalCenter\", \"middle\");\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the circle.\r\n */\r\n Circle.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n this.element.attr({ \"r\": this.pixelRadius });\r\n };\r\n Object.defineProperty(Circle.prototype, \"radius\", {\r\n /**\r\n * @return Radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Radius of the circle.\r\n *\r\n * Can be either absolute (pixels) or relative ([Percent]).\r\n *\r\n * @param value Radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Circle.prototype, \"pixelRadius\", {\r\n /**\r\n * Radius of the circle in pixels.\r\n *\r\n * This is a read-only property. To set radius in pixels, use `radius`\r\n * property.\r\n *\r\n * @readonly\r\n * @return Radius (px)\r\n */\r\n get: function () {\r\n return $utils.relativeToValue(this.radius, $math.min(this.innerWidth / 2, this.innerHeight / 2));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates bounding box.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Circle.prototype.measureElement = function () {\r\n var pixelRadius = this.pixelRadius;\r\n this._bbox = {\r\n x: -pixelRadius,\r\n y: -pixelRadius,\r\n width: pixelRadius * 2,\r\n height: pixelRadius * 2\r\n };\r\n };\r\n return Circle;\r\n}(Sprite));\r\nexport { Circle };\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[\"Circle\"] = Circle;\r\n//# sourceMappingURL=Circle.js.map","/**\r\n * Ellipse module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Circle } from \"./Circle\";\r\nimport { registry } from \"../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws an ellipse\r\n * @see {@link IEllipseEvents} for a list of available events\r\n * @see {@link IEllipseAdapters} for a list of available Adapters\r\n */\r\nvar Ellipse = /** @class */ (function (_super) {\r\n __extends(Ellipse, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Ellipse() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Ellipse\";\r\n _this.element = _this.paper.add(\"ellipse\");\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the ellipsis.\r\n */\r\n Ellipse.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n this.element.attr({ \"rx\": this.radius });\r\n this.element.attr({ \"ry\": this.radiusY });\r\n };\r\n Object.defineProperty(Ellipse.prototype, \"radiusY\", {\r\n /**\r\n * @return Vertical radius\r\n */\r\n get: function () {\r\n return this.innerHeight / 2;\r\n },\r\n /**\r\n * Vertical radius.\r\n *\r\n * It's a relative size to the `radius`.\r\n *\r\n * E.g. 0.8 will mean the height of the ellipsis will be 80% of it's\r\n * horizontal radius.\r\n *\r\n * @param value Vertical radius\r\n */\r\n set: function (value) {\r\n this.height = value * 2;\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Ellipse.prototype, \"radius\", {\r\n /**\r\n * @return Horizontal radius\r\n */\r\n get: function () {\r\n return this.innerWidth / 2;\r\n },\r\n /**\r\n * Horizontal radius.\r\n *\r\n * @param value Horizontal radius\r\n */\r\n set: function (value) {\r\n this.width = value * 2;\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Ellipse;\r\n}(Circle));\r\nexport { Ellipse };\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[\"Ellipse\"] = Ellipse;\r\n//# sourceMappingURL=Ellipse.js.map","/**\r\n * Functionality for adding images in SVG tree.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $dom from \"../utils/DOM\";\r\nimport * as $type from \"../utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to add `
` elements to SVG.\r\n *\r\n * @see {@link IImageEvents} for a list of available events\r\n * @see {@link IImageAdapters} for a list of available Adapters\r\n */\r\nvar Image = /** @class */ (function (_super) {\r\n __extends(Image, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Image() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Image\";\r\n _this.element = _this.paper.add(\"image\");\r\n _this.applyTheme();\r\n _this.width = 50;\r\n _this.height = 50;\r\n return _this;\r\n }\r\n /**\r\n * Draws an `` element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Image.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n if (this.href) {\r\n var width = this.innerWidth;\r\n var height = this.innerHeight;\r\n if ($type.isNumber(this.widthRatio)) {\r\n width = height * this.widthRatio;\r\n this.width = width;\r\n }\r\n if ($type.isNumber(this.heightRatio)) {\r\n height = width * this.heightRatio;\r\n this.height = height;\r\n }\r\n this.element.attr({\r\n \"width\": width,\r\n \"height\": height\r\n });\r\n this.element.attrNS($dom.XLINK, \"xlink:href\", this.href);\r\n }\r\n };\r\n Object.defineProperty(Image.prototype, \"href\", {\r\n /**\r\n * @return Image URI\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"href\");\r\n },\r\n /**\r\n * An image URI.\r\n *\r\n * @param value Image URI\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"href\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"widthRatio\", {\r\n /**\r\n * @return Ratio\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"widthRatio\");\r\n },\r\n /**\r\n * Sets image `width` relatively to its `height`.\r\n *\r\n * If image's `height = 100` and `widthRatio = 0.5` the actual width will be\r\n * `50`.\r\n *\r\n * @param value Ratio\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"widthRatio\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"heightRatio\", {\r\n /**\r\n * @return Ratio\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"heightRatio\");\r\n },\r\n /**\r\n * Sets image `height` relatively to its `width`.\r\n *\r\n * If image's `width = 100` and `heightRatio = 0.5` the actual height will be\r\n * `50`.\r\n *\r\n * @param value Ratio\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"heightRatio\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"bbox\", {\r\n /**\r\n * Returns bounding box (square) for this element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n get: function () {\r\n return {\r\n x: 0,\r\n y: 0,\r\n width: this.pixelWidth,\r\n height: this.pixelHeight\r\n };\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Image;\r\n}(Sprite));\r\nexport { Image };\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[\"Image\"] = Image;\r\n//# sourceMappingURL=Image.js.map","/**\r\n * Line drawing functionality.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport { color } from \"../utils/Color\";\r\nimport { LinearGradient } from \"../rendering/fills/LinearGradient\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $type from \"../utils/Type\";\r\nimport * as $math from \"../utils/Math\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a line.\r\n *\r\n * @see {@link ILineEvents} for a list of available events\r\n * @see {@link ILineAdapters} for a list of available Adapters\r\n */\r\nvar Line = /** @class */ (function (_super) {\r\n __extends(Line, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Line() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Line\";\r\n _this.element = _this.paper.add(\"line\");\r\n _this.fill = color(); //\"none\";\r\n _this.x1 = 0;\r\n _this.y1 = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the line.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Line.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n if (this.x1 == this.x2 || this.y1 == this.y2) {\r\n this.pixelPerfect = true;\r\n }\r\n else {\r\n this.pixelPerfect = false;\r\n }\r\n this.x1 = this.x1;\r\n this.x2 = this.x2;\r\n this.y1 = this.y1;\r\n this.y2 = this.y2;\r\n };\r\n Object.defineProperty(Line.prototype, \"x1\", {\r\n /**\r\n * @return X\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"x1\");\r\n },\r\n /**\r\n * X coordinate of first end.\r\n *\r\n * @param value X\r\n */\r\n set: function (value) {\r\n if (!$type.isNumber(value)) {\r\n value = 0;\r\n }\r\n var delta = 0;\r\n if (this.pixelPerfect && this.stroke instanceof LinearGradient) {\r\n delta = 0.00001;\r\n }\r\n this.setPropertyValue(\"x1\", value, true);\r\n this.element.attr({ \"x1\": value + delta });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"x2\", {\r\n /**\r\n * @return X\r\n */\r\n get: function () {\r\n var value = this.getPropertyValue(\"x2\");\r\n if (!$type.isNumber(value)) {\r\n value = this.pixelWidth;\r\n }\r\n return value;\r\n },\r\n /**\r\n * X coordinate of second end.\r\n *\r\n * @param value X\r\n */\r\n set: function (value) {\r\n if (!$type.isNumber(value)) {\r\n value = 0;\r\n }\r\n this.setPropertyValue(\"x2\", value, true);\r\n this.element.attr({ \"x2\": value });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"y1\", {\r\n /**\r\n * @return Y\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"y1\");\r\n },\r\n /**\r\n * Y coordinate of first end.\r\n *\r\n * @param value Y\r\n */\r\n set: function (value) {\r\n if (!$type.isNumber(value)) {\r\n value = 0;\r\n }\r\n var delta = 0;\r\n if (this.pixelPerfect && this.stroke instanceof LinearGradient) {\r\n delta = 0.00001;\r\n }\r\n this.setPropertyValue(\"y1\", value, true);\r\n this.element.attr({ \"y1\": value + delta });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"y2\", {\r\n /**\r\n * @return Y\r\n */\r\n get: function () {\r\n var value = this.getPropertyValue(\"y2\");\r\n if (!$type.isNumber(value)) {\r\n value = this.pixelHeight;\r\n }\r\n return value;\r\n },\r\n /**\r\n * Y coordinate of second end.\r\n *\r\n * @param value Y\r\n */\r\n set: function (value) {\r\n if (!$type.isNumber(value)) {\r\n value = 0;\r\n }\r\n this.setPropertyValue(\"y2\", value, true);\r\n this.element.attr({ \"y2\": value });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\r\n Line.prototype.positionToPoint = function (position) {\r\n var point1 = { x: this.x1, y: this.y1 };\r\n var point2 = { x: this.x2, y: this.y2 };\r\n var point = $math.getMidPoint(point1, point2, position);\r\n var angle = $math.getAngle(point1, point2);\r\n return { x: point.x, y: point.y, angle: angle };\r\n };\r\n return Line;\r\n}(Sprite));\r\nexport { Line };\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[\"Line\"] = Line;\r\n//# sourceMappingURL=Line.js.map","/**\r\n * Pointed shape module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport * as $type from \"../utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a shape with a pointer.\r\n *\r\n * @see {@link IPointedShapeEvents} for a list of available events\r\n * @see {@link IPointedShapeAdapters} for a list of available Adapters\r\n */\r\nvar PointedShape = /** @class */ (function (_super) {\r\n __extends(PointedShape, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PointedShape() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PointedShape\";\r\n _this.pointerBaseWidth = 15;\r\n _this.pointerLength = 10;\r\n _this.pointerY = 0;\r\n _this.pointerX = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PointedShape.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n if (!$type.isNumber(this.pointerX)) {\r\n this.pointerX = this.pixelWidth / 2;\r\n }\r\n if (!$type.isNumber(this.pointerY)) {\r\n this.pointerY = this.pixelHeight + 10;\r\n }\r\n };\r\n Object.defineProperty(PointedShape.prototype, \"pointerBaseWidth\", {\r\n /**\r\n * @return Width (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"pointerBaseWidth\");\r\n },\r\n /**\r\n * A width of the pinter's (stem's) thick end (base) in pixels.\r\n *\r\n * @default 15\r\n * @param value Width (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"pointerBaseWidth\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointedShape.prototype, \"pointerLength\", {\r\n /**\r\n * @return Length (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"pointerLength\");\r\n },\r\n /**\r\n * A length of the pinter (stem) in pixels.\r\n *\r\n * @default 10\r\n * @param value Length (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"pointerLength\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointedShape.prototype, \"pointerX\", {\r\n /**\r\n * @return X\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"pointerX\");\r\n },\r\n /**\r\n * X coordinate the shape is pointing to.\r\n *\r\n * @param value X\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"pointerX\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointedShape.prototype, \"pointerY\", {\r\n /**\r\n * @return Y\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"pointerY\");\r\n },\r\n /**\r\n * Y coordinate the shape is pointing to.\r\n *\r\n * @param value Y\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"pointerY\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PointedShape;\r\n}(Sprite));\r\nexport { PointedShape };\r\n//# sourceMappingURL=PointedShape.js.map","/**\r\n * Pointed rectangle module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { PointedShape } from \"./PointedShape\";\r\nimport * as $math from \"../utils/Math\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a rectangle with a pointer.\r\n *\r\n * @see {@link IPointedRectangleEvents} for a list of available events\r\n * @see {@link IPointedRectangleAdapters} for a list of available Adapters\r\n */\r\nvar PointedRectangle = /** @class */ (function (_super) {\r\n __extends(PointedRectangle, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PointedRectangle() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PointedRectangle\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.cornerRadius = 6;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PointedRectangle.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var cr = this.cornerRadius;\r\n var w = this.innerWidth;\r\n var h = this.innerHeight;\r\n if (w > 0 && h > 0) {\r\n var x = this.pointerX;\r\n var y = this.pointerY;\r\n var bwh = this.pointerBaseWidth / 2;\r\n var maxcr = $math.min(w / 2, h / 2);\r\n var crtl = $math.fitToRange(cr, 0, maxcr);\r\n var crtr = $math.fitToRange(cr, 0, maxcr);\r\n var crbr = $math.fitToRange(cr, 0, maxcr);\r\n var crbl = $math.fitToRange(cr, 0, maxcr);\r\n // corner coordinates\r\n // top left\r\n var xtl = 0;\r\n var ytl = 0;\r\n // top right\r\n var xtr = w;\r\n var ytr = 0;\r\n // bottom right\r\n var xbr = w;\r\n var ybr = h;\r\n // bottom left\r\n var xbl = 0;\r\n var ybl = h;\r\n var lineT = void 0;\r\n var lineR = void 0;\r\n var lineB = void 0;\r\n var lineL = void 0;\r\n // find stem base side: http://$math.stackexchange.com/questions/274712/calculate-on-which-side-of-straign-line-is-dot-located\r\n // d=(x−x1)(y2−y1)−(y−y1)(x2−x1)\r\n var d1 = (x - xtl) * (ybr - ytl) - (y - ytl) * (xbr - xtl);\r\n var d2 = (x - xbl) * (ytr - ybl) - (y - ybl) * (xtr - xbl);\r\n // top\r\n if (d1 > 0 && d2 > 0) {\r\n var stemX = $math.fitToRange(x, crtl + bwh, w - bwh - crtr);\r\n y = $math.fitToRange(y, -Infinity, 0);\r\n lineT = \"M\" + crtl + \",0 L\" + (stemX - bwh) + \",0 L\" + x + \",\" + y + \" L\" + (stemX + bwh) + \",0 L\" + (w - crtr) + \",0\";\r\n }\r\n else {\r\n lineT = \"M\" + crtl + \",0 L\" + (w - crtr) + \",0\";\r\n }\r\n // bottom\r\n if (d1 < 0 && d2 < 0) {\r\n var stemX = $math.fitToRange(x, crbl + bwh, w - bwh - crbr);\r\n y = $math.fitToRange(y, h, Infinity);\r\n lineB = \" L\" + (w - crbr) + \",\" + h + \" L\" + (stemX + bwh) + \",\" + h + \" L\" + x + \",\" + y + \" L\" + (stemX - bwh) + \",\" + h + \" L\" + crbl + \",\" + h;\r\n }\r\n else {\r\n lineB = \" L\" + crbl + \",\" + h;\r\n }\r\n // left\r\n if (d1 < 0 && d2 > 0) {\r\n var stemY = $math.fitToRange(y, crtl + bwh, h - crbl - bwh);\r\n x = $math.fitToRange(x, -Infinity, 0);\r\n lineL = \" L0,\" + (h - crbl) + \" L0,\" + (stemY + bwh) + \" L\" + x + \",\" + y + \" L0,\" + (stemY - bwh) + \" L0,\" + crtl;\r\n }\r\n else {\r\n lineL = \" L0,\" + crtl;\r\n }\r\n // right\r\n if (d1 > 0 && d2 < 0) {\r\n var stemY = $math.fitToRange(y, crtr + bwh, h - bwh - crbr);\r\n x = $math.fitToRange(x, w, Infinity);\r\n lineR = \" L\" + w + \",\" + crtr + \" L\" + w + \",\" + (stemY - bwh) + \" L\" + x + \",\" + y + \" L\" + w + \",\" + (stemY + bwh) + \" L\" + w + \",\" + (h - crbr);\r\n }\r\n else {\r\n lineR = \" L\" + w + \",\" + (h - crbr);\r\n }\r\n var arcTR = \" a\" + crtr + \",\" + crtr + \" 0 0 1 \" + crtr + \",\" + crtr;\r\n var arcBR = \" a\" + crbr + \",\" + crbr + \" 0 0 1 -\" + crbr + \",\" + crbr;\r\n var arcBL = \" a\" + crbl + \",\" + crbl + \" 0 0 1 -\" + crbl + \",-\" + crbl;\r\n var arcTL = \" a\" + crtl + \",\" + crtl + \" 0 0 1 \" + crtl + \",-\" + crtl;\r\n this.path = lineT + arcTR + lineR + arcBR + lineB + arcBL + lineL + arcTL;\r\n }\r\n };\r\n Object.defineProperty(PointedRectangle.prototype, \"cornerRadius\", {\r\n /**\r\n * @return Corner radius (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cornerRadius\");\r\n },\r\n /**\r\n * Radius of rectangle's border in pixels.\r\n *\r\n * @default 0\r\n * @param value Corner radius (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"cornerRadius\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PointedRectangle;\r\n}(PointedShape));\r\nexport { PointedRectangle };\r\n//# sourceMappingURL=PointedRectangle.js.map","/**\r\n * A collection of functions that deals with path calculations.\r\n */\r\nimport * as $math from \"../utils/Math\";\r\nimport * as $type from \"../utils/Type\";\r\nimport { getGhostPaper } from \"../rendering/Paper\";\r\nimport { options } from \"../Options\";\r\n/**\r\n * ============================================================================\r\n * PATH FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Returns an SVG path from a number of points.\r\n *\r\n * @ignore Exclude from docs\r\n * @param points An array of line elbow points\r\n * @return SVG path\r\n */\r\nexport function polyline(points) {\r\n var path = lineTo(points[0]);\r\n var prevPoint = { x: 0, y: 0 };\r\n var minStep = options.minPolylineStep;\r\n if (!$type.isNumber(minStep)) {\r\n minStep = 0.5;\r\n }\r\n for (var i = 0, len = points.length; i < len; i++) {\r\n var point = points[i];\r\n if ($math.getDistance(point, prevPoint) > minStep) {\r\n path += lineTo(point);\r\n prevPoint = point;\r\n }\r\n }\r\n return path;\r\n}\r\n/**\r\n * Returns a starting point of an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point Starting point\r\n * @return SVG path\r\n */\r\nexport function moveTo(point) {\r\n return \" M\" + $math.round(point.x, 4) + \",\" + $math.round(point.y, 4) + \" \";\r\n}\r\n/**\r\n * Returns a line part of SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point SVG path\r\n * @return SVG path\r\n */\r\nexport function lineTo(point) {\r\n return \" L\" + $math.round(point.x, 4) + \",\" + $math.round(point.y, 4) + \" \";\r\n}\r\n/**\r\n * Returns a quadratic curve part of an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point End point of the curve\r\n * @param controlPoint Control point\r\n * @return SVG path\r\n */\r\nexport function quadraticCurveTo(point, controlPoint) {\r\n return \" Q\" + $math.round(controlPoint.x, 4)\r\n + \",\" + $math.round(controlPoint.y, 4) + \" \" + $math.round(point.x, 4)\r\n + \",\" + $math.round(point.y, 4);\r\n}\r\n/**\r\n * Returns a cubic curve part of an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point End point of the curve\r\n * @param controlPointA Control point A\r\n * @param controlPointB Control point B\r\n * @return SVG path\r\n */\r\nexport function cubicCurveTo(point, controlPointA, controlPointB) {\r\n return \" C\" + $math.round(controlPointA.x, 4)\r\n + \",\" + $math.round(controlPointA.y, 4) + \" \" + $math.round(controlPointB.x, 4)\r\n + \",\" + $math.round(controlPointB.y, 4) + \" \" + $math.round(point.x, 4)\r\n + \",\" + $math.round(point.y, 4);\r\n}\r\n/**\r\n * Returns a terminator for an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @return SVG path\r\n */\r\nexport function closePath() {\r\n return \" Z\";\r\n}\r\n/**\r\n * Returns an arc part of an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Better parameter descriptions\r\n * @param startAngle Starting angle\r\n * @param arc Arc\r\n * @param radius Radius\r\n * @param radiusY Vertical radius\r\n * @return SVG path\r\n */\r\nexport function arcTo(startAngle, arc, radius, radiusY) {\r\n if (arc == 0) {\r\n return \"\";\r\n }\r\n if (!$type.isNumber(radiusY)) {\r\n radiusY = radius;\r\n }\r\n var path = \"\";\r\n var c = \",\";\r\n var segments = Math.ceil(Math.abs(arc) / 180);\r\n var l = 1;\r\n if (arc < 0) {\r\n l = 0;\r\n }\r\n // previous, as we use a not A\r\n var pax = 0;\r\n var pay = 0;\r\n // center\r\n var cx = -$math.cos(startAngle) * radius;\r\n var cy = -$math.sin(startAngle) * radiusY;\r\n // foir very short angles and big radius, solves artefacts\r\n if (arc < 0.5 && radius > 3000) {\r\n var endAngle = startAngle + arc;\r\n var ax = $math.round($math.cos(endAngle) * radius, 4);\r\n var ay = $math.round($math.sin(endAngle) * radiusY, 4);\r\n return lineTo({ x: ax, y: ay });\r\n }\r\n for (var i = 0; i < segments; i++) {\r\n var endAngle = startAngle + arc / segments * (i + 1);\r\n var ax = $math.round($math.cos(endAngle) * radius + cx - pax, 4);\r\n var ay = $math.round($math.sin(endAngle) * radiusY + cy - pay, 4);\r\n path += \" a\" + radius + c + radiusY + c + 0 + c + 0 + c + l + c + ax + c + ay;\r\n pax = ax;\r\n pay = ay;\r\n }\r\n return path;\r\n}\r\n/**\r\n * Creates an arc path.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startAngle [description]\r\n * @param arc [description]\r\n * @param radius [description]\r\n * @param innerRadius [description]\r\n * @param radiusY [description]\r\n * @param cornerRadius [description]\r\n * @param innerCornerRadius [description]\r\n * @return SVG path\r\n */\r\nexport function arc(startAngle, arc, radius, innerRadius, radiusY, cornerRadius, innerCornerRadius) {\r\n if (arc == 0) {\r\n return \"\";\r\n }\r\n if (!$type.isNumber(innerRadius)) {\r\n innerRadius = 0;\r\n }\r\n if (radius == 0 && innerRadius <= 0) {\r\n return \"\";\r\n }\r\n if (radius < innerRadius) {\r\n var temp = radius;\r\n radius = innerRadius;\r\n innerRadius = temp;\r\n if ($type.isNumber(radiusY)) {\r\n radiusY = radiusY / innerRadius * radius;\r\n }\r\n }\r\n arc = $math.min(arc, 360);\r\n if (arc == 360) {\r\n cornerRadius = 0;\r\n innerCornerRadius = 0;\r\n }\r\n var endAngle = startAngle + arc;\r\n var crSin = $math.sin($math.min(arc, 45) / 2);\r\n radiusY = $type.isNumber(radiusY) ? radiusY : radius;\r\n cornerRadius = cornerRadius || 0;\r\n innerCornerRadius = $type.isNumber(innerCornerRadius) ? innerCornerRadius : cornerRadius;\r\n var innerRadiusY = (radiusY / radius) * innerRadius;\r\n var cornerRadiusY = (radiusY / radius) * cornerRadius;\r\n var innerCornerRadiusY = (radiusY / radius) * innerCornerRadius;\r\n cornerRadius = $math.fitToRange(cornerRadius, 0, (radius - innerRadius) / 2);\r\n cornerRadiusY = $math.fitToRange(cornerRadiusY, 0, (radiusY - innerRadiusY) / 2);\r\n innerCornerRadius = $math.fitToRange(innerCornerRadius, 0, (radius - innerRadius) / 2);\r\n innerCornerRadiusY = $math.fitToRange(innerCornerRadiusY, 0, (radiusY - innerRadiusY) / 2);\r\n cornerRadius = $math.round($math.fitToRange(cornerRadius, 0, radius * crSin), 4);\r\n cornerRadiusY = $math.round($math.fitToRange(cornerRadiusY, 0, radiusY * crSin), 4);\r\n innerCornerRadius = $math.round($math.fitToRange(innerCornerRadius, 0, innerRadius * crSin), 4);\r\n innerCornerRadiusY = $math.round($math.fitToRange(innerCornerRadiusY, 0, innerRadiusY * crSin), 4);\r\n var crAngle = Math.asin(cornerRadius / radius / 2) * $math.DEGREES * 2;\r\n var crAngleY = Math.asin(cornerRadiusY / radiusY / 2) * $math.DEGREES * 2;\r\n if (innerRadius < innerCornerRadius) {\r\n innerRadius = innerCornerRadius;\r\n }\r\n if (innerRadiusY < innerCornerRadiusY) {\r\n innerRadiusY = innerCornerRadiusY;\r\n }\r\n var crInnerAngle = Math.asin(innerCornerRadius / innerRadius / 2) * $math.DEGREES * 2;\r\n var crInnerAngleY = Math.asin(innerCornerRadiusY / innerRadiusY / 2) * $math.DEGREES * 2;\r\n if (!$type.isNumber(crInnerAngle)) {\r\n crInnerAngle = 0;\r\n }\r\n if (!$type.isNumber(crInnerAngleY)) {\r\n crInnerAngleY = 0;\r\n }\r\n var middleAngle = startAngle + arc / 2;\r\n var mPoint = { x: $math.round($math.cos(middleAngle) * innerRadius, 4), y: $math.sin(middleAngle) * innerRadiusY };\r\n var a0 = { x: $math.cos(startAngle) * (innerRadius + innerCornerRadius), y: $math.sin(startAngle) * (innerRadiusY + innerCornerRadiusY) };\r\n var b0 = { x: $math.cos(startAngle) * (radius - cornerRadius), y: $math.sin(startAngle) * (radiusY - cornerRadiusY) };\r\n var c0 = { x: $math.cos(endAngle) * (radius - cornerRadius), y: $math.sin(endAngle) * (radiusY - cornerRadiusY) };\r\n var d0 = { x: $math.cos(endAngle) * (innerRadius + innerCornerRadius), y: $math.sin(endAngle) * (innerRadiusY + innerCornerRadiusY) };\r\n var b1 = { x: $math.cos(startAngle + crAngle) * radius, y: $math.sin(startAngle + crAngleY) * radiusY };\r\n var d1 = { x: $math.cos(endAngle - crInnerAngle) * innerRadius, y: $math.sin(endAngle - crInnerAngleY) * innerRadiusY };\r\n // some magic math\r\n innerCornerRadius += innerCornerRadius * $math.sin(crInnerAngle / 2);\r\n innerCornerRadiusY += innerCornerRadiusY * $math.sin(crInnerAngleY / 2);\r\n if (crInnerAngle > (endAngle - startAngle) / 2) {\r\n d1 = mPoint;\r\n }\r\n var path = \"\";\r\n // start from b if this is full circle\r\n if (arc == 360) {\r\n path = moveTo(b0);\r\n }\r\n // otherwise start from a\r\n else {\r\n path = moveTo(a0);\r\n path += lineTo(b0);\r\n path += arcToPoint(b1, cornerRadius, cornerRadiusY, true);\r\n }\r\n // draw arc\r\n path += arcTo(startAngle + crAngle, arc - 2 * crAngle, radius, radiusY);\r\n // draw inner arc\r\n if ($type.isNumber(innerRadius) && innerRadius != 0) {\r\n // move to B if this is full circle\r\n if (arc == 360 && cornerRadius == 0) {\r\n path += moveTo(d0);\r\n }\r\n // draw line otherwise\r\n else {\r\n path += arcToPoint(c0, cornerRadius, cornerRadiusY, true);\r\n path += lineTo(d0);\r\n path += arcToPoint(d1, innerCornerRadius, innerCornerRadiusY, true);\r\n }\r\n path += arcTo(endAngle - crInnerAngle, -(arc - 2 * crInnerAngle), innerRadius, innerRadiusY);\r\n if (arc < 360 || cornerRadius > 0) {\r\n path += arcToPoint(a0, innerCornerRadius, innerCornerRadiusY, true);\r\n }\r\n path += lineTo(a0);\r\n }\r\n else {\r\n path += arcToPoint(c0, cornerRadius, cornerRadiusY, true);\r\n if (arc < 360) {\r\n path += lineTo(a0);\r\n }\r\n }\r\n return path;\r\n}\r\n/**\r\n * Creates a path for an arc to specific coordinate.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param point Reference point\r\n * @param radius Radius\r\n * @param radiusY Vertical radius (for skewed arcs)\r\n * @param sweepFlag [description]\r\n * @param largeArcFlag [description]\r\n * @param xAxisRotation [description]\r\n * @return Arc path\r\n */\r\nexport function arcToPoint(point, radius, radiusY, sweepFlag, largeArcFlag, xAxisRotation) {\r\n if (radius == 0) {\r\n return \"\";\r\n }\r\n xAxisRotation = xAxisRotation || 0;\r\n largeArcFlag = Boolean(largeArcFlag);\r\n sweepFlag = Boolean(sweepFlag);\r\n var c = \",\";\r\n var sweepFlagValue = +sweepFlag; // converts to 1 or 0\r\n var largeArcFlagValue = +largeArcFlag; // converts to 1 or 0\r\n return \" A\" + radius + c + radiusY + c + xAxisRotation + c + largeArcFlagValue + c + sweepFlagValue + c + $math.round(point.x, 4) + c + $math.round(point.y, 4);\r\n}\r\n/**\r\n * Creates a new rectangle.\r\n *\r\n * @ignore Exclude from docs\r\n * @param width Width (px)\r\n * @param height Height (px)\r\n * @param x X position\r\n * @param y Y position\r\n * @return Rectangle\r\n */\r\nexport function rectangle(width, height, x, y) {\r\n if (!$type.isNumber(x)) {\r\n x = 0;\r\n }\r\n if (!$type.isNumber(y)) {\r\n y = 0;\r\n }\r\n return moveTo({ x: x, y: y }) + lineTo({ x: x + width, y: y }) + lineTo({ x: x + width, y: y + height }) + lineTo({ x: x, y: y + height }) + closePath();\r\n}\r\n/**\r\n * Converts a rectangle to an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param rect Rectangle\r\n * @param ccw Counter-clockwise?\r\n * @return SVG path\r\n */\r\nexport function rectToPath(rect, ccw) {\r\n var c = \",\";\r\n var L = \" L\";\r\n if (ccw) {\r\n return \"M\" + rect.x\r\n + c + rect.y + L + rect.x\r\n + c + (rect.y + rect.height) + L + (rect.x + rect.width)\r\n + c + (rect.y + rect.height) + L + (rect.x + rect.width)\r\n + c + rect.y + L + rect.x\r\n + c + rect.y;\r\n }\r\n else {\r\n return \"M\" + rect.x\r\n + c + rect.y + L + (rect.x + rect.width)\r\n + c + rect.y + L + (rect.x + rect.width)\r\n + c + (rect.y + rect.height) + L + rect.x\r\n + c + (rect.y + rect.height) + L + rect.x\r\n + c + rect.y;\r\n }\r\n}\r\n/**\r\n * Converts SVG path to array of points.\r\n *\r\n * Note, this is experimental feature based on method which is deprecated\r\n * on some browsers and some browsers do not support it at all.\r\n *\r\n * You can save the output of this function, but not rely on it completely.\r\n */\r\nexport function pathToPoints(path, pointCount) {\r\n var paper = getGhostPaper();\r\n var svgPath = paper.add(\"path\").node;\r\n svgPath.setAttribute(\"d\", path);\r\n if (svgPath.getPointAtLength && svgPath.getTotalLength) {\r\n var length_1 = svgPath.getTotalLength();\r\n var toPoints = [];\r\n for (var i = 0; i < pointCount; i++) {\r\n var point = svgPath.getPointAtLength(i / pointCount * length_1);\r\n toPoints.push({ x: point.x, y: point.y });\r\n }\r\n return toPoints;\r\n }\r\n svgPath.remove();\r\n}\r\nexport function spiralPoints(cx, cy, radius, radiusY, innerRadius, step, radiusStep, startAngle, endAngle) {\r\n if (!$type.isNumber(startAngle)) {\r\n startAngle = 0;\r\n }\r\n if (!$type.isNumber(startAngle)) {\r\n endAngle = startAngle;\r\n }\r\n var r = innerRadius + 0.01;\r\n var angle = startAngle * $math.RADIANS;\r\n var points = [];\r\n while (r < radius + radiusStep) {\r\n var stepSize = step;\r\n if (stepSize / 2 > r) {\r\n stepSize = 2 * r;\r\n }\r\n angle += 2 * Math.asin(stepSize / 2 / r);\r\n if (angle * $math.DEGREES > endAngle + ((radius - innerRadius) / radiusStep) * 360) {\r\n break;\r\n }\r\n var degrees = angle * $math.DEGREES;\r\n var point = { x: cx + r * Math.cos(angle), y: cy + r * radiusY / radius * Math.sin(angle) };\r\n points.push(point);\r\n r = innerRadius + degrees / 360 * radiusStep;\r\n }\r\n points.shift();\r\n return points;\r\n}\r\nexport function pointsToPath(points) {\r\n if (!points || points.length == 0) {\r\n return \"\";\r\n }\r\n var path = moveTo(points[0]);\r\n if (points && points.length > 0) {\r\n for (var i = 1; i < points.length; i++) {\r\n path += lineTo(points[i]);\r\n }\r\n }\r\n return path;\r\n}\r\n//# sourceMappingURL=Path.js.map","/**\r\n * Polyline module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport { color } from \"../utils/Color\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $path from \"../rendering/Path\";\r\nimport * as $math from \"../utils/Math\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a polyline.\r\n *\r\n * @see {@link IPolylineEvents} for a list of available events\r\n * @see {@link IPolylineAdapters} for a list of available Adapters\r\n */\r\nvar Polyline = /** @class */ (function (_super) {\r\n __extends(Polyline, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Polyline() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * [_distance description]\r\n *\r\n * @todo Description\r\n */\r\n _this._distance = 0;\r\n _this.className = \"Polyline\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.shapeRendering = \"auto\";\r\n _this.fill = color();\r\n _this.strokeOpacity = 1;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Creats and adds an SVG path for the arc.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Polyline.prototype.makePath = function () {\r\n this._distance = 0;\r\n var segments = this.segments;\r\n if (segments && segments.length > 0) {\r\n var path = \"\";\r\n for (var i = 0, len = segments.length; i < len; i++) {\r\n var points = segments[i];\r\n if (points.length > 0) {\r\n path += $path.moveTo(points[0]);\r\n for (var p = 1; p < points.length; p++) {\r\n var point = points[p];\r\n path += $path.lineTo(point);\r\n this._distance += $math.getDistance(points[p - 1], point);\r\n }\r\n }\r\n }\r\n this.path = path;\r\n }\r\n this._realSegments = segments;\r\n };\r\n Object.defineProperty(Polyline.prototype, \"segments\", {\r\n /**\r\n * @return Segments\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"segments\");\r\n },\r\n /**\r\n * A list of segment coordinates for the multi-part line.\r\n *\r\n * @todo Example\r\n * @param segments Segments\r\n */\r\n set: function (segments) {\r\n this.setPropertyValue(\"segments\", segments);\r\n this.makePath();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Polyline.prototype, \"distance\", {\r\n /**\r\n * [distance description]\r\n *\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._distance;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\r\n Polyline.prototype.positionToPoint = function (position) {\r\n var deltaAngle = 0;\r\n if (position < 0) {\r\n position = Math.abs(position);\r\n deltaAngle = 180;\r\n }\r\n var segments = this._realSegments;\r\n if (segments) {\r\n var totalDistance = this.distance;\r\n var currentDistance = 0;\r\n var distanceAB = void 0;\r\n var positionA = 0;\r\n var positionB = 0;\r\n var pointA = void 0;\r\n var pointB = void 0;\r\n for (var s = 0; s < segments.length; s++) {\r\n var points = segments[s];\r\n if (points.length > 1) {\r\n for (var p = 1; p < points.length; p++) {\r\n pointA = points[p - 1];\r\n pointB = points[p];\r\n positionA = currentDistance / totalDistance;\r\n distanceAB = $math.getDistance(pointA, pointB);\r\n currentDistance += distanceAB;\r\n positionB = currentDistance / totalDistance;\r\n if (positionA <= position && positionB > position) {\r\n s = segments.length;\r\n break;\r\n }\r\n }\r\n }\r\n else if (points.length == 1) {\r\n pointA = points[0];\r\n pointB = points[0];\r\n positionA = 0;\r\n positionB = 1;\r\n }\r\n }\r\n if (pointA && pointB) {\r\n var positionAB = (position - positionA) / (positionB - positionA);\r\n var midPoint = $math.getMidPoint(pointA, pointB, positionAB);\r\n return { x: midPoint.x, y: midPoint.y, angle: deltaAngle + $math.getAngle(pointA, pointB) };\r\n }\r\n }\r\n return { x: 0, y: 0, angle: 0 };\r\n };\r\n Object.defineProperty(Polyline.prototype, \"realSegments\", {\r\n /**\r\n * @ignore\r\n */\r\n get: function () {\r\n return this._realSegments;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Polyline;\r\n}(Sprite));\r\nexport { Polyline };\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[\"Polyline\"] = Polyline;\r\n//# sourceMappingURL=Polyline.js.map","/**\r\n * Module for a multi-part arched line.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Polyline } from \"./Polyline\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a multi-part arched line.\r\n *\r\n * @see {@link IPolyarcEvents} for a list of available events\r\n * @see {@link IPolyarcAdapters} for a list of available Adapters\r\n */\r\nvar Polyarc = /** @class */ (function (_super) {\r\n __extends(Polyarc, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Polyarc() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Polyarc\";\r\n _this.controlPointDistance = 0.5;\r\n _this.controlPointPosition = 0.5;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Creats and adds an SVG path for the arc.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Polyarc.prototype.makePath = function () {\r\n this._distance = 0;\r\n var segments = this.segments;\r\n if (segments && segments.length > 0) {\r\n var path = \"\";\r\n this._realSegments = [];\r\n for (var i = 0, len = segments.length; i < len; i++) {\r\n var points = segments[i];\r\n var realPoints = [];\r\n this._realSegments.push(realPoints);\r\n if (points.length > 0) {\r\n path += $path.moveTo(points[0]);\r\n for (var p = 1; p < points.length; p++) {\r\n var pointA = points[p - 1];\r\n var pointB = points[p];\r\n var distanceAB = $math.getDistance(pointB, pointA);\r\n var cpDistance = distanceAB * this.controlPointDistance;\r\n var controlPointPosition = this.controlPointPosition;\r\n var angle = -$math.getAngle(pointA, pointB);\r\n var cpx = pointA.x + (pointB.x - pointA.x) * controlPointPosition * 0.5 - cpDistance * $math.sin(angle);\r\n var cpy = pointA.y + (pointB.y - pointA.y) * controlPointPosition * 0.5 - cpDistance * $math.cos(angle);\r\n var controlPoint1 = { x: cpx, y: cpy };\r\n var cpx2 = pointA.x + (pointB.x - pointA.x) * controlPointPosition * 1.5 - cpDistance * $math.sin(angle);\r\n var cpy2 = pointA.y + (pointB.y - pointA.y) * controlPointPosition * 1.5 - cpDistance * $math.cos(angle);\r\n var controlPoint2 = { x: cpx2, y: cpy2 };\r\n path += $path.cubicCurveTo(pointB, controlPoint1, controlPoint2);\r\n // we add a lot of points in order to get the position/angle later\r\n var stepCount = Math.ceil(distanceAB);\r\n var prevPoint = pointA;\r\n if (stepCount > 0) {\r\n for (var i_1 = 0; i_1 <= stepCount; i_1++) {\r\n var point = $math.getPointOnCubicCurve(pointA, pointB, controlPoint1, controlPoint2, i_1 / stepCount);\r\n realPoints.push(point);\r\n this._distance += $math.getDistance(prevPoint, point);\r\n prevPoint = point;\r\n }\r\n }\r\n else {\r\n realPoints.push(pointA);\r\n }\r\n }\r\n }\r\n }\r\n this.path = path;\r\n }\r\n };\r\n Object.defineProperty(Polyarc.prototype, \"controlPointPosition\", {\r\n /**\r\n * @return Position (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"controlPointPosition\");\r\n },\r\n /**\r\n * Relative position along the line the control point is. (0-1)\r\n *\r\n * @default 0.5\r\n * @param value Position (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"controlPointPosition\", value);\r\n this.makePath();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Polyarc.prototype, \"controlPointDistance\", {\r\n /**\r\n * @return Distance (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"controlPointDistance\");\r\n },\r\n /**\r\n * Relative distance of the control point. (0-1)\r\n *\r\n * Default is half the length of the line. (0.5)\r\n *\r\n * @default 0.5\r\n * @param value Distance (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"controlPointDistance\", value);\r\n this.makePath();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Polyarc;\r\n}(Polyline));\r\nexport { Polyarc };\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[\"Polyarc\"] = Polyarc;\r\n//# sourceMappingURL=Polyarc.js.map","/**\r\n * Morpher module contains functionality that allows morphing one polygon to\r\n * another.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { BaseObject } from \"../Base\";\r\nimport { Animation, AnimationDisposer } from \"../utils/Animation\";\r\nimport * as $math from \"../utils/Math\";\r\nimport * as $ease from \"../utils/Ease\";\r\nimport * as $type from \"../utils/Type\";\r\n/**\r\n * Morpher can be used to morph one polygon to some other polygon.\r\n */\r\nvar Morpher = /** @class */ (function (_super) {\r\n __extends(Morpher, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param morphable An object to morph\r\n */\r\n function Morpher(morphable) {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * A storage for measurements.\r\n */\r\n _this._bboxes = [];\r\n /**\r\n * Duration of the morphing animation in milliseconds.\r\n */\r\n _this.morphDuration = 800;\r\n /**\r\n * An easing function to use for morphing animation.\r\n *\r\n * @see {@link Ease}\r\n */\r\n _this.morphEasing = $ease.cubicOut;\r\n /**\r\n * If set to `true`, all separate parts of the multi-part polygon will\r\n * morph into a single circle or polygon when using built-in methods\r\n * `morphToCircle()` or `morphToPolygon()`.\r\n *\r\n * Otherwise each separate part of polygon will morph to individual target\r\n * circle or polgyon.\r\n */\r\n _this.morphToSingle = true;\r\n /**\r\n * A ratio to scale morphed object in relation to the source object.\r\n */\r\n _this.scaleRatio = 1;\r\n _this.className = \"Morpher\";\r\n _this.morphable = morphable;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Morphs a polygon to another polygon.\r\n *\r\n * @param toPoints Corner points of the target shape\r\n * @param duration Duration in milliseconds\r\n * @param easing Easing function\r\n * @return Animation\r\n */\r\n Morpher.prototype.morphToPolygon = function (toPoints, duration, easing) {\r\n var points = this.morphable.currentPoints;\r\n if (points && toPoints) {\r\n this.sortPoints(points);\r\n this.sortPoints(toPoints);\r\n this._morphFromPointsReal = [];\r\n this._morphToPointsReal = [];\r\n if (!$type.hasValue(duration)) {\r\n duration = this.morphDuration;\r\n }\r\n if (!$type.hasValue(easing)) {\r\n easing = this.morphEasing;\r\n }\r\n this._morphFromPointsReal = this.normalizePoints(toPoints, points);\r\n this._morphToPointsReal = this.normalizePoints(points, toPoints);\r\n this.morphable.currentPoints = this._morphFromPointsReal;\r\n var animation = new Animation(this, { property: \"morphProgress\", from: 0, to: 1 }, duration, easing);\r\n this._disposers.push(animation);\r\n animation.start();\r\n return animation;\r\n }\r\n };\r\n /**\r\n * [normalizePoints description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param pointsA Point A\r\n * @param pointsB Point B\r\n * @return Normalized points\r\n */\r\n Morpher.prototype.normalizePoints = function (pointsA, pointsB) {\r\n for (var i = 0, len = pointsA.length; i < len; i++) {\r\n var surfaceA = pointsA[i][0];\r\n var holeA = pointsA[i][1];\r\n var bboxA = $type.getValue($math.getBBox(surfaceA));\r\n var middleX = bboxA.x + bboxA.width;\r\n var middleY = bboxA.y + bboxA.height;\r\n // check if we have the same in PointsB\r\n if (!pointsB[i]) {\r\n pointsB[i] = [];\r\n }\r\n // check if we have surface in pointsB\r\n if (surfaceA && !pointsB[i][0]) {\r\n pointsB[i][0] = [{ x: middleX, y: middleY }, { x: middleX, y: middleY }];\r\n }\r\n if (pointsB[i][0]) {\r\n pointsB[i][0] = this.addPoints(pointsB[i][0], surfaceA.length);\r\n var distance = Infinity;\r\n var splitAt = 0;\r\n for (var a = 0; a < pointsB[i][0].length; a++) {\r\n var newDistance = $math.getDistance(pointsB[i][0][a], surfaceA[0]);\r\n if (newDistance < distance) {\r\n splitAt = a;\r\n distance = newDistance;\r\n }\r\n }\r\n var partA = pointsB[i][0].slice(0, splitAt);\r\n var partB = pointsB[i][0].slice(splitAt);\r\n pointsB[i][0] = partB.concat(partA);\r\n }\r\n if (holeA) {\r\n if (!pointsB[i][1]) {\r\n pointsB[i][1] = [{ x: middleX, y: middleY }, { x: middleX, y: middleY }];\r\n }\r\n pointsB[i][1] = this.addPoints(pointsB[i][1], holeA.length);\r\n }\r\n }\r\n return pointsB;\r\n };\r\n /**\r\n * [sortPoints description]\r\n *\r\n * @ignore Exclude from doc\r\n * @todo Description\r\n * @param points [description]\r\n * @return common bbox of points\r\n */\r\n Morpher.prototype.sortPoints = function (points) {\r\n points.sort(function (a, b) {\r\n var bbox1 = $type.getValue($math.getBBox(a[0]));\r\n var bbox2 = $type.getValue($math.getBBox(b[0]));\r\n if (bbox1.width * bbox1.height > bbox2.width * bbox2.height) {\r\n return -1;\r\n }\r\n else {\r\n return 1;\r\n }\r\n });\r\n var bboxes = [];\r\n for (var i = 0, len = points.length; i < len; i++) {\r\n var surface = points[i][0];\r\n if (surface) {\r\n bboxes.push($type.getValue($math.getBBox(surface)));\r\n }\r\n }\r\n return $math.getCommonRectangle(bboxes);\r\n };\r\n /**\r\n * Morphs polygon to a circle (it is actually a polygon which makes a circle).\r\n *\r\n * @param radius Target circle radius (px)\r\n * @param duration Duration (ms)\r\n * @param easing Easing function\r\n * @return Animation\r\n */\r\n Morpher.prototype.morphToCircle = function (radius, duration, easing) {\r\n var points = this.morphable.points;\r\n var commonBBox = this.sortPoints(points);\r\n this._morphFromPointsReal = [];\r\n this._morphToPointsReal = [];\r\n if (!$type.hasValue(duration)) {\r\n duration = this.morphDuration;\r\n }\r\n if (!$type.hasValue(easing)) {\r\n easing = this.morphEasing;\r\n }\r\n // surface\r\n for (var i = 0, len = points.length; i < len; i++) {\r\n var surface = points[i][0];\r\n var hole = points[i][1];\r\n this._morphFromPointsReal[i] = [];\r\n this._morphToPointsReal[i] = [];\r\n if (surface) {\r\n var toPoints = surface;\r\n var fromPoints = surface;\r\n var bbox = $type.getValue($math.getBBox(fromPoints)); // this._bboxes[i];\r\n if (this.morphToSingle) {\r\n bbox = $type.getValue(commonBBox);\r\n }\r\n var middleX = bbox.x + bbox.width / 2;\r\n var middleY = bbox.y + bbox.height / 2;\r\n var realRadius = radius;\r\n if (!$type.isNumber(realRadius)) {\r\n realRadius = Math.min(bbox.width / 2, bbox.height / 2);\r\n }\r\n toPoints = [];\r\n // find angle for the first point\r\n var startAngle = $math.getAngle({ x: middleX, y: middleY }, surface[0]);\r\n var count = 100;\r\n if (surface.length > count) {\r\n count = surface.length;\r\n }\r\n fromPoints = this.addPoints(surface, count);\r\n count = fromPoints.length; // add Points might increase number a bit\r\n var angle = 360 / (count - 1);\r\n for (var a = 0; a < count; a++) {\r\n var realAngle = angle * a + startAngle;\r\n var pointOnCircle = { x: middleX + realRadius * $math.cos(realAngle), y: middleY + realRadius * $math.sin(realAngle) };\r\n toPoints[a] = pointOnCircle;\r\n }\r\n if (hole && hole.length > 0) {\r\n for (var i_1 = 0, hlen = hole.length; i_1 < hlen; i_1++) {\r\n toPoints.push({ x: middleX, y: middleY });\r\n }\r\n }\r\n this._morphFromPointsReal[i][0] = fromPoints;\r\n this._morphToPointsReal[i][0] = toPoints;\r\n }\r\n }\r\n this.morphable.currentPoints = this._morphFromPointsReal;\r\n var animation = new Animation(this, { property: \"morphProgress\", from: 0, to: 1 }, duration, easing);\r\n this._disposers.push(animation);\r\n animation.start();\r\n return animation;\r\n };\r\n /**\r\n * [addPoints description]\r\n *\r\n * @ignore Exclude from doc\r\n * @todo Description\r\n * @param points [description]\r\n * @param mustHaveCount [description]\r\n * @return [description]\r\n */\r\n Morpher.prototype.addPoints = function (points, mustHaveCount) {\r\n var addToSegmentCount = Math.round(mustHaveCount / points.length);\r\n var newPoints = [];\r\n for (var i = 0, len = points.length; i < len; i++) {\r\n var point0 = points[i];\r\n var point1 = void 0;\r\n if (i == points.length - 1) {\r\n point1 = points[0];\r\n }\r\n else {\r\n point1 = points[i + 1];\r\n }\r\n newPoints.push(point0);\r\n for (var p = 1; p < addToSegmentCount; p++) {\r\n var percent = p / addToSegmentCount;\r\n var extraPoint = { x: point0.x + (point1.x - point0.x) * percent, y: point0.y + (point1.y - point0.y) * percent };\r\n newPoints.push(extraPoint);\r\n }\r\n // stop adding in case we already added more than left in original\r\n if (newPoints.length + points.length - i == mustHaveCount) {\r\n addToSegmentCount = 0;\r\n }\r\n }\r\n if (newPoints.length < mustHaveCount && points.length > 0) {\r\n var lastPoint = points[points.length - 1];\r\n for (var p = newPoints.length; p < mustHaveCount; p++) {\r\n // add same as last\r\n newPoints.push({ x: lastPoint.x, y: lastPoint.y });\r\n }\r\n }\r\n return newPoints;\r\n };\r\n /**\r\n * Morphs polygon into a rectangular polygon.\r\n *\r\n * @param width Width of the target rectangle (px)\r\n * @param height Height of the target rectangle (px)\r\n * @param duration Duration (ms)\r\n * @param easing Easing function\r\n * @return Animation\r\n */\r\n Morpher.prototype.morphToRectangle = function (width, height, duration, easing) {\r\n var points = this.morphable.points;\r\n this.sortPoints(points);\r\n this._morphFromPointsReal = [];\r\n this._morphToPointsReal = [];\r\n if (!$type.hasValue(duration)) {\r\n duration = this.morphDuration;\r\n }\r\n if (!$type.hasValue(easing)) {\r\n easing = this.morphEasing;\r\n }\r\n //\t\tlet biggestBBox: IRectangle = this._bboxes[this._biggestIndex];\r\n // surface\r\n for (var i = 0, len = points.length; i < len; i++) {\r\n var surface = points[i][0];\r\n var hole = points[i][1];\r\n this._morphFromPointsReal[i] = [];\r\n this._morphToPointsReal[i] = [];\r\n if (surface) {\r\n var toPoints = surface;\r\n var fromPoints = surface;\r\n var bbox = this._bboxes[i];\r\n // we only work with first area. TODO: maybe we should find the biggest one?\r\n if (this.morphToSingle) {\r\n //if (i != this._biggestIndex) {\r\n //\tbbox = { x: biggestBBox.x + biggestBBox.width / 2, y: biggestBBox.y + biggestBBox.height / 2, width: 0, height: 0 };\r\n //}\r\n }\r\n var x = bbox.x;\r\n var y = bbox.y;\r\n var realWidth = width;\r\n var realHeight = height;\r\n if (!$type.isNumber(realWidth)) {\r\n realWidth = bbox.width;\r\n }\r\n if (!$type.isNumber(realHeight)) {\r\n realHeight = bbox.height;\r\n }\r\n toPoints = [{ x: x, y: y }, { x: x + realWidth, y: y }, { x: x + realWidth, y: y + realHeight }, { x: x, y: y + realHeight }];\r\n toPoints = this.addPoints(toPoints, surface.length);\r\n // if polygon has less points then count, add\r\n if (surface.length < 4) {\r\n for (var i_2 = surface.length; i_2 < 4; i_2++) {\r\n toPoints.push({ x: surface[i_2].x, y: surface[i_2].y });\r\n }\r\n }\r\n if (hole && hole.length > 0) {\r\n var middleX = bbox.x + bbox.width / 2;\r\n var middleY = bbox.y + bbox.height / 2;\r\n for (var i_3 = 0, hlen = hole.length; i_3 < hlen; i_3++) {\r\n toPoints.push({ x: middleX, y: middleY });\r\n }\r\n }\r\n this._morphFromPointsReal[i][0] = fromPoints;\r\n this._morphToPointsReal[i][0] = toPoints;\r\n }\r\n }\r\n this.morphable.currentPoints = this._morphFromPointsReal;\r\n var animation = new Animation(this, { property: \"morphProgress\", from: 0, to: 1 }, duration, easing);\r\n this._disposers.push(animation);\r\n animation.start();\r\n return animation;\r\n };\r\n Object.defineProperty(Morpher.prototype, \"morphProgress\", {\r\n /**\r\n * Returns the progress of morph transition.\r\n *\r\n * @return Progress (0-1)\r\n */\r\n get: function () {\r\n return this._morphProgress;\r\n },\r\n /**\r\n * Progress of the morph transition.\r\n *\r\n * Setting this will also trigger actual transformation.\r\n *\r\n * @param value Progress (0-1)\r\n */\r\n set: function (value) {\r\n this._morphProgress = value;\r\n var currentPoints = [];\r\n if (value != null) {\r\n var fromPoints = this._morphFromPointsReal;\r\n var toPoints = this._morphToPointsReal;\r\n if (fromPoints != null && toPoints != null) {\r\n for (var i = 0, len = fromPoints.length; i < len; i++) {\r\n var currentArea = [];\r\n currentPoints.push(currentArea);\r\n var surfaceFrom = fromPoints[i][0];\r\n var holeFrom = fromPoints[i][1];\r\n var surfaceTo = toPoints[i][0];\r\n var holeTo = toPoints[i][1];\r\n if (surfaceFrom && surfaceFrom.length > 0 && surfaceTo && surfaceTo.length > 0) {\r\n var currentSurface = [];\r\n for (var i_4 = 0, slen = surfaceFrom.length; i_4 < slen; i_4++) {\r\n var point0 = surfaceFrom[i_4];\r\n var point1 = surfaceTo[i_4];\r\n var currentPoint = { x: point0.x + (point1.x * this.scaleRatio - point0.x) * value, y: point0.y + (point1.y * this.scaleRatio - point0.y) * value };\r\n currentSurface.push(currentPoint);\r\n }\r\n currentArea[0] = currentSurface;\r\n }\r\n if (holeFrom && holeFrom.length > 0 && holeTo && holeTo.length > 0) {\r\n var currentHole = [];\r\n for (var i_5 = 0, hlen = holeFrom.length; i_5 < hlen; i_5++) {\r\n var point0 = holeFrom[i_5];\r\n var point1 = holeTo[i_5];\r\n var currentPoint = { x: point0.x + (point1.x * this.scaleRatio - point0.x) * value, y: point0.y + (point1.y * this.scaleRatio - point0.y) * value };\r\n currentHole.push(currentPoint);\r\n }\r\n currentArea[1] = currentHole;\r\n }\r\n }\r\n }\r\n }\r\n this.morphable.currentPoints = currentPoints;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Restores the polygon to its original appearance.\r\n *\r\n * @param duration Duration (ms)\r\n * @param easing Easing function\r\n * @return Animation\r\n */\r\n Morpher.prototype.morphBack = function (duration, easing) {\r\n this._morphToPointsReal = this._morphFromPointsReal;\r\n this._morphFromPointsReal = this.morphable.currentPoints;\r\n if (!$type.hasValue(duration)) {\r\n duration = this.morphDuration;\r\n }\r\n if (!$type.hasValue(easing)) {\r\n easing = this.morphEasing;\r\n }\r\n var animation = new Animation(this, { property: \"morphProgress\", from: 0, to: 1 }, duration, easing);\r\n this._disposers.push(animation);\r\n animation.start();\r\n return animation;\r\n };\r\n Object.defineProperty(Morpher.prototype, \"animations\", {\r\n /**\r\n * Returns a list of morph animations currently being played.\r\n *\r\n * @return List of animations\r\n */\r\n get: function () {\r\n if (!this._animations) {\r\n this._animations = [];\r\n this._disposers.push(new AnimationDisposer(this._animations));\r\n }\r\n return this._animations;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Morpher;\r\n}(BaseObject));\r\nexport { Morpher };\r\n//# sourceMappingURL=Morpher.js.map","/**\r\n * Polygon module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport { Morpher } from \"../utils/Morpher\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $path from \"../rendering/Path\";\r\nimport * as $type from \"../utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a polygon.\r\n *\r\n * @see {@link IPolygonEvents} for a list of available events\r\n * @see {@link IPolygonAdapters} for a list of available Adapters\r\n */\r\nvar Polygon = /** @class */ (function (_super) {\r\n __extends(Polygon, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Polygon() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Polygon\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.shapeRendering = \"auto\";\r\n _this._currentPoints = [];\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(Polygon.prototype, \"points\", {\r\n /**\r\n * @return Polygon points\r\n */\r\n get: function () {\r\n var points = this.getPropertyValue(\"points\");\r\n var path = this.path;\r\n if (path && (!points || points.length == 0)) {\r\n var valueStr = path.slice(1, path.length - 1);\r\n var segments = valueStr.split(\"ZM\");\r\n for (var s = 0; s < segments.length; s++) {\r\n var segment = segments[s];\r\n if (segment.length > 0) {\r\n var areaHole = segment.split(\"M\");\r\n var areaArr = areaHole[0];\r\n var holeArr = areaHole[1];\r\n if (areaArr && areaArr.length > 0) {\r\n var pointsArr = areaArr.split(\"L\");\r\n if (pointsArr.length > 0) {\r\n var area = [];\r\n var areaAndHole = [area];\r\n points.push(areaAndHole);\r\n for (var p = 0; p < pointsArr.length; p++) {\r\n var coords = pointsArr[p].split(\",\");\r\n area.push({ x: +coords[0], y: +coords[1] });\r\n }\r\n if (holeArr && holeArr.length > 0) {\r\n var pointsArr_1 = holeArr.split(\"L\");\r\n if (pointsArr_1.length > 0) {\r\n var hole = [];\r\n areaAndHole.push(hole);\r\n for (var p = pointsArr_1.length - 1; p >= 0; p--) {\r\n var coords = pointsArr_1[p].split(\",\");\r\n hole.push({ x: +coords[0], y: +coords[1] });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this.setPropertyValue(\"points\", points);\r\n this._currentPoints = points;\r\n }\r\n return points;\r\n },\r\n /**\r\n * An array of X/Y coordinates for each elbow of the polygon.\r\n *\r\n * @todo Example\r\n * @param points Polygon points\r\n */\r\n set: function (points) {\r\n this.setPropertyValue(\"points\", points, true);\r\n this._currentPoints = points;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Polygon.prototype, \"currentPoints\", {\r\n /**\r\n * @return Polygon points\r\n */\r\n get: function () {\r\n if ((!this._currentPoints || this._currentPoints.length == 0) && this.path) {\r\n this._currentPoints = this.points;\r\n }\r\n return this._currentPoints;\r\n },\r\n /**\r\n * Current points. Used when morphing the element, so that original `points`\r\n * are not overwritten.\r\n *\r\n * @param points Polygon points\r\n */\r\n set: function (points) {\r\n if (this._currentPoints != points) {\r\n this._currentPoints = points;\r\n this.draw();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Polygon.prototype.draw = function () {\r\n var path = \"\";\r\n var points = this._currentPoints;\r\n var left;\r\n var right;\r\n var top;\r\n var bottom;\r\n if (points.length > 0) {\r\n // separate areas\r\n for (var i = 0, len = points.length; i < len; i++) {\r\n // surface\r\n var surface = points[i][0];\r\n var hole = points[i][1];\r\n if (surface && surface.length > 0) {\r\n var point = surface[0];\r\n path += $path.moveTo(point);\r\n for (var s = 0; s < surface.length; s++) {\r\n point = surface[s];\r\n path += $path.lineTo(point);\r\n if (!$type.isNumber(right) || (right < point.x)) {\r\n right = point.x;\r\n }\r\n if (!$type.isNumber(left) || (left > point.x)) {\r\n left = point.x;\r\n }\r\n if (!$type.isNumber(top) || (top > point.y)) {\r\n top = point.y;\r\n }\r\n if (!$type.isNumber(bottom) || (bottom < point.y)) {\r\n bottom = point.y;\r\n }\r\n }\r\n }\r\n // hole\r\n if (hole && hole.length > 0) {\r\n var point = hole[0];\r\n path += $path.moveTo(point);\r\n for (var h = 0, hlen = hole.length; h < hlen; h++) {\r\n point = hole[h];\r\n path += $path.lineTo(point);\r\n }\r\n }\r\n }\r\n if (path) {\r\n path += $path.closePath();\r\n }\r\n this.bbox.x = left;\r\n this.bbox.y = top;\r\n this.bbox.width = right - left;\r\n this.bbox.height = bottom - top;\r\n _super.prototype.setPath.call(this, path);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Polygon.prototype.setPath = function (value) {\r\n if (_super.prototype.setPath.call(this, value)) {\r\n this.points = [];\r\n this._bbox = this.group.getBBox();\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Measures element\r\n */\r\n Polygon.prototype.measureElement = function () {\r\n // Overriding to avoid extra measurement.\r\n };\r\n Object.defineProperty(Polygon.prototype, \"centerPoint\", {\r\n /**\r\n * A calculated center point for the shape.\r\n *\r\n * @readonly\r\n * @return Center\r\n */\r\n get: function () {\r\n return { x: this.bbox.x + this.bbox.width / 2, y: this.bbox.y + this.bbox.height / 2 };\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Polygon.prototype, \"morpher\", {\r\n /**\r\n * A [[Morpher]] instance that is used to morph polygon into some other\r\n * shape.\r\n *\r\n * @readonly\r\n * @return Morpher instance\r\n */\r\n get: function () {\r\n if (!this._morpher) {\r\n this._morpher = new Morpher(this);\r\n this._disposers.push(this._morpher);\r\n }\r\n return this._morpher;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Polygon;\r\n}(Sprite));\r\nexport { Polygon };\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[\"Polygon\"] = Polygon;\r\n//# sourceMappingURL=Polygon.js.map","/**\r\n * Polyspline (smoothed line) module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Polyline } from \"./Polyline\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a polysline. (smoothed multi-sigment line)\r\n *\r\n * @see {@link IPolysplineEvents} for a list of available events\r\n * @see {@link IPolysplineAdapters} for a list of available Adapters\r\n */\r\nvar Polyspline = /** @class */ (function (_super) {\r\n __extends(Polyspline, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Polyspline() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Polyspline\";\r\n _this.tensionX = 0.5;\r\n _this.tensionY = 0.5;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Creats and adds an SVG path for the arc.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Polyspline.prototype.makePath = function () {\r\n this._distance = 0;\r\n var segments = this.segments;\r\n var tensionX = this.tensionX;\r\n var tensionY = this.tensionY;\r\n this.allPoints = [];\r\n if (segments && segments.length > 0) {\r\n var path = \"\";\r\n this._realSegments = [];\r\n for (var i = 0, len = segments.length; i < len; i++) {\r\n var points = segments[i];\r\n var realPoints = [];\r\n this._realSegments.push(realPoints);\r\n if (points.length > 0) {\r\n var first = points[0];\r\n var last = points[points.length - 1];\r\n var closed_1 = false;\r\n if ($math.round(first.x, 3) == $math.round(last.x) && $math.round(first.y) == $math.round(last.y)) {\r\n closed_1 = true;\r\n }\r\n path += $path.moveTo(points[0]);\r\n for (var p = 0; p < points.length - 1; p++) {\r\n var p0 = points[p - 1];\r\n var p1 = points[p];\r\n var p2 = points[p + 1];\r\n var p3 = points[p + 2];\r\n if (p === 0) {\r\n p0 = points[p];\r\n }\r\n else if (p == points.length - 2) {\r\n p3 = points[p + 1];\r\n }\r\n if (!p3) {\r\n p3 = p2;\r\n }\r\n if (p === 0) {\r\n if (closed_1) {\r\n p0 = points[points.length - 2];\r\n }\r\n else {\r\n p0 = points[i];\r\n }\r\n }\r\n else if (p == points.length - 2) {\r\n if (closed_1) {\r\n p3 = points[1];\r\n }\r\n else {\r\n p3 = points[p + 1];\r\n }\r\n }\r\n var controlPointA = $math.getCubicControlPointA(p0, p1, p2, p3, tensionX, tensionY);\r\n var controlPointB = $math.getCubicControlPointB(p0, p1, p2, p3, tensionX, tensionY);\r\n path += $path.cubicCurveTo(p2, controlPointA, controlPointB);\r\n // now split to small segments so that we could have positionToPoint later\r\n var stepCount = Math.ceil($math.getCubicCurveDistance(p1, p2, controlPointA, controlPointB, 20)) * 1.2;\r\n var prevPoint = p1;\r\n if (stepCount > 0) {\r\n // not good for curved charts\r\n //this.allPoints[0] = { x: points[0].x, y: points[0].y, angle: $math.getAngle(points[0], points[1]) };\r\n //realPoints.push(this.allPoints[0]);\r\n for (var s = 0; s <= stepCount; s++) {\r\n var point = $math.getPointOnCubicCurve(p1, p2, controlPointA, controlPointB, s / stepCount);\r\n if (point.x == prevPoint.x && point.y == prevPoint.y) {\r\n continue;\r\n }\r\n realPoints.push(point);\r\n var angle = $math.round($math.getAngle(prevPoint, point), 5);\r\n //this.allPoints.push({ x: point.x, y: point.y, angle: angle });\r\n this._distance += $math.getDistance(prevPoint, point);\r\n this.allPoints[Math.floor(this._distance)] = { x: point.x, y: point.y, angle: angle };\r\n prevPoint = point;\r\n }\r\n }\r\n else {\r\n realPoints.push(p0);\r\n }\r\n }\r\n }\r\n var allPoints = this.allPoints;\r\n if (allPoints.length > 1) {\r\n for (var i_1 = 0; i_1 < allPoints.length; i_1++) {\r\n if (!allPoints[i_1]) {\r\n if (i_1 > 1) {\r\n allPoints[i_1] = allPoints[i_1 - 1];\r\n }\r\n else {\r\n for (var k = 1; k < allPoints.length; k++) {\r\n if (allPoints[k]) {\r\n allPoints[i_1] = allPoints[k];\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this.path = path;\r\n }\r\n };\r\n /**\r\n * Returns an index of the point that is closest to specified coordinates.\r\n *\r\n * @param point Reference point\r\n * @return Index\r\n */\r\n Polyspline.prototype.getClosestPointIndex = function (point) {\r\n var points = this.allPoints;\r\n var index;\r\n var closest = Infinity;\r\n if (points.length > 1) {\r\n for (var p = 1; p < points.length; p++) {\r\n var distance = $math.getDistance(point, points[p]);\r\n if (distance < closest) {\r\n index = p;\r\n closest = distance;\r\n }\r\n }\r\n }\r\n return index;\r\n };\r\n Object.defineProperty(Polyspline.prototype, \"tensionX\", {\r\n /**\r\n * @return Tension\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tensionX\");\r\n },\r\n /**\r\n * Horizontal tension for the spline.\r\n *\r\n * Used by the line smoothing algorithm.\r\n *\r\n * @default 0.5\r\n * @param value Tension\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tensionX\", value);\r\n this.makePath();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Polyspline.prototype, \"tensionY\", {\r\n /**\r\n * @return Tension\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tensionY\");\r\n },\r\n /**\r\n * Vertical tension for the spline.\r\n *\r\n * Used by the line smoothing algorithm.\r\n *\r\n * @default 0.5\r\n * @param value Tensions\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tensionY\", value, true);\r\n this.makePath();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\r\n Polyspline.prototype.positionToPoint = function (position, extend) {\r\n var deltaAngle = 0;\r\n var allPoints = this.allPoints;\r\n var len = allPoints.length;\r\n if (!$type.isNumber(position)) {\r\n position = 0;\r\n }\r\n if (len > 1) {\r\n if (extend && len > 3) {\r\n if (position < 0) {\r\n if (position < -0.01) {\r\n position = -0.01;\r\n }\r\n var f0 = allPoints[0];\r\n var f1 = allPoints[1];\r\n var x = f0.x - (f0.x - f1.x) * len * position;\r\n var y = f0.y - (f0.y - f1.y) * len * position;\r\n return { x: x, y: y, angle: $math.getAngle(f0, f1) };\r\n }\r\n else if (position > 1) {\r\n if (position > 1.01) {\r\n position = 1.01;\r\n }\r\n var f0 = allPoints[allPoints.length - 2];\r\n var f1 = allPoints[allPoints.length - 3];\r\n var x = f0.x + (f0.x - f1.x) * len * (position - 1);\r\n var y = f0.y + (f0.y - f1.y) * len * (position - 1);\r\n return { x: x, y: y, angle: $math.getAngle(f0, { x: x, y: y }) };\r\n }\r\n else if (position == 1) {\r\n var point_1 = allPoints[allPoints.length - 1];\r\n return { x: point_1.x, y: point_1.y, angle: point_1.angle };\r\n }\r\n }\r\n else {\r\n if (position < 0) {\r\n position = Math.abs(position);\r\n deltaAngle = 180;\r\n }\r\n if (position >= 1) {\r\n position = 0.9999999999999;\r\n }\r\n }\r\n var point = allPoints[Math.floor(position * len)];\r\n return { x: point.x, y: point.y, angle: point.angle + deltaAngle };\r\n }\r\n else if (len == 1) {\r\n var point = allPoints[0];\r\n return { x: point.x, y: point.y, angle: point.angle };\r\n }\r\n else {\r\n return { x: 0, y: 0, angle: 0 };\r\n }\r\n };\r\n return Polyspline;\r\n}(Polyline));\r\nexport { Polyspline };\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[\"Polyspline\"] = Polyspline;\r\n//# sourceMappingURL=Polyspline.js.map","/**\r\n * Slice module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../Container\";\r\nimport { Sprite } from \"../Sprite\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $math from \"../utils/Math\";\r\nimport * as $path from \"../rendering/Path\";\r\nimport * as $type from \"../utils/Type\";\r\nimport * as $utils from \"../utils/Utils\";\r\nimport { Percent } from \"../utils/Percent\";\r\nimport { RadialGradient } from \"../rendering/fills/RadialGradient\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a wedged semi-circle - slice. Usually used for Pie/Donut charts.\r\n *\r\n * @see {@link ISliceEvents} for a list of available events\r\n * @see {@link ISliceAdapters} for a list of available Adapters\r\n */\r\nvar Slice = /** @class */ (function (_super) {\r\n __extends(Slice, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Slice() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"Slice\";\r\n // Set defaults\r\n _this.setPropertyValue(\"cornerRadius\", 0);\r\n _this.setPropertyValue(\"startAngle\", 0);\r\n _this.setPercentProperty(\"innerRadius\", 0);\r\n _this.setPercentProperty(\"radius\", 0);\r\n _this.setPropertyValue(\"arc\", 0);\r\n _this.setPropertyValue(\"shiftRadius\", 0);\r\n _this.strokeOpacity = 1;\r\n _this.setPropertyValue(\"layout\", \"none\");\r\n // Create a slice wedge element\r\n _this.slice = _this.createChild(Sprite);\r\n _this.slice.isMeasured = false;\r\n _this._disposers.push(_this.slice);\r\n //this.element.attr({ \"stroke-linejoin\": \"round\" });\r\n //this.element.attr({ \"stroke-linecap\": \"round\" });\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Slice.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var radiusY = this.radiusY;\r\n if (this.radius > 0 && radiusY == 0) {\r\n radiusY = 0.01;\r\n }\r\n this.slice.path = $path.arc(this.startAngle, this.arc, this.radius, this.pixelInnerRadius, radiusY, this.cornerRadius, this.innerCornerRadius);\r\n this.slice.invalidate();\r\n this.shiftRadius = this.shiftRadius;\r\n if (this.realFill instanceof RadialGradient) {\r\n this.updateGradient(this.realFill);\r\n }\r\n if (this.realStroke instanceof RadialGradient) {\r\n this.updateGradient(this.realStroke);\r\n }\r\n };\r\n Slice.prototype.updateGradient = function (gradient) {\r\n gradient.element.attr({ \"gradientUnits\": \"userSpaceOnUse\" });\r\n gradient.element.attr({ \"r\": this.radius });\r\n gradient.cx = 0;\r\n gradient.cy = 0;\r\n gradient.element.attr({ radius: this.radius });\r\n };\r\n Object.defineProperty(Slice.prototype, \"bbox\", {\r\n /**\r\n * Returns bounding box (square) for this element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n get: function () {\r\n if (this.definedBBox) {\r\n return this.definedBBox;\r\n }\r\n if (this.isMeasured) {\r\n var innerRect = $math.getArcRect(this.startAngle, this.startAngle + this.arc, this.pixelInnerRadius);\r\n var outerRect = $math.getArcRect(this.startAngle, this.startAngle + this.arc, this.radius);\r\n return $math.getCommonRectangle([innerRect, outerRect]);\r\n }\r\n else {\r\n return { x: 0, y: 0, width: 0, height: 0 };\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"startAngle\", {\r\n /**\r\n * @return Angle (0-360)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startAngle\");\r\n },\r\n /**\r\n * The angle at which left edge of the slice is drawn. (0-360)\r\n *\r\n * 0 is to the right of the center.\r\n *\r\n * @param value Angle (0-360)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startAngle\", $math.normalizeAngle(value), true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"arc\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"arc\");\r\n },\r\n /**\r\n * [arc description]\r\n *\r\n * @todo Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n if (!$type.isNumber(value)) {\r\n value = 0;\r\n }\r\n this.setPropertyValue(\"arc\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"radius\", {\r\n /**\r\n * @return Radius (px)\r\n */\r\n get: function () {\r\n var radius = this.getPropertyValue(\"radius\");\r\n if (!$type.isNumber(radius)) {\r\n radius = 0;\r\n }\r\n return radius;\r\n },\r\n /**\r\n * Radius of the slice in pixels.\r\n *\r\n * @param value Radius (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"radius\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"radiusY\", {\r\n /**\r\n * @return Vertical radius (0-1)\r\n */\r\n get: function () {\r\n var value = this.getPropertyValue(\"radiusY\");\r\n if (!$type.isNumber(value)) {\r\n value = this.radius;\r\n }\r\n return value;\r\n },\r\n /**\r\n * Vertical radius for creating skewed slices.\r\n *\r\n * This is relevant to `radius`, e.g. 0.5 will set vertical radius to half\r\n * the `radius`.\r\n *\r\n * @param value Vertical radius (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"radiusY\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"innerRadius\", {\r\n /**\r\n * @return Radius (px or %)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Inner radius of the slice for creating cut out (donut) slices.\r\n *\r\n * @default 0\r\n * @param value Radius (px or %)\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"pixelInnerRadius\", {\r\n /**\r\n * @return Radius px\r\n */\r\n get: function () {\r\n return $utils.relativeToValue(this.innerRadius, this.radius);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"cornerRadius\", {\r\n /**\r\n * @return Radius (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cornerRadius\");\r\n },\r\n /**\r\n * Radius of slice's outer corners in pixels.\r\n *\r\n * @default 0\r\n * @param value Radius (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"cornerRadius\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"innerCornerRadius\", {\r\n /**\r\n * @return Radius (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerCornerRadius\");\r\n },\r\n /**\r\n * Radius of slice's inner corners in pixels.\r\n *\r\n * @default 0\r\n * @param value Radius (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"innerCornerRadius\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"shiftRadius\", {\r\n /**\r\n * @return Radius shift\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"shiftRadius\");\r\n },\r\n /**\r\n * Indicates how far (relatively to center) a slice should be moved.\r\n *\r\n * The value is relative to the radius of the slice. Meaning 0 no shift,\r\n * 1 - slice shifted outside by whole of its radius.\r\n *\r\n * @param value Radius shift\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"shiftRadius\", value);\r\n this.dx = value * this.radius * this.ix;\r\n this.dy = value * this.radiusY * this.iy;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"ix\", {\r\n /**\r\n * [ix description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n return $math.cos(this.middleAngle);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"iy\", {\r\n /**\r\n * [iy description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n if (this.radius > 0) {\r\n return $math.sin(this.middleAngle);\r\n }\r\n else {\r\n return $math.sin(this.middleAngle);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice.prototype, \"middleAngle\", {\r\n /**\r\n * An angle of the slice's middle.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Angle\r\n */\r\n get: function () {\r\n return this.startAngle + this.arc / 2;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * X coordinate for the slice tooltip.\r\n *\r\n * @return X\r\n */\r\n Slice.prototype.getTooltipX = function () {\r\n var value = this.getPropertyValue(\"tooltipX\");\r\n if ($type.isNumber(value)) {\r\n return value;\r\n }\r\n var p = 0.5;\r\n if (value instanceof Percent) {\r\n p = value.value;\r\n }\r\n var innerRadius = $utils.relativeToValue(this.innerRadius, this.radius);\r\n return this.ix * (innerRadius + (this.radius - innerRadius) * p);\r\n };\r\n /**\r\n * Y coordinate for the slice tooltip.\r\n *\r\n * @return Y\r\n */\r\n Slice.prototype.getTooltipY = function () {\r\n var value = this.getPropertyValue(\"tooltipY\");\r\n if ($type.isNumber(value)) {\r\n return value;\r\n }\r\n var p = 0.5;\r\n if (value instanceof Percent) {\r\n p = value.value;\r\n }\r\n var innerRadius = $utils.relativeToValue(this.innerRadius, this.radius);\r\n return this.iy * (innerRadius + (this.radius - innerRadius) * p) + this.slice.dy;\r\n };\r\n return Slice;\r\n}(Container));\r\nexport { Slice };\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[\"Slice\"] = Slice;\r\n//# sourceMappingURL=Slice.js.map","/**\r\n * Preloader module.\r\n *\r\n * Preloader is a progress indicator.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../Container\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { Slice } from \"./Slice\";\r\nimport { Label } from \"./Label\";\r\nimport { registry } from \"../Registry\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A class used to draw and display progress indicator.\r\n *\r\n * @see {@link IPreloaderEvents} for a list of available events\r\n * @see {@link IPreloaderAdapters} for a list of available Adapters\r\n */\r\nvar Preloader = /** @class */ (function (_super) {\r\n __extends(Preloader, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Preloader() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"Preloader\";\r\n // Set dimensions\r\n _this.width = percent(100);\r\n _this.height = percent(100);\r\n var interfaceColors = new InterfaceColorSet();\r\n // Create main container\r\n var sliceContainer = _this.createChild(Container);\r\n sliceContainer.shouldClone = false;\r\n // Add background (100%) slice\r\n var backgroundSlice = sliceContainer.createChild(Slice);\r\n backgroundSlice.shouldClone = false;\r\n backgroundSlice.radius = 53;\r\n backgroundSlice.arc = 360;\r\n backgroundSlice.fill = interfaceColors.getFor(\"fill\");\r\n backgroundSlice.fillOpacity = 0.8;\r\n backgroundSlice.innerRadius = 42;\r\n backgroundSlice.isMeasured = false;\r\n _this.backgroundSlice = backgroundSlice;\r\n // Add progress slice\r\n var progressSlice = sliceContainer.createChild(Slice);\r\n progressSlice.shouldClone = false;\r\n progressSlice.radius = 50;\r\n progressSlice.innerRadius = 45;\r\n progressSlice.fill = interfaceColors.getFor(\"alternativeBackground\");\r\n progressSlice.fillOpacity = 0.2;\r\n progressSlice.isMeasured = false;\r\n _this.progressSlice = progressSlice;\r\n // Add text label element\r\n var label = sliceContainer.createChild(Label);\r\n label.shouldClone = false;\r\n label.horizontalCenter = \"middle\";\r\n label.verticalCenter = \"middle\";\r\n label.isMeasured = false;\r\n label.fill = interfaceColors.getFor(\"text\");\r\n label.align = \"center\";\r\n label.valign = \"middle\";\r\n label.textAlign = \"middle\";\r\n label.fillOpacity = 0.4;\r\n _this.label = label;\r\n // Set defaults\r\n _this.background.opacity = 1;\r\n _this.background.fill = interfaceColors.getFor(\"background\");\r\n _this.contentAlign = \"center\";\r\n _this.contentValign = \"middle\";\r\n _this.delay = 300;\r\n // Create hidden state\r\n var hiddenState = _this.states.create(\"hidden\");\r\n hiddenState.properties.opacity = 0;\r\n // Hide by default\r\n _this.visible = false;\r\n _this.hide(0);\r\n _this.__disabled = true;\r\n // Make it disposable\r\n // @todo Maybe it's enough to just dispose `sliceContainer`?\r\n _this._disposers.push(_this.backgroundSlice);\r\n _this._disposers.push(_this.progressSlice);\r\n _this._disposers.push(_this.label);\r\n _this._disposers.push(sliceContainer);\r\n return _this;\r\n }\r\n Object.defineProperty(Preloader.prototype, \"progress\", {\r\n /**\r\n * @return Progress (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"progress\");\r\n },\r\n /**\r\n * Current preload progress. (0-1)\r\n *\r\n * * 0 - 0%\r\n * * 0.5 - 50%\r\n * * 1 - 100%\r\n *\r\n * Setting this to a value less than 1, will automatically reveal the\r\n * preloader, while setting it to 1 (100%) will hide it.\r\n *\r\n * @param value Progress (0-1)\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n this.__disabled = false;\r\n this.validateLayout(); // show not in center without this\r\n this.setPropertyValue(\"progress\", value);\r\n /*if (!this.visible && value == 1) {\r\n return;\r\n }*/\r\n this.progressSlice.arc = 360 * value;\r\n if (this.label) {\r\n this.label.text = Math.round(value * 100) + \"%\";\r\n }\r\n if (value >= 1) {\r\n // Cancel the timeout\r\n if (this._started) {\r\n this._started = undefined;\r\n }\r\n // TODO remove closure ?\r\n registry.events.once(\"enterframe\", function () {\r\n var animation = _this.hide();\r\n if (animation && !animation.isFinished()) {\r\n animation.events.once(\"animationended\", function () {\r\n _this.__disabled = true;\r\n });\r\n }\r\n else {\r\n _this.__disabled = true;\r\n }\r\n });\r\n this.interactionsEnabled = false;\r\n this.setPropertyValue(\"progress\", 0);\r\n }\r\n else if (value > 0) {\r\n if (this.delay) {\r\n if (!this._started) {\r\n this._started = new Date().getTime();\r\n }\r\n else if ((this._started + this.delay) <= new Date().getTime()) {\r\n this.__disabled = false;\r\n this.show();\r\n this.interactionsEnabled = true;\r\n }\r\n }\r\n else {\r\n this.__disabled = false;\r\n this.show();\r\n this.interactionsEnabled = true;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Preloader.prototype, \"delay\", {\r\n /**\r\n * @return Delay (ms)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"delay\");\r\n },\r\n /**\r\n * Delay display of preloader by X milliseconds.\r\n *\r\n * When loading starts (`progress` is set to <1) and finishes (`progress` is\r\n * set to 1) before `delay` ms, the loader is never shown.\r\n *\r\n * This is used to avoid brief flashing of the preload for very quick loads.\r\n *\r\n * @default 1000\r\n * @param value Delay (ms)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"delay\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Preloader;\r\n}(Container));\r\nexport { Preloader };\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[\"Preloader\"] = Preloader;\r\n//# sourceMappingURL=Preloader.js.map","/**\r\n * Resize button module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Button } from \"./Button\";\r\nimport { Sprite } from \"../Sprite\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $path from \"../rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a draggable resize/grip button.\r\n *\r\n * @see {@link IResizeButtonEvents} for a list of available events\r\n * @see {@link IResizeButtonAdapters} for a list of available Adapters\r\n */\r\nvar ResizeButton = /** @class */ (function (_super) {\r\n __extends(ResizeButton, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ResizeButton() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"ResizeButton\";\r\n // Set defaults\r\n _this.orientation = \"horizontal\";\r\n _this.layout = \"absolute\";\r\n _this.horizontalCenter = \"middle\";\r\n _this.verticalCenter = \"middle\";\r\n _this.draggable = true;\r\n _this.padding(8, 8, 8, 8);\r\n _this.background.cornerRadius(20, 20, 20, 20);\r\n // Create an icon\r\n var icon = new Sprite();\r\n icon.element = _this.paper.add(\"path\");\r\n var path = $path.moveTo({ x: -2, y: -6 });\r\n path += $path.lineTo({ x: -2, y: 6 });\r\n path += $path.moveTo({ x: 2, y: -6 });\r\n path += $path.lineTo({ x: 2, y: 6 });\r\n icon.path = path;\r\n icon.pixelPerfect = true;\r\n icon.padding(0, 4, 0, 4);\r\n icon.stroke = new InterfaceColorSet().getFor(\"alternativeText\");\r\n icon.strokeOpacity = 0.7;\r\n //icon.align = \"center\";\r\n //icon.valign = \"middle\";\r\n _this.icon = icon;\r\n _this.label.dispose();\r\n _this.label = undefined;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(ResizeButton.prototype, \"orientation\", {\r\n /**\r\n * Use for setting of direction (orientation) of the resize button.\r\n *\r\n * Available options: \"horizontal\", \"vertical\".\r\n *\r\n * @param value Orientation\r\n */\r\n set: function (value) {\r\n var icon = this.icon;\r\n if (icon) {\r\n if (value == \"horizontal\") {\r\n icon.rotation = 0;\r\n }\r\n else {\r\n icon.rotation = -90;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ResizeButton;\r\n}(Button));\r\nexport { ResizeButton };\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[\"ResizeButton\"] = ResizeButton;\r\n//# sourceMappingURL=ResizeButton.js.map","/**\r\n * Zoom out button functionality.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Button } from \"./Button\";\r\nimport { Sprite } from \"../Sprite\";\r\nimport { registry } from \"../Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $path from \"../rendering/Path\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { MouseCursorStyle } from \"../../core/interaction/Mouse\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a zoom out button.\r\n *\r\n * @see {@link ICloseButtonEvents} for a list of available events\r\n * @see {@link ICloseButtonAdapters} for a list of available Adapters\r\n */\r\nvar CloseButton = /** @class */ (function (_super) {\r\n __extends(CloseButton, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CloseButton() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"CloseButton\";\r\n _this.padding(8, 8, 8, 8);\r\n _this.showSystemTooltip = true;\r\n _this.width = 30;\r\n _this.height = 30;\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.cursorOverStyle = MouseCursorStyle.pointer;\r\n var background = _this.background;\r\n background.cornerRadius(20, 20, 20, 20);\r\n var bgc = interfaceColors.getFor(\"background\");\r\n background.fill = bgc;\r\n background.stroke = interfaceColors.getFor(\"primaryButton\");\r\n background.strokeOpacity = 1;\r\n background.strokeWidth = 1;\r\n var downColor = interfaceColors.getFor(\"primaryButtonActive\");\r\n var bhs = background.states.getKey(\"hover\");\r\n bhs.properties.strokeWidth = 3;\r\n bhs.properties.fill = bgc;\r\n var bds = background.states.getKey(\"down\");\r\n bds.properties.stroke = downColor;\r\n bds.properties.fill = bgc;\r\n // Create an icon\r\n var icon = new Sprite();\r\n icon.element = _this.paper.add(\"path\");\r\n icon.stroke = background.stroke;\r\n _this.icon = icon;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n CloseButton.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n var w = this.pixelWidth / 3;\r\n var h = this.pixelHeight / 3;\r\n var path = $path.moveTo({ x: -w / 2, y: -h / 2 });\r\n path += $path.lineTo({ x: w / 2, y: h / 2 });\r\n path += $path.moveTo({ x: w / 2, y: -h / 2 });\r\n path += $path.lineTo({ x: -w / 2, y: h / 2 });\r\n this.icon.path = path;\r\n this.invalidateLayout();\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n CloseButton.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Close\");\r\n }\r\n };\r\n return CloseButton;\r\n}(Button));\r\nexport { CloseButton };\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[\"CloseButton\"] = CloseButton;\r\n//# sourceMappingURL=CloseButton.js.map","/**\r\n * Functionality for drawing simple SwitchButtons.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../Container\";\r\nimport { Label } from \"./Label\";\r\nimport { Button } from \"../elements/Button\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { Circle } from \"../../core/elements/Circle\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { registry } from \"../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * SwitchButton class is capable of drawing a simple rectangular SwitchButton with\r\n * optionally rounded corners and an icon in it.\r\n *\r\n * @see {@link ISwitchButtonEvents} for a list of available events\r\n * @see {@link ISwitchButtonAdapters} for a list of available Adapters\r\n */\r\nvar SwitchButton = /** @class */ (function (_super) {\r\n __extends(SwitchButton, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SwitchButton() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"SwitchButton\";\r\n _this.tooltipY = 0;\r\n // Set defaults\r\n _this.layout = \"horizontal\";\r\n _this.contentAlign = \"center\";\r\n _this.contentValign = \"middle\";\r\n _this.padding(8, 16, 8, 16);\r\n _this.setStateOnChildren = true;\r\n _this.states.create(\"active\");\r\n var interfaceColors = new InterfaceColorSet();\r\n // Create the label element\r\n var leftLabel = new Label();\r\n leftLabel.fillOpacity = 0.3;\r\n var llas = leftLabel.states.create(\"active\");\r\n llas.properties.fillOpacity = 1;\r\n leftLabel.isActive = true;\r\n _this.leftLabel = leftLabel;\r\n var button = new Button();\r\n var circle = new Circle();\r\n button.contentValign = \"none\";\r\n button.padding(0, 0, 0, 0);\r\n circle.radius = 10;\r\n button.icon = circle;\r\n button.icon.valign = \"middle\";\r\n button.label = undefined;\r\n var p100 = percent(100);\r\n button.background.cornerRadius(p100, p100, p100, p100);\r\n button.width = circle.radius * 3.5;\r\n button.height = circle.radius * 2.1;\r\n button.marginLeft = 8;\r\n button.marginRight = 8;\r\n button.togglable = true;\r\n circle.dx = -circle.radius * 0.7;\r\n circle.fill = interfaceColors.getFor(\"primaryButton\");\r\n var hs = circle.states.create(\"hover\");\r\n hs.properties.fill = interfaceColors.getFor(\"primaryButtonHover\");\r\n var as = circle.states.create(\"active\");\r\n as.properties.fill = interfaceColors.getFor(\"primaryButtonActive\");\r\n as.properties.dx = circle.radius * 0.7;\r\n _this.switchButton = button;\r\n _this.events.on(\"toggled\", function () {\r\n _this.leftLabel.isActive = !_this.isActive;\r\n _this.rightLabel.isActive = _this.isActive;\r\n });\r\n // Create the label element\r\n var rightLabel = new Label();\r\n rightLabel.fillOpacity = 0.3;\r\n var rlas = rightLabel.states.create(\"active\");\r\n rlas.properties.fillOpacity = 1;\r\n _this.rightLabel = rightLabel;\r\n // Set up accessibility\r\n // A Button should be always focusable\r\n _this.role = \"button\";\r\n _this.focusable = true;\r\n rightLabel.valign = \"middle\";\r\n leftLabel.valign = \"middle\";\r\n button.valign = \"middle\";\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(SwitchButton.prototype, \"leftLabel\", {\r\n /**\r\n * @return Left label element\r\n */\r\n get: function () {\r\n return this._leftLabel;\r\n },\r\n /**\r\n * [[Label]] element to be used for left text.\r\n *\r\n * @param left label element\r\n */\r\n set: function (label) {\r\n if (this._leftLabel) {\r\n this.removeDispose(this._leftLabel);\r\n }\r\n this._leftLabel = label;\r\n if (label) {\r\n label.parent = this;\r\n label.interactionsEnabled = false;\r\n label.shouldClone = false;\r\n this._disposers.push(this._leftLabel);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SwitchButton.prototype, \"rightLabel\", {\r\n /**\r\n * @return Rigth label element\r\n */\r\n get: function () {\r\n return this._rightLabel;\r\n },\r\n /**\r\n * [[Label]] element to be used for left text.\r\n *\r\n * @param rigth label element\r\n */\r\n set: function (label) {\r\n if (this._rightLabel) {\r\n this.removeDispose(this._rightLabel);\r\n }\r\n this._rightLabel = label;\r\n if (label) {\r\n label.parent = this;\r\n label.interactionsEnabled = false;\r\n label.shouldClone = false;\r\n this._disposers.push(this._rightLabel);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SwitchButton.prototype, \"switch\", {\r\n /**\r\n * @return Left label element\r\n */\r\n get: function () {\r\n return this._switchButton;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SwitchButton.prototype, \"switchButton\", {\r\n /**\r\n * [[Label]] element to be used for left text.\r\n *\r\n * @param rigth label element\r\n */\r\n set: function (button) {\r\n if (this._switchButton) {\r\n this.removeDispose(this._switchButton);\r\n }\r\n this._switchButton = button;\r\n if (button) {\r\n button.parent = this;\r\n button.shouldClone = false;\r\n this._disposers.push(this._switchButton);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies properties and other attributes.\r\n *\r\n * @param source Source\r\n */\r\n SwitchButton.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (source.leftLabel) {\r\n this.leftLabel.copyFrom(source.leftLabel);\r\n }\r\n if (source.rightLabel) {\r\n this.rightLabel.copyFrom(source.rightLabel);\r\n }\r\n if (source.switchButton) {\r\n this.switchButton.copyFrom(source.switchButton);\r\n }\r\n };\r\n return SwitchButton;\r\n}(Container));\r\nexport { SwitchButton };\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[\"SwitchButton\"] = SwitchButton;\r\n//# sourceMappingURL=SwitchButton.js.map","/**\r\n * Provides functionality used to build scrollbars.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../Container\";\r\nimport { ResizeButton } from \"../elements/ResizeButton\";\r\nimport { Button } from \"../elements/Button\";\r\nimport { getInteraction } from \"../interaction/Interaction\";\r\nimport { MouseCursorStyle } from \"../interaction/Mouse\";\r\nimport { RoundedRectangle } from \"../elements/RoundedRectangle\";\r\nimport { registry } from \"../Registry\";\r\nimport { keyboard } from \"../utils/Keyboard\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { percent, Percent } from \"../utils/Percent\";\r\nimport * as $math from \"../utils/Math\";\r\nimport * as $ease from \"../utils/Ease\";\r\nimport * as $type from \"../utils/Type\";\r\nimport * as $utils from \"../utils/Utils\";\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Scrollbar is a generic control allowing to select a range of values or pan\r\n * the selection.\r\n *\r\n * @see {@link IScrollbarEvents} for a list of available events\r\n * @see {@link IScrollbarAdapters} for a list of available Adapters\r\n */\r\nvar Scrollbar = /** @class */ (function (_super) {\r\n __extends(Scrollbar, _super);\r\n /**\r\n * Construtor\r\n */\r\n function Scrollbar() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Previously selected lower (start) value.\r\n */\r\n _this._previousStart = 0;\r\n /**\r\n * Previously selected upper (end) value.\r\n */\r\n _this._previousEnd = 1;\r\n /**\r\n * A value of previously selected lower value, used for doubleclick function.\r\n */\r\n _this._prevStart = 0;\r\n /**\r\n * A value of previously selected upper value, used for doubleclick function.\r\n */\r\n _this._prevEnd = 1;\r\n /**\r\n * Indicates if the Scrollbar is currently \"busy\" (animating and or\r\n * performing zoom by user interaction).\r\n */\r\n _this._isBusy = false;\r\n /**\r\n * [_skipRangeEvents description]\r\n *\r\n * @todo Description\r\n */\r\n _this._skipRangeEvents = false;\r\n /**\r\n * Update the selection when dragging the grips.\r\n *\r\n * If set to `false` selection will be updated only when the grip is\r\n * released.\r\n *\r\n * @default true\r\n */\r\n _this.updateWhileMoving = true;\r\n _this.className = \"Scrollbar\";\r\n _this.minHeight = 12;\r\n _this.minWidth = 12;\r\n _this.animationDuration = 0;\r\n _this.animationEasing = $ease.cubicOut;\r\n _this.margin(10, 10, 10, 10);\r\n var interfaceColors = new InterfaceColorSet();\r\n // background is also container as it might contain graphs, grid, etc\r\n var background = _this.background;\r\n background.cornerRadius(10, 10, 10, 10);\r\n background.fill = interfaceColors.getFor(\"fill\");\r\n background.fillOpacity = 0.5;\r\n // Make system tooltips appear by default\r\n _this.showSystemTooltip = true;\r\n _this.startGrip = new ResizeButton();\r\n _this.endGrip = new ResizeButton();\r\n // Default orientation...\r\n // ... is set in `applyInternalDefaults()` because it accesses `language`\r\n // and should only be started to access when parent is set\r\n // Set events\r\n _this.events.on(\"transformed\", _this.updateThumb, _this, false);\r\n // Initial positions\r\n _this.start = 0;\r\n _this.end = 1;\r\n // Set roles\r\n _this.role = \"scrollbar\";\r\n _this.thumb.role = \"slider\";\r\n _this.thumb.readerLive = \"polite\";\r\n _this.startGrip.role = \"slider\";\r\n _this.endGrip.role = \"slider\";\r\n // otherwise range changed wont' be registered\r\n _this.events.once(\"inited\", function () {\r\n _this._previousStart = undefined;\r\n _this.dispatchRangeChange();\r\n }, undefined, false);\r\n _this.hideGrips = false;\r\n _this.orientation = \"horizontal\";\r\n // Min/max values for accessibility\r\n _this.setSVGAttribute({ \"aria-valuemin\": \"0\" });\r\n _this.setSVGAttribute({ \"aria-valuemax\": \"100\" });\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n Scrollbar.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Set screen reader tetxt accordingly\r\n if (this.orientation === \"horizontal\") {\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Use TAB to select grip buttons or left and right arrows to change selection\");\r\n }\r\n if (!$type.hasValue(this.thumb.readerDescription)) {\r\n this.thumb.readerDescription = this.language.translate(\"Use left and right arrows to move selection\");\r\n }\r\n if (!$type.hasValue(this.startGrip.readerDescription)) {\r\n this.startGrip.readerDescription = this.language.translate(\"Use left and right arrows to move left selection\");\r\n }\r\n if (!$type.hasValue(this.endGrip.readerDescription)) {\r\n this.endGrip.readerDescription = this.language.translate(\"Use left and right arrows to move right selection\");\r\n }\r\n this.readerOrientation = \"horizontal\";\r\n }\r\n else {\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Use TAB select grip buttons or up and down arrows to change selection\");\r\n }\r\n if (!$type.hasValue(this.thumb.readerDescription)) {\r\n this.thumb.readerDescription = this.language.translate(\"Use up and down arrows to move selection\");\r\n }\r\n if (!$type.hasValue(this.startGrip.readerDescription)) {\r\n this.startGrip.readerDescription = this.language.translate(\"Use up and down arrows to move upper selection\");\r\n }\r\n if (!$type.hasValue(this.endGrip.readerDescription)) {\r\n this.endGrip.readerDescription = this.language.translate(\"Use up and down arrows to move lower selection\");\r\n }\r\n this.readerOrientation = \"vertical\";\r\n }\r\n this.readerControls = this.baseSprite.uidAttr();\r\n };\r\n /**\r\n * Validates the layout of the scrollbar's elements.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.validateLayout = function () {\r\n this.updateSize();\r\n _super.prototype.validateLayout.call(this);\r\n // when size changes, need to update extremes\r\n this.updateExtremes();\r\n };\r\n /**\r\n * Update background for the scrollbar.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.processBackground = function () {\r\n _super.prototype.processBackground.call(this);\r\n var background = this.background;\r\n background.clickable = true;\r\n background.events.on(\"hit\", this.handleBgHit, this, undefined);\r\n };\r\n /**\r\n * Zooms to the particular place when clicked/tapped on the scrollbar\r\n * background.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n Scrollbar.prototype.handleBgHit = function (event) {\r\n this.makeBusy();\r\n var point = event.spritePoint;\r\n point = $utils.spritePointToSprite(point, this.background, this);\r\n var thumb = this.thumb;\r\n if (this.orientation == \"horizontal\") {\r\n var thumbX = point.x - thumb.pixelWidth / 2;\r\n thumbX = $math.fitToRange(thumbX, 0, this.innerWidth - thumb.pixelWidth);\r\n this._thumbAnimation = thumb.animate({ property: \"x\", to: thumbX }, this.animationDuration, this.animationEasing);\r\n }\r\n else {\r\n var thumbY = point.y - thumb.pixelHeight / 2;\r\n thumbY = $math.fitToRange(thumbY, 0, this.innerHeight - thumb.pixelHeight);\r\n this._thumbAnimation = thumb.animate({ property: \"y\", to: thumbY }, this.animationDuration, this.animationEasing);\r\n }\r\n if (this.animationDuration > 0) {\r\n this._thumbAnimation.events.on(\"animationended\", this.makeUnbusy, this, false);\r\n }\r\n else {\r\n this._thumb.validate();\r\n this.makeUnbusy();\r\n }\r\n };\r\n /**\r\n * Set scrollbar as busy. (currently zooming)\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.makeBusy = function () {\r\n this._isBusy = true;\r\n this._skipRangeEvents = false;\r\n if (this._unbusyTimeout) {\r\n this.removeDispose(this._unbusyTimeout);\r\n }\r\n this._unbusyTimeout = undefined;\r\n this.stopAnimations();\r\n };\r\n /**\r\n * Stops all animations, currently playing for the scrollbar.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.stopAnimations = function () {\r\n if (this._thumbAnimation) {\r\n this._thumbAnimation.stop(true);\r\n }\r\n if (this._zoomAnimation) {\r\n this._zoomAnimation.stop(true);\r\n }\r\n };\r\n /**\r\n * Cancels \"busy\" status of the Scrollbar.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.makeUnbusy = function () {\r\n /**\r\n * We cannot make Scrollbar not busy right after release, because then axes\r\n * will take over controll and Scrollbar will start to animate.\r\n * Theorethically, it's not right to set timeout by `animationDuration`,\r\n * however we can not know all the durations of elements we scroll, so we\r\n * assume that animation duration will be the same as\r\n * `interpolationDuration` or `rangeChange` duration.\r\n */\r\n this._unbusyTimeout = this.setTimeout(this.makeUnbusyReal.bind(this), this.animationDuration * 1.1);\r\n };\r\n /**\r\n * [makeUnbusyReal description]\r\n *\r\n * @todo Description\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.makeUnbusyReal = function () {\r\n this._usingGrip = undefined;\r\n this._isBusy = false;\r\n if (!this.updateWhileMoving) {\r\n this.dispatchRangeChange();\r\n }\r\n };\r\n /**\r\n * Disptatches rangechanged event if it really changed\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.dispatchRangeChange = function () {\r\n if (this._previousEnd != this.end || this._previousStart != this.start) {\r\n this._previousStart = this.start;\r\n this._previousEnd = this.end;\r\n this.dispatch(\"rangechanged\");\r\n }\r\n };\r\n /**\r\n * Updates the \"thumb\" element. A draggable element between the grips.\r\n */\r\n Scrollbar.prototype.updateThumb = function () {\r\n if (!this.parent) {\r\n return;\r\n }\r\n var thumb = this.thumb;\r\n var start = this.start;\r\n var end = this.end;\r\n var startGrip = this.startGrip;\r\n var endGrip = this.endGrip;\r\n if (this.orientation == \"horizontal\") {\r\n var innerWidth_1 = this.innerWidth;\r\n thumb.width = innerWidth_1 * (end - start);\r\n thumb.maxX = innerWidth_1 - thumb.pixelWidth;\r\n thumb.x = start * innerWidth_1;\r\n startGrip.moveTo({ x: thumb.pixelX, y: 0 }, undefined, undefined, true); // overrides dragging\r\n endGrip.moveTo({ x: thumb.pixelX + thumb.pixelWidth, y: 0 }, undefined, undefined, true);\r\n startGrip.readerTitle = this.language.translate(\"From %1\", undefined, this.adapter.apply(\"positionValue\", {\r\n value: Math.round(start * 100) + \"%\",\r\n position: start\r\n }).value);\r\n startGrip.readerValueNow = \"\" + Math.round(start * 100);\r\n startGrip.readerValueText = startGrip.readerTitle;\r\n endGrip.readerTitle = this.language.translate(\"To %1\", undefined, this.adapter.apply(\"positionValue\", {\r\n value: Math.round(end * 100) + \"%\",\r\n position: end\r\n }).value);\r\n endGrip.readerValueNow = \"\" + Math.round(end * 100);\r\n endGrip.readerValueText = endGrip.readerTitle;\r\n }\r\n else {\r\n var innerHeight_1 = this.innerHeight;\r\n thumb.height = innerHeight_1 * (end - start);\r\n thumb.maxY = innerHeight_1 - thumb.pixelHeight;\r\n thumb.y = (1 - end) * innerHeight_1;\r\n startGrip.moveTo({ x: 0, y: thumb.pixelY + thumb.pixelHeight }, undefined, undefined, true);\r\n endGrip.moveTo({ x: 0, y: thumb.pixelY }, undefined, undefined, true);\r\n startGrip.readerTitle = this.language.translate(\"To %1\", undefined, this.adapter.apply(\"positionValue\", {\r\n value: Math.round((1 - start) * 100) + \"%\",\r\n position: (1 - start)\r\n }).value);\r\n startGrip.readerValueNow = \"\" + Math.round(start * 100);\r\n startGrip.readerValueText = startGrip.readerTitle;\r\n endGrip.readerTitle = this.language.translate(\"From %1\", undefined, this.adapter.apply(\"positionValue\", {\r\n value: Math.round((1 - end) * 100) + \"%\",\r\n position: (1 - end)\r\n }).value);\r\n endGrip.readerValueNow = \"\" + Math.round(end * 100);\r\n endGrip.readerValueText = endGrip.readerTitle;\r\n }\r\n // Add accessibility\r\n thumb.readerTitle = this.language.translate(\"From %1 to %2\", undefined, this.adapter.apply(\"positionValue\", {\r\n value: Math.round(start * 100) + \"%\",\r\n position: start\r\n }).value, this.adapter.apply(\"positionValue\", {\r\n value: Math.round(end * 100) + \"%\",\r\n position: end\r\n }).value);\r\n thumb.readerValueNow = \"\" + Math.round(start * 100);\r\n thumb.readerValueText = thumb.readerTitle;\r\n this.readerValueNow = \"\" + Math.round(start * 100);\r\n this.readerValueText = thumb.readerTitle;\r\n if (!this._skipRangeEvents && this.updateWhileMoving) {\r\n this.dispatchRangeChange();\r\n }\r\n };\r\n /**\r\n * Updates extremes of the scrollbar.\r\n */\r\n Scrollbar.prototype.updateExtremes = function () {\r\n var orientation = this.orientation;\r\n var minX = 0;\r\n var minY = 0;\r\n var maxX = 0;\r\n var maxY = 0;\r\n if (orientation == \"horizontal\") {\r\n maxX = this.innerWidth;\r\n minY = maxY = this.innerHeight / 2;\r\n }\r\n else {\r\n maxY = this.innerHeight;\r\n minX = maxX = this.innerWidth / 2;\r\n }\r\n var startGrip = this.startGrip;\r\n startGrip.minX = minX;\r\n startGrip.maxX = maxX;\r\n startGrip.minY = minY;\r\n startGrip.maxY = maxY;\r\n var endGrip = this.endGrip;\r\n endGrip.minX = minX;\r\n endGrip.maxX = maxX;\r\n endGrip.minY = minY;\r\n endGrip.maxY = maxY;\r\n var thumb = this.thumb;\r\n thumb.minX = minX;\r\n thumb.maxX = maxX;\r\n thumb.minY = minY;\r\n thumb.maxY = maxY;\r\n };\r\n /**\r\n * Updates size of the scrollbar.\r\n */\r\n Scrollbar.prototype.updateSize = function () {\r\n var orientation = this.orientation;\r\n var startGrip = this.startGrip;\r\n if (startGrip) {\r\n startGrip.orientation = orientation;\r\n }\r\n if (this.endGrip) {\r\n this.endGrip.orientation = orientation;\r\n }\r\n var thumb = this.thumb;\r\n if (thumb) {\r\n if (orientation == \"horizontal\") {\r\n if (!$type.isNumber(this._pixelWidth)) {\r\n if (!(this.width instanceof Percent)) {\r\n this.width = percent(100);\r\n }\r\n }\r\n // this teorethically might be wrong, if user indeed sets height of a horizontal scrollbar in percent\r\n // however without this height might be equal to 100% if previous orientation was set to horizontal\r\n // so this is ok solution, in case user really wants to have scrollbar height set in percent,\r\n // he should do this after orientation.\r\n if ($type.hasValue(this.percentHeight)) {\r\n this.height = this.minHeight;\r\n }\r\n thumb.height = this.innerHeight;\r\n thumb.verticalCenter = \"middle\";\r\n thumb.horizontalCenter = \"left\";\r\n }\r\n else {\r\n if (!$type.isNumber(this._pixelHeight)) {\r\n if (!(this.height instanceof Percent)) {\r\n this.height = percent(100);\r\n }\r\n }\r\n // same as above with percentHeight\r\n if ($type.hasValue(this.percentWidth)) {\r\n this.width = this.minWidth;\r\n }\r\n thumb.width = this.innerWidth;\r\n thumb.verticalCenter = \"top\";\r\n thumb.horizontalCenter = \"middle\";\r\n }\r\n }\r\n };\r\n Object.defineProperty(Scrollbar.prototype, \"isBusy\", {\r\n /**\r\n * Indicates if the Scrollbar is currently \"busy\" (animating and or\r\n * performing zoom by user interaction).\r\n * @return boolean\r\n */\r\n get: function () {\r\n return this._isBusy;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scrollbar.prototype, \"start\", {\r\n /**\r\n * @return Position (0-1)\r\n */\r\n get: function () {\r\n return Math.min(this.getPosition(this._start), this.getPosition(this._end));\r\n },\r\n /**\r\n * ==========================================================================\r\n * POSITIONS\r\n * ==========================================================================\r\n * @hidden\r\n */\r\n /**\r\n * Relative position (0-1) of the start grip.\r\n *\r\n * @param position Position (0-1)\r\n */\r\n set: function (position) {\r\n if (!this._isBusy) {\r\n this.__start = position;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scrollbar.prototype, \"__start\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._start;\r\n },\r\n /**\r\n * [__start description]\r\n *\r\n * @todo Description\r\n * @param position [description]\r\n */\r\n set: function (position) {\r\n this._start = this.getPosition(position);\r\n this.updateThumb();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scrollbar.prototype, \"end\", {\r\n /**\r\n * @return Position (0-1)\r\n */\r\n get: function () {\r\n return Math.max(this.getPosition(this._start), this.getPosition(this._end));\r\n },\r\n /**\r\n * Relative position (0-1) of the end grip.\r\n *\r\n * @param position Position (0-1)\r\n */\r\n set: function (position) {\r\n if (!this._isBusy) {\r\n this.__end = position;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scrollbar.prototype, \"__end\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._end;\r\n },\r\n /**\r\n * [__end description]\r\n *\r\n * @todo Description\r\n * @param position [description]\r\n */\r\n set: function (position) {\r\n this._end = this.getPosition(position);\r\n this.updateThumb();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scrollbar.prototype, \"range\", {\r\n /**\r\n * Current selection range.\r\n *\r\n * @readonly\r\n * @return Range\r\n */\r\n get: function () {\r\n return { start: this.start, end: this.end, priority: this._usingGrip };\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disables range change events.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.skipRangeEvents = function () {\r\n if (!this._isBusy) {\r\n this._skipRangeEvents = true;\r\n }\r\n };\r\n /**\r\n * [fixRange description]\r\n *\r\n * @todo Description\r\n * @ignore Exclude from docs\r\n * @param range Range\r\n */\r\n Scrollbar.prototype.fixRange = function (range) {\r\n if (range.start != $math.round(this._start, 2) || range.end != $math.round(this._end, 2)) {\r\n this._start = range.start;\r\n this._end = range.end;\r\n this._skipRangeEvents = true;\r\n this.updateThumb();\r\n this._skipRangeEvents = false;\r\n this.thumb.validate();\r\n this.thumb.background.validate();\r\n }\r\n };\r\n /**\r\n * [getPosition description]\r\n *\r\n * @todo Description\r\n * @param position [description]\r\n * @return [description]\r\n */\r\n Scrollbar.prototype.getPosition = function (position) {\r\n return $math.fitToRange($math.round(position, 4), 0, 1);\r\n };\r\n Object.defineProperty(Scrollbar.prototype, \"orientation\", {\r\n /**\r\n * @return Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"orientation\");\r\n },\r\n /**\r\n * ==========================================================================\r\n * MISC\r\n * ==========================================================================\r\n * @hidden\r\n */\r\n /**\r\n * Orientation of the scrollbar.\r\n *\r\n * Available options: \"horizontal\" (default) and \"vertical\".\r\n *\r\n * @default \"horizontal\"\r\n * @param value Orientation\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"orientation\", value)) {\r\n // Set mouse cursors and screen reader tetxt accordingly\r\n if (value === \"horizontal\") {\r\n // Mouse styles\r\n this.startGrip.cursorOverStyle = MouseCursorStyle.horizontalResize;\r\n this.endGrip.cursorOverStyle = MouseCursorStyle.horizontalResize;\r\n // Reader text\r\n /*this.readerTitle = this.language.translate(\"Use TAB to select grip buttons or left and right arrows to change selection\");\r\n this.thumb.readerDescription = this.language.translate(\"Use left and right arrows to move selection\");\r\n this.startGrip.readerDescription = this.language.translate(\"Use left and right arrows to move left selection\");\r\n this.endGrip.readerDescription = this.language.translate(\"Use left and right arrows to move right selection\");*/\r\n }\r\n else {\r\n // Mouse styles\r\n this.startGrip.cursorOverStyle = MouseCursorStyle.verticalResize;\r\n this.endGrip.cursorOverStyle = MouseCursorStyle.verticalResize;\r\n // Reader text\r\n /*this.readerTitle = this.language.translate(\"Use TAB select grip buttons or up and down arrows to change selection\");\r\n this.thumb.readerDescription = this.language.translate(\"Use up and down arrows to move selection\");\r\n this.startGrip.readerDescription = this.language.translate(\"Use up and down arrows to move upper selection\");\r\n this.endGrip.readerDescription = this.language.translate(\"Use up and down arrows to move lower selection\");*/\r\n }\r\n this.updateByOrientation();\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n Scrollbar.prototype.updateByOrientation = function () {\r\n };\r\n Object.defineProperty(Scrollbar.prototype, \"startGrip\", {\r\n /**\r\n * @return Grip element\r\n */\r\n get: function () {\r\n return this._startGrip;\r\n },\r\n /**\r\n * ==========================================================================\r\n * GRIPS\r\n * ==========================================================================\r\n * @hidden\r\n */\r\n /**\r\n * Start grip element. (button)\r\n *\r\n * @param button Grip element\r\n */\r\n set: function (button) {\r\n if (this._startGrip) {\r\n this.removeDispose(this._startGrip);\r\n }\r\n this._startGrip = button;\r\n this.processGrip(button);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scrollbar.prototype, \"endGrip\", {\r\n /**\r\n * @return Grip element\r\n */\r\n get: function () {\r\n return this._endGrip;\r\n },\r\n /**\r\n * End grip element. (button)\r\n *\r\n * @param button Grip element\r\n */\r\n set: function (button) {\r\n if (this._endGrip) {\r\n this.removeDispose(this._endGrip);\r\n }\r\n this._endGrip = button;\r\n this.processGrip(button);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Decorates the grip button with properties and events.\r\n *\r\n * @ignore Exclude from docs\r\n * @param button Grip button\r\n */\r\n Scrollbar.prototype.processGrip = function (button) {\r\n button.parent = this;\r\n button.isMeasured = false;\r\n button.focusable = true;\r\n button.shouldClone = false;\r\n // Set button defaults\r\n //button.showSystemTooltip = true; // setting this here is not right because we break inheritance\r\n button.zIndex = 100;\r\n button.events.on(\"drag\", this.handleGripDrag, this, false);\r\n button.events.on(\"dragstop\", this.makeUnbusy, this, false);\r\n button.events.on(\"down\", this.makeBusy, this, false);\r\n this._disposers.push(button);\r\n };\r\n /**\r\n * Updates positions of related elements after grip element is dragged.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n Scrollbar.prototype.handleGripDrag = function (event) {\r\n this.makeBusy();\r\n if (event.target === this._startGrip) {\r\n this._usingGrip = \"start\";\r\n }\r\n else {\r\n this._usingGrip = \"end\";\r\n }\r\n if (this.orientation == \"horizontal\") {\r\n this._start = this.startGrip.pixelX / this.innerWidth;\r\n this._end = this.endGrip.pixelX / this.innerWidth;\r\n }\r\n else {\r\n this._start = 1 - this.startGrip.pixelY / this.innerHeight;\r\n this._end = 1 - this.endGrip.pixelY / this.innerHeight;\r\n }\r\n this.updateThumb();\r\n };\r\n Object.defineProperty(Scrollbar.prototype, \"thumb\", {\r\n /**\r\n * @return Thumb element\r\n */\r\n get: function () {\r\n if (!this._thumb) {\r\n // Create scrollbar controls (setters will handle adding disposers)\r\n var thumb = new Button();\r\n thumb.background.cornerRadius(10, 10, 10, 10);\r\n thumb.padding(0, 0, 0, 0);\r\n this.thumb = thumb;\r\n }\r\n return this._thumb;\r\n },\r\n /**\r\n * A \"thumb\" element.\r\n *\r\n * It's a draggable square space between the grips, that can be used to\r\n * pan the selection.\r\n *\r\n * @param thumb Thumb element\r\n */\r\n set: function (thumb) {\r\n var _this = this;\r\n if (thumb) {\r\n if (this._thumb) {\r\n this.removeDispose(this._thumb);\r\n }\r\n this._thumb = thumb;\r\n thumb.parent = this;\r\n thumb.isMeasured = false;\r\n thumb.inert = true;\r\n thumb.draggable = true;\r\n thumb.clickable = true;\r\n thumb.hoverable = true;\r\n thumb.focusable = true;\r\n thumb.shouldClone = false;\r\n thumb.zIndex = 0;\r\n // TODO remove closures ?\r\n // Add events\r\n // Add cursor styles to thumb\r\n thumb.cursorOverStyle = MouseCursorStyle.grab;\r\n thumb.cursorDownStyle = MouseCursorStyle.grabbing;\r\n thumb.events.on(\"dragstart\", this.makeBusy, this, false);\r\n thumb.events.on(\"dragstop\", this.makeUnbusy, this, false);\r\n thumb.events.on(\"positionchanged\", this.handleThumbPosition, this, false);\r\n thumb.events.on(\"sizechanged\", this.handleThumbPosition, this, false);\r\n thumb.events.on(\"doublehit\", this.handleDoubleClick, this, false);\r\n // Add event for space and ENTER to toggle full zoom out and back\r\n // (same as doubleclick)\r\n this._disposers.push(getInteraction().body.events.on(\"keyup\", function (ev) {\r\n if (keyboard.isKey(ev.event, [\"space\", \"enter\"]) && _this.thumb.isFocused) {\r\n ev.event.preventDefault();\r\n _this.handleDoubleClick();\r\n }\r\n }));\r\n this._disposers.push(this._thumb);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Zooms-in and out the selection on double-click of the thumb.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.handleDoubleClick = function () {\r\n this.makeBusy();\r\n var newStart = 0;\r\n var newEnd = 1;\r\n if (this.start != 0 || this.end != 1) {\r\n this._prevStart = this.start;\r\n this._prevEnd = this.end;\r\n }\r\n else {\r\n newStart = this._prevStart;\r\n newEnd = this._prevEnd;\r\n }\r\n var zoomAnimation = this.animate([{ property: \"__start\", to: newStart }, { property: \"__end\", to: newEnd }], this.animationDuration, this.animationEasing);\r\n if (zoomAnimation && !zoomAnimation.isFinished()) {\r\n zoomAnimation.events.on(\"animationended\", this.makeUnbusy, this, false);\r\n this._zoomAnimation = zoomAnimation;\r\n }\r\n else {\r\n this.makeUnbusy();\r\n }\r\n };\r\n /**\r\n * Updates positions of other elements when thumb is moved.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Scrollbar.prototype.handleThumbPosition = function () {\r\n var thumb = this.thumb;\r\n if (this.orientation == \"horizontal\") {\r\n var innerWidth_2 = this.innerWidth;\r\n var w = thumb.innerWidth;\r\n var x = thumb.pixelX;\r\n this._start = x / innerWidth_2;\r\n this._end = (x + w) / innerWidth_2;\r\n this.updateThumb();\r\n }\r\n else {\r\n var innerHeight_2 = this.innerHeight;\r\n var h = thumb.innerHeight;\r\n var y = thumb.pixelY;\r\n this._start = 1 - (y + h) / innerHeight_2;\r\n this._end = 1 - y / innerHeight_2;\r\n this.updateThumb();\r\n }\r\n };\r\n /**\r\n * Creates a background element for the scrollbar.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Background\r\n */\r\n Scrollbar.prototype.createBackground = function () {\r\n return new RoundedRectangle();\r\n };\r\n Object.defineProperty(Scrollbar.prototype, \"hideGrips\", {\r\n /**\r\n * @return Show only on hover?\r\n */\r\n get: function () {\r\n return this._hideGrips;\r\n },\r\n /**\r\n * Use this property to set whether grips should be always visible (`false`),\r\n * or they should just appear on scrollbar hover (`true`).\r\n *\r\n * @param value Show only on hover?\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n this._hideGrips = value;\r\n if (this._overDisposer) {\r\n this.removeDispose(this._overDisposer);\r\n }\r\n if (this._outDisposer) {\r\n this.removeDispose(this._outDisposer);\r\n }\r\n if (value) {\r\n this._overDisposer = this.events.on(\"over\", function () {\r\n _this.startGrip.show();\r\n _this.endGrip.show();\r\n }, undefined, false);\r\n this._outDisposer = this.events.on(\"out\", function () {\r\n _this.startGrip.hide();\r\n _this.endGrip.hide();\r\n }, undefined, false);\r\n this.startGrip.hide();\r\n this.endGrip.hide();\r\n }\r\n else {\r\n this.startGrip.show();\r\n this.endGrip.show();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scrollbar.prototype, \"animationDuration\", {\r\n /**\r\n * @return Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"animationDuration\");\r\n },\r\n /**\r\n * Duration in milliseconds of scrollbar animation (happens when user clicks on a background of a scrollbar)\r\n * @default 0\r\n * @param value number\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"animationDuration\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scrollbar.prototype, \"animationEasing\", {\r\n /**\r\n * @return {Function}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"animationEasing\");\r\n },\r\n /**\r\n * Animation easing function.\r\n * @todo: review description and default\r\n * @default $ease.cubicOut\r\n * @param value (value: number) => number\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"animationEasing\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds easing functions to \"function\" fields.\r\n *\r\n * @param field Field name\r\n * @return Assign as function?\r\n */\r\n Scrollbar.prototype.asFunction = function (field) {\r\n return field == \"animationEasing\" || _super.prototype.asIs.call(this, field);\r\n };\r\n return Scrollbar;\r\n}(Container));\r\nexport { Scrollbar };\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[\"Scrollbar\"] = Scrollbar;\r\n//# sourceMappingURL=Scrollbar.js.map","/**\r\n * Slider is a scrollbar with just one selection grip.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Scrollbar } from \"../../core/elements/Scrollbar\";\r\nimport { registry } from \"../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a slider - a version of scrollbar with just one grip.\r\n *\r\n * @see {@link ISliderEvents} for a list of available events\r\n * @see {@link ISliderAdapters} for a list of available Adapters\r\n */\r\nvar Slider = /** @class */ (function (_super) {\r\n __extends(Slider, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Slider() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Slider\";\r\n _this.thumb.opacity = 0;\r\n _this.thumb.interactionsEnabled = false;\r\n _this.endGrip.opacity = 0;\r\n _this.endGrip.interactionsEnabled = false;\r\n _this.startGrip.events.on(\"drag\", function () {\r\n _this.endGrip.x = _this.startGrip.x;\r\n _this.endGrip.y = _this.startGrip.y;\r\n });\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(Slider.prototype, \"__end\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._start;\r\n },\r\n set: function (value) {\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"end\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._start;\r\n },\r\n /**\r\n * Relative position (0-1) of the end grip.\r\n *\r\n * @param position Position (0-1)\r\n */\r\n set: function (position) {\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"start\", {\r\n /**\r\n * @return Position (0-1)\r\n */\r\n get: function () {\r\n return this._start;\r\n },\r\n /**\r\n * Relative position (0-1) of the start grip.\r\n *\r\n * @param position Position (0-1)\r\n */\r\n set: function (position) {\r\n if (!this._isBusy) {\r\n this.__start = position;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Slider;\r\n}(Scrollbar));\r\nexport { Slider };\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[\"Slider\"] = Slider;\r\n//# sourceMappingURL=Slider.js.map","/**\r\n * A module that defines Text element used to indicate links.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Label } from \"../../core/elements/Label\";\r\nimport { MouseCursorStyle } from \"../../core/interaction/Mouse\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { registry } from \"../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a text element with a link.\r\n *\r\n * @see {@link ITextLinkEvents} for a list of available events\r\n * @see {@link ITextLinkAdapters} for a list of available Adapters\r\n */\r\nvar TextLink = /** @class */ (function (_super) {\r\n __extends(TextLink, _super);\r\n /**\r\n * Constructor\r\n */\r\n function TextLink() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"TextLink\";\r\n _this.selectable = true;\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.fill = interfaceColors.getFor(\"primaryButton\").brighten(0.3);\r\n var hoverState = _this.states.create(\"hover\");\r\n hoverState.properties.fill = interfaceColors.getFor(\"primaryButtonHover\").brighten(0.3);\r\n var downState = _this.states.create(\"down\");\r\n downState.properties.fill = interfaceColors.getFor(\"primaryButtonDown\").brighten(0.3);\r\n _this.cursorOverStyle = MouseCursorStyle.pointer;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return TextLink;\r\n}(Label));\r\nexport { TextLink };\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[\"TextLink\"] = TextLink;\r\n//# sourceMappingURL=TextLink.js.map","/**\r\n * This module contains a base class for an SVG filter.\r\n *\r\n * Filters can be used to decorate, change and transform just about any DOM\r\n * element.\r\n *\r\n * A Filter works by applying one or more effects (primitives) to SVG element.\r\n *\r\n * For more information on how SVG filters work, refer to\r\n * [this MDN tutorial](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_Filters_Tutorial).\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { BaseObject } from \"../../Base\";\r\nimport { getGhostPaper } from \"../Paper\";\r\nimport { Animation, AnimationDisposer } from \"../../utils/Animation\";\r\nimport { List } from \"../../utils/List\";\r\nimport * as $object from \"../../utils/Object\";\r\nimport * as $iter from \"../../utils/Iterator\";\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Base filter class.\r\n *\r\n * This class while can be instantiated will not do anything. It is just a base\r\n * functionality for any other \"real\" filters to extend.\r\n *\r\n * Filters can be used to decorate, change and transform just about any DOM\r\n * element.\r\n *\r\n * A Filter works by applying one or more effects (primitives) to SVG element.\r\n *\r\n * For more information on how SVG filters work, refer to\r\n * [this MDN tutorial](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_Filters_Tutorial).\r\n *\r\n * @todo Example\r\n */\r\nvar Filter = /** @class */ (function (_super) {\r\n __extends(Filter, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Filter() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * A storage for Filter property/value pairs.\r\n *\r\n * @ignore Exclude from docs\r\n * @see {@link FilterProperties}\r\n */\r\n _this.properties = {};\r\n /**\r\n * Identifies if this object is a \"template\" and should not be treated as\r\n * real object that is drawn or actually used in the chart.\r\n */\r\n _this.isTemplate = false;\r\n /**\r\n * [_scale description]\r\n *\r\n * @todo Description\r\n */\r\n _this._scale = 1;\r\n /**\r\n * [_nonScaling description]\r\n *\r\n * @todo Description\r\n */\r\n _this._nonScaling = true;\r\n _this.className = \"Filter\";\r\n // Create a list to hold primitives (effect elements)\r\n _this.filterPrimitives = new List();\r\n _this.properties.filterUnits = \"objectBoundingBox\";\r\n // Automatically add added primitives to `_disposers` so they are discarded\r\n // when Filter object is destroyed (disposed)\r\n _this.filterPrimitives.events.on(\"inserted\", function (ev) {\r\n _this._disposers.push(ev.newValue);\r\n });\r\n // Set default dimensions\r\n _this.width = 120;\r\n _this.height = 120;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Appends actual filter elements to the filter group.\r\n *\r\n * @ignore Exclude from docs\r\n * @param filterElement An SVG `` element to add filter element to\r\n */\r\n Filter.prototype.appendPrimitives = function (filterElement) {\r\n $iter.each(this.filterPrimitives.iterator(), function (filterPrimitive) {\r\n filterElement.add(filterPrimitive);\r\n });\r\n };\r\n /**\r\n * Uses Transitions filter's values from current to target. This is used to\r\n * smoothly appear filter, rather than it pop into effect.\r\n *\r\n * @ignore Exclude from docs\r\n * @param animationOptions Animation options\r\n * @param duration Duration in milliseconds\r\n * @param easing Easing function\r\n * @return Animation instance\r\n */\r\n Filter.prototype.animate = function (animationOptions, duration, easing) {\r\n var animation = new Animation(this, animationOptions, duration, easing).start();\r\n return animation;\r\n };\r\n Object.defineProperty(Filter.prototype, \"width\", {\r\n /**\r\n * @return Width (%)\r\n */\r\n get: function () {\r\n return this.properties[\"width\"];\r\n },\r\n /**\r\n * Width of the filter element in percent.\r\n *\r\n * If the filter is designed to \"bleed out\" of the original target element,\r\n * like for example a shadow, you need this bigger than 100, or the\r\n * non-fitting parts will be clipped.\r\n *\r\n * @default 120\r\n * @param value Width (px)\r\n */\r\n set: function (value) {\r\n this.properties[\"width\"] = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Filter.prototype, \"height\", {\r\n /**\r\n * @return Height\r\n */\r\n get: function () {\r\n return this.properties[\"height\"];\r\n },\r\n /**\r\n * Height of the filter element in percent.\r\n *\r\n * If the filter is designed to \"bleed out\" of the original target element,\r\n * like for example a shadow, you need this bigger than 100, or the\r\n * non-fitting parts will be clipped.\r\n *\r\n * @default 120\r\n * @param value Height (%)\r\n */\r\n set: function (value) {\r\n this.properties[\"height\"] = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies properties from another [[Filter]] object.\r\n *\r\n * @param filter Source [[Filter]] object\r\n */\r\n Filter.prototype.copyFrom = function (filter) {\r\n var _this = this;\r\n _super.prototype.copyFrom.call(this, filter);\r\n $object.each(filter.properties, function (key, value) {\r\n _this[key] = value;\r\n });\r\n };\r\n Object.defineProperty(Filter.prototype, \"paper\", {\r\n /**\r\n * @return Paper\r\n */\r\n get: function () {\r\n if (this._paper) {\r\n return this._paper;\r\n }\r\n return getGhostPaper();\r\n },\r\n /**\r\n * Sets [[Paper]] instance to create filter's elements in.\r\n *\r\n * @ignore Exclude from docs\r\n * @param paper Paper\r\n */\r\n set: function (paper) {\r\n if (this._paper != paper) {\r\n this._paper = paper;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Filter.prototype, \"animations\", {\r\n /**\r\n * All animations currently in play.\r\n *\r\n * @ignore Exclude from docs\r\n * @return List of animations\r\n */\r\n get: function () {\r\n if (!this._animations) {\r\n this._animations = [];\r\n this._disposers.push(new AnimationDisposer(this._animations));\r\n }\r\n return this._animations;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Filter.prototype, \"scale\", {\r\n /**\r\n * @ignore Exclude from docs\r\n */\r\n get: function () {\r\n return this._scale;\r\n },\r\n /**\r\n * [[Sprite]] uses this method to inform filter about it's scale.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n set: function (value) {\r\n this._scale = value;\r\n this.updateScale();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates filter properties which depend on scale.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Filter.prototype.updateScale = function () {\r\n // Dummy method for extending classes to override.\r\n };\r\n Object.defineProperty(Filter.prototype, \"filterUnits\", {\r\n /**\r\n * @return Filter units\r\n */\r\n get: function () {\r\n return this.properties.filterUnits;\r\n },\r\n /**\r\n * Which units are used when drawing filter.\r\n *\r\n * Use `\"userSpaceOnUse\"` when applying filters on a perfectly straight line.\r\n *\r\n * @since 4.9.17\r\n * @default objectBoundingBox\r\n * @param value Filter units\r\n */\r\n set: function (value) {\r\n this.properties.filterUnits = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Filter.prototype, \"nonScaling\", {\r\n /**\r\n * @return Non scaling?\r\n */\r\n get: function () {\r\n return this._nonScaling;\r\n },\r\n /**\r\n * If a filter is non scaling, it will look the same even if the sprite is\r\n * scaled, otherwise filter will scale together with a [[Sprite]].\r\n *\r\n * @default false\r\n * @param value Non scaling?\r\n */\r\n set: function (value) {\r\n this._nonScaling = value;\r\n if (!value) {\r\n this._scale = 1;\r\n }\r\n this.updateScale();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Filter.prototype, \"sprite\", {\r\n /**\r\n * A target element this filter is currently attached to.\r\n *\r\n * We need to keep track of it because one filter can be used for just one\r\n * element, so we have to remove it from the old \"parent\" when attaching to\r\n * the new one.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Target element\r\n */\r\n set: function (value) {\r\n this.setSprite(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets filter's target element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Element filter is being attached to\r\n */\r\n Filter.prototype.setSprite = function (value) {\r\n if (this._sprite && this._sprite != value) {\r\n this._sprite.filters.removeValue(this);\r\n }\r\n this._sprite = value;\r\n };\r\n return Filter;\r\n}(BaseObject));\r\nexport { Filter };\r\n//# sourceMappingURL=Filter.js.map","/**\r\n * Module for \"Drop Shadow\" filter.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Filter } from \"./Filter\";\r\nimport { color } from \"../../utils/Color\";\r\nimport { registry } from \"../../Registry\";\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creats a \"Drop Shadow\" filter.\r\n */\r\nvar DropShadowFilter = /** @class */ (function (_super) {\r\n __extends(DropShadowFilter, _super);\r\n /**\r\n * Constructor\r\n */\r\n function DropShadowFilter() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"DropShadowFilter\";\r\n // Create elements\r\n // NOTE: we do not need to add each individual element to `_disposers`\r\n // because `filterPrimitives` has an event handler which automatically adds\r\n // anything added to it to `_disposers`\r\n _this.color = color(\"#000\");\r\n _this.feGaussianBlur = _this.paper.add(\"feGaussianBlur\");\r\n _this.feGaussianBlur.attr({ \"result\": \"blurOut\", \"in\": \"SourceGraphic\" });\r\n _this.filterPrimitives.push(_this.feGaussianBlur);\r\n _this.feOffset = _this.paper.add(\"feOffset\");\r\n _this.feOffset.attr({ \"result\": \"offsetBlur\" });\r\n _this.filterPrimitives.push(_this.feOffset);\r\n _this.feFlood = _this.paper.add(\"feFlood\");\r\n _this.feFlood.attr({ \"flood-color\": _this.color });\r\n _this.filterPrimitives.push(_this.feFlood);\r\n _this.feComposite = _this.paper.add(\"feComposite\");\r\n _this.feComposite.attr({ \"in2\": \"offsetBlur\", operator: \"in\" });\r\n _this.filterPrimitives.push(_this.feComposite);\r\n _this.feMerge = _this.paper.addGroup(\"feMerge\");\r\n _this.feMerge.add(_this.paper.add(\"feMergeNode\"));\r\n _this.feMerge.add(_this.paper.add(\"feMergeNode\").attr({ \"in\": \"SourceGraphic\" }));\r\n _this.filterPrimitives.push(_this.feMerge);\r\n // Set default properties\r\n _this.width = 200;\r\n _this.height = 200;\r\n _this.blur = 1.5;\r\n _this.dx = 3;\r\n _this.dy = 3;\r\n _this.opacity = 0.5;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(DropShadowFilter.prototype, \"color\", {\r\n /**\r\n * @return Color\r\n */\r\n get: function () {\r\n return this.properties.color;\r\n },\r\n /**\r\n * Shadow color.\r\n *\r\n * @param value Color\r\n */\r\n set: function (value) {\r\n this.properties.color = value;\r\n if (this.feFlood) {\r\n this.feFlood.attr({ \"flood-color\": value });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DropShadowFilter.prototype, \"opacity\", {\r\n /**\r\n * @return Opacity (0-1)\r\n */\r\n get: function () {\r\n return this.properties.opacity;\r\n },\r\n /**\r\n * Opacity of the shadow. (0-1)\r\n *\r\n * @param value Opacity (0-1)\r\n */\r\n set: function (value) {\r\n this.properties.opacity = value;\r\n this.feFlood.attr({ \"flood-opacity\": value });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DropShadowFilter.prototype, \"dx\", {\r\n /**\r\n * @return Horizontal offset (px)\r\n */\r\n get: function () {\r\n return this.properties.dx;\r\n },\r\n /**\r\n * Horizontal offset in pixels.\r\n *\r\n * @param value Horizontal offset (px)\r\n */\r\n set: function (value) {\r\n this.properties.dx = value;\r\n this.feOffset.attr({ \"dx\": value / this.scale });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DropShadowFilter.prototype, \"dy\", {\r\n /**\r\n * @return Vertical offset (px)\r\n */\r\n get: function () {\r\n return this.properties.dy;\r\n },\r\n /**\r\n * Vertical offset in pixels.\r\n *\r\n * @param value Vertical offset (px)\r\n */\r\n set: function (value) {\r\n this.properties.dy = value;\r\n this.feOffset.attr({ \"dy\": value / this.scale });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DropShadowFilter.prototype, \"blur\", {\r\n /**\r\n * @return Blur\r\n */\r\n get: function () {\r\n return this.properties.blur;\r\n },\r\n /**\r\n * Blur.\r\n *\r\n * @param value Blur\r\n */\r\n set: function (value) {\r\n this.properties.blur = value;\r\n this.feGaussianBlur.attr({ \"stdDeviation\": value / this.scale });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * [updateScale description]\r\n *\r\n * @todo Description\r\n */\r\n DropShadowFilter.prototype.updateScale = function () {\r\n this.dx = this.dx;\r\n this.dy = this.dy;\r\n this.blur = this.blur;\r\n };\r\n return DropShadowFilter;\r\n}(Filter));\r\nexport { DropShadowFilter };\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[\"DropShadowFilter\"] = DropShadowFilter;\r\n//# sourceMappingURL=DropShadowFilter.js.map","/**\r\n * Provides functionality used to creating and showing tooltips (balloons).\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../Container\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { PointedRectangle } from \"./PointedRectangle\";\r\nimport { Label } from \"../elements/Label\";\r\nimport { Animation } from \"../utils/Animation\";\r\nimport { color } from \"../utils/Color\";\r\nimport { DropShadowFilter } from \"../rendering/filters/DropShadowFilter\";\r\nimport * as $math from \"../utils/Math\";\r\nimport * as $ease from \"../utils/Ease\";\r\nimport * as $utils from \"../utils/Utils\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Tooltip displays text and/or multimedia information in a balloon over chart\r\n * area.\r\n * @see {@link ITooltipEvents} for a list of available events\r\n * @see {@link ITooltipAdapters} for a list of available Adapters\r\n */\r\nvar Tooltip = /** @class */ (function (_super) {\r\n __extends(Tooltip, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Tooltip() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Holds numeric boundary values. Calculated from the `boundingContainer`.\r\n * @ignore\r\n */\r\n _this._boundingRect = { x: -40000, y: -40000, width: 80000, height: 80000 };\r\n /**\r\n * Coordinates tooltip's pointer (stem) should point to.\r\n */\r\n _this._pointTo = { x: 0, y: 0 };\r\n /**\r\n * If set to `true` the pointer/stem of the Tooltip will not go outside\r\n * Tooltip's width or height depending on pointer's orientation.\r\n *\r\n * @default false\r\n */\r\n _this.fitPointerToBounds = false;\r\n /**\r\n * If `tooltipOrientation` is vertical, it can be drawn below or above point\r\n * We need to know this when solving overlapping.\r\n */\r\n _this._verticalOrientation = \"up\";\r\n _this.className = \"Tooltip\";\r\n _this.isMeasured = false;\r\n _this.getFillFromObject = true;\r\n _this.margin(5, 5, 5, 5);\r\n _this.defaultState.transitionDuration = 1;\r\n _this.hiddenState.transitionDuration = 1;\r\n // Create chrome/background\r\n var background = _this.background;\r\n background.interactionsEnabled = false;\r\n background.fillOpacity = 0.9;\r\n background.strokeWidth = 1;\r\n background.strokeOpacity = 1;\r\n background.stroke = color(\"#ffffff\");\r\n background.cornerRadius = 3;\r\n background.pointerLength = 6;\r\n background.pointerBaseWidth = 10;\r\n var dropShadow = new DropShadowFilter();\r\n dropShadow.dy = 1;\r\n dropShadow.dx = 1;\r\n dropShadow.opacity = 0.5;\r\n background.filters.push(dropShadow);\r\n _this.autoTextColor = true;\r\n // Create text element\r\n var label = _this.createChild(Label);\r\n label.shouldClone = false;\r\n _this.label = label;\r\n label.padding(7, 12, 4, 12);\r\n label.interactionsEnabled = false;\r\n label.horizontalCenter = \"middle\";\r\n label.fill = color(\"#ffffff\");\r\n _this._disposers.push(label);\r\n _this.label.events.on(\"sizechanged\", _this.drawBackground, _this);\r\n _this.label.zIndex = 1; // @todo remove this line when bg sorting is solved\r\n // Set defaults\r\n _this.pointerOrientation = \"vertical\";\r\n _this.animationDuration = 0;\r\n _this.animationEasing = $ease.cubicOut;\r\n _this.setPropertyValue(\"showInViewport\", false);\r\n // Set accessibility options\r\n _this.role = \"tooltip\";\r\n _this.visible = false;\r\n _this.opacity = 0;\r\n _this.x = 0;\r\n _this.y = 0;\r\n _this.events.on(\"visibilitychanged\", _this.handleVisibility, _this);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Tooltip.prototype.handleVisibility = function () {\r\n if (this.visible) {\r\n this.label.invalidate();\r\n }\r\n };\r\n Object.defineProperty(Tooltip.prototype, \"getStrokeFromObject\", {\r\n /**\r\n * Specifies if tooltip background should get stroke color from the sprite it is pointing to.\r\n *\r\n * @return {boolean}\r\n * @default false\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"getStrokeFromObject\");\r\n },\r\n /**\r\n * Specifies if tooltip background should get stroke color from the sprite it is pointing to.\r\n *\r\n * @param value boolean\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"getStrokeFromObject\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"autoTextColor\", {\r\n /**\r\n * @return {boolean}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"autoTextColor\");\r\n },\r\n /**\r\n * Specifies if text color should be chosen automatically for a better\r\n * readability.\r\n *\r\n * IMPORTANT: this feature is generally ignored, if `getFillFromObject = false`.\r\n *\r\n * If inheriting of `fill` color from object tooltip is displayed for is\r\n * disabled, this feature will not work. If you are explicitly setting a\r\n * color for tooltip background, you may set a color for its label as well\r\n * using `tooltip.label.fill` property.\r\n *\r\n *\r\n * @param value boolean\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"autoTextColor\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"keepTargetHover\", {\r\n /**\r\n * @return Keep target hovered?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"keepTargetHover\");\r\n },\r\n /**\r\n * If this tooltip is displayed on hover on some other object, keep that\r\n * element hovered if hovering on the tooltip.\r\n *\r\n * @default false\r\n * @since 4.1.13\r\n * @param value Keep target hovered?\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this.setPropertyValue(\"keepTargetHover\", value, true)) {\r\n if (value) {\r\n this.hoverable = true;\r\n this.background.interactionsEnabled = true;\r\n this._disposers.push(this.events.on(\"over\", function (ev) {\r\n if (_this.targetSprite && _this.targetSprite.hoverable) {\r\n _this.targetSprite.isHover = true;\r\n }\r\n }));\r\n this._disposers.push(this.events.on(\"out\", function (ev) {\r\n if (_this.targetSprite && _this.targetSprite.hoverable) {\r\n //this.hideTooltip();\r\n //this.targetSprite.handleOut();\r\n _this.targetSprite.isHover = false;\r\n }\r\n }));\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"showInViewport\", {\r\n /**\r\n * @return Force showing tooltip?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"showInViewport\");\r\n },\r\n /**\r\n * Normally, a tooltip will hide itself if it is pointing to a coordinate\r\n * that is outside viewport.\r\n *\r\n * Setting this setting to `true` will override that and make tooltip\r\n * appear next to the viewport edge closest to the target point.\r\n *\r\n * @default false\r\n * @since 4.5.7\r\n * @param value Force showing tooltip?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"showInViewport\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"getFillFromObject\", {\r\n /**\r\n * Specifies if tooltip background should get fill color from the sprite it is pointing to.\r\n *\r\n * @return {boolean}\r\n * @default true\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"getFillFromObject\");\r\n },\r\n /**\r\n * @param value boolean\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"getFillFromObject\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates and returns a background element.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Background\r\n */\r\n Tooltip.prototype.createBackground = function () {\r\n return new PointedRectangle();\r\n };\r\n Object.defineProperty(Tooltip.prototype, \"pointerOrientation\", {\r\n /**\r\n * @return Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"pointerOrientation\");\r\n },\r\n /**\r\n * Pointer orientation: `\"horizontal\"`, `\"vertical\"`, `\"up\"`, `\"down\"`,\r\n * `\"right\"`, or `\"left\"`.\r\n *\r\n * Options`\"horizontal\"` or `\"vertical\"` are location-aware, meaning they\r\n * will change position of the Tooltip based on the target point's position\r\n * in relation to chart center.\r\n *\r\n * Options `\"up\"`, `\"down\"`, `\"right\"`, `\"left\"` are static and will point\r\n * in the specified direction regardless of the position, even if that means\r\n * going out of chart/screen bounds.\r\n *\r\n * IMPORTANT: in some situations, like having multiple tooltips stacked for\r\n * multiple series, the `\"up\"` and `\"down\"` values might be ignored in order\r\n * to make tooltip overlap algorithm work.\r\n *\r\n * @default \"vertical\"\r\n * @param value Orientation\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"pointerOrientation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"animationDuration\", {\r\n /**\r\n * @return Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"animationDuration\");\r\n },\r\n /**\r\n * Duration in milliseconds for the animation to take place when the tooltip\r\n * is moving from one place to another.\r\n *\r\n * @default 0\r\n * @param value number\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"animationDuration\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"animationEasing\", {\r\n /**\r\n * @return {Function}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"animationEasing\");\r\n },\r\n /**\r\n * Tooltip animation (moving from one place to another) easing function.\r\n *\r\n * @default $ease.cubicOut\r\n * @param value (value: number) => number\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"animationEasing\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"html\", {\r\n /**\r\n * @return HTML content\r\n */\r\n get: function () {\r\n return this.label.html;\r\n },\r\n /**\r\n * HTML content for the Tooltip.\r\n *\r\n * Provided value will be used as is, without applying any further\r\n * formatting to it.\r\n *\r\n * @param value HTML content\r\n */\r\n set: function (value) {\r\n if (this.label.html != value) {\r\n this.label.html = value;\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"text\", {\r\n /**\r\n * @return SVG text\r\n */\r\n get: function () {\r\n return this.label.text;\r\n },\r\n /**\r\n * SVG text content for the Tooltip.\r\n *\r\n * Text can have a number of formatting options supported by\r\n * [[TextFormatter]].\r\n *\r\n * @param value SVG text\r\n */\r\n set: function (value) {\r\n if (this.label.text != value) {\r\n this.label.text = value;\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates the Tooltip.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Tooltip.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var label = this.label;\r\n if (label.invalid) {\r\n label.validate();\r\n }\r\n var x = this._pointTo.x;\r\n var y = this._pointTo.y;\r\n var boundingRect = this._boundingRect;\r\n var textW = label.measuredWidth;\r\n var textH = label.measuredHeight;\r\n var pointerLength = this.background.pointerLength;\r\n var textX;\r\n var textY;\r\n // try to handle if text is wider than br\r\n if (textW > boundingRect.width) {\r\n // TODO maybe this isn't needed ?\r\n $utils.spritePointToDocument({ x: boundingRect.x, y: boundingRect.y }, this.parent);\r\n var p1 = $utils.spritePointToDocument({ x: boundingRect.x + boundingRect.width, y: boundingRect.y + boundingRect.height }, this.parent);\r\n var documentWidth = document.body.offsetWidth;\r\n // TODO maybe this isn't needed ?\r\n $utils.used(document.body.offsetHeight);\r\n if (p1.x > documentWidth / 2) {\r\n boundingRect.x = boundingRect.width - textW;\r\n }\r\n else {\r\n boundingRect.width = boundingRect.x + textW;\r\n }\r\n }\r\n var pointerOrientation = this.pointerOrientation;\r\n // horizontal\r\n if (pointerOrientation == \"horizontal\" || pointerOrientation == \"left\" || pointerOrientation == \"right\") {\r\n textY = -textH / 2;\r\n if (pointerOrientation == \"horizontal\") {\r\n if (x > boundingRect.x + boundingRect.width / 2) {\r\n textX = -textW / 2 - pointerLength;\r\n }\r\n else {\r\n textX = textW / 2 + pointerLength;\r\n }\r\n }\r\n else if (pointerOrientation == \"left\") {\r\n textX = textW / 2 + pointerLength;\r\n }\r\n else {\r\n textX = -textW / 2 - pointerLength;\r\n }\r\n }\r\n // vertical pointer\r\n else {\r\n textX = $math.fitToRange(0, boundingRect.x - x + textW / 2, boundingRect.x - x + boundingRect.width - textW / 2);\r\n if (pointerOrientation == \"vertical\") {\r\n if (y > boundingRect.y + textH + pointerLength) {\r\n textY = -textH - pointerLength;\r\n this._verticalOrientation = \"up\";\r\n }\r\n else {\r\n textY = pointerLength;\r\n this._verticalOrientation = \"down\";\r\n }\r\n }\r\n else if (pointerOrientation == \"down\") {\r\n textY = -textH - pointerLength;\r\n this._verticalOrientation = \"up\";\r\n }\r\n else {\r\n textY = pointerLength;\r\n this._verticalOrientation = \"down\";\r\n }\r\n }\r\n textY = $math.fitToRange(textY, boundingRect.y - y, boundingRect.y + boundingRect.height - textH - y);\r\n label.x = textX;\r\n label.y = textY;\r\n this.drawBackground();\r\n };\r\n /**\r\n * Overrides functionality from the superclass.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Tooltip.prototype.updateBackground = function () {\r\n this.group.addToBack(this.background.group);\r\n };\r\n /**\r\n * Draws Tooltip background (chrome, background and pointer/stem).\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Tooltip.prototype.drawBackground = function () {\r\n var label = this.label;\r\n var background = this.background;\r\n var textWidth = label.measuredWidth;\r\n var textHeight = label.measuredHeight;\r\n var boundingRect = this._boundingRect;\r\n var bgWidth = textWidth;\r\n var bgX = label.pixelX - textWidth / 2;\r\n var bgHeight = textHeight;\r\n var bgY = label.pixelY;\r\n var x = this._pointTo.x;\r\n var y = this._pointTo.y;\r\n var boundX1 = boundingRect.x - x;\r\n var boundX2 = boundX1 + boundingRect.width;\r\n var boundY1 = boundingRect.y - y;\r\n var boundY2 = boundY1 + boundingRect.height;\r\n background.x = bgX;\r\n background.y = bgY;\r\n background.width = bgWidth;\r\n background.height = bgHeight;\r\n if (this.fitPointerToBounds) {\r\n background.pointerX = $math.fitToRange(-background.x, boundX1 - background.x, boundX2 - background.x);\r\n background.pointerY = $math.fitToRange(-background.y, boundY1 - background.y, boundY2 - background.y);\r\n }\r\n else {\r\n background.pointerX = -background.x;\r\n background.pointerY = -background.y;\r\n }\r\n background.validate();\r\n };\r\n /**\r\n *\r\n */\r\n Tooltip.prototype.delayedPointTo = function (point, instantly) {\r\n var _this = this;\r\n if (this._pointToDisposer) {\r\n this._pointToDisposer.dispose();\r\n }\r\n this._pointToDisposer = registry.events.once(\"exitframe\", function () {\r\n _this.pointTo(point, instantly);\r\n });\r\n this.addDisposer(this._pointToDisposer);\r\n };\r\n /**\r\n * Set nes tooltip's anchor point and moves whole tooltip.\r\n *\r\n * @param x X coordinate\r\n * @param y Y coordinate\r\n */\r\n Tooltip.prototype.pointTo = function (point, instantly) {\r\n if (this._pointTo.x != point.x || this._pointTo.y != point.y) {\r\n this._pointTo = point;\r\n this.invalidate();\r\n // this helps to avoid strange animation from nowhere on initial show or when balloon was hidden already\r\n if (!this.visible || instantly) {\r\n this.moveTo(this._pointTo);\r\n if (this._animation) {\r\n this._animation.kill();\r\n }\r\n }\r\n else {\r\n // helps to avoid flicker on top/left corner\r\n if (this.pixelX == 0 && this.pixelY == 0) {\r\n this.moveTo(this._pointTo);\r\n }\r\n else {\r\n if (this._animation) {\r\n this._animation.kill();\r\n }\r\n this._animation = new Animation(this, [{ property: \"x\", to: point.x, from: this.pixelX }, { property: \"y\", to: point.y, from: this.pixelY }], this.animationDuration, this.animationEasing).start();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Sets numeric boundaries Tooltip needs to obey (so it does not go outside\r\n * specific area).\r\n *\r\n * @ignore Exclude from docs\r\n * @param rectangle Boundary rectangle\r\n */\r\n Tooltip.prototype.setBounds = function (rectangle) {\r\n var oldRect = this._boundingRect;\r\n if (oldRect.x != rectangle.x || oldRect.y != rectangle.y || oldRect.width != rectangle.width || oldRect.height != rectangle.height) {\r\n this._boundingRect = rectangle;\r\n this.invalidate();\r\n }\r\n };\r\n Object.defineProperty(Tooltip.prototype, \"boundingContainer\", {\r\n /**\r\n * Sets a [[Container]] instance to be used when calculating numeric\r\n * boundaries for the Tooltip.\r\n *\r\n * @ignore Exclude from docs\r\n * @param container Boundary container\r\n */\r\n set: function (container) {\r\n this._boundingContainer = container;\r\n // TODO remove closures ?\r\n container.events.on(\"sizechanged\", this.updateBounds, this);\r\n container.events.on(\"positionchanged\", this.updateBounds, this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates numeric boundaries for the Tooltip, based on the\r\n * `boundingCountrainer`.\r\n */\r\n Tooltip.prototype.updateBounds = function () {\r\n var boundingContainer = this._boundingContainer;\r\n // to global\r\n var rect = $utils.spriteRectToSvg({\r\n x: boundingContainer.pixelX,\r\n y: boundingContainer.pixelY,\r\n width: boundingContainer.maxWidth,\r\n height: boundingContainer.maxHeight\r\n }, boundingContainer);\r\n this.setBounds(rect);\r\n };\r\n Object.defineProperty(Tooltip.prototype, \"verticalOrientation\", {\r\n /**\r\n * If tooltipOrientation is vertical, it can be drawn below or above point.\r\n * We need to know this when solving overlapping.\r\n *\r\n * @ignore Exclude from docs\r\n * @return \"up\" | \"down\"\r\n */\r\n get: function () {\r\n return this._verticalOrientation;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tooltip.prototype, \"tooltip\", {\r\n /**\r\n * To avoid stackoverflow\r\n * @ignore\r\n */\r\n get: function () {\r\n return undefined;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies properties and other attributes.\r\n *\r\n * @param source Source\r\n */\r\n Tooltip.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.label.copyFrom(source.label);\r\n if (source._boundingRect) {\r\n this._boundingRect = source._boundingRect;\r\n }\r\n };\r\n /**\r\n * Adds easing functions to \"function\" fields.\r\n *\r\n * @param field Field name\r\n * @return Assign as function?\r\n */\r\n Tooltip.prototype.asFunction = function (field) {\r\n return field == \"animationEasing\" || _super.prototype.asIs.call(this, field);\r\n };\r\n return Tooltip;\r\n}(Container));\r\nexport { Tooltip };\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[\"Tooltip\"] = Tooltip;\r\n//# sourceMappingURL=Tooltip.js.map","/**\r\n * Functionality for drawing a trapezoid.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $utils from \"../utils/Utils\";\r\nimport * as $type from \"../utils/Type\";\r\nimport * as $path from \"../rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to draw a Trapezoid.\r\n *\r\n * @see {@link ITrapezoidEvents} for a list of available events\r\n * @see {@link ITrapezoidAdapters} for a list of available Adapters\r\n */\r\nvar Trapezoid = /** @class */ (function (_super) {\r\n __extends(Trapezoid, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Trapezoid() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Trapezoid\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.topSide = percent(100);\r\n _this.bottomSide = percent(100);\r\n _this.leftSide = percent(100);\r\n _this.rightSide = percent(100);\r\n _this.isMeasured = false; // todo: add measureElement\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Trapezoid.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var w = this.pixelWidth;\r\n var h = this.pixelHeight;\r\n var ts = $utils.relativeToValue(this.topSide, w);\r\n var bs = $utils.relativeToValue(this.bottomSide, w);\r\n var ls = $utils.relativeToValue(this.leftSide, h);\r\n var rs = $utils.relativeToValue(this.rightSide, h);\r\n // 1----2\r\n // | |\r\n // 4----3\r\n var x0 = (w - ts) / 2;\r\n var y0 = (h - ls) / 2;\r\n var x1 = w - (w - ts) / 2;\r\n var y1 = (h - rs) / 2;\r\n var x2 = w - (w - bs) / 2;\r\n var y2 = h - (h - rs) / 2;\r\n var x3 = (w - bs) / 2;\r\n var y3 = h - (h - ls) / 2;\r\n var mt = \"\";\r\n var mr = \"\";\r\n var mb = \"\";\r\n var ml = \"\";\r\n if ($type.hasValue(this.horizontalNeck)) {\r\n var hn = this.horizontalNeck.value;\r\n mt = $path.lineTo({ x: w * hn, y: Math.max(y0, y1) });\r\n mb = $path.lineTo({ x: w * hn, y: Math.min(y2, y3) });\r\n }\r\n if ($type.hasValue(this.verticalNeck)) {\r\n var vn = this.verticalNeck.value;\r\n mr = $path.lineTo({ x: Math.min(x1, x2), y: h * vn });\r\n ml = $path.lineTo({ x: Math.max(x0, x3), y: h * vn });\r\n }\r\n var path = $path.moveTo({ x: x0, y: y0 })\r\n + mt\r\n + $path.lineTo({ x: x1, y: y1 })\r\n + mr\r\n + $path.lineTo({ x: x2, y: y2 })\r\n + mb\r\n + $path.lineTo({ x: x3, y: y3 })\r\n + ml;\r\n this.path = path;\r\n };\r\n Object.defineProperty(Trapezoid.prototype, \"topSide\", {\r\n /**\r\n * @return Width\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"topSide\");\r\n },\r\n /**\r\n * Wdith of the top side. Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(100)\r\n * @param value Width\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"topSide\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Trapezoid.prototype, \"bottomSide\", {\r\n /**\r\n * @return Width\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"bottomSide\");\r\n },\r\n /**\r\n * Wdith of the bottom side. Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(100)\r\n * @param value Width\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"bottomSide\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Trapezoid.prototype, \"leftSide\", {\r\n /**\r\n * @return Height\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"leftSide\");\r\n },\r\n /**\r\n * Height of the left side. Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(100)\r\n * @param value Height\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"leftSide\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Trapezoid.prototype, \"rightSide\", {\r\n /**\r\n * @return Height\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"rightSide\");\r\n },\r\n /**\r\n * Height of the right side. Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(100)\r\n * @param value Height\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"rightSide\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Trapezoid.prototype, \"horizontalNeck\", {\r\n /**\r\n * @return Horizontal neck position\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"horizontalNeck\");\r\n },\r\n /**\r\n * A relative vertical position of the \"neck\". If the top and bottom sides\r\n * are of different width, and `horizontalNeck` is set, a choke point\r\n * will be created at that position, creating a funnel shape.\r\n *\r\n * @param value Horizontal neck position\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"horizontalNeck\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Trapezoid.prototype, \"verticalNeck\", {\r\n /**\r\n * @return Vertical neck position\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"verticalNeck\");\r\n },\r\n /**\r\n * A relative horizontal position of the \"neck\". If the left and right sides\r\n * are of different height, and `verticalNeck` is set, a choke point\r\n * will be created at that position, creating a funnel shape.\r\n *\r\n * @param value Vertical neck position\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"verticalNeck\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Trapezoid;\r\n}(Sprite));\r\nexport { Trapezoid };\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[\"Trapezoid\"] = Trapezoid;\r\n//# sourceMappingURL=Trapezoid.js.map","/**\r\n * Functionality for drawing triangles.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../Sprite\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $path from \"../rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to draw a triangle.\r\n *\r\n * @see {@link ITriangleEvents} for a list of available events\r\n * @see {@link ITriangleAdapters} for a list of available Adapters\r\n */\r\nvar Triangle = /** @class */ (function (_super) {\r\n __extends(Triangle, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Triangle() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Triangle\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.direction = \"top\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Triangle.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var w = this.pixelWidth;\r\n var h = this.pixelHeight;\r\n var path;\r\n switch (this.direction) {\r\n case \"right\":\r\n path = $path.moveTo({ x: 0, y: 0 })\r\n + $path.lineTo({ x: w, y: h / 2 })\r\n + $path.lineTo({ x: 0, y: h })\r\n + $path.closePath();\r\n break;\r\n case \"left\":\r\n path = $path.moveTo({ x: w, y: 0 })\r\n + $path.lineTo({ x: 0, y: h / 2 })\r\n + $path.lineTo({ x: w, y: h })\r\n + $path.closePath();\r\n break;\r\n case \"bottom\":\r\n path = $path.moveTo({ x: 0, y: 0 })\r\n + $path.lineTo({ x: w, y: 0 })\r\n + $path.lineTo({ x: w / 2, y: h })\r\n + $path.closePath();\r\n break;\r\n case \"top\":\r\n path = $path.moveTo({ x: w / 2, y: 0 })\r\n + $path.lineTo({ x: w, y: h })\r\n + $path.lineTo({ x: 0, y: h })\r\n + $path.closePath();\r\n break;\r\n }\r\n this.path = path;\r\n };\r\n Object.defineProperty(Triangle.prototype, \"direction\", {\r\n /**\r\n * Returns direction of a triangle\r\n *\r\n * @return value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"direction\");\r\n },\r\n /**\r\n * Sets direction of a triangle\r\n *\r\n * @param value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"direction\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Triangle;\r\n}(Sprite));\r\nexport { Triangle };\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[\"Triangle\"] = Triangle;\r\n//# sourceMappingURL=Triangle.js.map","/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { registry } from \"../Registry\";\r\nimport * as $path from \"./Path\";\r\nimport * as $array from \"../utils/Array\";\r\nimport * as $utils from \"../utils/Utils\";\r\nimport * as $math from \"../utils/Math\";\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nvar Tension = /** @class */ (function () {\r\n /**\r\n * Constructor.\r\n *\r\n * @param tensionX [description]\r\n * @param tensionY [description]\r\n */\r\n function Tension(tensionX, tensionY) {\r\n this._tensionX = tensionX;\r\n this._tensionY = tensionY;\r\n }\r\n /**\r\n * [smooth description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param points [description]\r\n * @return [description]\r\n */\r\n Tension.prototype.smooth = function (points) {\r\n for (var i = points.length - 1; i > 0; i--) {\r\n var p0 = points[i];\r\n var p1 = points[i - 1];\r\n if (Math.abs(p0.x - p1.x) < 0.1 && Math.abs(p0.y - p1.y) < 0.1) {\r\n points.splice(i, 1);\r\n }\r\n }\r\n var tensionX = this._tensionX;\r\n var tensionY = this._tensionY;\r\n if (points.length < 3 || (tensionX >= 1 && tensionY >= 1)) {\r\n return $path.polyline(points);\r\n }\r\n var first = points[0];\r\n var last = points[points.length - 1];\r\n var closed = false;\r\n if ($math.round(first.x, 3) == $math.round(last.x) && $math.round(first.y) == $math.round(last.y)) {\r\n closed = true;\r\n }\r\n // Can't moveTo here, as it wont be possible to have fill then.\r\n var path = \"\";\r\n for (var i = 0, len = points.length - 1; i < len; i++) {\r\n var p0 = points[i - 1];\r\n var p1 = points[i];\r\n var p2 = points[i + 1];\r\n var p3 = points[i + 2];\r\n if (i === 0) {\r\n if (closed) {\r\n p0 = points[points.length - 2];\r\n }\r\n else {\r\n p0 = points[i];\r\n }\r\n }\r\n else if (i == points.length - 2) {\r\n if (closed) {\r\n p3 = points[1];\r\n }\r\n else {\r\n p3 = points[i + 1];\r\n }\r\n }\r\n var controlPointA = $math.getCubicControlPointA(p0, p1, p2, p3, tensionX, tensionY);\r\n var controlPointB = $math.getCubicControlPointB(p0, p1, p2, p3, tensionX, tensionY);\r\n path += $path.cubicCurveTo(p2, controlPointA, controlPointB);\r\n }\r\n return path;\r\n };\r\n return Tension;\r\n}());\r\nexport { Tension };\r\n/**\r\n * Returns a waved line SVG path between two points.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point1 Starting point\r\n * @param point2 Ending point\r\n * @param waveLength Wave length\r\n * @param waveHeight Wave height\r\n * @param adjustWaveLength Adjust wave length based on the actual line length\r\n * @return SVG path\r\n */\r\nexport function wavedLine(point1, point2, waveLength, waveHeight, tension, adjustWaveLength) {\r\n var x1 = point1.x;\r\n var y1 = point1.y;\r\n var x2 = point2.x;\r\n var y2 = point2.y;\r\n var distance = $math.getDistance(point1, point2);\r\n if (adjustWaveLength) {\r\n waveLength = distance / Math.round(distance / waveLength);\r\n }\r\n var d = registry.getCache($utils.stringify([\"wavedLine\", point1.x, point2.x, point1.y, point2.y, waveLength, waveHeight]));\r\n if (!d) {\r\n if (distance > 0) {\r\n var angle = Math.atan2(y2 - y1, x2 - x1);\r\n var cos = Math.cos(angle);\r\n var sin = Math.sin(angle);\r\n var waveLengthX = waveLength * cos;\r\n var waveLengthY = waveLength * sin;\r\n if (waveLength <= 1 || waveHeight <= 1) {\r\n d = $path.lineTo(point2);\r\n }\r\n else {\r\n var halfWaveCount = Math.round(2 * distance / waveLength);\r\n var points = [];\r\n var sign = 1;\r\n if (x2 < x1) {\r\n sign *= -1;\r\n }\r\n if (y2 < y1) {\r\n sign *= -1;\r\n }\r\n for (var i = 0; i <= halfWaveCount; i++) {\r\n sign *= -1;\r\n var x = x1 + i * waveLengthX / 2 + sign * waveHeight / 2 * sin;\r\n var y = y1 + i * waveLengthY / 2 - sign * waveHeight / 2 * cos;\r\n points.push({ x: x, y: y });\r\n }\r\n d = new Tension(tension, tension).smooth(points);\r\n }\r\n }\r\n else {\r\n d = \"\";\r\n }\r\n registry.setCache($utils.stringify([\"wavedLine\", point1.x, point2.x, point1.y, point2.y, waveLength, waveHeight]), d);\r\n }\r\n return d;\r\n}\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nvar Basis = /** @class */ (function () {\r\n /**\r\n * Constructor.\r\n *\r\n * @param info [description]\r\n */\r\n function Basis(info) {\r\n this._closed = info.closed;\r\n }\r\n /**\r\n * [smooth description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param points [description]\r\n * @return [description]\r\n */\r\n Basis.prototype.smooth = function (points) {\r\n var _this = this;\r\n var x0 = NaN;\r\n var x1 = NaN;\r\n var x2 = NaN;\r\n var x3 = NaN;\r\n var x4 = NaN;\r\n var y0 = NaN;\r\n var y1 = NaN;\r\n var y2 = NaN;\r\n var y3 = NaN;\r\n var y4 = NaN;\r\n var point = 0;\r\n var output = \"\";\r\n var pushCurve = function (x, y) {\r\n output += $path.cubicCurveTo({\r\n x: (x0 + 4 * x1 + x) / 6,\r\n y: (y0 + 4 * y1 + y) / 6\r\n }, {\r\n x: (2 * x0 + x1) / 3,\r\n y: (2 * y0 + y1) / 3\r\n }, {\r\n x: (x0 + 2 * x1) / 3,\r\n y: (y0 + 2 * y1) / 3\r\n });\r\n };\r\n var pushPoint = function (_a) {\r\n var x = _a.x, y = _a.y;\r\n switch (point) {\r\n case 0:\r\n point = 1;\r\n if (_this._closed) {\r\n x2 = x;\r\n y2 = y;\r\n }\r\n else {\r\n output += $path.lineTo({ x: x, y: y });\r\n }\r\n break;\r\n case 1:\r\n point = 2;\r\n if (_this._closed) {\r\n x3 = x;\r\n y3 = y;\r\n }\r\n break;\r\n case 2:\r\n point = 3;\r\n if (_this._closed) {\r\n x4 = x;\r\n y4 = y;\r\n output += $path.moveTo({ x: (x0 + 4 * x1 + x) / 6, y: (y0 + 4 * y1 + y) / 6 });\r\n break;\r\n }\r\n else {\r\n output += $path.lineTo({ x: (5 * x0 + x1) / 6, y: (5 * y0 + y1) / 6 });\r\n // fall-through\r\n }\r\n default:\r\n pushCurve(x, y);\r\n break;\r\n }\r\n x0 = x1;\r\n x1 = x;\r\n y0 = y1;\r\n y1 = y;\r\n };\r\n $array.each(points, pushPoint);\r\n if (this._closed) {\r\n switch (point) {\r\n case 1:\r\n output += $path.moveTo({ x: x2, y: y2 });\r\n output += $path.closePath();\r\n break;\r\n case 2:\r\n output += $path.moveTo({ x: (x2 + 2 * x3) / 3, y: (y2 + 2 * y3) / 3 });\r\n output += $path.lineTo({ x: (x3 + 2 * x2) / 3, y: (y3 + 2 * y2) / 3 });\r\n output += $path.closePath();\r\n break;\r\n case 3:\r\n pushPoint({ x: x2, y: y2 });\r\n pushPoint({ x: x3, y: y3 });\r\n pushPoint({ x: x4, y: y4 });\r\n break;\r\n }\r\n }\r\n else {\r\n switch (point) {\r\n case 3:\r\n pushCurve(x1, y1);\r\n // fall-through\r\n case 2:\r\n output += $path.lineTo({ x: x1, y: y1 });\r\n break;\r\n }\r\n output += $path.closePath();\r\n }\r\n return output;\r\n };\r\n return Basis;\r\n}());\r\nexport { Basis };\r\n//# sourceMappingURL=Smoothing.js.map","/**\r\n * Functionality for drawing waved circles.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Circle } from \"./Circle\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $path from \"../rendering/Path\";\r\nimport * as $math from \"../utils/Math\";\r\nimport * as $utils from \"../utils/Utils\";\r\nimport * as $smoothing from \"../../core/rendering/Smoothing\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a waved circle.\r\n *\r\n * @see {@link IWavedCircleEvents} for a list of available events\r\n * @see {@link IWavedCircleAdapters} for a list of available Adapters\r\n */\r\nvar WavedCircle = /** @class */ (function (_super) {\r\n __extends(WavedCircle, _super);\r\n /**\r\n * Constructor\r\n */\r\n function WavedCircle() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"WavedCircle\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.waveLength = 16;\r\n _this.waveHeight = 4;\r\n _this.fill = undefined;\r\n _this.fillOpacity = 0;\r\n _this.tension = 0.8;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the waved line.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n WavedCircle.prototype.draw = function () {\r\n var path = \"\";\r\n var radius = this.pixelRadius;\r\n if (radius > 0) {\r\n var points = this.getPoints(radius);\r\n path = $path.moveTo(points[0]) + new $smoothing.Tension(this.tension, this.tension).smooth(points);\r\n }\r\n var innerRadius = this.pixelInnerRadius;\r\n if (innerRadius > 0) {\r\n var points = this.getPoints(innerRadius);\r\n points.reverse();\r\n path += $path.moveTo(points[0]) + new $smoothing.Tension(this.tension, this.tension).smooth(points);\r\n }\r\n this.path = path;\r\n };\r\n /**\r\n * Returns points that circle consists of.\r\n *\r\n * @param radius Radius (px)\r\n * @return Points\r\n */\r\n WavedCircle.prototype.getPoints = function (radius) {\r\n var circleLength = radius * Math.PI * 2;\r\n var halfWaveHeight = this.waveHeight / 2;\r\n var waveLength = circleLength / Math.round(circleLength / this.waveLength);\r\n var halfWaveLength = waveLength / 2;\r\n var points = [];\r\n var count = circleLength / waveLength;\r\n for (var i = 0; i <= count; i++) {\r\n var angle1 = (i * waveLength) / circleLength * 360;\r\n var angle2 = (i * waveLength + halfWaveLength) / circleLength * 360;\r\n points.push({ x: (radius - halfWaveHeight) * $math.cos(angle1), y: (radius - halfWaveHeight) * $math.sin(angle1) });\r\n points.push({ x: (radius + halfWaveHeight) * $math.cos(angle2), y: (radius + halfWaveHeight) * $math.sin(angle2) });\r\n }\r\n points.pop();\r\n return points;\r\n };\r\n Object.defineProperty(WavedCircle.prototype, \"innerRadius\", {\r\n /**\r\n * @return Inner radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Inner radius of the circle in pixels (absolute) or [[Percent]] (relative).\r\n *\r\n * @param value Inner radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedCircle.prototype, \"pixelInnerRadius\", {\r\n /**\r\n * Calculated inner radius of the circle in pixels.\r\n *\r\n * @readonly\r\n * @return Inner radius (px)\r\n */\r\n get: function () {\r\n return $utils.relativeToValue(this.innerRadius, $math.min(this.innerWidth / 2, this.innerHeight / 2));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedCircle.prototype, \"waveLength\", {\r\n /**\r\n * @return Wave length (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"waveLength\");\r\n },\r\n /**\r\n * Wave length in pixels.\r\n *\r\n * @default 16\r\n * @param value Wave length (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"waveLength\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedCircle.prototype, \"waveHeight\", {\r\n /**\r\n * @return Wave height (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"waveHeight\");\r\n },\r\n /**\r\n * Wave height in pixels.\r\n *\r\n * @default 4\r\n * @param value Wave height (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"waveHeight\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedCircle.prototype, \"tension\", {\r\n /**\r\n * @return Tension\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tension\");\r\n },\r\n /**\r\n * Tension of the wave.\r\n *\r\n * @default 0.8\r\n * @param value Tension\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tension\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return WavedCircle;\r\n}(Circle));\r\nexport { WavedCircle };\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[\"WavedCircle\"] = WavedCircle;\r\n//# sourceMappingURL=WavedCircle.js.map","/**\r\n * Functionality for drawing waved lines.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Line } from \"./Line\";\r\nimport { color } from \"../utils/Color\";\r\nimport { wavedLine } from \"../rendering/Smoothing\";\r\nimport * as $path from \"../rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a waved line.\r\n *\r\n * @see {@link IWavedLineEvents} for a list of available events\r\n * @see {@link IWavedLineAdapters} for a list of available Adapters\r\n */\r\nvar WavedLine = /** @class */ (function (_super) {\r\n __extends(WavedLine, _super);\r\n /**\r\n * Constructor\r\n */\r\n function WavedLine() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"WavedLine\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.waveLength = 16;\r\n _this.waveHeight = 4;\r\n _this.tension = 0.8;\r\n _this.pixelPerfect = false;\r\n _this.fill = color();\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the waved line.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n WavedLine.prototype.draw = function () {\r\n //super.draw();\r\n var p1 = { x: this.x1, y: this.y1 };\r\n var p2 = { x: this.x2, y: this.y2 };\r\n this.path = $path.moveTo(p1) + wavedLine(p1, p2, this.waveLength, this.waveHeight, this.tension, true);\r\n };\r\n Object.defineProperty(WavedLine.prototype, \"waveLength\", {\r\n /**\r\n * @return Wave length (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"waveLength\");\r\n },\r\n /**\r\n * Wave length in pixels.\r\n *\r\n * @default 16\r\n * @param value Wave length (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"waveLength\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedLine.prototype, \"waveHeight\", {\r\n /**\r\n * @return Wave height (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"waveHeight\");\r\n },\r\n /**\r\n * Wave height in pixels.\r\n *\r\n * @default 4\r\n * @param value Wave height (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"waveHeight\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedLine.prototype, \"tension\", {\r\n /**\r\n * @return Tension\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tension\");\r\n },\r\n /**\r\n * Tension of the wave.\r\n *\r\n * @default 0.8\r\n * @param value Tension\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tension\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return WavedLine;\r\n}(Line));\r\nexport { WavedLine };\r\n//# sourceMappingURL=WavedLine.js.map","/**\r\n * Functionality for drawing rectangles with waved edges.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Rectangle } from \"./Rectangle\";\r\nimport { wavedLine } from \"../rendering/Smoothing\";\r\nimport * as $path from \"../rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a rectangle with waved edges.\r\n *\r\n * @see {@link IWavedRectangleEvents} for a list of available events\r\n * @see {@link IWavedRectangleAdapters} for a list of available Adapters\r\n */\r\nvar WavedRectangle = /** @class */ (function (_super) {\r\n __extends(WavedRectangle, _super);\r\n /**\r\n * Constructor\r\n */\r\n function WavedRectangle() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"WavedRectangle\";\r\n // Add path element\r\n _this.element = _this.paper.add(\"path\");\r\n // Set defaults\r\n _this.waveLength = 16;\r\n _this.waveHeight = 4;\r\n _this.tension = 0.8;\r\n _this.setPropertyValue(\"wavedLeft\", true);\r\n _this.setPropertyValue(\"wavedRight\", true);\r\n _this.setPropertyValue(\"wavedTop\", true);\r\n _this.setPropertyValue(\"wavedBottom\", true);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the waved rectangle.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n WavedRectangle.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var w = this.pixelWidth;\r\n var h = this.pixelHeight;\r\n if (w > 0 && h > 0) {\r\n var p1 = { x: 0, y: 0 };\r\n var p2 = { x: w, y: 0 };\r\n var p3 = { x: w, y: h };\r\n var p4 = { x: 0, y: h };\r\n var waveLengthH = Math.min(w, this.waveLength);\r\n var waveHeightH = Math.min(h, this.waveHeight);\r\n var waveLengthV = Math.min(h, this.waveLength);\r\n var waveHeightV = Math.min(w, this.waveHeight);\r\n var td = \"\";\r\n var rd = \"\";\r\n var bd = \"\";\r\n var ld = \"\";\r\n if (this.wavedTop) {\r\n td = wavedLine(p1, p2, waveLengthH, waveHeightH, this.tension, true);\r\n }\r\n if (this.wavedRight) {\r\n rd = wavedLine(p2, p3, waveLengthV, waveHeightV, this.tension, true);\r\n }\r\n if (this.wavedBottom) {\r\n bd = wavedLine(p3, p4, waveLengthH, waveHeightH, this.tension, true);\r\n }\r\n if (this.wavedLeft) {\r\n ld = wavedLine(p4, p1, waveLengthV, waveHeightV, this.tension, true);\r\n }\r\n this.path = $path.moveTo(p1) + td + $path.lineTo(p2) + rd + $path.lineTo(p3) + bd + $path.lineTo(p4) + ld + \"z\";\r\n }\r\n };\r\n Object.defineProperty(WavedRectangle.prototype, \"waveLength\", {\r\n /**\r\n * @return Wave length (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"waveLength\");\r\n },\r\n /**\r\n * Wave length in pixels.\r\n *\r\n * @default 16\r\n * @param value Wave length (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"waveLength\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedRectangle.prototype, \"waveHeight\", {\r\n /**\r\n * @return Wave height (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"waveHeight\");\r\n },\r\n /**\r\n * Wave height in pixels.\r\n *\r\n * @default 4\r\n * @param value Wave height (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"waveHeight\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets which side should be waved or not. If particular side is set to\r\n * `false`, a straight line will be drawn on that side.\r\n *\r\n * @param top Top waved?\r\n * @param right Right side waved?\r\n * @param bottom Bottom Waved?\r\n * @param left Left side waved?\r\n */\r\n WavedRectangle.prototype.setWavedSides = function (top, right, bottom, left) {\r\n this.wavedTop = top;\r\n this.wavedRight = right;\r\n this.wavedBottom = bottom;\r\n this.wavedLeft = left;\r\n };\r\n Object.defineProperty(WavedRectangle.prototype, \"tension\", {\r\n /**\r\n * @return Tension\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tension\");\r\n },\r\n /**\r\n * Tension of the wave.\r\n *\r\n * @default 0.8\r\n * @param value Tension\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tension\", value);\r\n this.invalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedRectangle.prototype, \"wavedRight\", {\r\n /**\r\n * @return Wave right side?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"wavedRight\");\r\n },\r\n /**\r\n * Specifies if right side should be waved.\r\n *\r\n * @default true\r\n * @param value Waved?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"wavedRight\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedRectangle.prototype, \"wavedLeft\", {\r\n /**\r\n * @return Wave left side?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"wavedLeft\");\r\n },\r\n /**\r\n * Specifies if left side should be waved.\r\n *\r\n * @default true\r\n * @param value Waved?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"wavedLeft\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedRectangle.prototype, \"wavedTop\", {\r\n /**\r\n * @return Wave top side?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"wavedTop\");\r\n },\r\n /**\r\n * Specifies if top side should be waved.\r\n *\r\n * @default true\r\n * @param value Waved?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"wavedTop\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WavedRectangle.prototype, \"wavedBottom\", {\r\n /**\r\n * @return Wave bottom side?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"wavedBottom\");\r\n },\r\n /**\r\n * Specifies if bottom side should be waved.\r\n *\r\n * @default true\r\n * @param value Waved?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"wavedBottom\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return WavedRectangle;\r\n}(Rectangle));\r\nexport { WavedRectangle };\r\n//# sourceMappingURL=WavedRectangle.js.map","/**\r\n * Zoom out button functionality.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Button } from \"./Button\";\r\nimport { Sprite } from \"../Sprite\";\r\nimport { registry } from \"../Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $path from \"../rendering/Path\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a zoom out button.\r\n *\r\n * @see {@link IZoomOutButtonEvents} for a list of available events\r\n * @see {@link IZoomOutButtonAdapters} for a list of available Adapters\r\n */\r\nvar ZoomOutButton = /** @class */ (function (_super) {\r\n __extends(ZoomOutButton, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ZoomOutButton() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"ZoomOutButton\";\r\n _this.padding(9, 9, 9, 9);\r\n //this.dx = - 5;\r\n //this.dy = 5;\r\n _this.showSystemTooltip = true;\r\n var interfaceColors = new InterfaceColorSet();\r\n var background = _this.background;\r\n background.cornerRadius(20, 20, 20, 20);\r\n background.fill = interfaceColors.getFor(\"primaryButton\");\r\n background.stroke = interfaceColors.getFor(\"primaryButtonStroke\");\r\n background.strokeOpacity = 0;\r\n background.states.getKey(\"hover\").properties.fill = interfaceColors.getFor(\"primaryButtonHover\");\r\n background.states.getKey(\"down\").properties.fill = interfaceColors.getFor(\"primaryButtonActive\");\r\n // Create an icon\r\n var icon = new Sprite();\r\n icon.element = _this.paper.add(\"path\");\r\n var path = $path.moveTo({ x: 0, y: 0 });\r\n path += $path.lineTo({ x: 11, y: 0 });\r\n icon.path = path;\r\n icon.pixelPerfect = true;\r\n icon.padding(8, 3, 8, 3);\r\n icon.stroke = interfaceColors.getFor(\"primaryButtonText\");\r\n _this.icon = icon;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n ZoomOutButton.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Zoom Out\");\r\n }\r\n };\r\n return ZoomOutButton;\r\n}(Button));\r\nexport { ZoomOutButton };\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[\"ZoomOutButton\"] = ZoomOutButton;\r\n//# sourceMappingURL=ZoomOutButton.js.map","/**\r\n * Play button functionality.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Button } from \"./Button\";\r\nimport { RoundedRectangle } from \"./RoundedRectangle\";\r\nimport { registry } from \"../Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { Triangle } from \"./Triangle\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a zoom out button.\r\n *\r\n * @see {@link IPlayButtonEvents} for a list of available events\r\n * @see {@link IPlayButtonAdapters} for a list of available Adapters\r\n */\r\nvar PlayButton = /** @class */ (function (_super) {\r\n __extends(PlayButton, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PlayButton() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"PlayButton\";\r\n _this.padding(12, 12, 12, 12);\r\n _this.showSystemTooltip = true;\r\n var interfaceColors = new InterfaceColorSet();\r\n var background = _this.background;\r\n background.cornerRadius(25, 25, 25, 25);\r\n background.fill = interfaceColors.getFor(\"primaryButton\");\r\n background.stroke = interfaceColors.getFor(\"primaryButtonStroke\");\r\n background.strokeOpacity = 0;\r\n background.states.getKey(\"hover\").properties.fill = interfaceColors.getFor(\"primaryButtonHover\");\r\n background.states.getKey(\"down\").properties.fill = interfaceColors.getFor(\"primaryButtonActive\");\r\n // Create a play icon\r\n var playIcon = new Triangle();\r\n playIcon.direction = \"right\";\r\n playIcon.width = 9;\r\n playIcon.height = 11;\r\n playIcon.marginLeft = 1;\r\n playIcon.marginRight = 1;\r\n playIcon.horizontalCenter = \"middle\";\r\n playIcon.verticalCenter = \"middle\";\r\n playIcon.stroke = interfaceColors.getFor(\"primaryButtonText\");\r\n playIcon.fill = playIcon.stroke;\r\n _this.icon = playIcon;\r\n // Create a play icon\r\n var stopIcon = new RoundedRectangle();\r\n stopIcon.width = 11;\r\n stopIcon.height = 11;\r\n stopIcon.horizontalCenter = \"middle\";\r\n stopIcon.verticalCenter = \"middle\";\r\n stopIcon.cornerRadius(0, 0, 0, 0);\r\n stopIcon.stroke = interfaceColors.getFor(\"primaryButtonText\");\r\n stopIcon.fill = playIcon.stroke;\r\n _this.togglable = true;\r\n var activeState = _this.states.create(\"active\");\r\n activeState.transitionDuration = 0;\r\n activeState.properties.icon = stopIcon;\r\n _this.defaultState.transitionDuration = 0;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n PlayButton.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Play\");\r\n }\r\n };\r\n return PlayButton;\r\n}(Button));\r\nexport { PlayButton };\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[\"PlayButton\"] = PlayButton;\r\n//# sourceMappingURL=PlayButton.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { BaseObject } from \"../../Base\";\r\nimport { registry } from \"../../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A base class for color modifiers.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\nvar ColorModifier = /** @class */ (function (_super) {\r\n __extends(ColorModifier, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ColorModifier() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ColorModifier\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Modifies color value.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Original color\r\n * @return Modified\r\n */\r\n ColorModifier.prototype.modify = function (value) {\r\n return value;\r\n };\r\n return ColorModifier;\r\n}(BaseObject));\r\nexport { ColorModifier };\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[\"ColorModifier\"] = ColorModifier;\r\n//# sourceMappingURL=ColorModifier.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ColorModifier } from \"./ColorModifier\";\r\nimport { registry } from \"../../Registry\";\r\nimport * as $math from \"../../utils/Math\";\r\nimport * as $type from \"../../utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This class can be used to modify linear gradient steps, changing visual\r\n * properties like lightness, brightness, opacity of each set.\r\n *\r\n * It can also set offsets for each gradient step.\r\n *\r\n * E.g. if I want to fill a columns in a column series to be a solid fill from\r\n * top to 80% of height, then gradually fades out, I can use the following\r\n * gradient modifier as a `fillModifier`:\r\n *\r\n * ```TypeScript\r\n * let fillModifier = new am4core.GradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JavaScript\r\n * var fillModifier = new am4core.GradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JSON\r\n * \"series\": [{\r\n * \"type\": \"ColumnSeries\",\r\n * \"columns\": {\r\n * \"fillModifier\": {\r\n * \"type\": \"GradientModifier\",\r\n * \"opacities\": [1, 1, 0],\r\n * \"offsets\": [0, 0.8, 1]\r\n * }\r\n * }\r\n * }]\r\n * ```\r\n */\r\nvar GradientModifier = /** @class */ (function (_super) {\r\n __extends(GradientModifier, _super);\r\n /**\r\n * Constructor.\r\n */\r\n function GradientModifier() {\r\n var _this = _super.call(this) || this;\r\n _this.lightnesses = [];\r\n _this.brightnesses = [];\r\n _this.opacities = [];\r\n _this.offsets = [];\r\n _this.className = \"GradientModifier\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(GradientModifier.prototype, \"lightnesses\", {\r\n /**\r\n * @return Lightness values\r\n */\r\n get: function () {\r\n return this._lightnesses;\r\n },\r\n /**\r\n * An array of lightness values for each step.\r\n *\r\n * @param value Lightness values\r\n */\r\n set: function (value) {\r\n this._lightnesses = value;\r\n this._brightnesses = [];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GradientModifier.prototype, \"brightnesses\", {\r\n /**\r\n * @return Brightness values\r\n */\r\n get: function () {\r\n return this._brightnesses;\r\n },\r\n /**\r\n * An array of brightness values for each step.\r\n *\r\n * @param value Brightness values\r\n */\r\n set: function (value) {\r\n this._brightnesses = value;\r\n this._lightnesses = [];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GradientModifier.prototype, \"opacities\", {\r\n /**\r\n * @return Opacity values\r\n */\r\n get: function () {\r\n return this._opacities;\r\n },\r\n /**\r\n * An array of opacity values for each step.\r\n *\r\n * @param value Opacity values\r\n */\r\n set: function (value) {\r\n this._opacities = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GradientModifier.prototype, \"offsets\", {\r\n /**\r\n * @return Offsets\r\n */\r\n get: function () {\r\n return this._offsets;\r\n },\r\n /**\r\n * An array of relative position (0-1) for each step.\r\n *\r\n * If not set, all steps will be of equal relative length.\r\n *\r\n * @param value Offsets\r\n */\r\n set: function (value) {\r\n this._offsets = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Modifies the color based on step setting.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Source color\r\n * @return A gradient that matches set modification rules\r\n */\r\n GradientModifier.prototype.modify = function (value) {\r\n // Clear current gradient\r\n this.gradient.clear();\r\n // Get step count\r\n var count = 0;\r\n if (this.opacities) {\r\n count = $math.max(count, this.opacities.length);\r\n }\r\n if (this.lightnesses) {\r\n count = $math.max(count, this.lightnesses.length);\r\n }\r\n if (this.brightnesses) {\r\n count = $math.max(count, this.brightnesses.length);\r\n }\r\n // Init step values\r\n var opacity = 1, lightness, brightness;\r\n // Apply steps\r\n for (var i = 0; i < count; i++) {\r\n // Take base color\r\n var color = value;\r\n // Check if there are any parameters for this step\r\n if (this.opacities && $type.isNumber(this.opacities[i])) {\r\n opacity = this.opacities[i];\r\n }\r\n if (this.lightnesses && $type.isNumber(this.lightnesses[i])) {\r\n lightness = this.lightnesses[i];\r\n brightness = undefined;\r\n }\r\n if (this.brightnesses && $type.isNumber(this.brightnesses[i])) {\r\n brightness = this.brightnesses[i];\r\n lightness = undefined;\r\n }\r\n // Check if we need to brighten/lighten color\r\n if ($type.isNumber(brightness)) {\r\n color = value.brighten(this.brightnesses[i]);\r\n }\r\n else if ($type.isNumber(lightness)) {\r\n color = value.lighten(this.lightnesses[i]);\r\n }\r\n // Get offset (it's OK if it's undefined)\r\n var offset = this.offsets[i];\r\n // Apply step\r\n this.gradient.addColor(color, opacity, offset);\r\n }\r\n return this.gradient;\r\n };\r\n GradientModifier.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this._offsets = source.offsets;\r\n this._brightnesses = source.brightnesses;\r\n this._lightnesses = source.lightnesses;\r\n this._opacities = source.opacities;\r\n };\r\n return GradientModifier;\r\n}(ColorModifier));\r\nexport { GradientModifier };\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[\"GradientModifier\"] = GradientModifier;\r\n//# sourceMappingURL=GradientModifier.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { LinearGradient } from \"./LinearGradient\";\r\nimport { GradientModifier } from \"./GradientModifier\";\r\nimport { registry } from \"../../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This class can be used to modify linear gradient steps, changing visual\r\n * properties like lightness, brightness, opacity of each set.\r\n *\r\n * It can also set offsets for each gradient step.\r\n *\r\n * E.g. if I want to fill a columns in a column series to be a solid fill from\r\n * top to 80% of height, then gradually fades out, I can use the following\r\n * gradient modifier as a `fillModifier`:\r\n *\r\n * ```TypeScript\r\n * let fillModifier = new am4core.LinearGradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JavaScript\r\n * var fillModifier = new am4core.LinearGradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JSON\r\n * \"series\": [{\r\n * \"type\": \"ColumnSeries\",\r\n * \"columns\": {\r\n * \"fillModifier\": {\r\n * \"type\": \"LinearGradientModifier\",\r\n * \"opacities\": [1, 1, 0],\r\n * \"offsets\": [0, 0.8, 1]\r\n * }\r\n * }\r\n * }]\r\n * ```\r\n */\r\nvar LinearGradientModifier = /** @class */ (function (_super) {\r\n __extends(LinearGradientModifier, _super);\r\n /**\r\n * Constructor.\r\n */\r\n function LinearGradientModifier() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"LinearGradientModifier\";\r\n _this.gradient = new LinearGradient();\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n LinearGradientModifier.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.gradient = source.gradient.clone();\r\n };\r\n return LinearGradientModifier;\r\n}(GradientModifier));\r\nexport { LinearGradientModifier };\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[\"LinearGradientModifier\"] = LinearGradientModifier;\r\n//# sourceMappingURL=LinearGradientModifier.js.map","/**\r\n * Cone module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../Container\";\r\nimport { Sprite, visualProperties } from \"../../Sprite\";\r\nimport { Ellipse } from \"../../elements/Ellipse\";\r\nimport { LinearGradientModifier } from \"../../rendering/fills/LinearGradientModifier\";\r\nimport { percent } from \"../../utils/Percent\";\r\nimport * as $object from \"../../utils/Object\";\r\nimport * as $path from \"../../rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Builds a round cone/cylinder.\r\n *\r\n * @see {@link IConeEvents} for a list of available events\r\n * @see {@link IConeAdapters} for a list of available Adapters\r\n */\r\nvar Cone = /** @class */ (function (_super) {\r\n __extends(Cone, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Cone() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Cone\";\r\n _this.angle = 30;\r\n _this.radius = percent(100);\r\n _this.topRadius = percent(100);\r\n _this.top = _this.createChild(Ellipse);\r\n _this.top.shouldClone = false;\r\n _this.bottom = _this.createChild(Ellipse);\r\n _this.bottom.shouldClone = false;\r\n _this.body = _this.createChild(Sprite);\r\n _this.body.shouldClone = false;\r\n _this.body.setElement(_this.paper.add(\"path\"));\r\n _this.layout = \"none\";\r\n _this.bodyFillModifier = new LinearGradientModifier();\r\n _this.bodyFillModifier.lightnesses = [0, -0.25, 0];\r\n _this.body.fillModifier = _this.bodyFillModifier;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Cone.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n $object.copyProperties(this, this.top, visualProperties);\r\n $object.copyProperties(this, this.bottom, visualProperties);\r\n $object.copyProperties(this, this.body, visualProperties);\r\n var w = this.innerWidth;\r\n var h = this.innerHeight;\r\n var bottom = this.bottom;\r\n var top = this.top;\r\n var angle = this.angle;\r\n var radiusBase;\r\n var dx;\r\n var dy;\r\n if (this.orientation == \"horizontal\") {\r\n radiusBase = h / 2;\r\n bottom.y = h / 2;\r\n top.y = h / 2;\r\n top.x = w;\r\n dx = (90 - angle) / 90;\r\n dy = 0;\r\n this.bodyFillModifier.gradient.rotation = 90;\r\n }\r\n else {\r\n dx = 0;\r\n dy = (90 - angle) / 90;\r\n radiusBase = w / 2;\r\n bottom.y = h;\r\n bottom.x = w / 2;\r\n top.x = w / 2;\r\n this.bodyFillModifier.gradient.rotation = 0;\r\n }\r\n var radius = this.radius.value * radiusBase;\r\n var topRadius = this.topRadius.value * radiusBase;\r\n bottom.radius = radius - radius * dx;\r\n bottom.radiusY = radius - radius * dy;\r\n top.radius = topRadius - topRadius * dx;\r\n top.radiusY = topRadius - topRadius * dy;\r\n var path;\r\n if (this.orientation == \"horizontal\") {\r\n path = $path.moveTo({ x: 0, y: h / 2 - bottom.radiusY }) + $path.arcTo(-90, -180, bottom.radius, bottom.radiusY) + $path.lineTo({ x: w, y: h / 2 + top.radiusY }) + $path.arcTo(90, 180, top.radius, top.radiusY) + $path.closePath();\r\n }\r\n else {\r\n path = $path.moveTo({ x: w / 2 - top.radius, y: 0 }) + $path.arcTo(180, -180, top.radius, top.radiusY) + $path.lineTo({ x: w / 2 + bottom.radius, y: h }) + $path.arcTo(0, 180, bottom.radius, bottom.radiusY) + $path.closePath();\r\n }\r\n this.body.path = path;\r\n };\r\n Object.defineProperty(Cone.prototype, \"angle\", {\r\n /**\r\n * @return Angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"angle\");\r\n },\r\n /**\r\n * Angle of the point of view to the 3D element. (0-360)\r\n *\r\n * @default 30\r\n * @param value Angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"angle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Cone.prototype, \"radius\", {\r\n /**\r\n * @return Bottom radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * A relative radius of the cone's bottom (base).\r\n *\r\n * It is relevant to the inner width or height of the element.\r\n *\r\n * @default Percent(100)\r\n * @param value Bottom radius\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"radius\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Cone.prototype, \"topRadius\", {\r\n /**\r\n * @return Top radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"topRadius\");\r\n },\r\n /**\r\n * A relative radius of the cone's top (tip).\r\n *\r\n * It is relevant to the inner width or height of the element.\r\n *\r\n * @default Percent(0)\r\n * @param value Top radius\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"topRadius\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Cone.prototype, \"orientation\", {\r\n /**\r\n * Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"orientation\");\r\n },\r\n /**\r\n * Orientation of the cone\r\n *\r\n * @default \"vertical\"\r\n * @param value Orientation\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"orientation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Cone;\r\n}(Container));\r\nexport { Cone };\r\n//# sourceMappingURL=Cone.js.map","/**\r\n * Module for \"Lighten\" filter.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Filter } from \"./Filter\";\r\nimport { registry } from \"../../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a \"Lighten\" filter.\r\n */\r\nvar LightenFilter = /** @class */ (function (_super) {\r\n __extends(LightenFilter, _super);\r\n /**\r\n * Constructor\r\n */\r\n function LightenFilter() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"LightenFilter\";\r\n // Create elements\r\n // NOTE: we do not need to add each individual element to `_disposers`\r\n // because `filterPrimitives` has an event handler which automatically adds\r\n // anything added to it to `_disposers`\r\n _this.feColorMatrix = _this.paper.add(\"feColorMatrix\");\r\n _this.feColorMatrix.attr({ \"type\": \"matrix\" });\r\n _this.filterPrimitives.push(_this.feColorMatrix);\r\n // Set default properties\r\n _this.lightness = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(LightenFilter.prototype, \"lightness\", {\r\n /**\r\n * @return Lightness\r\n */\r\n get: function () {\r\n return this.properties[\"lightness\"];\r\n },\r\n /**\r\n * Lightness of the target colors.\r\n *\r\n * If `lightness` is a positive number, the filter will make all colors\r\n * lighter.\r\n *\r\n * If `lightness` is negative, colors will be darkened.\r\n *\r\n * @param value Lightness\r\n */\r\n set: function (value) {\r\n this.properties[\"lightness\"] = value;\r\n var v = value + 1;\r\n this.feColorMatrix.attr({ \"values\": v + \" 0 0 0 0 0 \" + v + \" 0 0 0 0 0 \" + v + \" 0 0 0 0 0 1 0\" });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return LightenFilter;\r\n}(Filter));\r\nexport { LightenFilter };\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[\"LightenFilter\"] = LightenFilter;\r\n//# sourceMappingURL=LightenFilter.js.map","/**\r\n * Creates a 3D rectangle.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../Container\";\r\nimport { Sprite } from \"../../Sprite\";\r\nimport * as $math from \"../../utils/Math\";\r\nimport * as $path from \"../../rendering/Path\";\r\nimport { Color, color, toColor } from \"../../utils/Color\";\r\nimport { RadialGradient } from \"../../rendering/fills/RadialGradient\";\r\nimport { LinearGradient } from \"../../rendering/fills/LinearGradient\";\r\nimport { LightenFilter } from \"../../rendering/filters/LightenFilter\";\r\nimport * as $type from \"../../utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Builds a 3D rectangle\r\n * @see {@link IRectangle3DEvents} for a list of available events\r\n * @see {@link IRectangle3DAdapters} for a list of available Adapters\r\n */\r\nvar Rectangle3D = /** @class */ (function (_super) {\r\n __extends(Rectangle3D, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Rectangle3D() {\r\n var _this = _super.call(this) || this;\r\n _this.angle = 30;\r\n _this.depth = 30;\r\n _this.className = \"Rectangle3D\";\r\n _this.layout = \"none\";\r\n var sideBack = _this.createChild(Sprite);\r\n sideBack.shouldClone = false;\r\n sideBack.setElement(_this.paper.add(\"path\"));\r\n sideBack.isMeasured = false;\r\n _this.sideBack = sideBack;\r\n _this._disposers.push(_this.sideBack);\r\n var sideBottom = _this.createChild(Sprite);\r\n sideBottom.shouldClone = false;\r\n sideBottom.setElement(_this.paper.add(\"path\"));\r\n sideBottom.isMeasured = false;\r\n _this.sideBottom = sideBottom;\r\n _this._disposers.push(_this.sideBottom);\r\n var sideLeft = _this.createChild(Sprite);\r\n sideLeft.shouldClone = false;\r\n sideLeft.setElement(_this.paper.add(\"path\"));\r\n sideLeft.isMeasured = false;\r\n _this.sideLeft = sideLeft;\r\n _this._disposers.push(_this.sideLeft);\r\n var sideRight = _this.createChild(Sprite);\r\n sideRight.shouldClone = false;\r\n sideRight.setElement(_this.paper.add(\"path\"));\r\n sideRight.isMeasured = false;\r\n _this.sideRight = sideRight;\r\n _this._disposers.push(_this.sideRight);\r\n var sideTop = _this.createChild(Sprite);\r\n sideTop.shouldClone = false;\r\n sideTop.setElement(_this.paper.add(\"path\"));\r\n sideTop.isMeasured = false;\r\n _this.sideTop = sideTop;\r\n _this._disposers.push(_this.sideTop);\r\n var sideFront = _this.createChild(Sprite);\r\n sideFront.shouldClone = false;\r\n sideFront.setElement(_this.paper.add(\"path\"));\r\n sideFront.isMeasured = false;\r\n _this.sideFront = sideFront;\r\n _this._disposers.push(_this.sideFront);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Rectangle3D.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var w = this.innerWidth;\r\n var h = this.innerHeight;\r\n var depth = this.depth;\r\n var angle = this.angle;\r\n var sin = $math.sin(angle);\r\n var cos = $math.cos(angle);\r\n var a = { x: 0, y: 0 };\r\n var b = { x: w, y: 0 };\r\n var c = { x: w, y: h };\r\n var d = { x: 0, y: h };\r\n var ah = { x: depth * cos, y: -depth * sin };\r\n var bh = { x: depth * cos + w, y: -depth * sin };\r\n var ch = { x: depth * cos + w, y: -depth * sin + h };\r\n var dh = { x: depth * cos, y: -depth * sin + h };\r\n this.sideFront.path = $path.moveTo(a) + $path.lineTo(b) + $path.lineTo(c) + $path.lineTo(d) + $path.closePath();\r\n this.sideBack.path = $path.moveTo(ah) + $path.lineTo(bh) + $path.lineTo(ch) + $path.lineTo(dh) + $path.closePath();\r\n this.sideLeft.path = $path.moveTo(a) + $path.lineTo(ah) + $path.lineTo(dh) + $path.lineTo(d) + $path.closePath();\r\n this.sideRight.path = $path.moveTo(b) + $path.lineTo(bh) + $path.lineTo(ch) + $path.lineTo(c) + $path.closePath();\r\n this.sideBottom.path = $path.moveTo(d) + $path.lineTo(dh) + $path.lineTo(ch) + $path.lineTo(c) + $path.closePath();\r\n this.sideTop.path = $path.moveTo(a) + $path.lineTo(ah) + $path.lineTo(bh) + $path.lineTo(b) + $path.closePath();\r\n };\r\n Object.defineProperty(Rectangle3D.prototype, \"depth\", {\r\n /**\r\n * @return Depth (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"depth\");\r\n },\r\n /**\r\n * Depth (Z dimension) of the 3D rectangle in pixels.\r\n *\r\n * @default 30\r\n * @param value Depth (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"depth\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Rectangle3D.prototype, \"angle\", {\r\n /**\r\n * @return Angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"angle\");\r\n },\r\n /**\r\n * Angle of the point of view to the 3D element. (0-360)\r\n *\r\n * @default 30\r\n * @param value Angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"angle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets actual `fill` property on the SVG element, including applicable color\r\n * modifiers.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Fill\r\n */\r\n Rectangle3D.prototype.setFill = function (value) {\r\n _super.prototype.setFill.call(this, value);\r\n if (!$type.isObject(value) || \"r\" in value) {\r\n value = toColor(value);\r\n }\r\n var colorStr;\r\n if (value instanceof Color) {\r\n colorStr = value.hex;\r\n }\r\n else if (value instanceof LinearGradient || value instanceof RadialGradient) {\r\n colorStr = value.stops.getIndex(0).color.hex;\r\n }\r\n else {\r\n var filter = new LightenFilter();\r\n filter.lightness = -0.2;\r\n this.sideBack.filters.push(filter);\r\n var filter2 = filter.clone();\r\n filter2.lightness = -0.4;\r\n this.sideLeft.filters.push(filter2);\r\n var filter3 = filter.clone();\r\n filter3.lightness = -0.2;\r\n this.sideRight.filters.push(filter3);\r\n var filter4 = filter.clone();\r\n filter4.lightness = -0.1;\r\n this.sideTop.filters.push(filter4);\r\n var filter5 = filter.clone();\r\n filter5.lightness = -0.5;\r\n this.sideBottom.filters.push(filter5);\r\n }\r\n if (colorStr) {\r\n this.sideBack.fill = color(colorStr).lighten(-0.2);\r\n this.sideLeft.fill = color(colorStr).lighten(-0.4);\r\n this.sideRight.fill = color(colorStr).lighten(-0.2);\r\n this.sideTop.fill = color(colorStr).lighten(-0.1);\r\n this.sideBottom.fill = color(colorStr).lighten(-0.5);\r\n }\r\n };\r\n /**\r\n * Copies all properties and related data from a different instance of Rectangle3D.\r\n *\r\n * @param source Source Rectangle3D\r\n */\r\n Rectangle3D.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.sideBack.copyFrom(source.sideBack);\r\n this.sideLeft.copyFrom(source.sideLeft);\r\n this.sideRight.copyFrom(source.sideRight);\r\n this.sideTop.copyFrom(source.sideTop);\r\n this.sideBottom.copyFrom(source.sideBottom);\r\n };\r\n return Rectangle3D;\r\n}(Container));\r\nexport { Rectangle3D };\r\n//# sourceMappingURL=Rectangle3D.js.map","/**\r\n * 3D slice module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Slice } from \"../Slice\";\r\nimport { Sprite } from \"../../Sprite\";\r\nimport * as $math from \"../../utils/Math\";\r\nimport * as $path from \"../../rendering/Path\";\r\nimport * as $type from \"../../utils/Type\";\r\nimport { Color, color } from \"../../utils/Color\";\r\nimport { RadialGradient } from \"../../rendering/fills/RadialGradient\";\r\nimport { LinearGradient } from \"../../rendering/fills/LinearGradient\";\r\nimport { LightenFilter } from \"../../rendering/filters/LightenFilter\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to draw a 3D slice of a Pie chart.\r\n *\r\n * @see {@link ISlice3DEvents} for a list of available events\r\n * @see {@link ISlice3DAdapters} for a list of available Adapters\r\n */\r\nvar Slice3D = /** @class */ (function (_super) {\r\n __extends(Slice3D, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Slice3D() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"Slice3D\";\r\n _this.layout = \"none\";\r\n // Create edge container\r\n var edge = _this.createChild(Sprite);\r\n _this.edge = edge;\r\n edge.shouldClone = false;\r\n edge.isMeasured = false;\r\n edge.toBack();\r\n // Set defaults\r\n _this.angle = 30;\r\n _this.depth = 20;\r\n // Create side A element\r\n var sideA = _this.createChild(Sprite);\r\n _this.sideA = sideA;\r\n sideA.shouldClone = false;\r\n sideA.isMeasured = false;\r\n //sideA.setElement(this.paper.add(\"path\"));\r\n //sideA.strokeOpacity = 0;\r\n // Crate side B element\r\n var sideB = _this.createChild(Sprite);\r\n _this.sideB = sideB;\r\n sideB.shouldClone = false;\r\n sideB.isMeasured = false;\r\n //sideB.setElement(this.paper.add(\"path\"));\r\n //sideB.strokeOpacity = 0;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets actual `fill` property on the SVG element, including applicable color\r\n * modifiers.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Fill\r\n */\r\n Slice3D.prototype.setFill = function (value) {\r\n _super.prototype.setFill.call(this, value);\r\n var colorStr;\r\n if (value instanceof Color) {\r\n colorStr = value.hex;\r\n }\r\n else if (value instanceof LinearGradient || value instanceof RadialGradient) {\r\n colorStr = value.stops.getIndex(0).color.hex;\r\n }\r\n else {\r\n var filter = new LightenFilter();\r\n filter.lightness = -0.25;\r\n this.edge.filters.push(filter);\r\n this.sideA.filters.push(filter.clone());\r\n this.sideB.filters.push(filter.clone());\r\n }\r\n if (colorStr) {\r\n var edgeFill = color(colorStr).lighten(-0.25);\r\n this.edge.fill = edgeFill;\r\n this.sideA.fill = edgeFill;\r\n this.sideB.fill = edgeFill;\r\n this.edge.stroke = edgeFill;\r\n this.sideA.stroke = edgeFill;\r\n this.sideB.stroke = edgeFill;\r\n }\r\n };\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Slice3D.prototype.draw = function () {\r\n this.cornerRadius = 0;\r\n this.innerCornerRadius = 0;\r\n _super.prototype.draw.call(this);\r\n if (this.arc !== 0 && this.radius > 0 && this.depth > 0) {\r\n this.sideB.show(0);\r\n this.sideA.show(0);\r\n this.edge.show(0);\r\n var startAngle = this.startAngle;\r\n var arc = this.arc;\r\n var innerRadius = this.pixelInnerRadius || 0;\r\n var radiusY = this.radiusY || 0;\r\n //let cornerRadius = this.cornerRadius || 0;\r\n //let innerCornerRadius = this.innerCornerRadius;\r\n var radius = this.radius;\r\n // this is code duplicate with $path.arc. @todo to think how to avoid it\r\n var endAngle = startAngle + arc;\r\n //let crSin = $math.sin($math.min(arc, 45) / 2);\r\n //innerCornerRadius = innerCornerRadius || cornerRadius;\r\n var innerRadiusY = (radiusY / radius) * innerRadius;\r\n //let cornerRadiusY = (radiusY / radius) * cornerRadius;\r\n //let innerCornerRadiusY = (radiusY / radius) * innerCornerRadius;\r\n //cornerRadius = $math.fitToRange(cornerRadius, 0, (radius - innerRadius) / 2);\r\n //cornerRadiusY = $math.fitToRange(cornerRadiusY, 0, (radiusY - innerRadiusY) / 2);\r\n //innerCornerRadius = $math.fitToRange(innerCornerRadius, 0, (radius - innerRadius) / 2);\r\n //innerCornerRadiusY = $math.fitToRange(innerCornerRadiusY, 0, (radiusY - innerRadiusY) / 2);\r\n //cornerRadius = $math.fitToRange(cornerRadius, 0, radius * crSin);\r\n //cornerRadiusY = $math.fitToRange(cornerRadiusY, 0, radiusY * crSin);\r\n //innerCornerRadius = $math.fitToRange(innerCornerRadius, 0, innerRadius * crSin);\r\n //innerCornerRadiusY = $math.fitToRange(innerCornerRadiusY, 0, innerRadiusY * crSin);\r\n //let crAngle: number = Math.asin(cornerRadius / radius / 2) * $math.DEGREES * 2;\r\n //let crAngleY: number = Math.asin(cornerRadiusY / radiusY / 2) * $math.DEGREES * 2;\r\n //if (innerRadius < innerCornerRadius) {\r\n //\tinnerRadius = innerCornerRadius;\r\n //}\r\n //if (innerRadiusY < innerCornerRadiusY) {\r\n //\tinnerRadiusY = innerCornerRadiusY;\r\n //}\r\n //let crInnerAngle: number = Math.asin(innerCornerRadius / innerRadius / 2) * $math.DEGREES * 2;\r\n //let crInnerAngleY: number = Math.asin(innerCornerRadiusY / innerRadiusY / 2) * $math.DEGREES * 2;\r\n //if (!$type.isNumber(crInnerAngle)) {\r\n //\tcrInnerAngle = 0;\r\n //}\r\n //if (!$type.isNumber(crInnerAngleY)) {\r\n //\tcrInnerAngleY = 0;\r\n //}\r\n //let middleAngle = startAngle + arc / 2;\r\n //let mPoint = { x: $math.round($math.cos(middleAngle) * innerRadius, 4), y: $math.round($math.sin(middleAngle) * innerRadiusY, 4) };\r\n var a0 = { x: $math.cos(startAngle) * (innerRadius), y: $math.sin(startAngle) * (innerRadiusY) };\r\n var b0 = { x: $math.cos(startAngle) * (radius), y: $math.sin(startAngle) * (radiusY) };\r\n var c0 = { x: $math.cos(endAngle) * (radius), y: $math.sin(endAngle) * (radiusY) };\r\n var d0 = { x: $math.cos(endAngle) * (innerRadius), y: $math.sin(endAngle) * (innerRadiusY) };\r\n // end of duplicate\r\n var h = this.depth;\r\n var ah = { x: a0.x, y: a0.y - h };\r\n var bh = { x: b0.x, y: b0.y - h };\r\n var ch = { x: c0.x, y: c0.y - h };\r\n var dh = { x: d0.x, y: d0.y - h };\r\n var edgePath = \"\";\r\n var count = Math.ceil(arc / 5);\r\n var step = arc / count;\r\n var mangle = startAngle;\r\n var prevPoint = bh;\r\n for (var i = 0; i < count; i++) {\r\n mangle += step;\r\n if (mangle > 0 && mangle < 180) {\r\n edgePath += $path.moveTo(prevPoint);\r\n var pp = { x: $math.cos(mangle) * (radius), y: $math.sin(mangle) * (radiusY) - h };\r\n edgePath += $path.lineTo({ x: prevPoint.x, y: prevPoint.y + h });\r\n edgePath += $path.arcToPoint({ x: pp.x, y: pp.y + h }, radius, radiusY, true);\r\n edgePath += $path.lineTo(pp);\r\n edgePath += $path.arcToPoint(prevPoint, radius, radiusY);\r\n edgePath += \"z\";\r\n prevPoint = pp;\r\n }\r\n else {\r\n edgePath += $path.moveTo(prevPoint);\r\n var pp = { x: $math.cos(mangle) * (radius), y: $math.sin(mangle) * (radiusY) - h };\r\n edgePath += $path.arcToPoint(pp, radius, radiusY, true);\r\n edgePath += $path.lineTo({ x: pp.x, y: pp.y + h });\r\n edgePath += $path.arcToPoint({ x: prevPoint.x, y: prevPoint.y + h }, radius, radiusY);\r\n edgePath += $path.lineTo(prevPoint);\r\n edgePath += \"z\";\r\n prevPoint = pp;\r\n }\r\n }\r\n prevPoint = ah;\r\n mangle = startAngle;\r\n for (var i = 0; i < count; i++) {\r\n mangle += step;\r\n if (mangle > 0 && mangle < 180) {\r\n edgePath += $path.moveTo(prevPoint);\r\n var pp = { x: $math.cos(mangle) * (innerRadius), y: $math.sin(mangle) * (innerRadiusY) - h };\r\n edgePath += $path.lineTo({ x: prevPoint.x, y: prevPoint.y + h });\r\n edgePath += $path.arcToPoint({ x: pp.x, y: pp.y + h }, innerRadius, innerRadiusY, true);\r\n edgePath += $path.lineTo(pp);\r\n edgePath += $path.arcToPoint(prevPoint, innerRadius, innerRadiusY);\r\n edgePath += \"z\";\r\n prevPoint = pp;\r\n }\r\n else {\r\n edgePath += $path.moveTo(prevPoint);\r\n var pp = { x: $math.cos(mangle) * (innerRadius), y: $math.sin(mangle) * (innerRadiusY) - h };\r\n edgePath += $path.arcToPoint(pp, innerRadius, innerRadiusY, true);\r\n edgePath += $path.lineTo({ x: pp.x, y: pp.y + h });\r\n edgePath += $path.arcToPoint({ x: prevPoint.x, y: prevPoint.y + h }, innerRadius, innerRadiusY);\r\n edgePath += $path.lineTo(prevPoint);\r\n edgePath += \"z\";\r\n prevPoint = pp;\r\n }\r\n }\r\n this.edge.path = edgePath;\r\n /*\r\n a0 = { x: $math.cos(startAngle) * (innerRadius + innerCornerRadius), y: $math.sin(startAngle) * (innerRadiusY + innerCornerRadiusY) };\r\n b0 = { x: $math.cos(startAngle) * (radius - cornerRadius), y: $math.sin(startAngle) * (radiusY - cornerRadiusY) };\r\n c0 = { x: $math.cos(endAngle) * (radius - cornerRadius), y: $math.sin(endAngle) * (radiusY - cornerRadiusY) };\r\n d0 = { x: $math.cos(endAngle) * (innerRadius + innerCornerRadius), y: $math.sin(endAngle) * (innerRadiusY + innerCornerRadiusY) };\r\n // end of duplicate\r\n \r\n ah = { x: a0.x, y: a0.y - h };\r\n bh = { x: b0.x, y: b0.y - h };\r\n ch = { x: c0.x, y: c0.y - h };\r\n dh = { x: d0.x, y: d0.y - h };\r\n */\r\n this.sideA.path = $path.moveTo(a0) + $path.lineTo(b0) + $path.lineTo(bh) + $path.lineTo(ah) + $path.closePath();\r\n this.sideB.path = $path.moveTo(c0) + $path.lineTo(d0) + $path.lineTo(dh) + $path.lineTo(ch) + $path.closePath();\r\n if (this.startAngle < 90) {\r\n this.sideA.toBack();\r\n }\r\n else {\r\n this.sideA.toFront();\r\n }\r\n if (this.startAngle + this.arc > 90) {\r\n this.sideB.toBack();\r\n }\r\n else {\r\n this.sideB.toFront();\r\n }\r\n this.slice.dy = -h;\r\n }\r\n else {\r\n this.sideA.hide(0);\r\n this.sideB.hide(0);\r\n this.edge.hide(0);\r\n }\r\n };\r\n Object.defineProperty(Slice3D.prototype, \"depth\", {\r\n /**\r\n * @return Depth (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"depth\");\r\n },\r\n /**\r\n * Depth (height) of the 3D slice in pixels.\r\n *\r\n * @default 20\r\n * @param depth Depth (px)\r\n */\r\n set: function (depth) {\r\n this.setPropertyValue(\"depth\", depth, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice3D.prototype, \"angle\", {\r\n /**\r\n * @return Angle\r\n */\r\n get: function () {\r\n var angle = this.getPropertyValue(\"angle\");\r\n if (!$type.isNumber(angle)) {\r\n angle = 0;\r\n }\r\n return angle;\r\n },\r\n /**\r\n * Angle of the point of view to the 3D element. (0-360)\r\n *\r\n * @default 30\r\n * @param value Angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"angle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slice3D.prototype, \"radiusY\", {\r\n /**\r\n * @return Vertical radius (0-1)\r\n */\r\n get: function () {\r\n var radiusY = this.getPropertyValue(\"radiusY\");\r\n if (!$type.isNumber(radiusY)) {\r\n radiusY = this.radius - this.radius * this.angle / 90;\r\n }\r\n return radiusY;\r\n },\r\n /**\r\n * Vertical radius for creating skewed slices.\r\n *\r\n * This is relevant to `radius`, e.g. 0.5 will set vertical radius to half\r\n * the `radius`.\r\n *\r\n * @param value Vertical radius (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"radiusY\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all properties and related data from a different instance of Axis.\r\n *\r\n * @param source Source Axis\r\n */\r\n Slice3D.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.edge.copyFrom(source.edge);\r\n this.sideA.copyFrom(source.sideA);\r\n this.sideB.copyFrom(source.sideB);\r\n };\r\n return Slice3D;\r\n}(Slice));\r\nexport { Slice3D };\r\n//# sourceMappingURL=Slice3D.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { RadialGradient } from \"./RadialGradient\";\r\nimport { GradientModifier } from \"./GradientModifier\";\r\nimport { registry } from \"../../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This class can be used to modify radial gradient steps, changing visual\r\n * properties like lightness, brightness, opacity of each set.\r\n *\r\n * It can also set offsets for each gradient step.\r\n *\r\n * E.g. if I want to fill a columns in a column series to be a solid fill from\r\n * top to 80% of height, then gradually fades out, I can use the following\r\n * gradient modifier as a `fillModifier`:\r\n *\r\n * ```TypeScript\r\n * let fillModifier = new am4core.LinearGradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JavaScript\r\n * var fillModifier = new am4core.LinearGradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JSON\r\n * \"series\": [{\r\n * \"type\": \"ColumnSeries\",\r\n * \"columns\": {\r\n * \"fillModifier\": {\r\n * \"type\": \"LinearGradientModifier\",\r\n * \"opacities\": [1, 1, 0],\r\n * \"offsets\": [0, 0.8, 1]\r\n * }\r\n * }\r\n * }]\r\n * ```\r\n */\r\nvar RadialGradientModifier = /** @class */ (function (_super) {\r\n __extends(RadialGradientModifier, _super);\r\n /**\r\n * Constructor.\r\n */\r\n function RadialGradientModifier() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"RadialGradientModifier\";\r\n _this.gradient = new RadialGradient();\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n RadialGradientModifier.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.gradient = source.gradient.clone();\r\n };\r\n return RadialGradientModifier;\r\n}(GradientModifier));\r\nexport { RadialGradientModifier };\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[\"RadialGradientModifier\"] = RadialGradientModifier;\r\n//# sourceMappingURL=RadialGradientModifier.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Pattern } from \"./Pattern\";\r\nimport { registry } from \"../../Registry\";\r\nimport * as $path from \"../../rendering/Path\";\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Line pattern.\r\n */\r\nvar LinePattern = /** @class */ (function (_super) {\r\n __extends(LinePattern, _super);\r\n /**\r\n * Constructor\r\n */\r\n function LinePattern() {\r\n var _this = _super.call(this) || this;\r\n _this.properties[\"gap\"] = 0;\r\n _this._line = _this.paper.add(\"path\");\r\n _this.addElement(_this._line);\r\n return _this;\r\n }\r\n /**\r\n * Draws the pattern.\r\n */\r\n LinePattern.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n if (Math.round(this.rotation / 90) != this.rotation / 90) {\r\n this.properties[\"shapeRendering\"] = \"auto\";\r\n }\r\n if (this._line) {\r\n var w = this.width;\r\n var h = this.height;\r\n var path = \"\";\r\n if (!this.gap) {\r\n if (Math.round(this.rotation / 90) != this.rotation / 90) {\r\n path = $path.moveTo({ x: -w, y: h / 2 }) + $path.lineTo({ x: w * 2, y: h / 2 });\r\n this.properties[\"rotationX\"] = this.width / 2;\r\n this.properties[\"rotationY\"] = this.height / 2;\r\n }\r\n else {\r\n path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: w, y: 0 });\r\n }\r\n }\r\n else {\r\n var step = this.gap + this.strokeWidth;\r\n var count = this.height / step;\r\n for (var i = -count / 2; i < count * 1.5; i++) {\r\n if (Math.round(this.rotation / 90) != this.rotation / 90) {\r\n path += $path.moveTo({ x: -w, y: (i + 0.5) * step }) + $path.lineTo({ x: w * 2, y: (i + 0.5) * step });\r\n this.properties[\"rotationX\"] = this.width / 2;\r\n this.properties[\"rotationY\"] = this.height / 2;\r\n }\r\n else {\r\n path += $path.moveTo({ x: -w, y: i * step }) + $path.lineTo({ x: w * 2, y: i * step });\r\n }\r\n }\r\n }\r\n this._line.attr({ \"d\": path });\r\n }\r\n };\r\n Object.defineProperty(LinePattern.prototype, \"gap\", {\r\n /**\r\n * @return gap\r\n */\r\n get: function () {\r\n return this.properties[\"gap\"];\r\n },\r\n /**\r\n * Number of pixels between pattern lines.\r\n *\r\n * The pattern will automatically draw required number of lines to fill\r\n * pattern area maintaining `gap` distance between them.\r\n *\r\n * 0 (zero) means only single line will be drawn.\r\n *\r\n * @default 0\r\n * @since 4.7.7\r\n */\r\n set: function (value) {\r\n this.properties[\"gap\"] = value;\r\n this.draw();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return LinePattern;\r\n}(Pattern));\r\nexport { LinePattern };\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[\"LinePattern\"] = LinePattern;\r\n//# sourceMappingURL=LinePattern.js.map","/**\r\n * Rectangular pattern module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Pattern } from \"./Pattern\";\r\nimport { registry } from \"../../Registry\";\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Circular pattern\r\n */\r\nvar CirclePattern = /** @class */ (function (_super) {\r\n __extends(CirclePattern, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CirclePattern() {\r\n var _this = _super.call(this) || this;\r\n _this.properties[\"radius\"] = 2;\r\n _this._circle = _this.paper.add(\"circle\");\r\n _this.addElement(_this._circle);\r\n _this.shapeRendering = \"auto\";\r\n return _this;\r\n }\r\n /**\r\n * Draws the circle element.\r\n */\r\n CirclePattern.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n if (this._circle) {\r\n this._circle.attr({ \"r\": this.radius, \"cx\": this.width / 2, \"cy\": this.height / 2 });\r\n }\r\n };\r\n Object.defineProperty(CirclePattern.prototype, \"radius\", {\r\n /**\r\n * @return Radius (px)\r\n */\r\n get: function () {\r\n return this.properties[\"radius\"];\r\n },\r\n /**\r\n * Circle radius in pixels.\r\n *\r\n * @param value Radius (px)\r\n */\r\n set: function (value) {\r\n this.properties[\"radius\"] = value;\r\n this.draw();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CirclePattern;\r\n}(Pattern));\r\nexport { CirclePattern };\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[\"CirclePattern\"] = CirclePattern;\r\n//# sourceMappingURL=CirclePattern.js.map","/**\r\n * Rectangular pattern module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Pattern } from \"./Pattern\";\r\nimport { registry } from \"../../Registry\";\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Rectangular pattern\r\n */\r\nvar RectPattern = /** @class */ (function (_super) {\r\n __extends(RectPattern, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RectPattern() {\r\n var _this = _super.call(this) || this;\r\n _this.rectHeight = 1;\r\n _this.rectWidth = 1;\r\n _this._rect = _this.paper.add(\"rect\");\r\n _this.addElement(_this._rect);\r\n return _this;\r\n }\r\n /**\r\n * Draws the rectangular element.\r\n */\r\n RectPattern.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n this.properties[\"rotationX\"] = this.width / 2;\r\n this.properties[\"rotationY\"] = this.height / 2;\r\n if (this._rect) {\r\n this._rect.attr({ \"width\": this.rectWidth, \"height\": this.rectHeight, \"x\": (this.width - this.rectWidth) / 2, \"y\": (this.height - this.rectHeight) / 2 });\r\n }\r\n };\r\n Object.defineProperty(RectPattern.prototype, \"rectWidth\", {\r\n /**\r\n * @return Width (px)\r\n */\r\n get: function () {\r\n return this.properties[\"rectWidth\"];\r\n },\r\n /**\r\n * Rectangle width in pixels.\r\n *\r\n * @param value Width (px)\r\n */\r\n set: function (value) {\r\n this.properties[\"rectWidth\"] = value;\r\n this.draw();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RectPattern.prototype, \"rectHeight\", {\r\n /**\r\n * @return Height (px)\r\n */\r\n get: function () {\r\n return this.properties[\"rectHeight\"];\r\n },\r\n /**\r\n * Rectangle height in pixels.\r\n *\r\n * @param value Height (px)\r\n */\r\n set: function (value) {\r\n this.properties[\"rectHeight\"] = value;\r\n this.draw();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return RectPattern;\r\n}(Pattern));\r\nexport { RectPattern };\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[\"RectPattern\"] = RectPattern;\r\n//# sourceMappingURL=RectPattern.js.map","/**\r\n * Module for \"Colorize\" filter.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Filter } from \"./Filter\";\r\nimport { registry } from \"../../Registry\";\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a \"Colorize\" filter.\r\n */\r\nvar ColorizeFilter = /** @class */ (function (_super) {\r\n __extends(ColorizeFilter, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ColorizeFilter() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ColorizeFilter\";\r\n // Create elements\r\n // NOTE: we do not need to add each individual element to `_disposers`\r\n // because `filterPrimitives` has an event handler which automatically adds\r\n // anything added to it to `_disposers`\r\n _this.feColorMatrix = _this.paper.add(\"feColorMatrix\");\r\n _this.feColorMatrix.attr({ \"type\": \"matrix\" });\r\n //this.feColorMatrix.setAttribute(\"in\", \"SourceAlpha\");\r\n _this.filterPrimitives.push(_this.feColorMatrix);\r\n // Set default properties\r\n _this.intensity = 1;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * (Re)applies colors to the already existing filter by modifying filyer's\r\n * color matrix element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ColorizeFilter.prototype.applyFilter = function () {\r\n var i = this.intensity;\r\n var ii = 1 - i;\r\n var r;\r\n var g;\r\n var b;\r\n var color = this.color;\r\n if (color && color.rgb) {\r\n r = color.rgb.r / 255 * i;\r\n g = color.rgb.g / 255 * i;\r\n b = color.rgb.b / 255 * i;\r\n }\r\n else {\r\n r = 0;\r\n g = 0;\r\n b = 0;\r\n }\r\n this.feColorMatrix.attr({ \"values\": ii + \" 0 0 0 \" + r + \" 0 \" + ii + \" 0 0 \" + g + \" 0 0 \" + ii + \" 0 \" + b + \" 0 0 0 1 0\" });\r\n };\r\n Object.defineProperty(ColorizeFilter.prototype, \"color\", {\r\n /**\r\n * @return Color\r\n */\r\n get: function () {\r\n return this.properties[\"color\"];\r\n },\r\n /**\r\n * Target color to apply to the element.\r\n *\r\n * Depending on the `intensity`, all colors of the target element will steer\r\n * towards this color.\r\n *\r\n * E.g. setting to `am4core.color(\"greener\")` will make all colors greener.\r\n *\r\n * @param value Color\r\n */\r\n set: function (value) {\r\n this.properties[\"color\"] = value;\r\n this.applyFilter();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorizeFilter.prototype, \"intensity\", {\r\n /**\r\n * @return Intensity (0-1)\r\n */\r\n get: function () {\r\n return this.properties.intensity;\r\n },\r\n /**\r\n * Intensity of the color (0-1).\r\n *\r\n * The bigger the number the more of a `color` target's colors will become.\r\n *\r\n * 0 means the colors will remain as they are.\r\n * 1 means all colors will become the target `color`.\r\n *\r\n * @default 1\r\n * @param value Intensity (0-1)\r\n */\r\n set: function (value) {\r\n this.properties.intensity = value;\r\n this.applyFilter();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ColorizeFilter;\r\n}(Filter));\r\nexport { ColorizeFilter };\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[\"ColorizeFilter\"] = ColorizeFilter;\r\n//# sourceMappingURL=ColorizeFilter.js.map","/**\r\n * Module for \"Desaturate\" filter.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Filter } from \"./Filter\";\r\nimport { registry } from \"../../Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creats a \"Desaturate\" filter\r\n */\r\nvar DesaturateFilter = /** @class */ (function (_super) {\r\n __extends(DesaturateFilter, _super);\r\n /**\r\n * Constructor\r\n */\r\n function DesaturateFilter() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"DesaturateFilter\";\r\n // Create elements\r\n // NOTE: we do not need to add each individual element to `_disposers`\r\n // because `filterPrimitives` has an event handler which automatically adds\r\n // anything added to it to `_disposers`\r\n _this.feColorMatrix = _this.paper.add(\"feColorMatrix\");\r\n _this.feColorMatrix.attr({ \"type\": \"saturate\" });\r\n _this.filterPrimitives.push(_this.feColorMatrix);\r\n // Set default properties\r\n _this.width = 120;\r\n _this.height = 120;\r\n _this.saturation = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(DesaturateFilter.prototype, \"saturation\", {\r\n /**\r\n * @return Saturation (0-1)\r\n */\r\n get: function () {\r\n return this.properties[\"saturation\"];\r\n },\r\n /**\r\n * Saturation.\r\n *\r\n * 0 - completely desaturated.\r\n * 1 - fully saturated (gray).\r\n *\r\n * @param value Saturation (0-1)\r\n */\r\n set: function (value) {\r\n this.properties[\"saturation\"] = value;\r\n this.feColorMatrix.attr({ \"values\": value.toString() });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return DesaturateFilter;\r\n}(Filter));\r\nexport { DesaturateFilter };\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[\"DesaturateFilter\"] = DesaturateFilter;\r\n//# sourceMappingURL=DesaturateFilter.js.map","/**\r\n * Module for \"Blur\" filter.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Filter } from \"./Filter\";\r\nimport { registry } from \"../../Registry\";\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a \"Blur\" filter.\r\n */\r\nvar BlurFilter = /** @class */ (function (_super) {\r\n __extends(BlurFilter, _super);\r\n /**\r\n * Constructor\r\n */\r\n function BlurFilter() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"BlurFilter\";\r\n // Create elements\r\n // NOTE: we do not need to add each individual element to `_disposers`\r\n // because `filterPrimitives` has an event handler which automatically adds\r\n // anything added to it to `_disposers`\r\n _this.feGaussianBlur = _this.paper.add(\"feGaussianBlur\");\r\n _this.feGaussianBlur.attr({ \"result\": \"blurOut\", \"in\": \"SourceGraphic\" });\r\n _this.filterPrimitives.push(_this.feGaussianBlur);\r\n // Set default properties\r\n _this.width = 200;\r\n _this.height = 200;\r\n _this.blur = 1.5;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(BlurFilter.prototype, \"blur\", {\r\n /**\r\n * @return Blur\r\n */\r\n get: function () {\r\n return this.properties.blur;\r\n },\r\n /**\r\n * Blur value.\r\n *\r\n * The bigger the value, the blurrier the target element will become.\r\n *\r\n * @default 1.5\r\n * @param value Blur\r\n */\r\n set: function (value) {\r\n this.properties.blur = value;\r\n this.feGaussianBlur.attr({ \"stdDeviation\": value / this.scale });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return BlurFilter;\r\n}(Filter));\r\nexport { BlurFilter };\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[\"BlurFilter\"] = BlurFilter;\r\n//# sourceMappingURL=BlurFilter.js.map","/**\r\n * Module for \"Focus\" filter.\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport { Filter } from \"./Filter\";\r\nimport { InterfaceColorSet } from \"../../utils/InterfaceColorSet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a \"Focus\" filter.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/accessibility/} more about accessibility\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/changing-appearance-of-focused-items/} cusomizing focus appearance\r\n */\r\nvar FocusFilter = /** @class */ (function (_super) {\r\n __extends(FocusFilter, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FocusFilter() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"FocusFilter\";\r\n // Create elements\r\n // NOTE: we do not need to add each individual element to `_disposers`\r\n // because `filterPrimitives` has an event handler which automatically adds\r\n // anything added to it to `_disposers`\r\n _this.feFlood = _this.paper.add(\"feFlood\");\r\n _this.feFlood.attr({ \"flood-color\": new InterfaceColorSet().getFor(\"primaryButtonHover\"), \"result\": \"base\" });\r\n _this.filterPrimitives.push(_this.feFlood);\r\n _this.feMorphology = _this.paper.add(\"feMorphology\");\r\n _this.feMorphology.attr({ \"result\": \"bigger\", \"in\": \"SourceGraphic\", \"operator\": \"dilate\", \"radius\": \"2\" });\r\n _this.filterPrimitives.push(_this.feMorphology);\r\n _this.feColorMatrix = _this.paper.add(\"feColorMatrix\");\r\n _this.feColorMatrix.attr({ \"result\": \"mask\", \"in\": \"bigger\", \"type\": \"matrix\", \"values\": \"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0\" });\r\n _this.filterPrimitives.push(_this.feColorMatrix);\r\n _this.feComposite = _this.paper.add(\"feComposite\");\r\n _this.feComposite.attr({ \"result\": \"drop\", \"in\": \"base\", \"in2\": \"mask\", \"operator\": \"in\" });\r\n _this.filterPrimitives.push(_this.feComposite);\r\n _this.feBlend = _this.paper.add(\"feBlend\");\r\n _this.feBlend.attr({ \"in\": \"SourceGraphic\", \"in2\": \"drop\", \"mode\": \"normal\" });\r\n _this.filterPrimitives.push(_this.feBlend);\r\n // Set default properties\r\n _this.width = 130;\r\n _this.height = 130;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(FocusFilter.prototype, \"stroke\", {\r\n /**\r\n * @return Color\r\n */\r\n get: function () {\r\n return this.properties[\"stroke\"];\r\n },\r\n /**\r\n * Stroke (outline) color.\r\n *\r\n * @param value Color\r\n */\r\n set: function (value) {\r\n this.properties[\"stroke\"] = value;\r\n this.feFlood.attr({ \"flood-color\": value });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FocusFilter.prototype, \"strokeWidth\", {\r\n /**\r\n * @return Outline thickness (px)\r\n */\r\n get: function () {\r\n return this.properties[\"strokeWidth\"];\r\n },\r\n /**\r\n * Stroke (outline) thickness in pixels.\r\n *\r\n * @param value Outline thickness (px)\r\n */\r\n set: function (value) {\r\n this.properties[\"strokeWidth\"] = value;\r\n this.feMorphology.attr({ \"radius\": value });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FocusFilter.prototype, \"opacity\", {\r\n /**\r\n * @return Outline opacity (0-1)\r\n */\r\n get: function () {\r\n return this.properties[\"opacity\"];\r\n },\r\n /**\r\n * Opacity of the outline. (0-1)\r\n *\r\n * @param value Outline opacity (0-1)\r\n */\r\n set: function (value) {\r\n this.properties[\"opacity\"] = value;\r\n this.feColorMatrix.attr({ \"values\": \"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \" + value + \" 0\" });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets filter's target element.\r\n *\r\n * In addition it also disables built-in focus outline on element this\r\n * filter is applied to.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Element filter is being attached to\r\n */\r\n FocusFilter.prototype.setSprite = function (value) {\r\n if (this._sprite && this._sprite != value) {\r\n this._sprite.group.removeStyle(\"outline\");\r\n }\r\n value.group.addStyle({\r\n \"outline\": \"none\"\r\n });\r\n _super.prototype.setSprite.call(this, value);\r\n };\r\n return FocusFilter;\r\n}(Filter));\r\nexport { FocusFilter };\r\n//# sourceMappingURL=FocusFilter.js.map","/**\r\n * This module contains ColorSet object definition\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { BaseObject } from \"../Base\";\r\nimport { Color, color } from \"./Color\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $colors from \"./Colors\";\r\nimport * as $type from \"./Type\";\r\nimport * as $utils from \"./Utils\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Represents a set of colors. Can also generate colors according to set rules.\r\n *\r\n * @important\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/colors/} for color-related info\r\n */\r\nvar ColorSet = /** @class */ (function (_super) {\r\n __extends(ColorSet, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ColorSet() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Holds the list of the colors in this set. (preset or auto-generated)\r\n */\r\n _this._list = [];\r\n /**\r\n * Current step in a color generator's cycle.\r\n */\r\n _this._currentStep = 0;\r\n /**\r\n * If set to non-zero value, the ColorSet will start iterating colors from\r\n * that particular index, not the first color in the list.\r\n */\r\n _this._startIndex = 0;\r\n /**\r\n * Current pass in the color generator's cycle. Normally a generator would\r\n * cycle through all available hue range, then repeat it, alternating other\r\n * color properties, to generate distinctive colors.\r\n */\r\n _this._currentPass = 0;\r\n /**\r\n * A base color. If there are no colors pre-set in the color list, ColorSet\r\n * will use this color as a base when generating new ones, applying\r\n * `stepOptions` and `passOptions` to this base color.\r\n */\r\n _this.baseColor = new Color({\r\n r: 103,\r\n g: 183,\r\n b: 220\r\n });\r\n /**\r\n * Modifications to apply with each new generated color.\r\n */\r\n _this.stepOptions = {};\r\n /**\r\n * Modifications to apply on top of `stepOptions` for each \"pass\" of the\r\n * color generation.\r\n *\r\n * A \"pass\" is when ColorSet generates `minColors` number of colors.\r\n */\r\n _this.passOptions = {\r\n brighten: -0.2\r\n };\r\n /**\r\n * An index increment to use when iterating through color list.\r\n *\r\n * Default is 1, which means returning each and every color.\r\n *\r\n * Setting it to a bigger number will make ColorSet `next()` iterator skip\r\n * some colors.\r\n *\r\n * E.g. setting to 2, will return every second color in the list.\r\n *\r\n * This is useful, when the color list has colors that are too close each\r\n * other for contrast.\r\n *\r\n * However, having bigger number will mean that `next()` iterator will go\r\n * through the list quicker, and the generator will kick sooner.\r\n */\r\n _this.step = 1;\r\n /**\r\n * A number of colors to generate in one \"pass\".\r\n *\r\n * This setting can be automatically overridden, if ColorSet has a list of\r\n * pre-set colors. In such case ColorSet will generate exactly the same\r\n * number of colors with each pass as there were colors in original set.\r\n */\r\n _this.minColors = 20;\r\n /**\r\n * Do not let the \"lightness\" of generated color to fall below this\r\n * threshold.\r\n */\r\n _this.minLightness = 0.2;\r\n /**\r\n * Do not let the \"lightness\" of generated color to get above this threshold.\r\n */\r\n _this.maxLightness = 0.9;\r\n /**\r\n * Randomly shuffle generated colors.\r\n */\r\n _this.shuffle = false;\r\n /**\r\n * When colors are generated, based on `stepOptions`, each generated color\r\n * gets either lighter or darker.\r\n *\r\n * If this is set to `true`, color generator will switch to opposing spectrum\r\n * when reaching `minLightness` or `maxLightness`.\r\n *\r\n * E.g. if we start off with a red color, then gradually generate lighter\r\n * colors through rose shades, then switch back to dark red and gradually\r\n * increase the lightness of it until it reaches the starting red.\r\n *\r\n * If set to `false` it will stop there and cap lightness at whatever level\r\n * we hit `minLightness` or `maxLightness`, which may result in a number of\r\n * the same colors.\r\n */\r\n _this.wrap = true;\r\n /**\r\n * Re-use same colors in the pre-set list, when ColorSet runs out of colors,\r\n * rather than start generating new ones.\r\n */\r\n _this.reuse = false;\r\n /**\r\n * Saturation of colors. This will change saturation of all colors of color\r\n * set.\r\n *\r\n * It is recommended to set this in theme, as changing it at run time won't\r\n * make the items to redraw and change color.\r\n */\r\n _this.saturation = 1;\r\n _this.className = \"ColorSet\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(ColorSet.prototype, \"list\", {\r\n /**\r\n * Returns current list of colors.\r\n *\r\n * If there are none, a new list of colors is generated, based on various\r\n * ColorSet settings.\r\n *\r\n * @return Color list\r\n */\r\n get: function () {\r\n if (!this._list) {\r\n this.generate(this.minColors);\r\n }\r\n return this._list;\r\n },\r\n /**\r\n * Sets a list of pre-defined colors to use for the iterator.\r\n *\r\n * @param value Color list\r\n */\r\n set: function (value) {\r\n this._list = value;\r\n this.reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets reusable color.\r\n *\r\n * @param index Index of color\r\n * @return Color\r\n */\r\n ColorSet.prototype.getReusableColor = function (index) {\r\n if (this._list.length == 0) {\r\n this.generate(1);\r\n return this.list[0];\r\n }\r\n else {\r\n var tmpstep = index - (Math.floor(index / this._list.length) * this.list.length);\r\n return this.list[tmpstep];\r\n }\r\n };\r\n /**\r\n * Returns next color in the list using internal iterator counter.\r\n *\r\n * If `step` is set to something other than 1, it may return other color than\r\n * exact next one in the list.\r\n *\r\n * @return Color\r\n */\r\n ColorSet.prototype.next = function () {\r\n var color;\r\n if (this.list.length <= this._currentStep) {\r\n if (this.reuse) {\r\n color = this.getReusableColor(this._currentStep);\r\n }\r\n else {\r\n this.generate(this.minColors);\r\n color = this.list[this._currentStep];\r\n }\r\n }\r\n else {\r\n color = this.list[this._currentStep];\r\n }\r\n this._currentStep += this.step;\r\n return color.saturate(this.saturation);\r\n };\r\n /**\r\n * Returns a color at specific index in the list.\r\n *\r\n * @param i Index\r\n * @return Color\r\n */\r\n ColorSet.prototype.getIndex = function (i) {\r\n var color;\r\n if (this.list.length <= i) {\r\n if (this.reuse) {\r\n color = this.getReusableColor(i);\r\n }\r\n else {\r\n this.generate(this.minColors);\r\n color = this.getIndex(i);\r\n }\r\n }\r\n else {\r\n color = this.list[i];\r\n }\r\n return color.saturate(this.saturation);\r\n };\r\n /**\r\n * Resets internal iterator.\r\n *\r\n * Calling `next()` after this will return the very first color in the color\r\n * list, even if it was already returned before.\r\n */\r\n ColorSet.prototype.reset = function () {\r\n this._currentStep = this._startIndex;\r\n };\r\n Object.defineProperty(ColorSet.prototype, \"currentStep\", {\r\n /**\r\n * @return Step\r\n */\r\n get: function () {\r\n return this._currentStep;\r\n },\r\n /**\r\n * Sets current color iteration. You can use this property to skip some\r\n * colors from iteration. E.g. setting it to `10` will skip first ten\r\n * colors.\r\n *\r\n * Please note that the number is zero-based.\r\n *\r\n * @param value Step\r\n */\r\n set: function (value) {\r\n this._currentStep = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSet.prototype, \"startIndex\", {\r\n /**\r\n * @return Index\r\n */\r\n get: function () {\r\n return this._startIndex;\r\n },\r\n /**\r\n * If set to non-zero value, the ColorSet will start iterating colors from\r\n * that particular index, not the first color in the list.\r\n *\r\n * @default 0\r\n * @since 4.4.9\r\n * @param value Index\r\n */\r\n set: function (value) {\r\n this._startIndex = value;\r\n this.reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Generates colors based on the various ColorSet settings.\r\n *\r\n * @param count Number of colors to generate\r\n */\r\n ColorSet.prototype.generate = function (count) {\r\n // Init\r\n var curColor = this.currentColor;\r\n var hsl = $colors.rgbToHsl($type.getValue(curColor.rgb));\r\n var hueStep = $type.hasValue(this.stepOptions.hue) ? this.stepOptions.hue : 1 / count;\r\n var mods = {\r\n brighten: 0,\r\n lighten: 0,\r\n hue: hsl.h,\r\n lightness: hsl.l,\r\n saturation: hsl.s\r\n };\r\n // Generate list of hues, and shuffle them\r\n var hues = [];\r\n var startIndex = this.list.length == 0 ? 0 : 1;\r\n if (this.reuse) {\r\n for (var i = startIndex; i <= count; i++) {\r\n hues.push($colors.rgbToHsl($type.getValue(this._list[i].rgb)).h);\r\n }\r\n }\r\n else {\r\n for (var i = startIndex; i <= count; i++) {\r\n var h = hsl.h + hueStep * i;\r\n if (this.wrap && (h > 1)) {\r\n h -= 1;\r\n }\r\n hues.push(h);\r\n }\r\n }\r\n // Shuffle colors randomly\r\n if (this.shuffle) {\r\n hues.sort(function (a, b) {\r\n return Math.random() - 0.5;\r\n });\r\n }\r\n // Generate colors by rotating hue\r\n for (var i = 0; i < count; i++) {\r\n // Update hue\r\n if (this.reuse) {\r\n hsl = $colors.rgbToHsl($type.getValue(this._list[i].rgb));\r\n }\r\n else {\r\n hsl.h = hues.shift();\r\n }\r\n // Apply HSL mods\r\n this.applyStepOptions(hsl, mods, i, this._currentPass);\r\n // Convert back to Color\r\n var c = color($colors.hslToRgb(hsl));\r\n // Apply regular color mods\r\n var brighten = (this.stepOptions.brighten || 0) * i + (this.passOptions.brighten || 0) * this._currentPass;\r\n if (brighten != 0) {\r\n if (this.wrap) {\r\n brighten = $utils.fitNumberRelative(brighten, this.minLightness, this.maxLightness);\r\n }\r\n else {\r\n brighten = $utils.fitNumber(brighten, this.minLightness, this.maxLightness);\r\n }\r\n c = c.brighten(brighten);\r\n }\r\n var lighten = (this.stepOptions.lighten || 0) * i + (this.passOptions.lighten || 0) * this._currentPass;\r\n if (lighten != 0) {\r\n if (this.wrap) {\r\n lighten = $utils.fitNumberRelative(lighten, this.minLightness, this.maxLightness);\r\n }\r\n else {\r\n lighten = $utils.fitNumber(lighten, this.minLightness, this.maxLightness);\r\n }\r\n c = c.lighten(lighten);\r\n }\r\n this._list.push(c);\r\n }\r\n this._currentPass++;\r\n };\r\n Object.defineProperty(ColorSet.prototype, \"currentColor\", {\r\n /**\r\n * Returns current last color. It's either the last color in the list of\r\n * colors, or `baseColor` if list is empty.\r\n *\r\n * @return Color\r\n */\r\n get: function () {\r\n if (this._list.length == 0) {\r\n return this.baseColor.saturate(this.saturation);\r\n }\r\n else {\r\n return this._list[this._list.length - 1].saturate(this.saturation);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Generates modifiers for color, based on what step and pass.\r\n *\r\n * @param hsl Curren HSL value of the color to modify\r\n * @param base The modifiers that were before modification to use as a base\r\n * @param step Current step\r\n * @param pass Current pass\r\n */\r\n ColorSet.prototype.applyStepOptions = function (hsl, base, step, pass) {\r\n // Process lightness\r\n hsl.l = base.lightness + (this.stepOptions.lightness || 0) * step + (this.passOptions.lightness || 0) * pass;\r\n if (this.wrap) {\r\n if (hsl.l > 1) {\r\n hsl.l = hsl.l - Math.floor(hsl.l);\r\n }\r\n else if (hsl.l < 0) {\r\n hsl.l = -(hsl.l - Math.floor(hsl.l));\r\n }\r\n hsl.l = $utils.fitNumberRelative(hsl.l, this.minLightness, this.maxLightness);\r\n }\r\n else {\r\n if (hsl.l > 1) {\r\n hsl.l = 1;\r\n }\r\n else if (hsl.l < 0) {\r\n hsl.l = 0;\r\n }\r\n hsl.l = $utils.fitNumber(hsl.l, this.minLightness, this.maxLightness);\r\n }\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n ColorSet.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Set up axis ranges\r\n if ($type.hasValue(config.list) && $type.isArray(config.list)) {\r\n for (var i = 0, len = config.list.length; i < len; i++) {\r\n if (!(config.list[i] instanceof Color)) {\r\n config.list[i] = color(config.list[i]);\r\n }\r\n }\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n return ColorSet;\r\n}(BaseObject));\r\nexport { ColorSet };\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[\"ColorSet\"] = ColorSet;\r\n//# sourceMappingURL=ColorSet.js.map","/**\r\n * This module contains PatternSet object definition\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { BaseObject } from \"../Base\";\r\nimport { Color } from \"./Color\";\r\nimport { InterfaceColorSet } from \"./InterfaceColorSet\";\r\nimport { LinePattern } from \"../rendering/fills/LinePattern\";\r\nimport { RectPattern } from \"../rendering/fills/RectPattern\";\r\nimport { CirclePattern } from \"../rendering/fills/CirclePattern\";\r\nimport { registry } from \"../Registry\";\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines an interable list of distinctive patterns that can be used in\r\n * conjunction to colors to generate various fill patterns.\r\n *\r\n * @important\r\n * @since 4.7.5\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/colors/} for color-related info\r\n */\r\nvar PatternSet = /** @class */ (function (_super) {\r\n __extends(PatternSet, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PatternSet() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Holds the list of the colors in this set. (preset or auto-generated)\r\n */\r\n _this._list = [];\r\n /**\r\n * Current step.\r\n */\r\n _this._currentStep = 0;\r\n /**\r\n * If set to non-zero value, the PatternSet will start iterating patterns from\r\n * that particular index, not the first pattern in the list.\r\n */\r\n _this._startIndex = 0;\r\n /**\r\n * Current pass in cycle. Once all patterns in the list are iterated,\r\n * iteration restarts from beginning and currentPass is incremented.\r\n */\r\n _this._currentPass = 0;\r\n /**\r\n * A base color. If there are no colors pre-set in the color list, ColorSet\r\n * will use this color as a base when generating new ones, applying\r\n * `stepOptions` and `passOptions` to this base color.\r\n */\r\n _this.baseColor = new Color({\r\n r: 103,\r\n g: 183,\r\n b: 220\r\n });\r\n _this.className = \"PatternSet\";\r\n // Set base color to be used for pattern elements\r\n var interfaceColors = new InterfaceColorSet();\r\n // Set default patterns\r\n _this.list = [\r\n _this.getLinePattern(1000, 45, 1, 6),\r\n _this.getRectPattern(10, 0, 4),\r\n _this.getLinePattern(1000, -45, 1, 6),\r\n _this.getCirclePattern(11, 2, true),\r\n _this.getLinePattern(6, 90, 1),\r\n _this.getRectPattern(12, 45, 6, true),\r\n _this.getLinePattern(6, 0, 1),\r\n _this.getRectPattern(7, 0, 4),\r\n _this.getLinePattern(1000, 45, 2, 3, \"4,2\"),\r\n _this.getCirclePattern(9, 3, false),\r\n _this.getLinePattern(1000, -45, 2, 3, \"4,2\"),\r\n _this.getRectPattern(10, 45, Math.sqrt(50)),\r\n _this.getLinePattern(1000, -45, 2, 1),\r\n _this.getRectPattern(10, 0, 9),\r\n _this.getLinePattern(1000, 45, 2, 1),\r\n _this.getLinePattern(1000, 0, 3, 1),\r\n _this.getRectPattern(10, 45, 10),\r\n _this.getLinePattern(1000, 90, 3, 1)\r\n ];\r\n _this.baseColor = interfaceColors.getFor(\"stroke\");\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n PatternSet.prototype.getLinePattern = function (size, rotation, thickness, gap, strokeDashArray) {\r\n var pattern = new LinePattern();\r\n pattern.width = size;\r\n pattern.height = size;\r\n pattern.stroke = this.baseColor;\r\n pattern.gap = gap;\r\n pattern.strokeDasharray = strokeDashArray;\r\n pattern.strokeWidth = thickness;\r\n pattern.rotation = rotation;\r\n return pattern;\r\n };\r\n PatternSet.prototype.getRectPattern = function (size, rotation, thickness, outline) {\r\n var pattern = new RectPattern();\r\n pattern.width = size;\r\n pattern.height = size;\r\n pattern.rectWidth = thickness;\r\n pattern.rectHeight = thickness;\r\n if (outline) {\r\n pattern.stroke = this.baseColor;\r\n pattern.strokeWidth = 1;\r\n pattern.fillOpacity = 0;\r\n }\r\n else {\r\n pattern.fill = this.baseColor;\r\n pattern.strokeWidth = 0;\r\n }\r\n if (rotation != 0) {\r\n pattern.shapeRendering = \"auto\";\r\n }\r\n pattern.rotation = rotation;\r\n return pattern;\r\n };\r\n PatternSet.prototype.getCirclePattern = function (size, radius, outline) {\r\n var pattern = new CirclePattern();\r\n pattern.width = size;\r\n pattern.height = size;\r\n pattern.shapeRendering = \"auto\";\r\n pattern.radius = radius;\r\n if (outline) {\r\n pattern.stroke = this.baseColor;\r\n pattern.strokeWidth = 1;\r\n pattern.fillOpacity = 0;\r\n }\r\n else {\r\n pattern.fill = this.baseColor;\r\n pattern.strokeWidth = 0;\r\n }\r\n return pattern;\r\n };\r\n Object.defineProperty(PatternSet.prototype, \"list\", {\r\n /**\r\n * @return Pattern list\r\n */\r\n get: function () {\r\n return this._list;\r\n },\r\n /**\r\n * List of pre-defined patterns to be used in set.\r\n *\r\n * @param value Pattern list\r\n */\r\n set: function (value) {\r\n this._list = value;\r\n this.reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the next pattern in list.\r\n *\r\n * @return Pattern\r\n */\r\n PatternSet.prototype.next = function () {\r\n var pattern = this.getIndex(this.currentStep);\r\n this._currentStep++;\r\n return pattern;\r\n };\r\n /**\r\n * Returns a color at specific index in the list.\r\n *\r\n * @param i Index\r\n * @return Pattern\r\n */\r\n PatternSet.prototype.getIndex = function (i) {\r\n var pattern;\r\n while (this.list.length <= i) {\r\n this.generatePatterns();\r\n }\r\n pattern = this.list[i];\r\n return pattern.clone();\r\n };\r\n /**\r\n * Generates a new set of patterns.\r\n */\r\n PatternSet.prototype.generatePatterns = function () {\r\n var count = this.list.length / (this._currentPass + 1);\r\n this._currentPass++;\r\n for (var i = 0; i < count; i++) {\r\n this.list.push(this.list[i].clone());\r\n }\r\n };\r\n /**\r\n * Resets internal iterator.\r\n *\r\n * Calling `next()` after this will return the very first color in the color\r\n * list, even if it was already returned before.\r\n */\r\n PatternSet.prototype.reset = function () {\r\n this._currentStep = this._startIndex;\r\n };\r\n Object.defineProperty(PatternSet.prototype, \"currentStep\", {\r\n /**\r\n * @return Step\r\n */\r\n get: function () {\r\n return this._currentStep;\r\n },\r\n /**\r\n * Sets current color iteration. You can use this property to skip some\r\n * colors from iteration. E.g. setting it to `10` will skip first ten\r\n * colors.\r\n *\r\n * Please note that the number is zero-based.\r\n *\r\n * @param value Step\r\n */\r\n set: function (value) {\r\n this._currentStep = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PatternSet.prototype, \"startIndex\", {\r\n /**\r\n * @return Index\r\n */\r\n get: function () {\r\n return this._startIndex;\r\n },\r\n /**\r\n * If set to non-zero value, the ColorSet will start iterating colors from\r\n * that particular index, not the first color in the list.\r\n *\r\n * @default 0\r\n * @param value Index\r\n */\r\n set: function (value) {\r\n this._startIndex = value;\r\n this.reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n PatternSet.prototype.processConfig = function (config) {\r\n // if (config) {\r\n // \t// Set up axis ranges\r\n // \tif ($type.hasValue(config.list) && $type.isArray(config.list)) {\r\n // \t\tfor (let i = 0, len = config.list.length; i < len; i++) {\r\n // \t\t\tif (!(config.list[i] instanceof Color)) {\r\n // \t\t\t\tconfig.list[i] = color(config.list[i]);\r\n // \t\t\t}\r\n // \t\t}\r\n // \t}\r\n // }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n return PatternSet;\r\n}(BaseObject));\r\nexport { PatternSet };\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[\"PatternSet\"] = PatternSet;\r\n//# sourceMappingURL=PatternSet.js.map","/**\r\n * A plugin base class.\r\n */\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This is a base class that provides core functionality for plugins.\r\n *\r\n * The easiest way to start off with a new plugin is to extend this class.\r\n *\r\n * It will provide all the mandatory functionality, such as disposers.\r\n *\r\n * @since 4.2.2\r\n */\r\nvar Plugin = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n */\r\n function Plugin() {\r\n /**\r\n * Is this object disposed?\r\n */\r\n this._disposed = false;\r\n /**\r\n * List of IDisposer which will be disposed when the BaseObject is disposed.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this._disposers = [];\r\n // Nothing to do here\r\n }\r\n /**\r\n * Decorates series with required events and adapters used to hijack its\r\n * data.\r\n */\r\n Plugin.prototype.init = function () {\r\n // Does nothing\r\n // Override it\r\n };\r\n /**\r\n * Returns if this element is already disposed.\r\n *\r\n * @return Is disposed?\r\n */\r\n Plugin.prototype.isDisposed = function () {\r\n return this._disposed;\r\n };\r\n /**\r\n * Disposes this object and related stuff.\r\n */\r\n Plugin.prototype.dispose = function () {\r\n if (!this._disposed) {\r\n this._disposed = true;\r\n var a = this._disposers;\r\n this._disposers = null;\r\n while (a.length !== 0) {\r\n var disposer = a.shift();\r\n disposer.dispose();\r\n }\r\n }\r\n };\r\n return Plugin;\r\n}());\r\nexport { Plugin };\r\n//# sourceMappingURL=Plugin.js.map","/**\r\n * AmChartsLogo module.\r\n *\r\n * AmChartsLogo shows amCharts logo for non-commercial users of a library.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../Container\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { Polyspline } from \"./Polyspline\";\r\nimport { color } from \"../utils/Color\";\r\nimport { LinearGradient } from \"../rendering/fills/LinearGradient\";\r\nimport { DesaturateFilter } from \"../rendering/filters/DesaturateFilter\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A class used to draw and display progress indicator.\r\n *\r\n * @see {@link IAmChartsLogoEvents} for a list of available events\r\n * @see {@link IAmChartsLogoAdapters} for a list of available Adapters\r\n * @ignore Exclude from docs\r\n */\r\nvar AmChartsLogo = /** @class */ (function (_super) {\r\n __extends(AmChartsLogo, _super);\r\n /**\r\n * Constructor\r\n */\r\n function AmChartsLogo() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"AmChartsLogo\";\r\n _this.valign = \"bottom\";\r\n var d = 0.3;\r\n _this.opacity = 0.3;\r\n _this.defaultState.properties.opacity = 0.4;\r\n _this.url = \"https://www.amcharts.com/\";\r\n _this.urlTarget = \"_blank\";\r\n _this.showSystemTooltip = true;\r\n _this.readerTitle = \"Chart created using amCharts library\";\r\n _this.width = 220 * d;\r\n _this.height = 70 * d;\r\n _this.background.opacity = 0;\r\n var aColor = color(\"#474758\");\r\n if (new InterfaceColorSet().getFor(\"background\").alternative.hex == \"#ffffff\") {\r\n aColor = color(\"#ffffff\");\r\n }\r\n var aGradient = new LinearGradient();\r\n aGradient.addColor(aColor);\r\n aGradient.addColor(aColor, 1, 0.75);\r\n aGradient.addColor(color(\"#3cabff\"), 1, 0.755);\r\n aGradient.rotation = -10;\r\n var aStroke = aGradient;\r\n var m = _this.createChild(Polyspline);\r\n m.shouldClone = false;\r\n m.isMeasured = false;\r\n m.segments = [[{ x: 50 * d, y: 50 * d }, { x: 90 * d, y: 50 * d }, { x: 120 * d, y: 20 * d }, { x: 135 * d, y: 35 * d }, { x: 150 * d, y: 20 * d }, { x: 180 * d, y: 50 * d }, { x: 200 * d, y: 50 * d }]];\r\n m.strokeWidth = 6 * d;\r\n m.tensionX = 0.8;\r\n m.tensionY = 1;\r\n m.stroke = color(\"#3cabff\");\r\n var a = _this.createChild(Polyspline);\r\n a.shouldClone = false;\r\n a.isMeasured = false;\r\n a.segments = [[{ x: 20 * d, y: 50 * d }, { x: 50 * d, y: 50 * d }, { x: 90 * d, y: 12 * d }, { x: 133 * d, y: 50 * d }, { x: 170 * d, y: 50 * d }, { x: 200 * d, y: 50 * d }]];\r\n a.strokeWidth = 6 * d;\r\n a.tensionX = 0.75;\r\n a.tensionY = 1;\r\n a.stroke = aStroke;\r\n _this._disposers.push(a);\r\n var desaturateFilter = new DesaturateFilter();\r\n _this.filters.push(desaturateFilter);\r\n var desaturateFilterHover = new DesaturateFilter();\r\n desaturateFilterHover.saturation = 1;\r\n var hoverState = _this.states.create(\"hover\");\r\n hoverState.properties.opacity = 1;\r\n hoverState.filters.push(desaturateFilterHover);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return AmChartsLogo;\r\n}(Container));\r\nexport { AmChartsLogo };\r\n//# sourceMappingURL=AmChartsLogo.js.map","/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { system } from \"../System\";\r\nimport { registry } from \"../Registry\";\r\nimport { Container } from \"../Container\";\r\nimport { Component } from \"../Component\";\r\nimport { Paper } from \"../rendering/Paper\";\r\nimport { SVGContainer, svgContainers } from \"../rendering/SVGContainer\";\r\nimport { FocusFilter } from \"../rendering/filters/FocusFilter\";\r\nimport { Preloader } from \"../elements/Preloader\";\r\nimport { AmChartsLogo } from \"../elements/AmChartsLogo\";\r\nimport { Tooltip } from \"../elements/Tooltip\";\r\nimport { Disposer, MultiDisposer } from \"../utils/Disposer\";\r\nimport { percent } from \"./Percent\";\r\nimport { options } from \"../Options\";\r\nimport * as $array from \"./Array\";\r\nimport * as $type from \"./Type\";\r\nimport * as $dom from \"./DOM\";\r\nimport * as $utils from \"./Utils\";\r\nimport * as $log from \"./Log\";\r\n/**\r\n * ============================================================================\r\n * INSTANTIATION FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates all HTML and SVG containers needed for the chart instance, as well\r\n * as the new [[Sprite]] (as specified in `classType` parameter).\r\n *\r\n * @param htmlElement A container to creat elements in\r\n * @param classType A class definition of the new element to create\r\n * @return Newly-created Sprite object\r\n */\r\nfunction createChild(htmlElement, classType) {\r\n var htmlContainer = $dom.getElement(htmlElement);\r\n // If there's no container available yet, we create a fake one\r\n var tmpContainer = false;\r\n if (!htmlContainer) {\r\n htmlContainer = document.createElement(\"div\");\r\n htmlContainer.style.width = \"200px\";\r\n htmlContainer.style.height = \"200px\";\r\n htmlContainer.style.visibility = \"hidden\";\r\n htmlContainer.style.position = \"absolute\";\r\n document.body.appendChild(htmlContainer);\r\n tmpContainer = true;\r\n }\r\n if (htmlContainer) {\r\n htmlContainer.innerHTML = \"\";\r\n //htmlContainer.style.overflow = \"hidden\";\r\n var svgDiv_1 = new SVGContainer(htmlContainer);\r\n var paper = new Paper(svgDiv_1.SVGContainer, \"svg-\" + (svgContainers.length - 1));\r\n // the approach with masks is chosen because overflow:visible is set on SVG element in order tooltips could go outside\r\n // svg area - this is often needed when working with small charts.\r\n // main container which holds content container and tooltips container\r\n var container_1 = new Container();\r\n container_1.htmlContainer = htmlContainer;\r\n container_1.svgContainer = svgDiv_1;\r\n container_1.width = percent(100);\r\n container_1.height = percent(100);\r\n container_1.background.fillOpacity = 0;\r\n container_1.paper = paper;\r\n paper.append(container_1.group);\r\n // Set up moving to proper element container if it's not yet ready at call time\r\n if (tmpContainer) {\r\n $dom.ready(function () {\r\n container_1.moveHtmlContainer(htmlElement);\r\n });\r\n }\r\n // this is set from parent container, but this one doesn't have, so do it manually.\r\n container_1.relativeWidth = 1;\r\n container_1.relativeHeight = 1;\r\n svgDiv_1.container = container_1;\r\n // creating classType instance\r\n var sprite_1 = container_1.createChild(classType);\r\n sprite_1.topParent = container_1;\r\n var uid = sprite_1.uid;\r\n registry.invalidSprites[uid] = [];\r\n registry.invalidDatas[uid] = [];\r\n registry.invalidPositions[uid] = [];\r\n registry.invalidLayouts[uid] = [];\r\n container_1.baseId = uid;\r\n sprite_1.isBaseSprite = true;\r\n sprite_1.focusFilter = new FocusFilter();\r\n registry.baseSprites.push(sprite_1);\r\n registry.baseSpritesByUid[uid] = sprite_1;\r\n sprite_1.maskRectangle = { x: 0, y: 0, width: Math.max(svgDiv_1.width || 0, 0), height: Math.max(svgDiv_1.height || 0, 0) };\r\n // this solves issues with display:none, as all children are measured as 0x0\r\n container_1.events.on(\"maxsizechanged\", function (event) {\r\n if (event.previousWidth == 0 || event.previousHeight == 0) {\r\n container_1.deepInvalidate();\r\n }\r\n if (sprite_1.maskRectangle) {\r\n sprite_1.maskRectangle = { x: 0, y: 0, width: Math.max(svgDiv_1.width || 0, 0), height: Math.max(svgDiv_1.height || 0, 0) };\r\n }\r\n });\r\n var loopTimer_1 = null;\r\n // Checks to see whether the chart was properly disposed or not\r\n var loop_1 = function () {\r\n if (!sprite_1.isDisposed()) {\r\n if ($dom.getRoot(sprite_1.dom) == null) {\r\n if (options.autoDispose) {\r\n container_1.htmlContainer = undefined;\r\n svgDiv_1.htmlElement = undefined;\r\n sprite_1.dispose();\r\n }\r\n else {\r\n $log.warn(\"Chart was not disposed\", sprite_1.uid);\r\n }\r\n loopTimer_1 = null;\r\n }\r\n else {\r\n loopTimer_1 = window.setTimeout(loop_1, 1000);\r\n }\r\n }\r\n else {\r\n loopTimer_1 = null;\r\n }\r\n };\r\n loop_1();\r\n sprite_1.addDisposer(new Disposer(function () {\r\n if (loopTimer_1 !== null) {\r\n clearTimeout(loopTimer_1);\r\n }\r\n $array.remove(registry.baseSprites, sprite_1);\r\n registry.baseSpritesByUid[sprite_1.uid] = undefined;\r\n }));\r\n // TODO figure out a better way of doing this\r\n sprite_1.addDisposer(container_1);\r\n // tooltip container\r\n var tooltipContainer_1 = container_1.createChild(Container);\r\n tooltipContainer_1.topParent = container_1;\r\n tooltipContainer_1.width = percent(100);\r\n tooltipContainer_1.height = percent(100);\r\n tooltipContainer_1.isMeasured = false;\r\n container_1.tooltipContainer = tooltipContainer_1;\r\n sprite_1.tooltip = new Tooltip();\r\n sprite_1.tooltip.hide(0);\r\n sprite_1.tooltip.setBounds({ x: 0, y: 0, width: tooltipContainer_1.maxWidth, height: tooltipContainer_1.maxHeight });\r\n tooltipContainer_1.events.on(\"maxsizechanged\", function () {\r\n $type.getValue(sprite_1.tooltip).setBounds({ x: 0, y: 0, width: tooltipContainer_1.maxWidth, height: tooltipContainer_1.maxHeight });\r\n }, undefined, false);\r\n //@todo: maybe we don't need to create one by default but only on request?\r\n var preloader_1 = new Preloader();\r\n preloader_1.events.on(\"inited\", function () {\r\n preloader_1.__disabled = true;\r\n }, undefined, false);\r\n container_1.preloader = preloader_1;\r\n //if (!options.commercialLicense) {\r\n if (sprite_1 instanceof Container && !sprite_1.hasLicense()) {\r\n var logo_1 = tooltipContainer_1.createChild(AmChartsLogo);\r\n tooltipContainer_1.events.on(\"maxsizechanged\", function (ev) {\r\n if ((tooltipContainer_1.maxWidth <= 100) || (tooltipContainer_1.maxHeight <= 50)) {\r\n logo_1.hide();\r\n }\r\n else if (logo_1.isHidden || logo_1.isHiding) {\r\n logo_1.show();\r\n }\r\n }, undefined, false);\r\n sprite_1.logo = logo_1;\r\n logo_1.align = \"left\";\r\n logo_1.valign = \"bottom\";\r\n }\r\n $utils.used(sprite_1.numberFormatter); // need to create one.\r\n // Set this as an autonomouse instance\r\n // Controls like Preloader, Export will use this.\r\n container_1.isStandaloneInstance = true;\r\n if (options.onlyShowOnViewport) {\r\n if (!$dom.isElementInViewport(htmlContainer, options.viewportTarget)) {\r\n sprite_1.__disabled = true;\r\n sprite_1.tooltipContainer.__disabled = true;\r\n var disposers = [\r\n $dom.addEventListener(window, \"DOMContentLoaded\", function () { viewPortHandler(sprite_1); }),\r\n $dom.addEventListener(window, \"load\", function () { viewPortHandler(sprite_1); }),\r\n $dom.addEventListener(window, \"resize\", function () { viewPortHandler(sprite_1); }),\r\n $dom.addEventListener(window, \"scroll\", function () { viewPortHandler(sprite_1); })\r\n ];\r\n if (options.viewportTarget) {\r\n var targets = $type.isArray(options.viewportTarget) ? options.viewportTarget : options.viewportTarget ? [options.viewportTarget] : [];\r\n for (var i = 0; i < targets.length; i++) {\r\n var target = targets[i];\r\n disposers.push($dom.addEventListener(target, \"resize\", function () { viewPortHandler(sprite_1); }));\r\n disposers.push($dom.addEventListener(target, \"scroll\", function () { viewPortHandler(sprite_1); }));\r\n }\r\n }\r\n var disposer = new MultiDisposer(disposers);\r\n sprite_1.addDisposer(disposer);\r\n sprite_1.vpDisposer = disposer;\r\n }\r\n else if (options.queue) {\r\n addToQueue(sprite_1);\r\n }\r\n }\r\n else if (options.queue) {\r\n addToQueue(sprite_1);\r\n }\r\n return sprite_1;\r\n }\r\n else {\r\n system.log(\"html container not found\");\r\n throw new Error(\"html container not found\");\r\n }\r\n}\r\n/**\r\n * Disposes all of the currently active charts.\r\n */\r\nexport function disposeAllCharts() {\r\n while (registry.baseSprites.length !== 0) {\r\n registry.baseSprites.pop().dispose();\r\n }\r\n}\r\nexport function addToQueue(sprite) {\r\n if (registry.queue.indexOf(sprite) == -1) {\r\n sprite.__disabled = true;\r\n sprite.tooltipContainer.__disabled = true;\r\n sprite.events.disableType(\"appeared\");\r\n if (registry.queue.length == 0) {\r\n registry.events.once(\"exitframe\", function () {\r\n queueHandler(sprite);\r\n });\r\n system.requestFrame();\r\n }\r\n sprite.addDisposer(new Disposer(function () {\r\n removeFromQueue(sprite);\r\n }));\r\n registry.queue.push(sprite);\r\n }\r\n}\r\nexport function removeFromQueue(sprite) {\r\n var index = registry.queue.indexOf(sprite);\r\n if (index >= 0) {\r\n registry.queue.splice(registry.queue.indexOf(sprite), 1);\r\n var nextSprite = registry.queue[index];\r\n if (nextSprite) {\r\n queueHandler(nextSprite);\r\n }\r\n }\r\n}\r\nexport function viewPortHandler(sprite) {\r\n if (sprite.__disabled && $dom.isElementInViewport(sprite.htmlContainer, options.viewportTarget)) {\r\n if (sprite.vpDisposer) {\r\n sprite.vpDisposer.dispose();\r\n }\r\n addToQueue(sprite);\r\n }\r\n}\r\nexport function queueHandler(sprite) {\r\n sprite.__disabled = false;\r\n sprite.tooltipContainer.__disabled = false;\r\n sprite.events.enableType(\"appeared\");\r\n sprite.dispatch(\"removedfromqueue\");\r\n if (sprite.showOnInit) {\r\n sprite.events.on(\"appeared\", function () {\r\n removeFromQueue(sprite);\r\n });\r\n }\r\n if (sprite.vpDisposer) {\r\n sprite.vpDisposer.dispose();\r\n }\r\n if (sprite instanceof Container) {\r\n sprite.invalidateLabels();\r\n }\r\n if (sprite.tooltipContainer) {\r\n sprite.tooltipContainer.invalidateLayout();\r\n }\r\n if (sprite instanceof Component) {\r\n sprite.invalidateData();\r\n sprite.reinit();\r\n sprite.events.once(\"datavalidated\", function () {\r\n if (sprite.showOnInit) {\r\n sprite.appear();\r\n }\r\n else {\r\n removeFromQueue(sprite);\r\n }\r\n });\r\n }\r\n else {\r\n sprite.reinit();\r\n sprite.events.once(\"inited\", function () {\r\n removeFromQueue(sprite);\r\n });\r\n if (sprite.showOnInit) {\r\n sprite.appear();\r\n }\r\n }\r\n}\r\n/**\r\n * A shortcut to creating a chart instance.\r\n *\r\n * The first argument is either a reference to or an id of a DOM element to be\r\n * used as a container for the chart.\r\n *\r\n * The second argument is the type reference of the chart type. (for plain\r\n * JavaScript users this can also be a string indicating chart type)\r\n *\r\n * ```TypeScript\r\n * let chart = am4core.create(\"chartdiv\", am4charts.PieChart);\r\n * ```\r\n * ```JavaScript\r\n * // Can pass in chart type reference like this:\r\n * var chart = am4core.create(\"chartdiv\", am4charts.PieChart);\r\n *\r\n * // ... or chart class type as a string:\r\n * var chart = am4core.create(\"chartdiv\", \"PieChart\");\r\n * ```\r\n *\r\n * @param htmlElement Reference or id of the target container element\r\n * @param classType Class type of the target chart type\r\n * @return Chart instance\r\n */\r\nexport function create(htmlElement, classType) {\r\n // This is a nasty hack for the benefit of vanilla JS users, who do not\r\n // enjoy benefits of type-check anyway.\r\n // We're allowing passing in a name of the class rather than type reference\r\n // itself.\r\n var classError;\r\n if ($type.isString(classType)) {\r\n if ($type.hasValue(registry.registeredClasses[classType])) {\r\n classType = registry.registeredClasses[classType];\r\n }\r\n else {\r\n classType = registry.registeredClasses[\"Container\"];\r\n classError = new Error(\"Class [\" + classType + \"] is not loaded.\");\r\n }\r\n }\r\n // Create the chart\r\n var chart = createChild(htmlElement, classType);\r\n // Error?\r\n if (classError) {\r\n chart.raiseCriticalError(classError);\r\n }\r\n return chart;\r\n}\r\n/**\r\n * A shortcut to creating a chart from a config object.\r\n *\r\n * Example:\r\n *\r\n * ```TypeScript\r\n * let chart am4core.createFromConfig({ ... }, \"chartdiv\", am4charts.XYChart );\r\n * ```\r\n * ```JavaScript\r\n * var chart am4core.createFromConfig({ ... }, \"chartdiv\", \"XYChart\" );\r\n * ```\r\n *\r\n * If `chartType` parameter is not supplied it must be set in a config object,\r\n * via reference to chart type, e.g.:\r\n *\r\n * ```TypeScript\r\n * {\r\n * \"type\": am4charts.XYChart,\r\n * // ...\r\n * }\r\n * ```\r\n * ```JavaScript\r\n * {\r\n * \"type\": am4charts.XYChart,\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * Or via string: (if you are using JavaScript)\r\n *\r\n * ```TypeScript\r\n * {\r\n * \"type\": \"XYChart\",\r\n * // ...\r\n * }\r\n * ```\r\n * ```JavaScript\r\n * {\r\n * \"type\": \"XYChart\",\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * A `container` can either be a reference to an HTML container to put chart\r\n * in, or it's unique id.\r\n *\r\n * If `container` is not specified, it must be included in the config object:\r\n *\r\n * ```TypeScript\r\n * {\r\n * \"type\": \"XYChart\",\r\n * \"container\": \"chartdiv\",\r\n * // ...\r\n * }\r\n * ```\r\n * ```JavaScript\r\n * {\r\n * \"type\": \"XYChart\",\r\n * \"container\": \"chartdiv\",\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * @param config Config object in property/value pairs\r\n * @param htmlElement Container reference or ID\r\n * @param objectType Chart type\r\n * @return A newly created chart instance\r\n * @todo Throw exception if type is not correct\r\n */\r\nexport function createFromConfig(config, htmlElement, classType) {\r\n // Extract chart type from config if necessary\r\n if (!$type.hasValue(classType)) {\r\n classType = config.type;\r\n delete config.type;\r\n }\r\n // Extract element from config if necessary\r\n if (!$type.hasValue(htmlElement)) {\r\n htmlElement = config.container;\r\n delete config.container;\r\n }\r\n // Check if we need to extract actual type reference\r\n var finalType;\r\n var classError;\r\n if ($type.isString(classType) && $type.hasValue(registry.registeredClasses[classType])) {\r\n finalType = registry.registeredClasses[classType];\r\n }\r\n else if (typeof classType !== \"function\") {\r\n finalType = Container;\r\n classError = new Error(\"Class [\" + classType + \"] is not loaded.\");\r\n }\r\n else {\r\n finalType = classType;\r\n }\r\n // Create the chart\r\n var chart = createChild(htmlElement, finalType);\r\n // Set config\r\n if (classError) {\r\n chart.raiseCriticalError(classError);\r\n }\r\n else {\r\n chart.config = config;\r\n }\r\n return chart;\r\n}\r\n/**\r\n * Applies a theme to System, and subsequently all chart instances created\r\n * from that point forward.\r\n *\r\n * amCharts supports multiple themes. Calling `useTheme` multiple times will\r\n * make the System apply multiple themes, rather than overwrite previously\r\n * set one.\r\n *\r\n * This enables combining features from multiple themes on the same chart.\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * am4core.useTheme(am4themes.material);\r\n * am4core.useTheme(am4themes.animated);\r\n * ```\r\n * ```JavaScript\r\n * am4core.useTheme(am4themes.material);\r\n * am4core.useTheme(am4themes.animated);\r\n * ```\r\n *\r\n * The above will apply both the Material color and animation options to all\r\n * charts created.\r\n *\r\n * @param value A reference to a theme\r\n */\r\nexport function useTheme(value) {\r\n if (registry.themes.indexOf(value) === -1) {\r\n registry.themes.push(value);\r\n }\r\n}\r\n/**\r\n * Removes a theme from \"active themes\" list, so it won't get applied to any\r\n * charts created subsequently.\r\n *\r\n * @param value A reference to a theme\r\n */\r\nexport function unuseTheme(value) {\r\n $array.remove(registry.themes, value);\r\n}\r\n/**\r\n * Removes all \"active\" themes. Any charts created subsequently will not have\r\n * any theme applied to them.\r\n */\r\nexport function unuseAllThemes() {\r\n registry.themes = [];\r\n}\r\n/**\r\n * Adds a license, e.g.:\r\n *\r\n * ```TypeScript\r\n * am4core.addLicense(\"xxxxxxxx\");\r\n * ```\r\n * ```JavaScript\r\n * am4core.addLicense(\"xxxxxxxx\");\r\n * ```\r\n *\r\n * Multiple licenses can be added to cover for multiple products.\r\n *\r\n * @since 4.5.16\r\n * @param license License key\r\n */\r\nexport function addLicense(license) {\r\n options.licenses.push(license);\r\n}\r\n//# sourceMappingURL=Instance.js.map","/**\r\n * Grip module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Button } from \"./Button\";\r\nimport { Sprite } from \"../Sprite\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { registry } from \"../Registry\";\r\nimport { percent } from \"../utils/Percent\";\r\nimport * as $path from \"../rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a grip element that can be used for scrolling or other things.\r\n *\r\n * @see {@link IGripEvents} for a list of available events\r\n * @see {@link IGripAdapters} for a list of available Adapters\r\n * @since 4.4.0\r\n */\r\nvar Grip = /** @class */ (function (_super) {\r\n __extends(Grip, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Grip() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"Grip\";\r\n var cs = new InterfaceColorSet();\r\n // Set defaults\r\n _this.layout = \"absolute\";\r\n _this.padding(10, 10, 10, 10);\r\n _this.margin(3, 3, 3, 3);\r\n _this.background.fillOpacity = 0.3;\r\n _this.background.cornerRadius(10, 10, 10, 10);\r\n // Create an icon\r\n var icon = new Sprite();\r\n icon.element = _this.paper.add(\"path\");\r\n var path = $path.moveTo({ x: -6, y: 0 });\r\n path += $path.lineTo({ x: 6, y: 0 });\r\n path += $path.moveTo({ x: -8, y: -6 });\r\n path += $path.lineTo({ x: 0, y: -12 });\r\n path += $path.lineTo({ x: 8, y: -6 });\r\n path += $path.moveTo({ x: -8, y: 6 });\r\n path += $path.lineTo({ x: 0, y: 12 });\r\n path += $path.lineTo({ x: 8, y: 6 });\r\n icon.path = path;\r\n icon.strokeWidth = 2;\r\n icon.fillOpacity = 0;\r\n icon.pixelPerfect = true;\r\n icon.padding(0, 4, 0, 4);\r\n icon.stroke = cs.getFor(\"text\");\r\n icon.strokeOpacity = 0.7;\r\n icon.align = \"center\";\r\n icon.valign = \"middle\";\r\n _this.icon = icon;\r\n _this.label.dispose();\r\n _this.label = undefined;\r\n // Set default position\r\n _this.position = \"right\";\r\n // Set up autohide\r\n _this.autoHideDelay = 3000;\r\n _this.events.on(\"shown\", function (ev) {\r\n if (_this._autoHideTimeout) {\r\n _this._autoHideTimeout.dispose();\r\n }\r\n if (_this.autoHideDelay) {\r\n _this._autoHideTimeout = _this.setTimeout(function () {\r\n _this.hide();\r\n }, _this.autoHideDelay);\r\n }\r\n });\r\n _this.events.on(\"down\", function (ev) {\r\n if (_this._autoHideTimeout) {\r\n _this._autoHideTimeout.dispose();\r\n }\r\n });\r\n _this.events.on(\"out\", function (ev) {\r\n if (_this.autoHideDelay) {\r\n _this._autoHideTimeout = _this.setTimeout(function () {\r\n _this.hide();\r\n }, _this.autoHideDelay);\r\n }\r\n });\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(Grip.prototype, \"position\", {\r\n /**\r\n * @return Position\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"position\");\r\n },\r\n /**\r\n * Sets position of the grip.\r\n *\r\n * Available options: \"left\", \"right\" (default), \"top\", \"bottom\".\r\n *\r\n * @param value Position\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"position\", value)) {\r\n switch (value) {\r\n case \"left\":\r\n this.align = \"left\";\r\n this.valign = \"middle\";\r\n this.horizontalCenter = \"left\";\r\n this.verticalCenter = \"middle\";\r\n this.icon.rotation = 0;\r\n this.width = undefined;\r\n this.height = percent(30);\r\n break;\r\n case \"right\":\r\n this.align = \"right\";\r\n this.valign = \"middle\";\r\n this.horizontalCenter = \"right\";\r\n this.verticalCenter = \"middle\";\r\n this.icon.rotation = 0;\r\n this.width = undefined;\r\n this.height = percent(30);\r\n break;\r\n case \"top\":\r\n this.align = \"center\";\r\n this.valign = \"top\";\r\n this.horizontalCenter = \"middle\";\r\n this.verticalCenter = \"top\";\r\n this.icon.rotation = 90;\r\n this.width = percent(30);\r\n this.height = undefined;\r\n break;\r\n case \"bottom\":\r\n this.align = \"center\";\r\n this.valign = \"bottom\";\r\n this.horizontalCenter = \"middle\";\r\n this.verticalCenter = \"bottom\";\r\n this.icon.rotation = 90;\r\n this.width = percent(30);\r\n this.height = undefined;\r\n break;\r\n default:\r\n this.align = \"center\";\r\n this.valign = \"middle\";\r\n this.horizontalCenter = \"middle\";\r\n this.verticalCenter = \"middle\";\r\n this.icon.rotation = 90;\r\n this.width = percent(30);\r\n this.height = undefined;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Grip.prototype, \"autoHideDelay\", {\r\n /**\r\n * @return Delay\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"autoHideDelay\");\r\n },\r\n /**\r\n * Number of milliseconds to show grip until it is hidden automatically.\r\n *\r\n * @default 3000\r\n * @param value Delay\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"autoHideDelay\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Grip;\r\n}(Button));\r\nexport { Grip };\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[\"Grip\"] = Grip;\r\n//# sourceMappingURL=Grip.js.map","/**\r\n * [[Chart]] class provides base functionality for all chart types to inherit.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { registry } from \"../core/Registry\";\r\nimport { Component } from \"../core/Component\";\r\nimport { MutableValueDisposer, Disposer } from \"../core/utils/Disposer\";\r\nimport { ListTemplate, ListDisposer } from \"../core/utils/List\";\r\nimport { Container } from \"../core/Container\";\r\nimport { Label } from \"../core/elements/Label\";\r\nimport { Grip } from \"../core/elements/Grip\";\r\nimport { DataItem } from \"../core/DataItem\";\r\nimport { percent } from \"../core/utils/Percent\";\r\nimport * as $iter from \"../core/utils/Iterator\";\r\nimport * as $type from \"../core/utils/Type\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../core/utils/Responsive\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[Chart]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar ChartDataItem = /** @class */ (function (_super) {\r\n __extends(ChartDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ChartDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ChartDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return ChartDataItem;\r\n}(DataItem));\r\nexport { ChartDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A base class for all Charts.\r\n *\r\n * @see {@link IChartEvents} for a list of available Events\r\n * @see {@link IChartAdapters} for a list of available Adapters\r\n */\r\nvar Chart = /** @class */ (function (_super) {\r\n __extends(Chart, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Chart() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * A reference to chart's [[Legend]].\r\n * @ignore\r\n */\r\n _this._legend = new MutableValueDisposer();\r\n if (_this.constructor === Chart) {\r\n throw new Error(\"'Chart' cannot be instantiated directly. Please use a specific chart type.\");\r\n }\r\n _this.className = \"Chart\";\r\n // Create a list of titles\r\n var template = new Label();\r\n _this.titles = new ListTemplate(template);\r\n _this._disposers.push(new ListDisposer(_this.titles));\r\n _this._disposers.push(template);\r\n // Chart component is also a container. it holds _chartAndLegendCont and titles\r\n _this.width = percent(100);\r\n _this.height = percent(100);\r\n _this.layout = \"vertical\";\r\n // Chart and legend\r\n var chartAndLegendContainer = _this.createChild(Container);\r\n chartAndLegendContainer.shouldClone = false;\r\n chartAndLegendContainer.layout = \"vertical\";\r\n chartAndLegendContainer.width = percent(100);\r\n chartAndLegendContainer.height = percent(100);\r\n _this.chartAndLegendContainer = chartAndLegendContainer;\r\n // Chart container holds all the elements of a chart, extept titles and legend\r\n var chartContainer = chartAndLegendContainer.createChild(Container);\r\n chartContainer.shouldClone = false;\r\n chartContainer.width = percent(100);\r\n chartContainer.height = percent(100);\r\n _this.chartContainer = chartContainer;\r\n _this.showOnInit = true;\r\n _this._disposers.push(_this._legend);\r\n // Add title list events to apply certain formatting options and to make\r\n // the chart reference them as accessible screen reader labels\r\n _this.titles.events.on(\"inserted\", function (label) {\r\n _this.processTitle(label);\r\n _this.updateReaderTitleReferences();\r\n }, _this, false);\r\n _this.titles.events.on(\"removed\", function (label) {\r\n _this.updateReaderTitleReferences();\r\n }, _this, false);\r\n // Accessibility\r\n // It seems we can't set focusable on the whole chart because it seems to\r\n // mess up the whole focus event system - getting a focus on an inside\r\n // object also trigger focus on parent\r\n //this.focusable = true;\r\n _this.role = \"region\";\r\n _this.defaultState.transitionDuration = 1;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n Chart.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Chart\");\r\n }\r\n };\r\n /**\r\n * Initiates drawing of the chart.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Chart.prototype.draw = function () {\r\n this.fixLayout();\r\n _super.prototype.draw.call(this);\r\n };\r\n /**\r\n * Updates legend's hierarchy based on the position.\r\n */\r\n Chart.prototype.fixLayout = function () {\r\n var legend = this.legend;\r\n if (legend) {\r\n var chartAndLegendContainer = this.chartAndLegendContainer;\r\n var chartContainer = this.chartContainer;\r\n chartContainer.x = undefined;\r\n chartContainer.y = undefined;\r\n legend.x = undefined;\r\n legend.y = undefined;\r\n switch (legend.position) {\r\n case \"left\":\r\n chartAndLegendContainer.layout = \"horizontal\";\r\n legend.toBack();\r\n break;\r\n case \"right\":\r\n chartAndLegendContainer.layout = \"horizontal\";\r\n legend.toFront();\r\n break;\r\n case \"top\":\r\n chartAndLegendContainer.layout = \"vertical\";\r\n legend.toBack();\r\n break;\r\n case \"bottom\":\r\n chartAndLegendContainer.layout = \"vertical\";\r\n legend.toFront();\r\n }\r\n }\r\n };\r\n /**\r\n * Setups the legend to use the chart's data.\r\n */\r\n Chart.prototype.feedLegend = function () {\r\n // Nothing here. This method is provided only as a \"placeholder\" for\r\n // extending classes to override\r\n };\r\n /**\r\n * Adds a new title to the chart when it is inserted into chart's titles\r\n * list.\r\n * @param event An event object which is triggered when inserting into titles list\r\n * @return Label object\r\n */\r\n Chart.prototype.processTitle = function (event) {\r\n var title = event.newValue;\r\n title.parent = this;\r\n title.toBack();\r\n title.shouldClone = false;\r\n title.align = \"center\";\r\n // Need to explicitly apply the `id` attribute so it can be referenced by\r\n // `aria-labelledby`\r\n title.uidAttr();\r\n return title;\r\n };\r\n /**\r\n * Checks if chart has any title elements. If it does, we will use them in an\r\n * `aria-labelledby` attribute so that screen readers can use them to properly\r\n * describe the chart when it is focused or hovered.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Chart.prototype.updateReaderTitleReferences = function () {\r\n if (this.titles.length) {\r\n var titleIds_1 = [];\r\n $iter.each(this.titles.iterator(), function (title) {\r\n titleIds_1.push(title.uid);\r\n });\r\n this.setSVGAttribute({ \"aria-labelledby\": titleIds_1.join(\" \") });\r\n }\r\n else {\r\n this.removeSVGAttribute(\"aria-labelledby\");\r\n }\r\n };\r\n Object.defineProperty(Chart.prototype, \"legend\", {\r\n /**\r\n * @return Legend\r\n */\r\n get: function () {\r\n return this._legend.get();\r\n },\r\n /**\r\n * Holds the instance of chart's [[Leged]].\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/legend/} for more information about legends\r\n * @param Legend\r\n */\r\n set: function (legend) {\r\n this.setLegend(legend);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Prepares the legend instance for use in this chart.\r\n *\r\n * @param legend Legend\r\n */\r\n Chart.prototype.setLegend = function (legend) {\r\n var _this = this;\r\n if (this._legend.get() !== legend) {\r\n if (legend) {\r\n legend.maxWidth = 200;\r\n // Set legend options\r\n legend.parent = this.chartAndLegendContainer;\r\n this._legend.set(legend, legend.events.on(\"propertychanged\", function (event) {\r\n if (event.property == \"position\") {\r\n _this.fixLayout();\r\n }\r\n }, undefined, false));\r\n legend.addDisposer(new Disposer(function () {\r\n _this.legend = undefined;\r\n }));\r\n }\r\n else {\r\n this._legend.reset();\r\n }\r\n this.feedLegend();\r\n }\r\n };\r\n /**\r\n * Destroys this object and all related data.\r\n */\r\n Chart.prototype.dispose = function () {\r\n // otherwise there might be some errors when disposing chart which was just inited\r\n if (this.legend) {\r\n this.legend.dispose();\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n Chart.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Set up legend\r\n if ($type.hasValue(config.legend) && !$type.hasValue(config.legend.type)) {\r\n config.legend.type = \"Legend\";\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n /**\r\n * Copies all properties from another instance of [[Series]].\r\n *\r\n * @param source Source series\r\n */\r\n Chart.prototype.copyFrom = function (source) {\r\n this.titles.copyFrom(source.titles);\r\n this.chartContainer.copyFrom(source.chartContainer);\r\n if (source.legend) {\r\n this.legend = source.legend.clone();\r\n this.legend.removeChildren();\r\n }\r\n _super.prototype.copyFrom.call(this, source);\r\n };\r\n Object.defineProperty(Chart.prototype, \"dragGrip\", {\r\n /**\r\n * @return Grip\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._dragGrip) {\r\n var grip_1 = this.tooltipContainer.createChild(Grip);\r\n grip_1.align = \"right\";\r\n grip_1.valign = \"middle\";\r\n grip_1.hide(0);\r\n grip_1.events.on(\"down\", function (ev) {\r\n if (ev.touch) {\r\n _this.interactionsEnabled = false;\r\n }\r\n });\r\n grip_1.events.on(\"up\", function (ev) {\r\n _this.interactionsEnabled = true;\r\n });\r\n this.events.on(\"down\", function (ev) {\r\n if (ev.touch) {\r\n grip_1.show();\r\n }\r\n });\r\n this._dragGrip = grip_1;\r\n }\r\n return this._dragGrip;\r\n },\r\n /**\r\n * An instance of [[Grip]] which serves as a grip point which appears on\r\n * touch and allows scrolling whole page even if chart is occupying the\r\n * whole of the screen and would otherwise prevent scrolling.\r\n *\r\n * @since 4.4.0\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/touch/} For more information.\r\n * @param value Grip\r\n */\r\n set: function (value) {\r\n this._dragGrip = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Chart.prototype, \"focusable\", {\r\n get: function () {\r\n return this.parent.focusable;\r\n },\r\n set: function (value) {\r\n this.parent.focusable = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Chart;\r\n}(Component));\r\nexport { Chart };\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[\"Chart\"] = Chart;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Reduce horizontal margins\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.widthXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Chart) {\r\n var state = target.states.create(stateId);\r\n if (target.pixelPaddingLeft > 10) {\r\n state.properties.paddingLeft = 10;\r\n }\r\n if (target.pixelPaddingRight > 10) {\r\n state.properties.paddingRight = 10;\r\n }\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n/**\r\n * Reduce vertical margins\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.heightXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Chart) {\r\n var state = target.states.create(stateId);\r\n if (target.pixelPaddingTop > 10) {\r\n state.properties.paddingTop = 10;\r\n }\r\n if (target.pixelPaddingBottom > 10) {\r\n state.properties.paddingBottom = 10;\r\n }\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n/**\r\n * Remove horizontal padding\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.widthXXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Chart) {\r\n var state = target.states.create(stateId);\r\n state.properties.paddingLeft = 0;\r\n state.properties.paddingRight = 0;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n/**\r\n * Remove vertical padding\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.heightXXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Chart) {\r\n var state = target.states.create(stateId);\r\n state.properties.paddingTop = 0;\r\n state.properties.paddingBottom = 0;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=Chart.js.map","/**\r\n * Module that defines everything related to building bullets.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to creates bullets.\r\n *\r\n * @see {@link IBulletEvents} for a list of available events\r\n * @see {@link IBulletAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar Bullet = /** @class */ (function (_super) {\r\n __extends(Bullet, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Bullet() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Bullet\";\r\n _this.isMeasured = false;\r\n _this.tooltipX = 0;\r\n _this.tooltipY = 0;\r\n _this.layout = \"none\";\r\n _this.applyOnClones = true;\r\n _this.copyToLegendMarker = true;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(Bullet.prototype, \"locationX\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"locationX\");\r\n },\r\n /**\r\n * Relative horizontal location within cell. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"locationX\", value)) {\r\n var dataItem = this.dataItem;\r\n if (dataItem && dataItem.component) {\r\n dataItem.component.invalidate();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bullet.prototype, \"locationY\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"locationY\");\r\n },\r\n /**\r\n * Relative vertical location within cell. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"locationY\", value)) {\r\n var dataItem = this.dataItem;\r\n if (dataItem && dataItem.component) {\r\n dataItem.component.invalidate();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bullet.prototype, \"xField\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"xField\");\r\n },\r\n /**\r\n * [xField description]\r\n *\r\n * @todo Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"xField\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bullet.prototype, \"yField\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"yField\");\r\n },\r\n /**\r\n * [yField description]\r\n *\r\n * Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"yField\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bullet.prototype, \"isDynamic\", {\r\n /**\r\n * @return Redraw on data change?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"isDynamic\");\r\n },\r\n /**\r\n * Indicates if the bullet is \"dynamic\".\r\n *\r\n * In most cases the bullets remain the same, even if the underlying data\r\n * changes.\r\n *\r\n * However, in cases where bullet also displays a label, or its size depends\r\n * on data, it also needs to be redrawn when the underlying data changes.\r\n *\r\n * Only those bullets that have set `isDynamic = true` will be redrawn each\r\n * time data changes. Regular bullets will be reused as they are.\r\n *\r\n * @default false\r\n * @param value Redraw on data change?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"isDynamic\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bullet.prototype, \"copyToLegendMarker\", {\r\n /**\r\n * @return Redraw on data change?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"copyToLegendMarker\");\r\n },\r\n /**\r\n * Indicates if the bullet should be copied to legend marker\r\n *\r\n * @default false\r\n * @param value Redraw on data change?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"copyToLegendMarker\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Bullet;\r\n}(Container));\r\nexport { Bullet };\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[\"Bullet\"] = Bullet;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Hide bullets\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.isXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Bullet) {\r\n var state = target.states.create(stateId);\r\n state.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=Bullet.js.map","/**\r\n * Legend-related functionality.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Component } from \"../core/Component\";\r\nimport { DataItem } from \"../core/DataItem\";\r\nimport { ListTemplate, ListDisposer } from \"../core/utils/List\";\r\nimport { RoundedRectangle } from \"../core/elements/RoundedRectangle\";\r\nimport { Container } from \"../core/Container\";\r\nimport { Label } from \"../core/elements/Label\";\r\nimport { keyboard } from \"../core/utils/Keyboard\";\r\nimport { registry } from \"../core/Registry\";\r\nimport { getInteraction } from \"../core/interaction/Interaction\";\r\nimport { percent } from \"../core/utils/Percent\";\r\nimport { InterfaceColorSet } from \"../core/utils/InterfaceColorSet\";\r\nimport * as $utils from \"../core/utils/Utils\";\r\nimport * as $type from \"../core/utils/Type\";\r\nimport * as $math from \"../core/utils/Math\";\r\nimport { Sprite } from \"../core/Sprite\";\r\nimport { Disposer } from \"../core/utils/Disposer\";\r\nimport { MouseCursorStyle } from \"../core/interaction/Mouse\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../core/utils/Responsive\";\r\nimport { Scrollbar } from \"../core/elements/Scrollbar\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[Legend]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar LegendDataItem = /** @class */ (function (_super) {\r\n __extends(LegendDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function LegendDataItem() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * @ignore\r\n */\r\n _this.childrenCreated = false;\r\n _this.className = \"LegendDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(LegendDataItem.prototype, \"label\", {\r\n /**\r\n * A legend item's [[Label]] element.\r\n *\r\n * @return Label\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._label) {\r\n var label_1 = this.component.labels.create();\r\n this._label = label_1;\r\n this.addSprite(label_1);\r\n this._disposers.push(label_1);\r\n label_1.parent = this.itemContainer;\r\n this._disposers.push(new Disposer(function () {\r\n if ($type.hasValue(_this.component)) {\r\n _this.component.labels.removeValue(label_1);\r\n }\r\n }));\r\n }\r\n return this._label;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LegendDataItem.prototype, \"color\", {\r\n /**\r\n * @return Main color\r\n */\r\n get: function () {\r\n return this.properties.color;\r\n },\r\n /**\r\n * Main color of legend data item.\r\n *\r\n * This is set by the target element this legend item represents, like\r\n * a Series or a Slice.\r\n *\r\n * It can be used to derive a color in legend's sub-items, like label:\r\n *\r\n * ```TypeScript\r\n * chart.legend.labels.template.text = \"[{color}]{name}[/]\";\r\n * ```\r\n * ```JavaScript\r\n * chart.legend.labels.template.text = \"[{color}]{name}[/]\";\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"legend\": {\r\n * // ...\r\n * \"labels\": {\r\n * \"text\": \"[{color}]{name}[/]\"\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/legend/#Legend_labels} For more information about configuring legend labels.\r\n * @param value Main color\r\n */\r\n set: function (value) {\r\n this.setProperty(\"color\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LegendDataItem.prototype, \"valueLabel\", {\r\n /**\r\n * A legend item's [[Label]] element for \"value label\".\r\n *\r\n * @return Label\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._valueLabel) {\r\n var valueLabel_1 = this.component.valueLabels.create();\r\n this._valueLabel = valueLabel_1;\r\n this.addSprite(valueLabel_1);\r\n this._disposers.push(valueLabel_1);\r\n valueLabel_1.parent = this.itemContainer;\r\n this._disposers.push(new Disposer(function () {\r\n if ($type.hasValue(_this.component)) {\r\n _this.component.valueLabels.removeValue(valueLabel_1);\r\n }\r\n }));\r\n }\r\n return this._valueLabel;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LegendDataItem.prototype, \"itemContainer\", {\r\n /**\r\n * A reference to the main [[Container]] that holds legend item's elements:\r\n * marker and labels.\r\n *\r\n * @return Item container\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._itemContainer) {\r\n var component_1 = this.component;\r\n var itemContainer_1 = component_1.itemContainers.create();\r\n itemContainer_1.parent = component_1;\r\n this._itemContainer = itemContainer_1;\r\n this.addSprite(itemContainer_1);\r\n this._disposers.push(itemContainer_1);\r\n // Add click/tap event to toggle item\r\n if (itemContainer_1.togglable) {\r\n itemContainer_1.events.on(\"toggled\", function (ev) {\r\n component_1.toggleDataItem(ev.target.dataItem);\r\n }, undefined, false);\r\n }\r\n // Add focus event so that we can track which object is currently in focus\r\n // for keyboard toggling\r\n if (itemContainer_1.focusable) {\r\n itemContainer_1.events.on(\"hit\", function (ev) {\r\n // We need this here in order to reset focused item when it is clicked\r\n // normally so that it is not toggled by ENTER afterwards\r\n component_1.focusedItem = undefined;\r\n }, undefined, false);\r\n itemContainer_1.events.on(\"focus\", function (ev) {\r\n component_1.focusedItem = ev.target.dataItem;\r\n }, undefined, false);\r\n itemContainer_1.events.on(\"blur\", function (ev) {\r\n component_1.focusedItem = undefined;\r\n }, undefined, false);\r\n }\r\n this._disposers.push(new Disposer(function () {\r\n if ($type.hasValue(_this.component)) {\r\n _this.component.itemContainers.removeValue(itemContainer_1);\r\n }\r\n }));\r\n if (this.dataContext.uidAttr) {\r\n itemContainer_1.readerControls = this.dataContext.uidAttr();\r\n itemContainer_1.readerLabelledBy = this.dataContext.uidAttr();\r\n }\r\n var sprite = this.dataContext;\r\n if ((sprite instanceof DataItem || sprite instanceof Sprite) && !sprite.isDisposed()) {\r\n var visibilitychanged = function (ev) {\r\n itemContainer_1.readerChecked = ev.visible;\r\n itemContainer_1.events.disableType(\"toggled\");\r\n itemContainer_1.isActive = !ev.visible;\r\n itemContainer_1.events.enableType(\"toggled\");\r\n };\r\n sprite.addDisposer(new Disposer(function () {\r\n if (_this.component) {\r\n _this.component.dataItems.remove(_this);\r\n }\r\n }));\r\n if (sprite instanceof Sprite) {\r\n itemContainer_1.addDisposer(sprite.events.on(\"visibilitychanged\", visibilitychanged, undefined, false));\r\n itemContainer_1.addDisposer(sprite.events.on(\"hidden\", function (ev) {\r\n itemContainer_1.readerChecked = false;\r\n itemContainer_1.events.disableType(\"toggled\");\r\n itemContainer_1.isActive = true;\r\n itemContainer_1.events.enableType(\"toggled\");\r\n }, undefined, false));\r\n itemContainer_1.addDisposer(sprite.events.on(\"shown\", function (ev) {\r\n itemContainer_1.readerChecked = true;\r\n itemContainer_1.events.disableType(\"toggled\");\r\n itemContainer_1.isActive = false;\r\n itemContainer_1.events.enableType(\"toggled\");\r\n }, undefined, false));\r\n }\r\n else {\r\n itemContainer_1.addDisposer(sprite.events.on(\"visibilitychanged\", visibilitychanged, undefined, false));\r\n }\r\n }\r\n }\r\n return this._itemContainer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LegendDataItem.prototype, \"marker\", {\r\n /**\r\n * A [[Container]] that holds legend item's marker element.\r\n *\r\n * @return Marker\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._marker) {\r\n var marker_1 = this.component.markers.create();\r\n this._marker = marker_1;\r\n marker_1.parent = this.itemContainer;\r\n this.addSprite(marker_1);\r\n this._disposers.push(marker_1);\r\n this._disposers.push(new Disposer(function () {\r\n if ($type.hasValue(_this.component)) {\r\n _this.component.markers.removeValue(marker_1);\r\n }\r\n }));\r\n }\r\n return this._marker;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return LegendDataItem;\r\n}(DataItem));\r\nexport { LegendDataItem };\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a class that carries legend settings.\r\n *\r\n * A legend might change its settings dynamically. Legend can also be shared\r\n * by several elements, requiring different settings.\r\n *\r\n * Having legend's settings in a separate object is a good way to \"hot swap\"\r\n * a set of settings for the legend.\r\n */\r\nvar LegendSettings = /** @class */ (function () {\r\n function LegendSettings() {\r\n /**\r\n * Should marker be created for each legend item.\r\n */\r\n this.createMarker = true;\r\n }\r\n return LegendSettings;\r\n}());\r\nexport { LegendSettings };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * [[Legend]] class is used to create legend for the chart.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/legend/} for Legend documentation\r\n * @see {@link ILegendEvents} for a list of available events\r\n * @see {@link ILegendAdapters} for a list of available Adapters\r\n */\r\nvar Legend = /** @class */ (function (_super) {\r\n __extends(Legend, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Legend() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Legend\";\r\n // Set defaults\r\n _this.layout = \"grid\";\r\n _this.setPropertyValue(\"useDefaultMarker\", false);\r\n _this.setPropertyValue(\"scrollable\", false);\r\n _this.setPropertyValue(\"contentAlign\", \"center\");\r\n // Create a template container and list for legend items\r\n var itemContainer = new Container();\r\n itemContainer.applyOnClones = true;\r\n itemContainer.padding(8, 0, 8, 0);\r\n itemContainer.margin(0, 10, 0, 10);\r\n itemContainer.layout = \"horizontal\";\r\n itemContainer.clickable = true;\r\n itemContainer.focusable = true;\r\n itemContainer.role = \"switch\";\r\n itemContainer.togglable = true;\r\n itemContainer.cursorOverStyle = MouseCursorStyle.pointer;\r\n itemContainer.background.fillOpacity = 0; // creates hit area\r\n // Create container list using item template we just created\r\n _this.itemContainers = new ListTemplate(itemContainer);\r\n _this._disposers.push(new ListDisposer(_this.itemContainers));\r\n _this._disposers.push(_this.itemContainers.template);\r\n // Set up global keyboard events for toggling elements\r\n _this._disposers.push(getInteraction().body.events.on(\"keyup\", function (ev) {\r\n if (keyboard.isKey(ev.event, \"enter\") && _this.focusedItem) {\r\n var focusedItem = _this.focusedItem;\r\n var target = focusedItem.itemContainer;\r\n if (target.togglable) {\r\n _this.toggleDataItem(focusedItem);\r\n }\r\n else if (target.clickable && target.events.isEnabled(\"hit\")) {\r\n target.dispatchImmediately(\"hit\", { event: ev });\r\n // We need this here because \"hit\" event resets `this.focusedItem`\r\n // And we need it here\r\n _this.focusedItem = focusedItem;\r\n }\r\n }\r\n }, _this));\r\n var interfaceColors = new InterfaceColorSet();\r\n // Create a template container and list for the a marker\r\n var marker = new Container();\r\n marker.width = 23;\r\n marker.height = 23;\r\n marker.interactionsEnabled = false;\r\n marker.applyOnClones = true;\r\n marker.setStateOnChildren = true;\r\n marker.background.fillOpacity = 0;\r\n marker.background.strokeOpacity = 0;\r\n marker.propertyFields.fill = \"fill\";\r\n marker.valign = \"middle\";\r\n var disabledColor = interfaceColors.getFor(\"disabledBackground\");\r\n marker.events.on(\"childadded\", function (event) {\r\n var child = event.newValue;\r\n var activeState = child.states.create(\"active\");\r\n activeState.properties.stroke = disabledColor;\r\n activeState.properties.fill = disabledColor;\r\n });\r\n _this.markers = new ListTemplate(marker);\r\n _this._disposers.push(new ListDisposer(_this.markers));\r\n _this._disposers.push(_this.markers.template);\r\n // Create a legend background element\r\n var rectangle = marker.createChild(RoundedRectangle);\r\n rectangle.width = percent(100);\r\n rectangle.height = percent(100);\r\n rectangle.applyOnClones = true;\r\n rectangle.propertyFields.fill = \"fill\";\r\n rectangle.strokeOpacity = 0;\r\n // Create a template container and list for item labels\r\n var label = new Label();\r\n label.text = \"{name}\";\r\n label.margin(0, 5, 0, 5);\r\n label.valign = \"middle\";\r\n label.applyOnClones = true;\r\n label.states.create(\"active\").properties.fill = interfaceColors.getFor(\"disabledBackground\");\r\n _this.labels = new ListTemplate(label);\r\n _this._disposers.push(new ListDisposer(_this.labels));\r\n _this._disposers.push(_this.labels.template);\r\n label.interactionsEnabled = false;\r\n label.truncate = true;\r\n label.fullWords = false;\r\n // Create a template container and list for item value labels\r\n var valueLabel = new Label();\r\n valueLabel.margin(0, 5, 0, 0);\r\n valueLabel.valign = \"middle\";\r\n valueLabel.width = 50; // to avoid rearranging legend entries when value changes.\r\n valueLabel.align = \"right\";\r\n valueLabel.textAlign = \"end\";\r\n valueLabel.applyOnClones = true;\r\n valueLabel.states.create(\"active\").properties.fill = interfaceColors.getFor(\"disabledBackground\");\r\n valueLabel.interactionsEnabled = false;\r\n _this.valueLabels = new ListTemplate(valueLabel);\r\n _this._disposers.push(new ListDisposer(_this.valueLabels));\r\n _this._disposers.push(_this.valueLabels.template);\r\n _this.position = \"bottom\"; // don't use setPropertyValue here!\r\n // Create a state for disabled legend items\r\n itemContainer.states.create(\"active\");\r\n itemContainer.setStateOnChildren = true;\r\n // Apply accessibility settings\r\n _this.role = \"group\";\r\n _this.events.on(\"layoutvalidated\", _this.handleScrollbar, _this, false);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n Legend.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Legend\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n Legend.prototype.createDataItem = function () {\r\n return new LegendDataItem();\r\n };\r\n /**\r\n * [validateDataElement description]\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n * @todo Description\r\n * @todo Figure out how to update appearance of legend item without losing focus\r\n * @todo Update legend marker appearance as apperance of related series changes\r\n */\r\n Legend.prototype.validateDataElement = function (dataItem) {\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n // Get data item (legend item's) container\r\n var container = dataItem.itemContainer;\r\n var marker = dataItem.marker;\r\n $utils.used(dataItem.label);\r\n var valueLabel = dataItem.valueLabel;\r\n // Set parent and update current state\r\n container.readerChecked = dataItem.dataContext.visible;\r\n // Tell series its legend data item\r\n dataItem.dataContext.legendDataItem = dataItem;\r\n var tempMaxWidth = dataItem.label.maxWidth;\r\n dataItem.label.width = undefined;\r\n if (tempMaxWidth > 0) {\r\n dataItem.label.maxWidth = tempMaxWidth;\r\n }\r\n if (valueLabel.align == \"right\") {\r\n valueLabel.width = undefined;\r\n }\r\n var legendSettings = dataItem.dataContext.legendSettings;\r\n // If we are not using default markers, create a unique legend marker based\r\n // on the data item type\r\n var dataContext = dataItem.dataContext;\r\n if (dataContext.createLegendMarker && (!this.useDefaultMarker || !(dataContext instanceof Sprite))) {\r\n if (!dataItem.childrenCreated) {\r\n dataContext.createLegendMarker(marker);\r\n dataItem.childrenCreated = true;\r\n }\r\n }\r\n if (dataContext.updateLegendValue) {\r\n dataContext.updateLegendValue(); // this solves issue with external legend, as legend is created after chart updates legend values\r\n }\r\n if (dataContext.component && dataContext.component.updateLegendValue) {\r\n dataContext.component.updateLegendValue(dataContext);\r\n }\r\n if (valueLabel.invalid) {\r\n valueLabel.validate();\r\n }\r\n if (valueLabel.text == \"\" || valueLabel.text == undefined) {\r\n valueLabel.__disabled = true;\r\n }\r\n else {\r\n valueLabel.__disabled = false;\r\n }\r\n if (legendSettings && (legendSettings.itemValueText != undefined || legendSettings.valueText != undefined)) {\r\n valueLabel.__disabled = false;\r\n }\r\n var visible = dataItem.dataContext.visible;\r\n if (visible === undefined) {\r\n visible = true;\r\n }\r\n visible = $type.toBoolean(visible);\r\n dataItem.dataContext.visible = visible;\r\n container.events.disableType(\"toggled\");\r\n container.isActive = !visible;\r\n if (container.isActive) {\r\n container.setState(\"active\", 0);\r\n }\r\n else {\r\n container.setState(\"default\", 0);\r\n }\r\n container.events.enableType(\"toggled\");\r\n };\r\n Legend.prototype.afterDraw = function () {\r\n var _this = this;\r\n var maxWidth = this.getPropertyValue(\"maxWidth\");\r\n var maxLabelWidth = 0;\r\n this.labels.each(function (label) {\r\n if (label.invalid) {\r\n label.validate();\r\n }\r\n if (label.measuredWidth + label.pixelMarginLeft + label.pixelMarginRight > maxLabelWidth) {\r\n maxLabelWidth = label.measuredWidth + label.pixelMarginLeft + label.pixelMarginRight;\r\n }\r\n });\r\n var maxValueLabelWidth = 0;\r\n this.valueLabels.each(function (label) {\r\n if (label.invalid) {\r\n label.validate();\r\n }\r\n if (label.measuredWidth + label.pixelMarginLeft + label.pixelMarginRight > maxValueLabelWidth) {\r\n maxValueLabelWidth = label.measuredWidth + label.pixelMarginLeft + label.pixelMarginRight;\r\n }\r\n });\r\n var maxMarkerWidth = 0;\r\n this.markers.each(function (marker) {\r\n if (marker.invalid) {\r\n marker.validate();\r\n }\r\n if (marker.measuredWidth + marker.pixelMarginLeft + marker.pixelMarginRight > maxMarkerWidth) {\r\n maxMarkerWidth = marker.measuredWidth + marker.pixelMarginLeft + marker.pixelMarginRight;\r\n }\r\n });\r\n var itemContainer = this.itemContainers.template;\r\n var margin = itemContainer.pixelMarginRight + itemContainer.pixelMarginLeft;\r\n var maxAdjustedLabelWidth;\r\n var trueMaxWidth = maxLabelWidth + maxValueLabelWidth + maxMarkerWidth;\r\n if (!$type.isNumber(maxWidth)) {\r\n maxAdjustedLabelWidth = maxLabelWidth;\r\n }\r\n else {\r\n maxWidth = maxWidth - margin;\r\n if (maxWidth > trueMaxWidth) {\r\n maxWidth = trueMaxWidth;\r\n }\r\n maxAdjustedLabelWidth = maxWidth - maxMarkerWidth - maxValueLabelWidth;\r\n }\r\n this.labels.each(function (label) {\r\n if (_this.valueLabels.template.align == \"right\" || label.measuredWidth > maxAdjustedLabelWidth) {\r\n label.width = Math.min(label.maxWidth, maxAdjustedLabelWidth - label.pixelMarginLeft - label.pixelMarginRight);\r\n }\r\n });\r\n if (this.valueLabels.template.align == \"right\") {\r\n this.valueLabels.each(function (valueLabel) {\r\n valueLabel.width = maxValueLabelWidth - valueLabel.pixelMarginRight - valueLabel.pixelMarginLeft;\r\n });\r\n }\r\n _super.prototype.afterDraw.call(this);\r\n };\r\n Legend.prototype.handleScrollbar = function () {\r\n var scrollbar = this.scrollbar;\r\n if (this.scrollable && scrollbar) {\r\n scrollbar.height = this.measuredHeight;\r\n scrollbar.x = this.measuredWidth - scrollbar.pixelWidth - scrollbar.pixelMarginLeft;\r\n if (this.contentHeight > this.measuredHeight) {\r\n scrollbar.visible = true;\r\n scrollbar.thumb.height = scrollbar.height * this.measuredHeight / this.contentHeight;\r\n this.paddingRight = scrollbar.pixelWidth + scrollbar.pixelMarginLeft + +scrollbar.pixelMarginRight;\r\n }\r\n else {\r\n scrollbar.visible = false;\r\n }\r\n this.updateMasks();\r\n }\r\n };\r\n Object.defineProperty(Legend.prototype, \"position\", {\r\n /**\r\n * @return Position\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"position\");\r\n },\r\n /**\r\n * Position of the legend.\r\n *\r\n * Options: \"left\", \"right\", \"top\", \"bottom\" (default), or \"absolute\".\r\n *\r\n * IMPORTANT: [[MapChart]] will ignore this setting, as it is using different\r\n * layout structure than other charts.\r\n *\r\n * To position legend in [[MapChart]] set legend's `align` (`\"left\"` or\r\n * `\"right\"`) and `valign` (`\"top\"` or `\"bottom\"`) properties instead.\r\n *\r\n * @default \"bottom\"\r\n * @param value Position\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"position\", value)) {\r\n if (value == \"left\" || value == \"right\") {\r\n this.margin(10, 5, 10, 10);\r\n this.valign = \"middle\";\r\n this.contentAlign = \"none\";\r\n this.valueLabels.template.align = \"right\";\r\n if (!$type.isNumber(this.maxColumns)) {\r\n this.maxColumns = 1;\r\n }\r\n this.width = undefined;\r\n this.maxWidth = 220;\r\n }\r\n else {\r\n this.maxColumns = undefined;\r\n this.width = percent(100);\r\n this.valueLabels.template.align = \"left\";\r\n }\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Legend.prototype, \"useDefaultMarker\", {\r\n /**\r\n * @return Use default marker?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"useDefaultMarker\");\r\n },\r\n /**\r\n * Should legend try to mirror the look of the related item when building\r\n * the marker for legend item?\r\n *\r\n * If set to `false` it will try to make the marker look like its related\r\n * item.\r\n *\r\n * E.g. if an item is for a Line Series, it will display a line of the\r\n * same thickness, color, and will use the same bullets if series have them.\r\n *\r\n * If set to `true`, all markers will be shown as squares, regardless of te\r\n * series type.\r\n *\r\n * @default false\r\n * @param value Use default marker?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"useDefaultMarker\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Legend.prototype, \"scrollable\", {\r\n /**\r\n * @return Legend Scrollable?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"scrollable\");\r\n },\r\n /**\r\n * If set to `true` the Legend will display a scrollbar if its contents do\r\n * not fit into its `maxHeight`.\r\n *\r\n * Please note that `maxHeight` is automatically set for Legend when its\r\n * `position` is set to `\"left\"` or `\"right\"`.\r\n *\r\n * @default false\r\n * @since 4.8.0\r\n * @param value Legend Scrollable?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"scrollable\", value, true)) {\r\n if (value) {\r\n var scrollbar = this.createChild(Scrollbar);\r\n this.scrollbar = scrollbar;\r\n scrollbar.isMeasured = false;\r\n scrollbar.orientation = \"vertical\";\r\n scrollbar.endGrip.__disabled = true;\r\n scrollbar.startGrip.__disabled = true;\r\n scrollbar.visible = false;\r\n scrollbar.marginLeft = 5;\r\n this._mouseWheelDisposer = this.events.on(\"wheel\", this.handleWheel, this, false);\r\n this._disposers.push(this._mouseWheelDisposer);\r\n this._disposers.push(scrollbar.events.on(\"rangechanged\", this.updateMasks, this, false));\r\n }\r\n else {\r\n if (this._mouseWheelDisposer) {\r\n this._mouseWheelDisposer.dispose();\r\n if (this.scrollbar) {\r\n this.scrollbar.dispose();\r\n this.scrollbar = undefined;\r\n }\r\n }\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Handles mouse wheel scrolling of legend.\r\n *\r\n * @param event Event\r\n */\r\n Legend.prototype.handleWheel = function (event) {\r\n var shift = event.shift.y;\r\n var scrollbar = this.scrollbar;\r\n if (scrollbar) {\r\n var ds = (shift / 1000 * this.measuredHeight / this.contentHeight);\r\n var delta = scrollbar.end - scrollbar.start;\r\n if (shift > 0) {\r\n scrollbar.start = $math.max(0, scrollbar.start - ds);\r\n scrollbar.end = scrollbar.start + delta;\r\n }\r\n else {\r\n scrollbar.end = $math.min(1, scrollbar.end - ds);\r\n scrollbar.start = scrollbar.end - delta;\r\n }\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Legend.prototype.updateMasks = function () {\r\n var _this = this;\r\n if (this.scrollbar) {\r\n this.itemContainers.each(function (itemContainer) {\r\n itemContainer.dy = -_this.scrollbar.thumb.pixelY * _this.contentHeight / _this.measuredHeight;\r\n itemContainer.maskRectangle = { x: 0, y: -itemContainer.dy, width: _this.measuredWidth, height: _this.measuredHeight };\r\n });\r\n }\r\n };\r\n /**\r\n * Toggles a legend item.\r\n *\r\n * @ignore Exclude from docs\r\n * @param item Legend item\r\n * @todo Maybe do it with togglable instead\r\n */\r\n Legend.prototype.toggleDataItem = function (item) {\r\n var dataContext = item.dataContext;\r\n if (!dataContext.visible || dataContext.isHiding || (dataContext instanceof Sprite && dataContext.isHidden)) {\r\n item.color = item.colorOrig;\r\n item.itemContainer.isActive = false;\r\n if (dataContext.hidden === true) {\r\n dataContext.hidden = false;\r\n }\r\n if (dataContext.show) {\r\n dataContext.show();\r\n }\r\n else {\r\n dataContext.visible = true;\r\n }\r\n this.svgContainer.readerAlert(this.language.translate(\"%1 shown\", this.language.locale, item.label.readerTitle));\r\n }\r\n else {\r\n item.itemContainer.isActive = true;\r\n if (dataContext.hide) {\r\n dataContext.hide();\r\n }\r\n else {\r\n dataContext.visible = false;\r\n }\r\n this.svgContainer.readerAlert(this.language.translate(\"%1 hidden\", this.language.locale, item.label.readerTitle));\r\n item.color = new InterfaceColorSet().getFor(\"disabledBackground\");\r\n }\r\n };\r\n Object.defineProperty(Legend.prototype, \"preloader\", {\r\n /**\r\n * Override preloader method so that legend does not accidentally show its\r\n * own preloader.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Always `undefined`\r\n */\r\n get: function () {\r\n return;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * [handleDataItemPropertyChange description]\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Legend.prototype.handleDataItemPropertyChange = function (dataItem, name) {\r\n dataItem.valueLabel.invalidate();\r\n dataItem.label.invalidate();\r\n };\r\n return Legend;\r\n}(Component));\r\nexport { Legend };\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[\"Legend\"] = Legend;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Move legend to below the chart if chart is narrow\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.widthXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Legend && (target.position == \"left\" || target.position == \"right\")) {\r\n var state = target.states.create(stateId);\r\n state.properties.position = \"bottom\";\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n/**\r\n * Move legend to the right if chart is very short\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.heightXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Legend && (target.position == \"top\" || target.position == \"bottom\")) {\r\n var state = target.states.create(stateId);\r\n state.properties.position = \"right\";\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n/**\r\n * Disable legend altogether on small charts\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.isXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Legend) {\r\n var state = target.states.create(stateId);\r\n state.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=Legend.js.map","/**\r\n * Functionality for any series-based elements, like Line Series (graphs),\r\n * Pie slice lists, etc.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Component } from \"../../core/Component\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { List, ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { Dictionary, DictionaryDisposer } from \"../../core/utils/Dictionary\";\r\nimport { DataItem } from \"../../core/DataItem\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { Tooltip } from \"../../core/elements/Tooltip\";\r\nimport { Bullet } from \"../elements/Bullet\";\r\nimport { LegendSettings } from \"../Legend\";\r\nimport { options } from \"../../core/Options\";\r\nimport { Color } from \"../../core/utils/Color\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $ease from \"../../core/utils/Ease\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport * as $colors from \"../../core/utils/Colors\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[Series]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar SeriesDataItem = /** @class */ (function (_super) {\r\n __extends(SeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"SeriesDataItem\";\r\n //@todo Should we make `bullets` list disposable?\r\n //this._disposers.push(new DictionaryDisposer(this.bullets));\r\n _this.values.value = {};\r\n _this.values.value = {};\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(SeriesDataItem.prototype, \"bullets\", {\r\n /**\r\n * A dictionary of data items bullets, where key is uid of a bullet template.\r\n */\r\n get: function () {\r\n if (!this._bullets) {\r\n this._bullets = new Dictionary();\r\n this._disposers.push(new DictionaryDisposer(this._bullets));\r\n }\r\n return this._bullets;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Destroys this object and all related data.\r\n */\r\n SeriesDataItem.prototype.dispose = function () {\r\n this.bullets.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n Object.defineProperty(SeriesDataItem.prototype, \"value\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.value.value;\r\n },\r\n /**\r\n * data items's numeric value.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"value\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return SeriesDataItem;\r\n}(DataItem));\r\nexport { SeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines base class for any kind of serial data.\r\n *\r\n * @see {@link ISeriesEvents} for a list of available Events\r\n * @see {@link ISeriesAdapters} for a list of available Adapters\r\n * @todo Separate axis-related stuff to some other class so that MapSeries would not have unrelated stuff\r\n */\r\nvar Series = /** @class */ (function (_super) {\r\n __extends(Series, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Series() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Should this series excluded from the axis scale calculations?\r\n *\r\n * @default false\r\n */\r\n _this._ignoreMinMax = false;\r\n /**\r\n * Should series' bullets?\r\n *\r\n * @default true\r\n */\r\n _this._showBullets = true;\r\n /**\r\n * Settings for the appearance of the related legend items.\r\n */\r\n _this.legendSettings = new LegendSettings();\r\n /**\r\n * Lowest overal values by type.\r\n */\r\n _this._tmin = new Dictionary();\r\n /**\r\n * Highest overal values by type.\r\n */\r\n _this._tmax = new Dictionary();\r\n /**\r\n * Lowest values in current selection by type.\r\n */\r\n _this._smin = new Dictionary();\r\n /**\r\n * Highest values in current selection by type.\r\n */\r\n _this._smax = new Dictionary();\r\n /**\r\n * [dataItemsByAxis description]\r\n *\r\n * Both by category and date.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n _this.dataItemsByAxis = new Dictionary();\r\n /**\r\n * Normally series items are focusable using keyboard, so that people can\r\n * select them with a TAB key. However, if there are a lot of data points on\r\n * screen it might be long and useless to tab through all o fthem.\r\n *\r\n * This is where `skipFocusThreshold` comes in. If there are more items than\r\n * the value set here, we will not make those focusable and rather let screen\r\n * reader software rely on the series summary, or authors provide alternative\r\n * detailed information display, such as HTML table.\r\n *\r\n * Different series might have different threshold defaults.\r\n */\r\n _this.skipFocusThreshold = 20;\r\n /**\r\n * Used to indicate if `itemReaderText` was changed \"from the outside\".\r\n */\r\n _this._itemReaderTextChanged = false;\r\n /**\r\n * Most of the series use absolute values. However sometimes various\r\n * calculated percent values are need, e.g. item's percent representation\r\n * across all values in series, etc.\r\n *\r\n * It's a resource-intensive operation, so it is disabled by default.\r\n *\r\n * If you need percents to be calculated, e.g. for showing them in tooltips,\r\n * or creating 100% stacks, this setting needs to be set to `true`.\r\n *\r\n * NOTE: `PieChart`, which relies on slice percentages, has this\r\n * automatically set to `true`.\r\n *\r\n * @default false\r\n */\r\n _this.calculatePercent = false;\r\n /**\r\n * When `calculatePercent` is enabled and data item's percent value is\r\n * calculated, last item's real value is used instead of its working value.\r\n *\r\n * This is done for the animations when last item in series (e.g. slice in\r\n * a `PieSeries`) is hidden or shown. (if we would use real value, the\r\n * calculated percent would always be 100%).\r\n *\r\n * Sometimes there is a need (e.g. for drill-down Sunburst) to disable this\r\n * hack by setting `usePercentHack` to `false`.\r\n *\r\n * @since 4.9.13\r\n * @default true\r\n */\r\n _this.usePercentHack = true;\r\n /**\r\n * Specifies if series should be automatically disposed when removing from\r\n * chart's `series` list.\r\n *\r\n * @default true\r\n */\r\n _this.autoDispose = true;\r\n /**\r\n * When chart/series' data is processed, all kinds of derivative values are\r\n * calculated. E.g. sum, min, max, change, etc. This is a potentially\r\n * time-consuming operation, especially prominent in data-heavy charts.\r\n *\r\n * If your chart does not need those values, and you have a lot of data,\r\n * setting this to `true` might give a dramatic increase in initial chart\r\n * load speed.\r\n *\r\n * Please note, regular column and line series usage scenarios do not\r\n * require derivative values. Those come into play only when you do advanced\r\n * functionality like coloring segments of charts in different colors\r\n * depending on change between open and close values, have stacked series, or\r\n * display any of the derived values, like percent, in tooltips or bullets.\r\n *\r\n * @default false\r\n */\r\n _this.simplifiedProcessing = false;\r\n if (_this.constructor === Series) {\r\n throw new Error(\"'Series' cannot be instantiated directly. Please use a specific series type.\");\r\n }\r\n _this.className = \"Series\";\r\n _this.isMeasured = false;\r\n _this.layout = \"none\";\r\n _this.shouldClone = false;\r\n _this.setPropertyValue(\"hidden\", false);\r\n _this.axisRanges = new List();\r\n _this.axisRanges.events.on(\"inserted\", _this.processAxisRange, _this, false);\r\n _this.minBulletDistance = 0; // otherwise we'll have a lot of cases when people won't see bullets and think it's a bug\r\n _this.mainContainer = _this.createChild(Container);\r\n _this.mainContainer.shouldClone = false;\r\n _this.mainContainer.mask = _this.createChild(Sprite);\r\n _this._disposers.push(_this.mainContainer);\r\n // all bullets should go on top of lines/fills. So we add a separate container for bullets and later set it's parent to chart.bulletsContainer\r\n var bulletsContainer = _this.mainContainer.createChild(Container);\r\n _this._shouldBeReady.push(bulletsContainer);\r\n bulletsContainer.shouldClone = false;\r\n bulletsContainer.layout = \"none\";\r\n bulletsContainer.virtualParent = _this;\r\n _this._disposers.push(bulletsContainer);\r\n _this.bulletsContainer = bulletsContainer;\r\n _this.tooltip = new Tooltip();\r\n _this.tooltip.virtualParent = _this;\r\n _this._disposers.push(_this.tooltip);\r\n _this.hiddenState.transitionEasing = $ease.cubicIn;\r\n // this data item holds sums, averages, etc\r\n _this.dataItem = _this.createDataItem();\r\n _this._disposers.push(_this.dataItem);\r\n _this.dataItem.component = _this;\r\n // Apply accessibility\r\n _this.role = \"group\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * We need this here so that class names can be applied to bullets container.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Series.prototype.applyTheme = function () {\r\n _super.prototype.applyTheme.call(this);\r\n if (options.autoSetClassName && this.bulletsContainer) {\r\n this.bulletsContainer.className = this.className + \"-bullets\";\r\n this.bulletsContainer.setClassName();\r\n }\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n Series.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n Series.prototype.createDataItem = function () {\r\n return new SeriesDataItem();\r\n };\r\n Object.defineProperty(Series.prototype, \"chart\", {\r\n /**\r\n * @return Chart\r\n */\r\n get: function () {\r\n return this._chart;\r\n },\r\n /**\r\n * Chart series is used on.\r\n *\r\n * @param value Chart\r\n */\r\n set: function (value) {\r\n this._chart = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Positions bullet.\r\n *\r\n * @param bullet Sprite\r\n */\r\n Series.prototype.positionBullet = function (bullet) {\r\n // Placeholder method for extending classes to override.\r\n };\r\n /**\r\n * Decorates newly created bullet after it has been instert into the list.\r\n *\r\n * @param event List event\r\n * @todo investigate why itemReaderText is undefined\r\n */\r\n Series.prototype.processBullet = function (event) {\r\n var _this = this;\r\n var bullet = event.newValue;\r\n bullet.isTemplate = true;\r\n // Add accessibility options to bullet\r\n // If there are relatively few bullets, make them focusable\r\n this.events.once(\"datavalidated\", function (ev) {\r\n if (_this.itemsFocusable()) {\r\n bullet.focusable = true;\r\n }\r\n });\r\n };\r\n /**\r\n * removes bullets\r\n *\r\n * @param event List event\r\n */\r\n Series.prototype.removeBullet = function (event) {\r\n var bullet = event.oldValue;\r\n this.dataItems.each(function (dataItem) {\r\n var eachBullet = dataItem.bullets.getKey(bullet.uid);\r\n if (eachBullet) {\r\n eachBullet.dispose();\r\n }\r\n });\r\n this.invalidate();\r\n };\r\n /**\r\n * Validates data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Series.prototype.validateDataItems = function () {\r\n _super.prototype.validateDataItems.call(this);\r\n this.processValues(false);\r\n };\r\n /**\r\n * Returns first value for the specific key in the series.\r\n *\r\n * @param key Key\r\n * @return Value\r\n * @todo Description\r\n * @todo Convert to propert object property iterator\r\n */\r\n Series.prototype.getFirstValue = function (key, startIndex) {\r\n // find first\r\n /*\r\n return $iter.findMap(this.dataItems.iterator(), (dataItem) => {\r\n for (let key in dataItem.values) {\r\n if ($object.hasKey(dataItem.values, key)) {\r\n let value: number = dataItem.values[key].workingValue;\r\n if ($type.isNumber(value)) {\r\n return value;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n });*/\r\n //if (startIndex > 0 && startIndex < this.dataItems.length - 1) {\r\n //startIndex++;\r\n //}\r\n for (var i = startIndex; i >= 0; i--) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n var value = dataItem.getActualWorkingValue(key);\r\n if ($type.isNumber(value)) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Returns first value for the specific key in the series.\r\n *\r\n * @param key Key\r\n * @return Value\r\n * @todo Description\r\n * @todo Convert to propert object property iterator\r\n */\r\n Series.prototype.getAbsoluteFirstValue = function (key) {\r\n for (var i = 0; i < this.dataItems.length; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n var value = dataItem.values[key].value;\r\n if ($type.isNumber(value)) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * [rangeChangeUpdate description]\r\n *\r\n * @todo Description\r\n */\r\n Series.prototype.rangeChangeUpdate = function () {\r\n _super.prototype.rangeChangeUpdate.call(this);\r\n this.processValues(true);\r\n };\r\n /**\r\n * [processValues description]\r\n *\r\n * @todo Description\r\n * @todo Convert to propert object property iterator\r\n * @param dataItems [description]\r\n */\r\n Series.prototype.processValues = function (working) {\r\n var _this = this;\r\n if (!this.simplifiedProcessing) {\r\n var dataItems = this.dataItems;\r\n var count_1 = {};\r\n var sum_1 = {};\r\n var absoluteSum_1 = {};\r\n var low_1 = {};\r\n var high_1 = {};\r\n var open_1 = {};\r\n var close_1 = {};\r\n var previous_1 = {};\r\n var first_1 = {};\r\n var absoluteFirst_1 = {};\r\n //let duration: number = 0; // todo: check if series uses selection.change or selection.change.percent and set duration to interpolationduration\r\n var startIndex_1 = $math.max(0, this.startIndex);\r\n startIndex_1 = $math.min(startIndex_1, this.dataItems.length);\r\n var endIndex = $math.min(this.endIndex, this.dataItems.length);\r\n if (!$type.isNumber(startIndex_1)) {\r\n startIndex_1 = 0;\r\n }\r\n if (!$type.isNumber(endIndex)) {\r\n endIndex = this.dataItems.length;\r\n }\r\n if (startIndex_1 > 0) {\r\n var dataItem_1 = dataItems.getIndex(startIndex_1 - 1);\r\n $object.each(dataItem_1.values, function (key, values) {\r\n var value = dataItem_1.getActualWorkingValue(key);\r\n if ($type.isNumber(value)) {\r\n // save previous\r\n previous_1[key] = value;\r\n }\r\n });\r\n }\r\n var _loop_1 = function (i) {\r\n var dataItem_2 = dataItems.getIndex(i);\r\n $object.each(dataItem_2.values, function (key, values) {\r\n var value = dataItem_2.getActualWorkingValue(key);\r\n //if (i >= startIndex && i <= endIndex) { // do not add to count, sum etc if it is not within start/end index\r\n if ($type.isNumber(value)) {\r\n // count values\r\n if (!$type.isNumber(count_1[key])) {\r\n count_1[key] = 0;\r\n }\r\n count_1[key]++;\r\n // sum values\r\n if (!$type.isNumber(sum_1[key])) {\r\n sum_1[key] = 0;\r\n }\r\n sum_1[key] += value;\r\n // absolute sum values\r\n if (!$type.isNumber(absoluteSum_1[key])) {\r\n absoluteSum_1[key] = 0;\r\n }\r\n absoluteSum_1[key] += Math.abs(value);\r\n // open\r\n if (!$type.isNumber(open_1[key])) {\r\n open_1[key] = value;\r\n }\r\n // close\r\n close_1[key] = value;\r\n // low\r\n if (!$type.isNumber(low_1[key])) {\r\n low_1[key] = value;\r\n }\r\n else {\r\n if (low_1[key] > value) {\r\n low_1[key] = value;\r\n }\r\n }\r\n // high\r\n if (!$type.isNumber(high_1[key])) {\r\n high_1[key] = value;\r\n }\r\n else {\r\n if (high_1[key] < value) {\r\n high_1[key] = value;\r\n }\r\n }\r\n if (!$type.isNumber(first_1[key])) {\r\n first_1[key] = _this.getFirstValue(key, startIndex_1);\r\n }\r\n if (!$type.isNumber(absoluteFirst_1[key])) {\r\n absoluteFirst_1[key] = _this.getAbsoluteFirstValue(key);\r\n }\r\n // change\r\n dataItem_2.setCalculatedValue(key, value - first_1[key], \"change\");\r\n // change from start percent\r\n // will fail if first value is 0\r\n dataItem_2.setCalculatedValue(key, (value - first_1[key]) / first_1[key] * 100, \"changePercent\");\r\n dataItem_2.setCalculatedValue(key, (value - absoluteFirst_1[key]), \"startChange\");\r\n dataItem_2.setCalculatedValue(key, (value - absoluteFirst_1[key]) / absoluteFirst_1[key] * 100, \"startChangePercent\");\r\n // previous change\r\n var prevValue = previous_1[key];\r\n if (!$type.isNumber(prevValue)) {\r\n prevValue = value;\r\n }\r\n dataItem_2.setCalculatedValue(key, value - prevValue, \"previousChange\");\r\n // previous change percent\r\n dataItem_2.setCalculatedValue(key, (value - prevValue) / prevValue * 100, \"previousChangePercent\");\r\n // save previous\r\n previous_1[key] = value;\r\n }\r\n });\r\n };\r\n for (var i = startIndex_1; i < endIndex; i++) {\r\n _loop_1(i);\r\n }\r\n if (this.calculatePercent) {\r\n var _loop_2 = function (i) {\r\n var dataItem_3 = dataItems.getIndex(i);\r\n $object.each(dataItem_3.values, function (key) {\r\n var ksum = absoluteSum_1[key];\r\n var value = dataItem_3.getActualWorkingValue(key);\r\n if ($type.isNumber(value)) {\r\n if (ksum > 0) {\r\n if (_this.usePercentHack) {\r\n // this hack is made in order to make it possible to animate single slice to 0\r\n // if there is only one slice left, percent value is always 100%, so it won't animate\r\n // so we use real value of a slice instead of current value\r\n if (value == ksum) {\r\n ksum = dataItem_3.values[key].value;\r\n }\r\n }\r\n var percent = value / ksum * 100;\r\n dataItem_3.setCalculatedValue(key, percent, \"percent\");\r\n }\r\n else {\r\n dataItem_3.setCalculatedValue(key, 0, \"percent\");\r\n }\r\n }\r\n });\r\n };\r\n for (var i = startIndex_1; i < endIndex; i++) {\r\n _loop_2(i);\r\n }\r\n }\r\n // calculate one before first (cant do that in cycle, as we don't know open yet\r\n // when drawing line chart we should draw line to the invisible data point to the left, otherwise the line will always look like it starts from the selected point\r\n // so we do startIndex - 1\r\n if (startIndex_1 > 0) {\r\n var zeroItem_1 = dataItems.getIndex(startIndex_1 - 1);\r\n $object.each(zeroItem_1.values, function (key) {\r\n var value = zeroItem_1.values[key].value;\r\n // change\r\n zeroItem_1.setCalculatedValue(key, value - open_1[key], \"change\");\r\n // change percent\r\n zeroItem_1.setCalculatedValue(key, (value - open_1[key]) / open_1[key] * 100, \"changePercent\");\r\n });\r\n }\r\n // we save various data like sum, average to dataPoint of the series\r\n var dataItem_4 = this.dataItem;\r\n $object.each(dataItem_4.values, function (key) {\r\n dataItem_4.setCalculatedValue(key, sum_1[key], \"sum\");\r\n dataItem_4.setCalculatedValue(key, absoluteSum_1[key], \"absoluteSum\");\r\n dataItem_4.setCalculatedValue(key, sum_1[key] / count_1[key], \"average\");\r\n dataItem_4.setCalculatedValue(key, open_1[key], \"open\");\r\n dataItem_4.setCalculatedValue(key, close_1[key], \"close\");\r\n dataItem_4.setCalculatedValue(key, low_1[key], \"low\");\r\n dataItem_4.setCalculatedValue(key, high_1[key], \"high\");\r\n dataItem_4.setCalculatedValue(key, count_1[key], \"count\");\r\n });\r\n }\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Series.prototype.validate = function () {\r\n if ($utils.isIE()) {\r\n this.filters.clear();\r\n }\r\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\r\n //axisRange.contents.disposeChildren(); // not good for columns, as they are reused\r\n //\t\t\taxisRange.appendChildren();\r\n axisRange.validate();\r\n });\r\n _super.prototype.validate.call(this);\r\n var bulletsContainer = this.bulletsContainer;\r\n bulletsContainer.fill = this.fill;\r\n bulletsContainer.stroke = this.stroke;\r\n bulletsContainer.x = this.pixelX;\r\n bulletsContainer.y = this.pixelY;\r\n if (this.bulletsContainer.children.length > 0) {\r\n if (this._showBullets) {\r\n for (var i = 0; i < this.startIndex; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n if (dataItem) {\r\n dataItem.bullets.each(function (key, bullet) {\r\n bullet.__disabled = true;\r\n });\r\n }\r\n }\r\n for (var i = this.dataItems.length - 1; i > this.endIndex; i--) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n if (dataItem) {\r\n dataItem.bullets.each(function (key, bullet) {\r\n bullet.__disabled = true;\r\n });\r\n }\r\n }\r\n }\r\n else {\r\n this.bulletsContainer.children.each(function (bullet) {\r\n bullet.__disabled = true;\r\n });\r\n }\r\n }\r\n this.updateTooltipBounds();\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Series.prototype.updateTooltipBounds = function () {\r\n if (this.topParent) {\r\n var x = 0;\r\n var y = 0;\r\n var w = this.topParent.maxWidth;\r\n var h = this.topParent.maxHeight;\r\n var rect = { x: x, y: y, width: w, height: h };\r\n this.tooltip.setBounds(rect);\r\n }\r\n };\r\n Series.prototype.shouldCreateBullet = function (dataItem, bulletTemplate) {\r\n return true;\r\n };\r\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n Series.prototype.validateDataElement = function (dataItem) {\r\n var _this = this;\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n if (this._showBullets) {\r\n if (!this.isHidden) {\r\n this.bulletsContainer.visible = true;\r\n }\r\n this.bullets.each(function (bulletTemplate) {\r\n // always better to use the same, this helps to avoid redrawing\r\n var bullet = dataItem.bullets.getKey(bulletTemplate.uid);\r\n if (_this.shouldCreateBullet(dataItem, bulletTemplate)) {\r\n if (!bullet) {\r\n var disabledField = bulletTemplate.propertyFields.disabled;\r\n var dataContext = dataItem.dataContext;\r\n if (disabledField && dataContext && dataContext[disabledField] === false) {\r\n bulletTemplate.applyOnClones = false;\r\n bulletTemplate.disabled = false;\r\n bullet = bulletTemplate.clone();\r\n bulletTemplate.disabled = true;\r\n bulletTemplate.applyOnClones = true;\r\n }\r\n else {\r\n bullet = bulletTemplate.clone();\r\n }\r\n bullet.shouldClone = false;\r\n dataItem.addSprite(bullet);\r\n if (!_this.visible || _this.isHiding) {\r\n bullet.hide(0);\r\n }\r\n }\r\n var currentDataItem = bullet.dataItem;\r\n if (currentDataItem != dataItem) {\r\n // set to undefined in order not to reuse\r\n if (currentDataItem) {\r\n currentDataItem.bullets.setKey(bulletTemplate.uid, undefined);\r\n }\r\n var readerText_1 = _this.itemReaderText;\r\n if (bullet instanceof Bullet) {\r\n if (!readerText_1) {\r\n readerText_1 = (\"{\" + bullet.xField + \"}: {\" + bullet.yField + \"}\");\r\n }\r\n if (bullet.isDynamic) {\r\n dataItem.events.on(\"workingvaluechanged\", bullet.deepInvalidate, bullet, false);\r\n //dataItem.events.on(\"calculatedvaluechanged\", bullet.deepInvalidate, bullet, false);\r\n _this.dataItem.events.on(\"workingvaluechanged\", bullet.deepInvalidate, bullet, false);\r\n }\r\n bullet.deepInvalidate();\r\n }\r\n // Add accessibility to bullet\r\n if (bullet.focusable) {\r\n bullet.events.on(\"focus\", function (ev) {\r\n bullet.readerTitle = _this.populateString(readerText_1, bullet.dataItem);\r\n }, undefined, false);\r\n bullet.events.on(\"blur\", function (ev) {\r\n bullet.readerTitle = \"\";\r\n }, undefined, false);\r\n }\r\n if (bullet.hoverable) {\r\n bullet.events.on(\"over\", function (ev) {\r\n bullet.readerTitle = _this.populateString(readerText_1, bullet.dataItem);\r\n }, undefined, false);\r\n bullet.events.on(\"out\", function (ev) {\r\n bullet.readerTitle = \"\";\r\n }, undefined, false);\r\n }\r\n }\r\n bullet.parent = _this.bulletsContainer;\r\n dataItem.bullets.setKey(bulletTemplate.uid, bullet);\r\n // pass max w/h so we'd know if we should show/hide somethings\r\n bullet.maxWidth = dataItem.itemWidth;\r\n bullet.maxHeight = dataItem.itemHeight;\r\n bullet.__disabled = false;\r\n _this.positionBullet(bullet);\r\n }\r\n else {\r\n if (bullet) {\r\n bullet.__disabled = true;\r\n }\r\n }\r\n });\r\n }\r\n else {\r\n this.bulletsContainer.visible = false;\r\n }\r\n };\r\n /**\r\n * [handleDataItemWorkingValueChange description]\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Series.prototype.handleDataItemWorkingValueChange = function (dataItem, name) {\r\n if (!this.dataRangeInvalid) {\r\n this.invalidateProcessedData();\r\n }\r\n };\r\n Object.defineProperty(Series.prototype, \"ignoreMinMax\", {\r\n /**\r\n * @return Exclude from calculations?\r\n */\r\n get: function () {\r\n return this._ignoreMinMax;\r\n },\r\n /**\r\n * Should this series excluded from the axis scale calculations?\r\n *\r\n * @default false\r\n * @param value Exclude from calculations?\r\n */\r\n set: function (value) {\r\n this._ignoreMinMax = value;\r\n this.invalidateDataItems();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Create a mask for the series.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Series.prototype.createMask = function () {\r\n // A placeholder method for extending classes to override.\r\n };\r\n /**\r\n * Process axis range after it has been added to the list.\r\n *\r\n * @param event Event\r\n */\r\n Series.prototype.processAxisRange = function (event) {\r\n // create container if not existing\r\n if (!this.rangesContainer) {\r\n this.rangesContainer = this.createChild(Container);\r\n this.rangesContainer.shouldClone = false;\r\n this.rangesContainer.isMeasured = false;\r\n }\r\n var axisRange = event.newValue;\r\n if (axisRange) {\r\n axisRange.contents.parent = this.rangesContainer;\r\n axisRange.isRange = true;\r\n axisRange.events.on(\"valuechanged\", this.invalidateDataItems, this, false);\r\n }\r\n };\r\n /**\r\n * [getAxisField description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param axis [description]\r\n * @return [description]\r\n */\r\n Series.prototype.getAxisField = function (axis) {\r\n return;\r\n };\r\n /**\r\n * Shows the tooltip at specific position.\r\n *\r\n * @ignore Exclude from docs\r\n * @param xPosition X\r\n * @param yPosition Y\r\n */\r\n Series.prototype.showTooltipAtPosition = function (xPosition, yPosition) {\r\n // Placeholder method for extending classes to override.\r\n };\r\n Object.defineProperty(Series.prototype, \"minBulletDistance\", {\r\n /**\r\n * @return Distance (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"minBulletDistance\");\r\n },\r\n /**\r\n * Minimal distance between data points in pixels.\r\n *\r\n * If distance gets smaller than this, bullets are turned off to avoid\r\n * overlapping.\r\n *\r\n * `0` (zero) disables this behavior.\r\n *\r\n * IMPORTANT: This setting will work only when Series' base axis\r\n * is [[CategoryAxis]] or [[DateAxis]]. If base axis is [[ValueAxis]] the\r\n * setting will be ignored, because it would be a huge overhead to measure\r\n * distance between each and every bullet.\r\n *\r\n * @default 0\r\n * @param value Distance (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"minBulletDistance\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Series.prototype, \"bullets\", {\r\n /**\r\n * A list of bullets that will be added to each and every items in the\r\n * series.\r\n *\r\n * You can push any object that is a descendant of a [[Sprite]] here. All\r\n * items added to this list will be copied and used as a bullet on all data\r\n * items, including their properties, events, etc.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/bullets/} for more info about the concept of Bullets\r\n * @return List of bullets.\r\n */\r\n get: function () {\r\n if (!this._bullets) {\r\n this._bullets = new ListTemplate(new Bullet());\r\n this._bullets.template.virtualParent = this;\r\n this._bullets.events.on(\"inserted\", this.processBullet, this, false);\r\n this._bullets.events.on(\"removed\", this.removeBullet, this, false);\r\n this._disposers.push(new ListDisposer(this._bullets));\r\n this._disposers.push(this._bullets.template);\r\n }\r\n return this._bullets;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Binds related legend data item's visual settings to this series' visual\r\n * settings.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Legend item container\r\n */\r\n Series.prototype.createLegendMarker = function (marker) {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n Object.defineProperty(Series.prototype, \"hiddenInLegend\", {\r\n /**\r\n * @return Hidden in legend?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"hiddenInLegend\");\r\n },\r\n /**\r\n * Should the series be hidden in legend?\r\n *\r\n * @param value Hidden in legend?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"hiddenInLegend\", value)) {\r\n if (this.chart) {\r\n this.chart.feedLegend();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Series.prototype, \"name\", {\r\n /**\r\n * @return Name\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"name\");\r\n },\r\n /**\r\n * Series' name.\r\n *\r\n * @param value Name\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"name\", value);\r\n var legendDataItem = this.legendDataItem;\r\n if (legendDataItem) {\r\n legendDataItem.component.invalidate();\r\n legendDataItem.component.invalidateRawData();\r\n }\r\n this.readerTitle = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Series.prototype, \"itemReaderText\", {\r\n /**\r\n * @return Screen reader text template\r\n */\r\n get: function () {\r\n // Get explicitly set reader text\r\n var readerText = this._itemReaderText;\r\n // Not set? Let's try something else\r\n if (!readerText) {\r\n // Tooltip text?\r\n if (this.tooltipText) {\r\n readerText = $utils.plainText(this.tooltipText);\r\n }\r\n else if (this.tooltipHTML) {\r\n readerText = $utils.plainText(this.tooltipHTML);\r\n }\r\n }\r\n if (!this._adapterO) {\r\n return readerText;\r\n }\r\n else {\r\n return this._adapterO.apply(\"itemReaderText\", readerText);\r\n }\r\n },\r\n /**\r\n * Screen reader text to be applied to each individual data item, such\r\n * as bullets, columns or slices.\r\n *\r\n * The template can contain field reference meta codes, i.e. `{dateX}`,\r\n * `{valueY}`, etc.\r\n *\r\n * Any text formatting options, e.g. `[bold]` will be ignored.\r\n *\r\n * @param value Screen reader text template\r\n */\r\n set: function (value) {\r\n this._itemReaderText = value;\r\n this._itemReaderTextChanged = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns if number of data items in the series are beyond non-focusable\r\n * count and should not be available for TAB-through.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Items focusable?\r\n */\r\n Series.prototype.itemsFocusable = function () {\r\n return this.dataItems.length >= this.skipFocusThreshold ? false : true;\r\n };\r\n Object.defineProperty(Series.prototype, \"legendDataItem\", {\r\n /**\r\n * @return Data item\r\n */\r\n get: function () {\r\n return this._legendDataItem;\r\n },\r\n /**\r\n * Legend data item that corresponds to this series.\r\n *\r\n * @param value Data item\r\n */\r\n set: function (value) {\r\n this._legendDataItem = value;\r\n this._legendDataItem.itemContainer.deepInvalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates corresponding legend data item with current values.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n Series.prototype.updateLegendValue = function (dataItem, notRange) {\r\n // if this series has legend item\r\n if (this.legendDataItem) {\r\n var legendSettings = this.legendSettings;\r\n var legendDataItem = this.legendDataItem;\r\n var label = legendDataItem.label;\r\n var valueLabel = legendDataItem.valueLabel;\r\n // update legend\r\n if (dataItem || notRange) {\r\n if (valueLabel) {\r\n if (legendSettings.itemValueText) {\r\n valueLabel.text = legendSettings.itemValueText;\r\n }\r\n valueLabel.dataItem = dataItem;\r\n }\r\n if (label) {\r\n if (legendSettings.itemLabelText) {\r\n label.text = legendSettings.itemLabelText;\r\n }\r\n label.dataItem = dataItem;\r\n }\r\n }\r\n else {\r\n if (label) {\r\n // if itemLabelText is set, means we have to reset label even if labelText is not set\r\n if (legendSettings.labelText || legendSettings.itemLabelText != undefined) {\r\n label.text = legendSettings.labelText;\r\n }\r\n label.dataItem = this.dataItem;\r\n }\r\n if (valueLabel) {\r\n if (legendSettings.valueText || legendSettings.itemValueText != undefined) {\r\n valueLabel.text = legendSettings.valueText;\r\n }\r\n valueLabel.dataItem = this.dataItem;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Copies all properties from another instance of [[Series]].\r\n *\r\n * @param source Source series\r\n */\r\n Series.prototype.copyFrom = function (source) {\r\n this.bullets.copyFrom(source.bullets);\r\n this.bulletsContainer.copyFrom(source.bulletsContainer);\r\n this.calculatePercent = source.calculatePercent;\r\n this.usePercentHack = source.usePercentHack;\r\n this.simplifiedProcessing = source.simplifiedProcessing;\r\n _super.prototype.copyFrom.call(this, source);\r\n };\r\n /**\r\n * Displays a modal or console message with error, and halts any further\r\n * processing of this element.\r\n *\r\n * @param e Error\r\n */\r\n Series.prototype.raiseCriticalError = function (e) {\r\n if (this._chart && this._chart.modal) {\r\n this._chart.modal.content = this._chart.adapter.apply(\"criticalError\", e).message;\r\n this._chart.modal.closable = false;\r\n if (!options.suppressErrors) {\r\n this._chart.modal.open();\r\n }\r\n this._chart.disabled = true;\r\n }\r\n if (options.verbose) {\r\n console.log(e);\r\n }\r\n };\r\n /**\r\n * Applies filters to the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Series.prototype.applyFilters = function () {\r\n var _this = this;\r\n _super.prototype.applyFilters.call(this);\r\n this.bulletsContainer.filters.clear();\r\n // copyFrom of a list copies, does not clone\r\n $iter.each(this.filters.iterator(), function (filter) {\r\n _this.bulletsContainer.filters.push(filter.clone());\r\n });\r\n };\r\n Object.defineProperty(Series.prototype, \"heatRules\", {\r\n /**\r\n * A list of heat rules to apply to series' elements based on the value\r\n * of the data item.\r\n *\r\n * Heat rules can be any \"numeric\" (including `Color`) property, and can also\r\n * be applied to child objects of series, like columns, bullets, etc.\r\n *\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * series.heatRules.push({\r\n * \"target\": series.columns.template,\r\n * \"property\": \"fill\",\r\n * \"min\": am4core.color(\"#F5DBCB\"),\r\n * \"max\": am4core.color(\"#ED7B84\"),\r\n * \"dataField\": \"valueY\"\r\n *});\r\n *```\r\n * ```Javacript\r\n * series.heatRules.push({\r\n * \"target\": series.columns.template,\r\n * \"property\": \"fill\",\r\n * \"min\": am4core.color(\"#F5DBCB\"),\r\n * \"max\": am4core.color(\"#ED7B84\"),\r\n * \"dataField\": \"valueY\"\r\n *});\r\n *```\r\n *```JSON\r\n *{\r\n * // ...\r\n * \"series\": [{\r\n * \"type\": \"ColumnSeries\",\r\n * \"heatRules\": [{\r\n * \"target\": \"columns.template\",\r\n * \"property\": \"fill\",\r\n * \"min\": \"#F5DBCB\",\r\n * \"max\": \"#ED7B84\",\r\n * \"dataField\": \"valueY\"\r\n * }]\r\n * }]\r\n *}\r\n *```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/series/#Heat_maps} for more about heat rules\r\n * @return Heat rules\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._heatRules) {\r\n this._heatRules = new List();\r\n this._heatRules.events.on(\"inserted\", function (event) {\r\n var heatRule = event.newValue;\r\n var target = heatRule.target;\r\n if (target) {\r\n var dataField_1 = heatRule.dataField;\r\n if (!$type.hasValue(dataField_1)) {\r\n dataField_1 = \"value\";\r\n }\r\n var seriesDataItem_1 = _this.dataItem;\r\n var property_1 = heatRule.property;\r\n var minValue = $type.toNumber(heatRule.minValue);\r\n var maxValue = $type.toNumber(heatRule.maxValue);\r\n if (!$type.isNumber(minValue) && !$type.isNumber(maxValue)) {\r\n _this.dataItem.events.on(\"calculatedvaluechanged\", function (event) {\r\n if (event.property == dataField_1) {\r\n $iter.each(_this.dataItems.iterator(), function (dataItem) {\r\n var foundSprite = false;\r\n $array.each(dataItem.sprites, function (sprite) {\r\n if (sprite.clonedFrom == target) {\r\n var anySprite = sprite;\r\n anySprite[property_1] = anySprite[property_1];\r\n foundSprite = true;\r\n }\r\n });\r\n if (!foundSprite) {\r\n $array.each(dataItem.sprites, function (sprite) {\r\n if (sprite instanceof Container) {\r\n $iter.each(sprite.children.iterator(), function (child) {\r\n if (child.className == target.className) {\r\n var anyChild = child;\r\n anyChild[property_1] = anyChild[property_1];\r\n }\r\n // giveup here\r\n else if (child instanceof Container) {\r\n child.deepInvalidate();\r\n }\r\n });\r\n }\r\n });\r\n }\r\n });\r\n }\r\n });\r\n }\r\n _this.dataItems.template.events.on(\"workingvaluechanged\", function (event) {\r\n if (event.property == dataField_1) {\r\n var dataItem = event.target;\r\n var foundSprite_1 = false;\r\n $array.each(dataItem.sprites, function (sprite) {\r\n if (sprite.clonedFrom == target) {\r\n var anySprite = sprite;\r\n anySprite[property_1] = anySprite[property_1];\r\n foundSprite_1 = true;\r\n }\r\n });\r\n if (!foundSprite_1) {\r\n $array.each(dataItem.sprites, function (sprite) {\r\n if (sprite instanceof Container) {\r\n $iter.each(sprite.children.iterator(), function (child) {\r\n if (child.className == target.className) {\r\n var anyChild = child;\r\n anyChild[property_1] = anyChild[property_1];\r\n }\r\n // givup here\r\n else if (child instanceof Container) {\r\n child.deepInvalidate();\r\n }\r\n });\r\n }\r\n });\r\n }\r\n }\r\n });\r\n target.adapter.add(property_1, function (value, ruleTarget, property) {\r\n var minValue = $type.toNumber(heatRule.minValue);\r\n var maxValue = $type.toNumber(heatRule.maxValue);\r\n var min = heatRule.min;\r\n var max = heatRule.max;\r\n if (ruleTarget instanceof Sprite) {\r\n var anySprite = ruleTarget;\r\n var propertyField = anySprite.propertyFields[property];\r\n if (propertyField && ruleTarget.dataItem) {\r\n var dataContext = ruleTarget.dataItem.dataContext;\r\n if (dataContext && $type.hasValue(dataContext[propertyField])) {\r\n return value;\r\n }\r\n }\r\n }\r\n var dataItem = ruleTarget.dataItem;\r\n if (!$type.isNumber(minValue)) {\r\n minValue = seriesDataItem_1.values[dataField_1].low;\r\n }\r\n if (!$type.isNumber(maxValue)) {\r\n maxValue = seriesDataItem_1.values[dataField_1].high;\r\n }\r\n if (dataItem) {\r\n var fieldValues = dataItem.values[dataField_1];\r\n if (fieldValues) {\r\n var workingValue = dataItem.getActualWorkingValue(dataField_1);\r\n if ($type.hasValue(min) && $type.hasValue(max) && $type.isNumber(minValue) && $type.isNumber(maxValue) && $type.isNumber(workingValue)) {\r\n var percent = void 0;\r\n if (heatRule.logarithmic) {\r\n percent = (Math.log(workingValue) * Math.LOG10E - Math.log(minValue) * Math.LOG10E) / ((Math.log(maxValue) * Math.LOG10E - Math.log(minValue) * Math.LOG10E));\r\n }\r\n else {\r\n percent = (workingValue - minValue) / (maxValue - minValue);\r\n }\r\n if ($type.isNumber(workingValue) && !$type.isNumber(percent)) {\r\n percent = 0.5;\r\n }\r\n // fixes problems if all values are the same\r\n if ($type.isNumber(min)) {\r\n return min + (max - min) * percent;\r\n }\r\n else if (min instanceof Color) {\r\n return new Color($colors.interpolate(min.rgb, max.rgb, percent));\r\n }\r\n }\r\n }\r\n }\r\n return value;\r\n });\r\n }\r\n });\r\n }\r\n return this._heatRules;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n Series.prototype.processConfig = function (config) {\r\n var heatRules;\r\n if (config) {\r\n // Set up bullets\r\n if ($type.hasValue(config.bullets) && $type.isArray(config.bullets)) {\r\n for (var i = 0, len = config.bullets.length; i < len; i++) {\r\n var bullets = config.bullets[i];\r\n if (!$type.hasValue(bullets.type)) {\r\n bullets.type = \"Bullet\";\r\n }\r\n }\r\n }\r\n // Let's take heatRules out of the config, so that we can process\r\n // them later, when bullets are already there\r\n if ($type.hasValue(config.heatRules) && $type.isArray(config.heatRules)) {\r\n heatRules = config.heatRules;\r\n delete config.heatRules;\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n // Process heat rules again, when all other elements are ready\r\n if (heatRules) {\r\n for (var i = 0, len = heatRules.length; i < len; i++) {\r\n var rule = heatRules[i];\r\n // Resolve target\r\n var target = this;\r\n if ($type.hasValue(rule.target) && $type.isString(rule.target)) {\r\n // Check if we can find this element by id\r\n if (this.map.hasKey(rule.target)) {\r\n target = this.map.getKey(rule.target);\r\n }\r\n else {\r\n var parts = rule.target.split(\".\");\r\n for (var x = 0; x < parts.length; x++) {\r\n if (target instanceof List) {\r\n var listitem = target.getIndex($type.toNumber(parts[x]));\r\n if (!listitem) {\r\n target = target[parts[x]];\r\n }\r\n else {\r\n target = listitem;\r\n }\r\n }\r\n else {\r\n target = target[parts[x]];\r\n }\r\n }\r\n }\r\n }\r\n rule.target = target;\r\n // Resolve colors and percents\r\n if ($type.hasValue(rule.min)) {\r\n rule.min = this.maybeColorOrPercent(rule.min);\r\n }\r\n if ($type.hasValue(rule.max)) {\r\n rule.max = this.maybeColorOrPercent(rule.max);\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, {\r\n heatRules: heatRules\r\n });\r\n }\r\n };\r\n /**\r\n * Returns visibility value\r\n * @ignore\r\n */\r\n /*\r\n protected getVisibility(): boolean {\r\n let hidden = this.getPropertyValue(\"hidden\");\r\n if (hidden) {\r\n return false;\r\n }\r\n else {\r\n return super.getVisibility();\r\n }\r\n }*/\r\n /**\r\n * This function is used to sort element's JSON config properties, so that\r\n * some properties that absolutely need to be processed last, can be put at\r\n * the end.\r\n *\r\n * @ignore Exclude from docs\r\n * @param a Element 1\r\n * @param b Element 2\r\n * @return Sorting number\r\n */\r\n Series.prototype.configOrder = function (a, b) {\r\n if (a == b) {\r\n return 0;\r\n }\r\n // Must come last\r\n else if (a == \"heatRules\") {\r\n return 1;\r\n }\r\n else if (b == \"heatRules\") {\r\n return -1;\r\n }\r\n else {\r\n return _super.prototype.configOrder.call(this, a, b);\r\n }\r\n };\r\n /**\r\n * Sets `visibility` property:\r\n *\r\n * * `true` - visible\r\n * * `false` - hidden\r\n *\r\n * @param value true - visible, false - hidden\r\n * @return Current visibility\r\n */\r\n Series.prototype.setVisibility = function (value) {\r\n _super.prototype.setVisibility.call(this, value);\r\n this.bulletsContainer.visible = value;\r\n };\r\n return Series;\r\n}(Component));\r\nexport { Series };\r\n/**\r\n * Register class, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"Series\"] = Series;\r\nregistry.registeredClasses[\"SeriesDataItem\"] = SeriesDataItem;\r\n//# sourceMappingURL=Series.js.map","/**\r\n * Serial chart module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Chart, ChartDataItem } from \"../Chart\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { Series } from \"../series/Series\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { ColorSet } from \"../../core/utils/ColorSet\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport { Disposer } from \"../../core/utils/Disposer\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[SerialChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar SerialChartDataItem = /** @class */ (function (_super) {\r\n __extends(SerialChartDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SerialChartDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"SerialChartDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return SerialChartDataItem;\r\n}(ChartDataItem));\r\nexport { SerialChartDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A base class for all series-based charts, like XY, Pie, etc.\r\n *\r\n * Is not useful on its own.\r\n *\r\n * @see {@link ISerialChartEvents} for a list of available Events\r\n * @see {@link ISerialChartAdapters} for a list of available Adapters\r\n */\r\nvar SerialChart = /** @class */ (function (_super) {\r\n __extends(SerialChart, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SerialChart() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"SerialChart\";\r\n _this.colors = new ColorSet();\r\n _this._usesData = false;\r\n // Create a container for series\r\n var seriesContainer = _this.chartContainer.createChild(Container);\r\n seriesContainer.shouldClone = false;\r\n seriesContainer.width = percent(100);\r\n seriesContainer.height = percent(100);\r\n seriesContainer.isMeasured = false;\r\n seriesContainer.layout = \"none\";\r\n seriesContainer.zIndex = 2;\r\n _this.seriesContainer = seriesContainer;\r\n // Create a container for bullets\r\n var bulletsContainer = _this.chartContainer.createChild(Container);\r\n bulletsContainer.shouldClone = false;\r\n bulletsContainer.width = percent(100);\r\n bulletsContainer.height = percent(100);\r\n bulletsContainer.isMeasured = false;\r\n bulletsContainer.zIndex = 3;\r\n bulletsContainer.layout = \"none\";\r\n _this.bulletsContainer = bulletsContainer;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n SerialChart.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this.colors) {\r\n this.colors.dispose();\r\n }\r\n if (this.patterns) {\r\n this.patterns.dispose();\r\n }\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor\r\n */\r\n SerialChart.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Serial chart\");\r\n }\r\n };\r\n Object.defineProperty(SerialChart.prototype, \"series\", {\r\n /**\r\n * A list of chart's series.\r\n *\r\n * @return Chart's series\r\n */\r\n get: function () {\r\n if (!this._series) {\r\n this._series = new ListTemplate(this.createSeries());\r\n this._series.events.on(\"inserted\", this.handleSeriesAdded, this, false);\r\n this._series.events.on(\"removed\", this.handleSeriesRemoved, this, false);\r\n this._disposers.push(new ListDisposer(this._series, false));\r\n this._disposers.push(this._series.template);\r\n }\r\n return this._series;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SerialChart.prototype.handleSeriesRemoved = function (event) {\r\n var series = event.oldValue;\r\n this.dataUsers.removeValue(series);\r\n this.dataUsers.each(function (dataUser) {\r\n dataUser.invalidateDataItems();\r\n });\r\n if (series.autoDispose) {\r\n series.dispose();\r\n }\r\n else {\r\n series.parent = undefined;\r\n series.bulletsContainer.parent = undefined;\r\n }\r\n //this.feedLegend();\r\n var legend = this.legend;\r\n if (legend) {\r\n var dataItems = this.legend.dataItems;\r\n for (var i = dataItems.length - 1; i >= 0; i--) {\r\n var dataItem = dataItems.getIndex(i);\r\n if (dataItem && dataItem.dataContext == series) {\r\n legend.dataItems.remove(dataItem);\r\n }\r\n }\r\n for (var i = legend.data.length - 1; i >= 0; i--) {\r\n var di = legend.data[i];\r\n if (di && di == series) {\r\n $array.remove(legend.data, di);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Decorates a new [[Series]] object with required parameters when it is\r\n * added to the chart.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n SerialChart.prototype.handleSeriesAdded = function (event) {\r\n var _this = this;\r\n var series = event.newValue;\r\n if (series.isDisposed()) {\r\n return;\r\n }\r\n series.chart = this;\r\n series.parent = this.seriesContainer;\r\n series.bulletsContainer.parent = this.bulletsContainer;\r\n this._dataUsers.moveValue(series);\r\n series.addDisposer(new Disposer(function () {\r\n _this.dataUsers.removeValue(series);\r\n }));\r\n this.handleSeriesAdded2(series);\r\n if (!series.hiddenInLegend) {\r\n if (this.legend) {\r\n this.legend.addData(series);\r\n }\r\n }\r\n };\r\n SerialChart.prototype.handleSeriesAdded2 = function (series) {\r\n var _this = this;\r\n if (!this.dataInvalid) {\r\n this._disposers.push(\r\n // on exit only as data is usually passed after push\r\n registry.events.once(\"exitframe\", function () {\r\n if (!series.data || series.data.length == 0) {\r\n series.data = _this.data;\r\n if (series.showOnInit) {\r\n series.reinit();\r\n series.setPropertyValue(\"showOnInit\", false);\r\n series.showOnInit = true;\r\n }\r\n series.events.once(\"datavalidated\", function () {\r\n if (series.data == _this.data) {\r\n series._data = [];\r\n }\r\n });\r\n }\r\n }));\r\n }\r\n };\r\n /**\r\n * Setups the legend to use the chart's data.\r\n * @ignore\r\n */\r\n SerialChart.prototype.feedLegend = function () {\r\n var legend = this.legend;\r\n if (legend) {\r\n var legendData_1 = [];\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (!series.hiddenInLegend) {\r\n legendData_1.push(series);\r\n }\r\n });\r\n legend.dataFields.name = \"name\";\r\n legend.data = legendData_1;\r\n }\r\n };\r\n /**\r\n * Creates and returns a new Series, suitable for this chart type.\r\n *\r\n * @return New series\r\n */\r\n SerialChart.prototype.createSeries = function () {\r\n return new Series();\r\n };\r\n Object.defineProperty(SerialChart.prototype, \"colors\", {\r\n /**\r\n * @return Color list\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"colors\");\r\n },\r\n /**\r\n * Chart's color list.\r\n *\r\n * This list can be used by a number of serial items, like applying a new\r\n * color for each Series added. Or, applying a new color for each slice\r\n * of a Pie chart.\r\n *\r\n * Please see [[ColorSet]] for information on how you can set up to generate\r\n * unique colors.\r\n *\r\n * A theme you are using may override default pre-defined colors.\r\n *\r\n * @param value Color list\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"colors\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialChart.prototype, \"patterns\", {\r\n /**\r\n * @return Pattern set\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"patterns\");\r\n },\r\n /**\r\n * A [[PatternSet]] to use when creating patterned fills for slices.\r\n *\r\n * @since 4.7.5\r\n * @param value Pattern set\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"patterns\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all parameters from another [[SerialChart]].\r\n *\r\n * @param source Source SerialChart\r\n */\r\n SerialChart.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.series.copyFrom(source.series);\r\n };\r\n /**\r\n * Hides the chart instantly and then shows it. If defaultState.transitionDuration > 0, this will result an animation in which properties of hidden state will animate to properties of visible state.\r\n */\r\n SerialChart.prototype.appear = function () {\r\n _super.prototype.appear.call(this);\r\n this.series.each(function (series) {\r\n if (series.showOnInit && series.inited) {\r\n series.appear();\r\n }\r\n });\r\n };\r\n return SerialChart;\r\n}(Chart));\r\nexport { SerialChart };\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[\"SerialChart\"] = SerialChart;\r\n//# sourceMappingURL=SerialChart.js.map","/**\r\n * Axis break module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\r\nimport { WavedLine } from \"../../core/elements/WavedLine\";\r\nimport { List } from \"../../core/utils/List\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { color } from \"../../core/utils/Color\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Base class to define \"breaks\" on axes.\r\n *\r\n * @see {@link IAxisBreakEvents} for a list of available events\r\n * @see {@link IAxisBreakAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar AxisBreak = /** @class */ (function (_super) {\r\n __extends(AxisBreak, _super);\r\n /**\r\n * Constructor\r\n */\r\n function AxisBreak() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Reference to parent Axis.\r\n */\r\n _this._axis = new MutableValueDisposer();\r\n /**\r\n * A list of axis data items which fall within this break.\r\n */\r\n _this.dataItems = new List();\r\n _this.className = \"AxisBreak\";\r\n // Set defaults\r\n _this.breakSize = 0.01;\r\n _this.marginLeft = -5;\r\n _this.marginRight = -5;\r\n _this.marginTop = -5;\r\n _this.marginBottom = -5;\r\n var interfaceColors = new InterfaceColorSet();\r\n // Create elements\r\n // (these won't be used actually, just for setting properties)\r\n var fillShape = new WavedLine();\r\n fillShape.fill = interfaceColors.getFor(\"background\");\r\n fillShape.stroke = color();\r\n fillShape.fillOpacity = 0.9;\r\n fillShape.zIndex = 0;\r\n _this._fillShape = fillShape;\r\n var startLine = new WavedLine();\r\n startLine.fill = color();\r\n startLine.stroke = interfaceColors.getFor(\"grid\");\r\n startLine.strokeOpacity = 0.3;\r\n startLine.zIndex = 1;\r\n _this._startLine = startLine;\r\n var endLine = new WavedLine();\r\n endLine.fill = color();\r\n endLine.stroke = color(\"#000000\"); // interfaceColors.getFor(\"grid\");\r\n endLine.strokeOpacity = 0.3;\r\n endLine.zIndex = 2;\r\n _this._endLine = endLine;\r\n _this._disposers.push(_this._axis);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n AxisBreak.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this._fillShape) {\r\n this._fillShape.dispose();\r\n }\r\n if (this._startLine) {\r\n this._startLine.dispose();\r\n }\r\n if (this._endLine) {\r\n this._endLine.dispose();\r\n }\r\n };\r\n Object.defineProperty(AxisBreak.prototype, \"startLine\", {\r\n /**\r\n * @return Element\r\n */\r\n get: function () {\r\n return this._startLine;\r\n },\r\n /**\r\n * An element used for the starting line of the break.\r\n *\r\n * @param sprite Element\r\n */\r\n set: function (sprite) {\r\n if (this._startLine) {\r\n this._startLine.dispose();\r\n }\r\n this._startLine = sprite;\r\n this.addBreakSprite(sprite);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisBreak.prototype, \"endLine\", {\r\n /**\r\n * @return Element\r\n */\r\n get: function () {\r\n return this._endLine;\r\n },\r\n /**\r\n * An element used for the end line of the break.\r\n *\r\n * @param sprite Element\r\n */\r\n set: function (sprite) {\r\n if (this._endLine) {\r\n this._endLine.dispose();\r\n }\r\n this._endLine = sprite;\r\n this.addBreakSprite(sprite);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisBreak.prototype, \"fillShape\", {\r\n /**\r\n * @return Element\r\n */\r\n get: function () {\r\n return this._fillShape;\r\n },\r\n /**\r\n * An element used for fill of the break.\r\n *\r\n * @param sprite Element\r\n */\r\n set: function (sprite) {\r\n if (this._fillShape) {\r\n this._fillShape.dispose();\r\n }\r\n this._fillShape = sprite;\r\n this.addBreakSprite(sprite);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a break element (e.g. lines, fill) to the break, which is\r\n * [[Container]].\r\n *\r\n * @ignore Exclude from docs\r\n * @param sprite Element to add\r\n */\r\n AxisBreak.prototype.addBreakSprite = function (sprite) {\r\n sprite.parent = this;\r\n sprite.isMeasured = false;\r\n this._disposers.push(sprite);\r\n };\r\n Object.defineProperty(AxisBreak.prototype, \"axis\", {\r\n /**\r\n * @return Axis\r\n */\r\n get: function () {\r\n return this._axis.get();\r\n },\r\n /**\r\n * An Axis this Break is associated with.\r\n *\r\n * @param axis Axis\r\n */\r\n set: function (axis) {\r\n if (this._axis.get() !== axis) {\r\n this._axis.set(axis, axis.renderer.gridContainer.events.on(\"transformed\", this.invalidate, this, false));\r\n axis.renderer.createBreakSprites(this);\r\n // this can't go to copyFrom, as axis is set later\r\n var breakTemplate = axis.axisBreaks.template;\r\n this.startLine.copyFrom(breakTemplate.startLine);\r\n this.endLine.copyFrom(breakTemplate.endLine);\r\n this.fillShape.copyFrom(breakTemplate.fillShape);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisBreak.prototype, \"breakSize\", {\r\n /**\r\n * @return Relative axis break\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"breakSize\");\r\n },\r\n /**\r\n * A size of the break relative to the actual size of the scope break spans.\r\n *\r\n * For example, if `breakSize = 0.1` and unbroken scope of values it spans\r\n * would be 100 pixels, the break would be 10 pixels wide.\r\n *\r\n * 0 means the break will completely collapse and hide the values.\r\n * 1 means break would be not collapse at all, which would make it\r\n * effectively useless.\r\n *\r\n * @default 0.01\r\n * @param value Relative axis break\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"breakSize\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidate();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisBreak.prototype, \"startPoint\", {\r\n /**\r\n * Returns pixel coordinates of axis break's start.\r\n *\r\n * @return Start point\r\n */\r\n get: function () {\r\n var renderer = this.axis.renderer;\r\n if (renderer) {\r\n return renderer.positionToPoint(this.startPosition);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisBreak.prototype, \"endPoint\", {\r\n /**\r\n * Returns pixel coordinates of axis break's end.\r\n *\r\n * @return End point\r\n */\r\n get: function () {\r\n var renderer = this.axis.renderer;\r\n if (renderer) {\r\n return renderer.positionToPoint(this.endPosition);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisBreak.prototype, \"startPosition\", {\r\n /**\r\n * Returns a relative position at which axis break starts.\r\n *\r\n * This is a calculated position, meaning it shows relative position of the\r\n * break after break is applied.\r\n *\r\n * @return Start position\r\n */\r\n get: function () {\r\n return;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisBreak.prototype, \"endPosition\", {\r\n /**\r\n * Returns a relative position at which axis break ends.\r\n *\r\n * This is a calculated position, meaning it shows relative position of the\r\n * break after break is applied.\r\n *\r\n * @return End position\r\n */\r\n get: function () {\r\n return;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Draws the axis break.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisBreak.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n if (this.axis) {\r\n var renderer = this.axis.renderer;\r\n renderer.updateBreakElement(this);\r\n }\r\n };\r\n Object.defineProperty(AxisBreak.prototype, \"startValue\", {\r\n /**\r\n * @return Starting value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startValue\");\r\n },\r\n /**\r\n * A starting value for the break.\r\n *\r\n * @param value Starting value\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"startValue\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidate();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisBreak.prototype, \"endValue\", {\r\n /**\r\n * @return End value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endValue\");\r\n },\r\n /**\r\n * An end value for the break.\r\n *\r\n * @param value End value\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"endValue\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidate();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return AxisBreak;\r\n}(Container));\r\nexport { AxisBreak };\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[\"AxisBreak\"] = AxisBreak;\r\n//# sourceMappingURL=AxisBreak.js.map","/**\r\n * Base class for all Axis\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Component } from \"../../core/Component\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { DataItem } from \"../../core/DataItem\";\r\nimport { AxisBreak } from \"./AxisBreak\";\r\nimport { Label } from \"../../core/elements/Label\";\r\nimport { Tooltip } from \"../../core/elements/Tooltip\";\r\nimport { SortedListTemplate } from \"../../core/utils/SortedList\";\r\nimport { List, ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { Disposer, MultiDisposer } from \"../../core/utils/Disposer\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $number from \"../../core/utils/Number\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[Axis]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar AxisDataItem = /** @class */ (function (_super) {\r\n __extends(AxisDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function AxisDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"AxisDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(AxisDataItem.prototype, \"grid\", {\r\n /**\r\n * @return Grid element\r\n */\r\n get: function () {\r\n if (!this._grid) {\r\n var component_1 = this.component;\r\n if (component_1) {\r\n var template = void 0;\r\n var grid_1;\r\n if (this.isRange) {\r\n template = component_1.axisRanges.template.grid;\r\n if (template.disabled) {\r\n return;\r\n }\r\n else {\r\n grid_1 = template.clone();\r\n }\r\n }\r\n else {\r\n template = component_1.renderer.grid.template;\r\n if (template.disabled) {\r\n return;\r\n }\r\n else {\r\n grid_1 = component_1.renderer.grid.create();\r\n this._disposers.push(new Disposer(function () {\r\n component_1.renderer.grid.removeValue(grid_1);\r\n }));\r\n }\r\n }\r\n this.grid = grid_1;\r\n grid_1.shouldClone = false;\r\n this._disposers.push(grid_1);\r\n grid_1.axis = this.component;\r\n }\r\n }\r\n return this._grid;\r\n },\r\n /**\r\n * A [[Grid]] element associated with this data item.\r\n *\r\n * If there is no grid element associated with data item, a new one is\r\n * created and returned.\r\n *\r\n * @param grid Grid element\r\n */\r\n set: function (grid) {\r\n if (this._grid && this._grid != grid) {\r\n $array.remove(this.sprites, this._grid);\r\n this._grid.dataItem = undefined;\r\n }\r\n if (grid) {\r\n if (grid.dataItem && grid.dataItem != this) {\r\n $array.remove(grid.dataItem.sprites, grid);\r\n grid.dataItem.grid = undefined;\r\n }\r\n this.addSprite(grid);\r\n }\r\n this._grid = grid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisDataItem.prototype, \"tick\", {\r\n /**\r\n * @return Tick element\r\n */\r\n get: function () {\r\n if (!this._tick) {\r\n var component_2 = this.component;\r\n if (component_2) {\r\n var template = void 0;\r\n var tick_1;\r\n if (this.isRange) {\r\n template = component_2.axisRanges.template.tick;\r\n if (template.disabled) {\r\n return;\r\n }\r\n else {\r\n tick_1 = template.clone();\r\n }\r\n }\r\n else {\r\n template = component_2.renderer.ticks.template;\r\n if (template.disabled) {\r\n return;\r\n }\r\n else {\r\n tick_1 = component_2.renderer.ticks.create();\r\n this._disposers.push(new Disposer(function () {\r\n component_2.renderer.ticks.removeValue(tick_1);\r\n }));\r\n }\r\n }\r\n this.tick = tick_1;\r\n tick_1.axis = this.component;\r\n tick_1.shouldClone = false;\r\n this._disposers.push(tick_1);\r\n }\r\n }\r\n return this._tick;\r\n },\r\n /**\r\n * An [[AxisTick]] element associated with this data item.\r\n *\r\n * If there is no tick element associated with data item, a new one is\r\n * created and returned.\r\n *\r\n * @param tick Tick element\r\n */\r\n set: function (tick) {\r\n if (this._tick && this._tick != tick) {\r\n $array.remove(this.sprites, this._tick);\r\n this._tick.dataItem = undefined;\r\n }\r\n if (tick) {\r\n if (tick.dataItem && tick.dataItem != this) {\r\n $array.remove(tick.dataItem.sprites, tick);\r\n tick.dataItem.tick = undefined;\r\n }\r\n this.addSprite(tick);\r\n }\r\n this._tick = tick;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisDataItem.prototype, \"label\", {\r\n /**\r\n * @return Label element\r\n */\r\n get: function () {\r\n if (!this._label) {\r\n var component_3 = this.component;\r\n if (component_3) {\r\n var template = void 0;\r\n var label_1;\r\n if (this.isRange) {\r\n template = component_3.axisRanges.template.label;\r\n if (template.disabled) {\r\n return;\r\n }\r\n else {\r\n label_1 = template.clone();\r\n }\r\n }\r\n else {\r\n template = component_3.renderer.labels.template;\r\n if (template.disabled) {\r\n return;\r\n }\r\n else {\r\n label_1 = component_3.renderer.labels.create();\r\n this._disposers.push(new Disposer(function () {\r\n component_3.renderer.labels.removeValue(label_1);\r\n }));\r\n }\r\n }\r\n this._disposers.push(label_1);\r\n this.label = label_1;\r\n label_1.shouldClone = false;\r\n label_1.axis = this.component;\r\n label_1.virtualParent = component_3;\r\n }\r\n }\r\n return this._label;\r\n },\r\n /**\r\n * An [[AxisLabel]] element associated with this data item.\r\n *\r\n * If there is no label element associated with data item, a new one is\r\n * created and returned.\r\n *\r\n * @param label Label element\r\n */\r\n set: function (label) {\r\n if (this._label && this._label != label) {\r\n $array.remove(this.sprites, this._label);\r\n this._label.dataItem = undefined;\r\n }\r\n if (label) {\r\n if (label.dataItem && label.dataItem != this) {\r\n $array.remove(label.dataItem.sprites, label);\r\n label.dataItem.label = undefined;\r\n }\r\n this.addSprite(label);\r\n }\r\n this._label = label;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisDataItem.prototype, \"axisFill\", {\r\n /**\r\n * @return Label element\r\n */\r\n get: function () {\r\n if (!this._axisFill) {\r\n var component_4 = this.component;\r\n if (component_4) {\r\n var template = void 0;\r\n var axisFill_1;\r\n if (this.isRange) {\r\n template = component_4.axisRanges.template.axisFill;\r\n if (!this.isTemplate && template.disabled) {\r\n return;\r\n }\r\n else {\r\n axisFill_1 = template.clone();\r\n }\r\n }\r\n else {\r\n template = component_4.renderer.axisFills.template;\r\n if (template.disabled) {\r\n return;\r\n }\r\n else {\r\n axisFill_1 = component_4.renderer.axisFills.create();\r\n this._disposers.push(new Disposer(function () {\r\n component_4.renderer.axisFills.removeValue(axisFill_1);\r\n }));\r\n }\r\n }\r\n this.axisFill = axisFill_1;\r\n axisFill_1.shouldClone = false;\r\n this._disposers.push(axisFill_1);\r\n }\r\n }\r\n return this._axisFill;\r\n },\r\n /**\r\n * An [[AxisFill]] associated element with this data item.\r\n *\r\n * If there is no fill element associated with data item, a new one is\r\n * created and returned.\r\n *\r\n * @param label Label element\r\n */\r\n set: function (axisFill) {\r\n if (this._axisFill && this._axisFill != axisFill) {\r\n $array.remove(this.sprites, this._axisFill);\r\n this._axisFill.dataItem = undefined;\r\n }\r\n if (axisFill) {\r\n if (axisFill.dataItem && axisFill.dataItem != this) {\r\n $array.remove(axisFill.dataItem.sprites, axisFill);\r\n axisFill.dataItem.axisFill = undefined;\r\n }\r\n axisFill.axis = this.component;\r\n this.addSprite(axisFill);\r\n }\r\n this._axisFill = axisFill;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisDataItem.prototype, \"text\", {\r\n /**\r\n * @return Text label\r\n */\r\n get: function () {\r\n return this._text;\r\n },\r\n /**\r\n * Text to be used as data item's label.\r\n *\r\n * @param text Text label\r\n */\r\n set: function (text) {\r\n this._text = text;\r\n if (this._label) { // do not use getter, it will create unwanted instances!\r\n this._label.text = text;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisDataItem.prototype, \"mask\", {\r\n /**\r\n * Data item's mask.\r\n *\r\n * @return Mask\r\n */\r\n get: function () {\r\n return this._mask;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisDataItem.prototype, \"contents\", {\r\n /**\r\n * Returns a [[Container]] to place all visual elements, related to data item\r\n * in.\r\n *\r\n * If there is no Container, a new one is created.\r\n *\r\n * @return Contents container\r\n */\r\n get: function () {\r\n if (!this._contents) {\r\n var contents = new Container();\r\n this.addSprite(contents);\r\n contents.isMeasured = false;\r\n this._contents = contents;\r\n var component = this.component;\r\n if (component) {\r\n var mask = component.renderer.createFill(this.component);\r\n mask.disabled = false;\r\n mask.axis = component;\r\n this.addSprite(mask);\r\n this._mask = mask;\r\n contents.mask = mask;\r\n }\r\n }\r\n return this._contents;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisDataItem.prototype, \"axisBreak\", {\r\n /**\r\n * @return Axis break\r\n */\r\n get: function () {\r\n return this._axisBreak;\r\n },\r\n /**\r\n * An [[AxisBreak]] this data item falls within.\r\n *\r\n * @param axisBreak Axis break\r\n */\r\n set: function (axisBreak) {\r\n if (this._axisBreak) {\r\n this._axisBreak.dataItems.removeValue(this);\r\n }\r\n if (axisBreak) {\r\n axisBreak.dataItems.push(this);\r\n }\r\n this._axisBreak = axisBreak;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Re-draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisDataItem.prototype.validate = function () {\r\n if (this.component) {\r\n this.component.validateDataElement(this);\r\n }\r\n };\r\n /**\r\n * Appends data item's elements to the parent [[Container]].\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisDataItem.prototype.appendChildren = function () {\r\n if (this.component) {\r\n this.component.appendDataItem(this);\r\n }\r\n };\r\n /**\r\n * Ordering function used in JSON setup.\r\n *\r\n * @param a Item A\r\n * @param b Item B\r\n * @return Order\r\n */\r\n AxisDataItem.prototype.configOrder = function (a, b) {\r\n if (a == b) {\r\n return 0;\r\n }\r\n else if (a == \"language\") {\r\n return -1;\r\n }\r\n else if (b == \"language\") {\r\n return 1;\r\n }\r\n else if (a == \"component\") {\r\n return -1;\r\n }\r\n else if (b == \"component\") {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n /**\r\n * Checks if data item has particular property set.\r\n *\r\n * @param prop Property name\r\n * @return Property set?\r\n */\r\n AxisDataItem.prototype.hasProperty = function (prop) {\r\n return prop == \"component\" ? true : _super.prototype.hasProperty.call(this, prop);\r\n };\r\n /**\r\n * Copies all parameters from another [[AxisDataItem]].\r\n *\r\n * @param source Source AxisDataItem\r\n */\r\n AxisDataItem.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.text = source.text;\r\n if (source.bullet) {\r\n this.bullet = source.bullet.clone();\r\n }\r\n this.minPosition = source.minPosition;\r\n this.maxPosition = source.maxPosition;\r\n };\r\n /**\r\n * Sets visibility of the Data Item.\r\n *\r\n * @param value Data Item\r\n */\r\n AxisDataItem.prototype.setVisibility = function (value, noChangeValues) {\r\n _super.prototype.setVisibility.call(this, value, noChangeValues);\r\n if (this._contents) {\r\n this._contents.visible = value;\r\n }\r\n };\r\n Object.defineProperty(AxisDataItem.prototype, \"bullet\", {\r\n /**\r\n * @return Bullet\r\n */\r\n get: function () {\r\n return this._bullet;\r\n },\r\n /**\r\n * Set it to an instance of any [[Sprite]]. It will be displayed as an axis\r\n * bullet in the middle of the cell, or specific value.\r\n *\r\n * If you need position bullet relatively to the cell, use [[AxisBullet]]\r\n * instead. It has a `location` property which can be used to indicate\r\n * precise relative location within cell/range.\r\n *\r\n * Also, [[AxisBullet]] is a [[Container]] so you can push any other element\r\n * into it.\r\n *\r\n * NOTE: `location` is relative to the parent axis range's scope, i.e.\r\n * between its `date` and `endDate` for [[DateAxis]], or `value`/`endValue`\r\n * ([[ValueAxis]]), or `category`/`endCategory` ([[categoryAxis]]).\r\n *\r\n * ```TypeScript\r\n * let range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n *\r\n * let flag = new am4plugins_bullets.FlagBullet();\r\n * flag.label.text = \"Hello\";\r\n *\r\n * range.bullet = flag;\r\n * ```\r\n * ```JavaScript\r\n * var range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n *\r\n * var flag = new am4plugins_bullets.FlagBullet();\r\n * flag.label.text = \"Hello\";\r\n *\r\n * range.bullet = flag;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * // ...\r\n * \"axisRanges\": [{\r\n * \"date\": new Date(2018, 0, 5),\r\n * \"bullet: {\r\n * \"type\": \"FlagBullet\",\r\n * \"label\": {\r\n * \"text\": \"Hello\"\r\n * }\r\n * }\r\n * }]\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @since 4.5.9\r\n * @param value Bullet\r\n */\r\n set: function (value) {\r\n if (this._bullet && this._bullet != value) {\r\n $array.remove(this.sprites, this._bullet);\r\n this._bullet.dataItem = undefined;\r\n }\r\n this._bullet = value;\r\n if (value) {\r\n this.addSprite(value);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return AxisDataItem;\r\n}(DataItem));\r\nexport { AxisDataItem };\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines named positions for data item's location within [[Axis]].\r\n */\r\nexport var AxisItemLocation;\r\n(function (AxisItemLocation) {\r\n AxisItemLocation[AxisItemLocation[\"Start\"] = 0] = \"Start\";\r\n AxisItemLocation[AxisItemLocation[\"Middle\"] = 0.5] = \"Middle\";\r\n AxisItemLocation[AxisItemLocation[\"End\"] = 1] = \"End\";\r\n})(AxisItemLocation || (AxisItemLocation = {}));\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A base class for all Axis elements.\r\n *\r\n * @see {@link IAxisEvents} for a list of available Events\r\n * @see {@link IAxisAdapters} for a list of available Adapters\r\n */\r\nvar Axis = /** @class */ (function (_super) {\r\n __extends(Axis, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Axis() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Number of Grid elements on the axis.\r\n */\r\n _this._gridCount = 10;\r\n /**\r\n * A list of [[XYSeries]] that are using this Axis.\r\n */\r\n _this._series = new List();\r\n /**\r\n * Specifies if axis should be automatically disposed when removing from\r\n * chart's axis list.\r\n *\r\n * @default true\r\n */\r\n _this.autoDispose = true;\r\n /**\r\n * @ignore\r\n */\r\n _this._axisItemCount = 0;\r\n if (_this.constructor === Axis) {\r\n throw new Error(\"'Axis' cannot be instantiated directly. Please use a specific axis type.\");\r\n }\r\n _this.hideTooltipWhileZooming = true;\r\n _this.minWidth = 0.0001;\r\n _this.minHeight = 0.0001;\r\n _this.className = \"Axis\";\r\n _this.shouldClone = false;\r\n _this.setPropertyValue(\"cursorTooltipEnabled\", true);\r\n _this.toggleZoomOutButton = true;\r\n _this.zoomable = true;\r\n var interfaceColors = new InterfaceColorSet();\r\n // Create title\r\n _this.title = new Label();\r\n _this.title.shouldClone = false;\r\n _this._disposers.push(_this.title);\r\n _this.setPropertyValue(\"startLocation\", 0);\r\n _this.setPropertyValue(\"endLocation\", 1);\r\n // Data item iterator\r\n _this._dataItemsIterator = new $iter.ListIterator(_this.dataItems, function () { return _this.dataItems.create(); });\r\n _this._dataItemsIterator.createNewItems = true;\r\n // Create tooltip\r\n var tooltip = new Tooltip();\r\n _this._disposers.push(tooltip);\r\n tooltip.label.padding(5, 10, 5, 10);\r\n tooltip.background.pointerLength = 5;\r\n tooltip.fitPointerToBounds = true;\r\n tooltip.background.filters.clear();\r\n // Set virtual parentfor the tooltip so that it can properly inheirt\r\n // formatters from the axis.\r\n tooltip.virtualParent = _this;\r\n // Create background element for the tooltip\r\n var background = tooltip.background;\r\n background.cornerRadius = 0;\r\n background.fill = interfaceColors.getFor(\"alternativeBackground\");\r\n background.stroke = background.fill;\r\n background.strokeWidth = 1;\r\n background.fillOpacity = 1;\r\n tooltip.label.fill = interfaceColors.getFor(\"alternativeText\");\r\n _this.tooltip = tooltip;\r\n // Accessibility\r\n _this.readerHidden = true;\r\n _this.events.on(\"rangechangestarted\", function () {\r\n _this.series.each(function (series) {\r\n if (series.hideTooltipWhileZooming) {\r\n series.tooltip.hide();\r\n series.tooltip.preventShow = true;\r\n }\r\n });\r\n if (_this.hideTooltipWhileZooming) {\r\n _this.tooltip.hide();\r\n _this.tooltip.preventShow = true;\r\n }\r\n }, undefined, false);\r\n _this.events.on(\"rangechangeended\", function () {\r\n _this.series.each(function (series) {\r\n if (series.hideTooltipWhileZooming) {\r\n series.tooltip.hide();\r\n series.tooltip.preventShow = false;\r\n }\r\n });\r\n if (_this.hideTooltipWhileZooming) {\r\n _this.tooltip.hide();\r\n _this.tooltip.preventShow = false;\r\n }\r\n }, undefined, false);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Holds reference to a function that accepts a DataItem and its index as\r\n * parameters.\r\n *\r\n * It can either return a fill opacity for a fill, or manipulate data item\r\n * directly, to create various highlighting scenarios.\r\n *\r\n * For example, you can set it up to highlight only weekends on a\r\n * [[DateAxis]].\r\n */\r\n Axis.prototype.fillRule = function (dataItem, index) {\r\n if (!$type.isNumber(index)) {\r\n index = dataItem.index;\r\n }\r\n if (index / 2 == Math.round(index / 2)) {\r\n dataItem.axisFill.__disabled = true;\r\n dataItem.axisFill.opacity = 0;\r\n }\r\n else {\r\n dataItem.axisFill.opacity = 1;\r\n dataItem.axisFill.__disabled = false;\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n Axis.prototype.createDataItem = function () {\r\n return new AxisDataItem();\r\n };\r\n /**\r\n * Invalidates layout.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.invalidateLayout = function () {\r\n _super.prototype.invalidateLayout.call(this);\r\n // this puts series after axis in invalidation order also makes series update it's data items in case widht/height of a series is not 100%\r\n $iter.each(this.series.iterator(), function (series) {\r\n series.invalidateLayout();\r\n });\r\n };\r\n /**\r\n * Invalidates series of this axis.\r\n */\r\n Axis.prototype.invalidateSeries = function () {\r\n // this puts series after axis in invalidation order also makes series update it's data items in case widht/height of a series is not 100%\r\n $iter.each(this.series.iterator(), function (series) {\r\n series.invalidate();\r\n });\r\n };\r\n /**\r\n * Override to cancel super call for data element validation.\r\n * @ignore\r\n */\r\n Axis.prototype.validateDataElements = function () {\r\n this._axisItemCount = 0;\r\n if (this.ghostLabel) {\r\n this.renderer.updateLabelElement(this.ghostLabel, this.start, this.end);\r\n this.ghostLabel.validate();\r\n }\r\n };\r\n /**\r\n * Recalculates the number of grid items on the axis.\r\n */\r\n Axis.prototype.updateGridCount = function () {\r\n if (this.renderer) {\r\n var gridCount = this.axisLength / this.renderer.minGridDistance;\r\n if (gridCount != this._gridCount) {\r\n this._gridCount = gridCount;\r\n this.clearCache();\r\n }\r\n }\r\n };\r\n /**\r\n * Redraws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.validateLayout = function () {\r\n this.axisFullLength = this.axisLength / (this.end - this.start);\r\n _super.prototype.validateLayout.call(this);\r\n this.updateGridCount();\r\n var renderer = this.renderer;\r\n if (renderer) {\r\n renderer.updateAxisLine();\r\n renderer.updateTooltip();\r\n renderer.updateBaseGridElement();\r\n }\r\n if (this._prevLength != this.axisLength) {\r\n this.dispatchImmediately(\"lengthchanged\");\r\n this._prevLength = this.axisLength;\r\n }\r\n };\r\n /**\r\n * Initializes Axis' renderer.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.initRenderer = function () {\r\n };\r\n /**\r\n * Adds a data item to the Axis.\r\n *\r\n * @param dataItem Data item\r\n */\r\n Axis.prototype.appendDataItem = function (dataItem) {\r\n var renderer = this.renderer;\r\n var tick = dataItem.tick;\r\n if (tick) {\r\n if (tick.above) {\r\n tick.parent = renderer.bulletsContainer;\r\n }\r\n else {\r\n tick.parent = renderer.gridContainer;\r\n }\r\n }\r\n if (dataItem.label) {\r\n dataItem.label.parent = renderer;\r\n }\r\n var axisFill = dataItem.axisFill;\r\n if (axisFill) {\r\n if (axisFill.above) {\r\n axisFill.parent = renderer.bulletsContainer;\r\n }\r\n else {\r\n axisFill.parent = renderer.gridContainer;\r\n }\r\n }\r\n var grid = dataItem.grid;\r\n if (grid) {\r\n if (grid.above) {\r\n grid.parent = renderer.bulletsContainer;\r\n }\r\n else {\r\n grid.parent = renderer.gridContainer;\r\n }\r\n }\r\n if (dataItem.bullet) {\r\n dataItem.bullet.parent = renderer.bulletsContainer;\r\n }\r\n };\r\n /**\r\n * Redraws Axis' related items.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n this.validateLayout();\r\n this.renderer.updateGridContainer();\r\n };\r\n /**\r\n * Redars Axis ranges.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.validateAxisRanges = function () {\r\n var _this = this;\r\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\r\n _this.appendDataItem(axisRange);\r\n _this.validateDataElement(axisRange);\r\n if (axisRange.grid) {\r\n axisRange.grid.validate();\r\n }\r\n if (axisRange.tick) {\r\n axisRange.tick.validate();\r\n }\r\n if (axisRange.axisFill) {\r\n axisRange.axisFill.validate();\r\n }\r\n if (axisRange.label) {\r\n axisRange.label.validate();\r\n }\r\n });\r\n };\r\n /**\r\n * Invalidates all axis breaks, so they are redrawn.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.validateBreaks = function () {\r\n if (this._axisBreaks) {\r\n $iter.each(this._axisBreaks.iterator(), function (axisBreak) {\r\n axisBreak.invalidate();\r\n });\r\n }\r\n };\r\n /**\r\n * Associates an Axis break with this Axis, after it is inserted into\r\n * `axisBreaks`.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n Axis.prototype.processBreak = function (event) {\r\n var axisBreak = event.newValue;\r\n axisBreak.parent = this.renderer.breakContainer;\r\n axisBreak.axis = this;\r\n };\r\n /**\r\n * Registers a [[XYSeries]] element with this Axis.\r\n *\r\n * Returns a [[Disposer]] for all events, added to Series for watching\r\n * changes in Axis, and vice versa.\r\n * @ignore\r\n * @param series Series\r\n * @return Event disposer\r\n */\r\n Axis.prototype.registerSeries = function (series) {\r\n var _this = this;\r\n this.series.moveValue(series);\r\n return new MultiDisposer([\r\n new Disposer(function () {\r\n _this.series.removeValue(series);\r\n }),\r\n this.events.on(\"lengthchanged\", series.invalidate, series, false),\r\n this.events.on(\"lengthchanged\", series.createMask, series, false),\r\n this.events.on(\"startchanged\", series.invalidate, series, false),\r\n this.events.on(\"endchanged\", series.invalidate, series, false),\r\n ]);\r\n };\r\n Object.defineProperty(Axis.prototype, \"renderer\", {\r\n /**\r\n * @return Renderer\r\n */\r\n get: function () {\r\n return this._renderer;\r\n },\r\n /**\r\n * An [[AxisRenderer]] to be used to render this Axis.\r\n *\r\n * Please note that most of the settings, related to Axis' appearance are set\r\n * via its renderer. Not directly on the Axis.\r\n *\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * axis.renderer.inside = true;\r\n * axis.renderer.minLabelPosition = 0.1;\r\n * axis.renderer.maxLabelPosition = 0.9;\r\n * ```\r\n * ```JavaScript\r\n * axis.renderer.inside = true;\r\n * axis.renderer.minLabelPosition = 0.1;\r\n * axis.renderer.maxLabelPosition = 0.9;\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/} for more info\r\n * @param renderer Renderer\r\n */\r\n set: function (renderer) {\r\n if (renderer != this._renderer) {\r\n this._renderer = renderer;\r\n renderer.chart = this.chart;\r\n renderer.axis = this;\r\n renderer.parent = this;\r\n this.title.parent = this; // we add title to axis and set layout in renderer to avoid one extra container, as otherwise axis container would be used for holding renderer only\r\n this.initRenderer();\r\n this._disposers.push(renderer.gridContainer.events.on(\"maxsizechanged\", this.invalidate, this, false));\r\n var ghostLabel_1 = this.renderer.labels.create();\r\n this._disposers.push(ghostLabel_1);\r\n ghostLabel_1.dataItem = this.dataItems.template.clone(); // just for the adapters not to fail\r\n ghostLabel_1.text = \"L\";\r\n ghostLabel_1.parent = this.renderer;\r\n ghostLabel_1.shouldClone = false;\r\n ghostLabel_1.fillOpacity = 0;\r\n ghostLabel_1.opacity = 0;\r\n ghostLabel_1.strokeOpacity = 0;\r\n ghostLabel_1.interactionsEnabled = false;\r\n ghostLabel_1.validate();\r\n this.ghostLabel = ghostLabel_1;\r\n this.events.on(\"beforedatavalidated\", function () {\r\n ghostLabel_1.text = \"L\";\r\n }, undefined, false);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts a relative position to angle. (for circular axes)\r\n *\r\n * @param position Position (0-1)\r\n * @return Angle\r\n */\r\n Axis.prototype.positionToAngle = function (position) {\r\n return this.renderer.positionToAngle(position);\r\n };\r\n /**\r\n * Converts pixel coordinates to a relative position. (0-1)\r\n *\r\n * @param point Coorinates (px)\r\n * @return Position (0-1)\r\n */\r\n Axis.prototype.pointToPosition = function (point) {\r\n return this.renderer.pointToPosition(point);\r\n };\r\n /**\r\n * Converts relative position to coordinate.\r\n *\r\n * @since 4.7.15\r\n * @param position (0-1)\r\n * @return coordinate (px)\r\n */\r\n Axis.prototype.positionToCoordinate = function (position) {\r\n return this.renderer.positionToCoordinate(position);\r\n };\r\n /**\r\n * [getAnyRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param start [description]\r\n * @param end [description]\r\n * @return [description]\r\n */\r\n Axis.prototype.getAnyRangePath = function (start, end) {\r\n return this.renderer.getPositionRangePath(start, end);\r\n };\r\n /**\r\n * Converts any positional parameter to a relative position on axis.\r\n *\r\n * @todo Description (review)\r\n * @param value Pisition\r\n * @return Position (0-1)\r\n */\r\n Axis.prototype.anyToPosition = function (value) {\r\n return 0;\r\n };\r\n /**\r\n * Converts any positional parameter to a relative position on axis.\r\n *\r\n * @todo Description (review)\r\n * @param value Pisition\r\n * @return Orientation point\r\n */\r\n Axis.prototype.anyToPoint = function (value) {\r\n return { x: 0, y: 0, angle: 0 };\r\n };\r\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition [description]\r\n * @param endPosition [description]\r\n * @return [description]\r\n */\r\n Axis.prototype.getPositionRangePath = function (startPosition, endPosition) {\r\n if (this.renderer) {\r\n return this.renderer.getPositionRangePath(startPosition, endPosition);\r\n }\r\n return \"\";\r\n };\r\n Object.defineProperty(Axis.prototype, \"axisLength\", {\r\n /**\r\n * Actual axis length in pixels.\r\n *\r\n * @return Axis length (px)\r\n */\r\n get: function () {\r\n if (this.renderer) {\r\n return this.renderer.axisLength;\r\n }\r\n return 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Axis.prototype, \"cursorTooltipEnabled\", {\r\n /**\r\n * @return Display tooltip?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cursorTooltipEnabled\");\r\n },\r\n /**\r\n * Indicates if axis should display a tooltip for chart's cursor.\r\n *\r\n * @param value Display tooltip?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"cursorTooltipEnabled\", value)) {\r\n if (value && this.renderer) {\r\n this.renderer.updateTooltip();\r\n }\r\n else if (this.tooltip) {\r\n this.tooltip.hide(0);\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Axis.prototype, \"toggleZoomOutButton\", {\r\n /**\r\n * @return Toggle zoom out button?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"toggleZoomOutButton\");\r\n },\r\n /**\r\n * Normally, when axis is zoomed in, a zoom out button is shown by a chart,\r\n * and vice versa: when axis is zoomed out completely, zoom out button is\r\n * hidden.\r\n *\r\n * Setting this to `false` will disable this behavior. Zooming in our out\r\n * this axis will not reveal or hide zoom out button.\r\n *\r\n * @default true\r\n * @since 4.6.2\r\n * @param value Toggle zoom out button?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"toggleZoomOutButton\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Hides element's [[Tooltip]].\r\n *\r\n * @see {@link Tooltip}\r\n */\r\n Axis.prototype.hideTooltip = function (duration) {\r\n _super.prototype.hideTooltip.call(this, duration);\r\n this._tooltipPosition = undefined;\r\n };\r\n /**\r\n * Shows Axis tooltip at specific relative position within Axis. (0-1)\r\n *\r\n * @param position Position (0-1)\r\n * @param local or global position\r\n */\r\n Axis.prototype.showTooltipAtPosition = function (position, local) {\r\n var tooltip = this._tooltip;\r\n if (!tooltip || this.dataItems.length <= 0) {\r\n this._tooltipPosition = undefined;\r\n }\r\n else {\r\n if (!local) {\r\n position = this.toAxisPosition(position);\r\n }\r\n if (!$type.isNumber(position) || position < this.start || position > this.end) {\r\n tooltip.hide(0);\r\n this._tooltipPosition = undefined;\r\n return;\r\n }\r\n var renderer = this.renderer;\r\n //@todo: think of how to solve this better\r\n if (!tooltip.parent) {\r\n tooltip.parent = this.tooltipContainer;\r\n }\r\n var tooltipLocation = renderer.tooltipLocation;\r\n var startPosition = this.getCellStartPosition(position);\r\n var endPosition = this.getCellEndPosition(position);\r\n if (this.tooltipPosition == \"fixed\") {\r\n position = startPosition + (endPosition - startPosition) * tooltipLocation;\r\n }\r\n position = $math.fitToRange(position, this.start, this.end);\r\n if (this._tooltipPosition != position) {\r\n this._tooltipPosition = position;\r\n var tooltipLocation2 = renderer.tooltipLocation2;\r\n var startPoint = renderer.positionToPoint(startPosition, tooltipLocation2);\r\n var endPoint = renderer.positionToPoint(endPosition, tooltipLocation2);\r\n // save values so cursor could use them\r\n this.currentItemStartPoint = startPoint;\r\n this.currentItemEndPoint = endPoint;\r\n if (renderer.fullWidthTooltip) {\r\n tooltip.width = endPoint.x - startPoint.x;\r\n tooltip.height = endPoint.y - startPoint.y;\r\n }\r\n var point = renderer.positionToPoint(position, tooltipLocation2);\r\n var globalPoint = $utils.spritePointToSvg(point, this.renderer.line);\r\n tooltip.text = this.getTooltipText(position);\r\n if (tooltip.text) {\r\n tooltip.delayedPointTo(globalPoint);\r\n tooltip.show();\r\n }\r\n }\r\n if (!this.cursorTooltipEnabled || this.tooltip.disabled) {\r\n tooltip.hide(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Converts relative position (0-1) to Axis position with zoom level and\r\n * inversed taken into account.\r\n *\r\n * @param position Global position (0-1)\r\n * @return Position within Axis (0-1)\r\n */\r\n Axis.prototype.toAxisPosition = function (position) {\r\n position = this.renderer.toAxisPosition(position);\r\n if (position == undefined) {\r\n return;\r\n }\r\n position = position * (this.end - this.start);\r\n if (this.renderer.inversed) {\r\n position = this.end - position;\r\n }\r\n else {\r\n position = this.start + position;\r\n }\r\n return position;\r\n };\r\n /**\r\n * Converts position on the axis with zoom level and\r\n * inversed taken into account to global position.\r\n *\r\n * @param position Axis position (0-1)\r\n * @return Global position (0-1)\r\n */\r\n Axis.prototype.toGlobalPosition = function (position) {\r\n if (this.renderer.inversed) {\r\n position = this.end - position;\r\n }\r\n else {\r\n position = position - this.start;\r\n }\r\n return position / (this.end - this.start);\r\n };\r\n /**\r\n * Returns text to be used for cursor's Axis tooltip.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position coordinate (px)\r\n * @return Label text\r\n */\r\n Axis.prototype.getTooltipText = function (position) {\r\n return;\r\n };\r\n /**\r\n * Updates Axis' tooltip's position and possibly size, and pointer (stem)\r\n * place.\r\n *\r\n * @ignore Exclude from docs\r\n * @param pointerOrientation Pointer (stem) orientation\r\n * @param boundingRectangle A rectangle for tooltip to fit within\r\n */\r\n Axis.prototype.updateTooltip = function (pointerOrientation, boundingRectangle) {\r\n var tooltip = this._tooltip;\r\n if (tooltip) {\r\n tooltip.pointerOrientation = pointerOrientation;\r\n tooltip.setBounds($utils.spriteRectToSvg(boundingRectangle, this.renderer.line));\r\n }\r\n };\r\n /**\r\n * [roundPosition description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param position Relative position\r\n * @param location Location on axis\r\n * @return Rounded position\r\n */\r\n Axis.prototype.roundPosition = function (position, location, axisLocation) {\r\n return position;\r\n };\r\n /**\r\n * [getCellStartPosition description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param position [description]\r\n * @return [description]\r\n */\r\n Axis.prototype.getCellStartPosition = function (position) {\r\n return position;\r\n };\r\n /**\r\n * [getCellEndPosition description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param position [description]\r\n * @return [description]\r\n */\r\n Axis.prototype.getCellEndPosition = function (position) {\r\n return position;\r\n };\r\n Object.defineProperty(Axis.prototype, \"axisRanges\", {\r\n /**\r\n * A list of axis ranges for this Axis.\r\n *\r\n * @return Axis ranges\r\n */\r\n get: function () {\r\n if (!this._axisRanges) {\r\n var dataItem = this.createDataItem();\r\n dataItem.isRange = true;\r\n dataItem.axisFill = this.renderer.axisFills.template.clone();\r\n dataItem.grid = this.renderer.grid.template.clone();\r\n dataItem.tick = this.renderer.ticks.template.clone();\r\n dataItem.label = this.renderer.labels.template.clone();\r\n dataItem.isTemplate = true;\r\n dataItem.component = this;\r\n dataItem.axisFill.disabled = false;\r\n dataItem.tick.disabled = false;\r\n dataItem.grid.disabled = false;\r\n dataItem.label.disabled = false;\r\n this._axisRanges = new ListTemplate(dataItem);\r\n this._axisRanges.events.on(\"inserted\", this.processAxisRange, this, false);\r\n this._disposers.push(new ListDisposer(this._axisRanges));\r\n this._disposers.push(this._axisRanges.template);\r\n }\r\n return this._axisRanges;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Decorates an axis range after it has been added to the axis range list.\r\n *\r\n * @param event Event\r\n */\r\n Axis.prototype.processAxisRange = function (event) {\r\n var axisRange = event.newValue;\r\n axisRange.component = this;\r\n axisRange.isRange = true;\r\n };\r\n Object.defineProperty(Axis.prototype, \"axisBreaks\", {\r\n /**\r\n * A list of axis breaks on this Axis.\r\n *\r\n * @return Axis breaks.\r\n */\r\n get: function () {\r\n if (!this._axisBreaks) {\r\n this._axisBreaks = new SortedListTemplate(this.createAxisBreak(), function (a, b) {\r\n return $number.order(a.adjustedStartValue, b.adjustedStartValue);\r\n });\r\n this._axisBreaks.events.on(\"inserted\", this.processBreak, this, false);\r\n this._disposers.push(new ListDisposer(this._axisBreaks));\r\n this._disposers.push(this._axisBreaks.template);\r\n }\r\n return this._axisBreaks;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a new axis break.\r\n *\r\n * @return Axis break\r\n */\r\n Axis.prototype.createAxisBreak = function () {\r\n return new AxisBreak();\r\n };\r\n Object.defineProperty(Axis.prototype, \"series\", {\r\n /**\r\n * A list of Series currently associated with this Axis.\r\n *\r\n * @return Series\r\n */\r\n get: function () {\r\n if (!this._series) {\r\n this._series = new List();\r\n }\r\n return this._series;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Processes Series' data items.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.processSeriesDataItems = function () {\r\n };\r\n /**\r\n * Processes Series' single data item.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n Axis.prototype.processSeriesDataItem = function (dataItem, axisLetter) {\r\n };\r\n /**\r\n * Post-processes Serie's data items.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.postProcessSeriesDataItems = function (series) {\r\n };\r\n /**\r\n * Post-processes Serie's single data item.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n Axis.prototype.postProcessSeriesDataItem = function (dataItem) {\r\n };\r\n //\r\n /**\r\n * Updates Axis based on all Series that might influence it.\r\n *\r\n * Called by Series after Series data is validated.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.updateAxisBySeries = function () {\r\n };\r\n /**\r\n * Hides unused data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Axis.prototype.hideUnusedDataItems = function () {\r\n var _this = this;\r\n // hide all unused\r\n var dataItemsIterator = this._dataItemsIterator;\r\n dataItemsIterator.createNewItems = false;\r\n $iter.each(dataItemsIterator.iterator(), function (dataItem) {\r\n _this.validateDataElement(dataItem); // solves shrinking\r\n dataItem.__disabled = true;\r\n });\r\n dataItemsIterator.clear();\r\n dataItemsIterator.createNewItems = true;\r\n };\r\n /**\r\n * Returns a Series' data item that corresponds to specific position on Axis.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param series Series\r\n * @param position Position (0-1)\r\n * @param findNearest Should axis try to find nearest tooltip if there is no data item at exact position\r\n * @return Data item\r\n */\r\n Axis.prototype.getSeriesDataItem = function (series, position, findNearest) {\r\n return;\r\n };\r\n /**\r\n * Returns an angle that corresponds to specific position on axis.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key ???\r\n * @param location Location\r\n * @param stackKey ???\r\n * @return Angle\r\n */\r\n Axis.prototype.getAngle = function (dataItem, key, location, stackKey, range) {\r\n return;\r\n };\r\n /**\r\n * [getX description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @param stackKey [description]\r\n * @return [description]\r\n */\r\n Axis.prototype.getX = function (dataItem, key, location, stackKey, range) {\r\n return;\r\n };\r\n /**\r\n * [getX description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @param stackKey [description]\r\n * @return [description]\r\n */\r\n Axis.prototype.getPositionX = function (dataItem, key, location, stackKey, range) {\r\n return;\r\n };\r\n /**\r\n * [getY description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @param stackKey [description]\r\n * @return [description]\r\n */\r\n Axis.prototype.getY = function (dataItem, key, location, stackKey, range) {\r\n return;\r\n };\r\n /**\r\n * [getY description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @param stackKey [description]\r\n * @return [description]\r\n */\r\n Axis.prototype.getPositionY = function (dataItem, key, location, stackKey, range) {\r\n return;\r\n };\r\n Object.defineProperty(Axis.prototype, \"basePoint\", {\r\n /**\r\n * Coordinates of the actual axis start.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Base point coordinates\r\n */\r\n get: function () {\r\n return { x: 0, y: 0 };\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * [dataChangeUpdate description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n Axis.prototype.dataChangeUpdate = function () {\r\n };\r\n /**\r\n * [dataChangeUpdate description]\r\n *\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n Axis.prototype.seriesDataChangeUpdate = function (series) {\r\n };\r\n /**\r\n * Removes axis breaks that fall between `min` and `max` (???)\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param min Start value\r\n * @param max End value\r\n * @return Spread o\r\n */\r\n Axis.prototype.adjustDifference = function (min, max) {\r\n var difference = max - min;\r\n if ($type.isNumber(difference)) {\r\n if (this._axisBreaks) {\r\n $iter.eachContinue(this._axisBreaks.iterator(), function (axisBreak) {\r\n var startValue = axisBreak.adjustedStartValue;\r\n var endValue = axisBreak.adjustedEndValue;\r\n if ($type.isNumber(startValue) && $type.isNumber(endValue)) {\r\n // breaks are sorted, we don't need go further anymore\r\n if (startValue > max) {\r\n return false;\r\n }\r\n if (endValue >= min) {\r\n if ($type.isNumber(startValue) && $type.isNumber(endValue)) {\r\n var breakSize = axisBreak.breakSize;\r\n var intersection = $math.intersection({ start: startValue, end: endValue }, { start: min, end: max });\r\n if (intersection) {\r\n difference -= (intersection.end - intersection.start) * (1 - breakSize);\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n });\r\n }\r\n return difference;\r\n }\r\n };\r\n /**\r\n * Checks if specific value falls within a break.\r\n *\r\n * Returns [[AxisBreak]] the value falls into.\r\n *\r\n * @param value Value to check\r\n * @return Axis break\r\n */\r\n Axis.prototype.isInBreak = function (value) {\r\n if (this._axisBreaks) {\r\n return $iter.find(this._axisBreaks.iterator(), function (axisBreak) {\r\n return value >= axisBreak.adjustedStartValue &&\r\n value <= axisBreak.adjustedEndValue;\r\n });\r\n }\r\n };\r\n /**\r\n * [fixAxisBreaks description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n Axis.prototype.fixAxisBreaks = function () {\r\n var _this = this;\r\n if (this._axisBreaks) {\r\n var axisBreaks = this._axisBreaks;\r\n if (axisBreaks.length > 0) {\r\n // first make sure that startValue is <= end value\r\n // This needs to make a copy of axisBreaks because it mutates the list while traversing\r\n // TODO very inefficient\r\n $array.each($iter.toArray(axisBreaks.iterator()), function (axisBreak) {\r\n var startValue = $math.min(axisBreak.startValue, axisBreak.endValue);\r\n var endValue = $math.max(axisBreak.startValue, axisBreak.endValue);\r\n axisBreak.adjustedStartValue = startValue;\r\n axisBreak.adjustedEndValue = endValue;\r\n _this._axisBreaks.update(axisBreak);\r\n });\r\n var firstAxisBreak = axisBreaks.first;\r\n var previousEndValue_1 = Math.min(firstAxisBreak.startValue, firstAxisBreak.endValue);\r\n // process breaks\r\n // TODO does this need to call axisBreaks.update ?\r\n $iter.each(axisBreaks.iterator(), function (axisBreak) {\r\n var startValue = axisBreak.adjustedStartValue;\r\n var endValue = axisBreak.adjustedEndValue;\r\n // breaks can't overlap\r\n // if break starts before previous break ends\r\n if (startValue < previousEndValue_1) {\r\n startValue = previousEndValue_1;\r\n if (endValue < previousEndValue_1) {\r\n endValue = previousEndValue_1;\r\n }\r\n }\r\n axisBreak.adjustedStartValue = startValue;\r\n axisBreak.adjustedEndValue = endValue;\r\n });\r\n }\r\n }\r\n };\r\n Object.defineProperty(Axis.prototype, \"startIndex\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return [description]\r\n */\r\n get: function () {\r\n return 0;\r\n },\r\n /**\r\n * We need start/end indexes of axes to be 0 - `dataItems.length`.\r\n *\r\n * Yes, also for category axis, this helps to avoid jumping of categories\r\n * while scrolling and does not do a lot of extra work as we use\r\n * protected `_startIndex` and `_endIndex` when working with items.\r\n *\r\n * @hidden\r\n */\r\n /**\r\n * [startIndex description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Axis.prototype, \"endIndex\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this.dataItems.length;\r\n },\r\n /**\r\n * [endIndex description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a formatted label based on position.\r\n *\r\n * Individual axis types should override this method to generate a label\r\n * that is relevant to axis type.\r\n *\r\n * Please note that `position` represents position within axis which may be\r\n * zoomed and not correspond to Cursor's `position`.\r\n *\r\n * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.\r\n * @param position Relative position on axis (0-1)\r\n * @return Position label\r\n */\r\n Axis.prototype.getPositionLabel = function (position) {\r\n return Math.round(position * 100) + \"%x\";\r\n };\r\n Object.defineProperty(Axis.prototype, \"chart\", {\r\n /**\r\n * @return Chart\r\n */\r\n get: function () {\r\n return this._chart;\r\n },\r\n /**\r\n * A Chart this Axis belongs to.\r\n *\r\n * @param value Chart\r\n */\r\n set: function (value) {\r\n this._chart = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a data item for a Series range.\r\n *\r\n * @param series Target Series\r\n * @return Range data item\r\n */\r\n Axis.prototype.createSeriesRange = function (series) {\r\n var range = this.axisRanges.create();\r\n range.component = this;\r\n range.axisFill = this.renderer.axisFills.template.clone();\r\n range.axisFill.disabled = false;\r\n range.axisFill.fillOpacity = 0;\r\n range.grid = this.renderer.grid.template.clone();\r\n range.grid.disabled = true;\r\n range.tick = this.renderer.ticks.template.clone();\r\n range.tick.disabled = true;\r\n range.label = this.renderer.labels.template.clone();\r\n range.label.disabled = true;\r\n range.addDisposer(new Disposer(function () {\r\n series.axisRanges.removeValue(range);\r\n }));\r\n series.axisRanges.push(range);\r\n return range;\r\n };\r\n /**\r\n * Copies all properties and related data from a different instance of Axis.\r\n *\r\n * @param source Source Axis\r\n */\r\n Axis.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.renderer) {\r\n this.renderer.copyFrom(source.renderer);\r\n }\r\n else {\r\n if (source.renderer) {\r\n this.renderer = source.renderer.clone();\r\n this._disposers.push(this.renderer);\r\n }\r\n }\r\n if (source.title) {\r\n if (!this.title) {\r\n this.title = source.title.clone();\r\n this.title.parent = this;\r\n }\r\n else {\r\n this.title.copyFrom(source.title);\r\n }\r\n this._disposers.push(this.title);\r\n }\r\n };\r\n /**\r\n * Resets internal iterator.\r\n */\r\n Axis.prototype.resetIterators = function () {\r\n this._dataItemsIterator.reset();\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n Axis.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Set up axis ranges\r\n if ($type.hasValue(config.axisRanges) && $type.isArray(config.axisRanges)) {\r\n for (var i = 0, len = config.axisRanges.length; i < len; i++) {\r\n var range = config.axisRanges[i];\r\n // If `series` is set, we know it's a series range\r\n if ($type.hasValue(range[\"series\"])) {\r\n if ($type.isString(range[\"series\"])) {\r\n if (this.map.hasKey(range[\"series\"])) {\r\n //range[\"series\"] = this.map.getKey(range[\"series\"]);\r\n config.axisRanges[i] = this.createSeriesRange(this.map.getKey(range[\"series\"]));\r\n delete (range[\"series\"]);\r\n config.axisRanges[i].config = range;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n Object.defineProperty(Axis.prototype, \"startLocation\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startLocation\");\r\n },\r\n /**\r\n * Axis start location. Works on Date/Category axis, doesn't work on Value axis.\r\n *\r\n * * 0 - Full first cell is shown.\r\n * * 0.5 - Half of first cell is shown.\r\n * * 1 - None of the first cell is visible. (you probably don't want that)\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startLocation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Axis.prototype, \"endLocation\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endLocation\");\r\n },\r\n /**\r\n * Axis end location. Works on Date/Category axis, doesn't work on Value axis.\r\n *\r\n * * 0 - None of the last cell is shown. (don't do that)\r\n * * 0.5 - Half of the last cell is shown.\r\n * * 1 - Full last cell is shown.\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endLocation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Axis.prototype.setDisabled = function (value) {\r\n var changed = _super.prototype.setDisabled.call(this, value);\r\n if (this.renderer) {\r\n this.renderer.gridContainer.disabled = value;\r\n }\r\n return changed;\r\n };\r\n Object.defineProperty(Axis.prototype, \"title\", {\r\n /**\r\n * @return Title label\r\n */\r\n get: function () {\r\n return this._title;\r\n },\r\n /**\r\n * A reference to a [[Label]] element which serves as a title to the axis.\r\n *\r\n * When axis is created it aleready has an element, so you can just modify\r\n * it.\r\n *\r\n * Or you can replace it with your own instance of `Label`.\r\n *\r\n * @param value Title label\r\n */\r\n set: function (value) {\r\n if (this._title && this._title != value) {\r\n this._title.dispose();\r\n }\r\n if (value) {\r\n this._title = value;\r\n value.parent = this;\r\n value.shouldClone = false;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Axis.prototype, \"hideTooltipWhileZooming\", {\r\n /**\r\n * @return Hide tooltip while zooming?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"hideTooltipWhileZooming\");\r\n },\r\n /**\r\n * Indicates if axis' tooltip should be hidden while axis range is animating\r\n * (zooming)\r\n *\r\n * @default true\r\n * @since 4.7.16\r\n * @param value Hide tooltip while zooming?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"hideTooltipWhileZooming\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Axis.prototype, \"zoomable\", {\r\n /**\r\n * @return Zoomable?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"zoomable\");\r\n },\r\n /**\r\n * @todo mm\r\n */\r\n /**\r\n * Should the axis be zoomed with scrollbar/cursor?\r\n *\r\n * @default true\r\n * @since 4.9.28\r\n * @param value Zoomable?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"zoomable\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Axis;\r\n}(Component));\r\nexport { Axis };\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[\"Axis\"] = Axis;\r\nregistry.registeredClasses[\"AxisDataItem\"] = AxisDataItem;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Disable axis tooltips.\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.maybeXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Axis && target.tooltip) {\r\n var state = target.states.create(stateId);\r\n state.properties.cursorTooltipEnabled = false;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=Axis.js.map","/**\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { color } from \"../../core/utils/Color\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to draw Axis line.\r\n *\r\n * @see {@link IAxisLineEvents} for a list of available events\r\n * @see {@link IAxisLineAdapters} for a list of available Adapters\r\n */\r\nvar AxisLine = /** @class */ (function (_super) {\r\n __extends(AxisLine, _super);\r\n /**\r\n * Constructor\r\n */\r\n function AxisLine() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"AxisLine\";\r\n _this.element = _this.paper.add(\"path\");\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.stroke = interfaceColors.getFor(\"grid\");\r\n _this.strokeOpacity = 0.15;\r\n _this.pixelPerfect = true;\r\n _this.fill = color();\r\n _this.applyTheme();\r\n _this.interactionsEnabled = false;\r\n return _this;\r\n //this.element.moveTo({ x: 0, y: 0 });\r\n }\r\n return AxisLine;\r\n}(Sprite));\r\nexport { AxisLine };\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[\"AxisLine\"] = AxisLine;\r\n//# sourceMappingURL=AxisLine.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * AxisFill is a base class used to defines fill shapes for various\r\n * type-specific Axes.\r\n *\r\n * Axis fills are used to add fills to specific ranges of those axes.\r\n *\r\n * @see {@link IAxisFillEvents} for a list of available events\r\n * @see {@link IAxisFillAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar AxisFill = /** @class */ (function (_super) {\r\n __extends(AxisFill, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Axis\r\n */\r\n function AxisFill(axis) {\r\n var _this = _super.call(this) || this;\r\n _this.axis = axis;\r\n _this.element = _this.paper.add(\"path\");\r\n _this.className = \"AxisFill\";\r\n _this.isMeasured = false;\r\n _this.location = 0;\r\n _this.above = false;\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.fill = interfaceColors.getFor(\"alternativeBackground\");\r\n _this.fillOpacity = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n AxisFill.prototype.setDisabled = function (value) {\r\n var changed = _super.prototype.setDisabled.call(this, value);\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n }\r\n return changed;\r\n };\r\n /**\r\n * Draws the fill element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisFill.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n if (this.__disabled || this.disabled) {\r\n return;\r\n }\r\n if (this.axis && $type.isNumber(this.startPosition) && $type.isNumber(this.endPosition)) {\r\n this.fillPath = this.axis.getPositionRangePath(this.startPosition, this.endPosition);\r\n this.path = this.fillPath;\r\n if (this.isMeasured) {\r\n this.measure();\r\n }\r\n }\r\n };\r\n Object.defineProperty(AxisFill.prototype, \"startPosition\", {\r\n /**\r\n * @return Start position\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startPosition\");\r\n },\r\n /**\r\n * An actual starting position of the fill.\r\n *\r\n * @param value Starting position\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startPosition\", value);\r\n this.invalidate(); // this is needed as relative position might not change when zooming\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisFill.prototype, \"endPosition\", {\r\n /**\r\n * @return End position\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endPosition\");\r\n },\r\n /**\r\n * An actual end position of the fill.\r\n *\r\n * @param value End position\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endPosition\", value);\r\n this.invalidate(); // this is needed as relative position might not change when zooming\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisFill.prototype, \"location\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"location\");\r\n },\r\n /**\r\n * Relative location of the fill. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"location\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n AxisFill.prototype.setPath = function (value) {\r\n if (this.setPropertyValue(\"path\", value)) {\r\n this.element.attr({ \"d\": value });\r\n return true;\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(AxisFill.prototype, \"above\", {\r\n /**\r\n * @return Draw above series?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"above\");\r\n },\r\n /**\r\n * Normally fill goes below series. Set this to `true` to go above.\r\n *\r\n * @default false\r\n * @since 4.5.9\r\n * @param value Draw above series?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"above\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return AxisFill;\r\n}(Sprite));\r\nexport { AxisFill };\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[\"AxisFill\"] = AxisFill;\r\n//# sourceMappingURL=AxisFill.js.map","/**\r\n * A module defining functionality for axis grid elements.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { color } from \"../../core/utils/Color\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Displays an axis grid line.\r\n *\r\n * @see {@link IGridEvents} for a list of available events\r\n * @see {@link IGridAdapters} for a list of available Adapters\r\n * @todo Review: container is better, as we'll be able to attach something to the grid, also with 3d charts we might need some additional elements\r\n * @important\r\n */\r\nvar Grid = /** @class */ (function (_super) {\r\n __extends(Grid, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Grid() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Grid\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.location = 0.5;\r\n _this.isMeasured = false;\r\n _this.above = false;\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.stroke = interfaceColors.getFor(\"grid\");\r\n _this.pixelPerfect = true;\r\n _this.strokeOpacity = 0.15;\r\n _this.fill = color(); // \"none\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(Grid.prototype, \"location\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"location\");\r\n },\r\n /**\r\n * Location within axis cell to place grid line on.\r\n *\r\n * * 0 - start\r\n * * 0.5 - middle\r\n * * 1 - end\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"location\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Grid.prototype, \"above\", {\r\n /**\r\n * @return Draw above series?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"above\");\r\n },\r\n /**\r\n * Normally fill goes below series. Set this to `true` to go above.\r\n *\r\n * @default false\r\n * @since 4.5.9\r\n * @param value Draw above series?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"above\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n Grid.prototype.setDisabled = function (value) {\r\n var changed = _super.prototype.setDisabled.call(this, value);\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n }\r\n return changed;\r\n };\r\n return Grid;\r\n}(Sprite));\r\nexport { Grid };\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[\"Grid\"] = Grid;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Disable grid on smaller charts\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.maybeXS,\r\n state: function (target, stateId) {\r\n if (target instanceof Grid) {\r\n var state = target.states.create(stateId);\r\n state.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=Grid.js.map","/**\r\n * Axis Label module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Label } from \"../../core/elements/Label\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Use to create labels on Axis.\r\n *\r\n * @see {@link IAxisLabelEvents} for a list of available events\r\n * @see {@link IAxisLabelAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar AxisLabel = /** @class */ (function (_super) {\r\n __extends(AxisLabel, _super);\r\n /**\r\n * Constructor\r\n */\r\n function AxisLabel() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"AxisLabel\";\r\n _this.isMeasured = false;\r\n _this.padding(10, 10, 10, 10);\r\n _this.location = 0.5;\r\n //this.nonScaling = true; // not good for perf\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(AxisLabel.prototype, \"location\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"location\");\r\n },\r\n /**\r\n * Relative location of the label. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"location\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisLabel.prototype, \"inside\", {\r\n /**\r\n * Returns if label is set to be drawn inside axis.\r\n *\r\n * @return Inside?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"inside\");\r\n },\r\n /**\r\n * Sets if label should be drawn inside axis.\r\n *\r\n * @param value Inside?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"inside\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n AxisLabel.prototype.setDisabled = function (value) {\r\n var changed = _super.prototype.setDisabled.call(this, value);\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n }\r\n return changed;\r\n };\r\n return AxisLabel;\r\n}(Label));\r\nexport { AxisLabel };\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[\"AxisLabel\"] = AxisLabel;\r\n//# sourceMappingURL=AxisLabel.js.map","/**\r\n * Tick module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A basic Tick class.\r\n *\r\n * A tick is a short dash, mainly connecting an object like axis or slice to\r\n * it's textual label.\r\n *\r\n * @see {@link ITickEvents} for a list of available events\r\n * @see {@link ITickAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar Tick = /** @class */ (function (_super) {\r\n __extends(Tick, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Tick() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Tick\";\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.fillOpacity = 0;\r\n _this.length = 6;\r\n _this.strokeOpacity = 0.2;\r\n _this.stroke = interfaceColors.getFor(\"grid\");\r\n _this.isMeasured = false;\r\n _this.nonScalingStroke = true;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(Tick.prototype, \"length\", {\r\n /**\r\n * @return Length (px)\r\n */\r\n get: function () {\r\n if (this.disabled) {\r\n return 0;\r\n }\r\n return this.getPropertyValue(\"length\");\r\n },\r\n /**\r\n * Length of the tick in pixels.\r\n *\r\n * @param value Length (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"length\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Tick;\r\n}(Sprite));\r\nexport { Tick };\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[\"Tick\"] = Tick;\r\n//# sourceMappingURL=Tick.js.map","/**\r\n * Axis Tick module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Tick } from \"../elements/Tick\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws an axis tick\r\n * @see {@link IAxisTickEvents} for a list of available events\r\n * @see {@link IAxisTickAdapters} for a list of available Adapters\r\n */\r\nvar AxisTick = /** @class */ (function (_super) {\r\n __extends(AxisTick, _super);\r\n function AxisTick() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"AxisTick\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.location = 0.5;\r\n _this.above = false;\r\n _this.isMeasured = false;\r\n _this.pixelPerfect = true;\r\n _this.strokeOpacity = 0;\r\n _this.length = 5;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(AxisTick.prototype, \"location\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"location\");\r\n },\r\n /**\r\n * Relative location of the tick. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"location\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisTick.prototype, \"inside\", {\r\n /**\r\n * Returns if label is set to be drawn inside axis.\r\n *\r\n * @return Inside?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"inside\");\r\n },\r\n /**\r\n * Sets if tick should be drawn inside axis.\r\n *\r\n * @param value Inside?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"inside\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisTick.prototype, \"above\", {\r\n /**\r\n * @return Draw above series?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"above\");\r\n },\r\n /**\r\n * Normally tick goes below series. Set this to `true` to go above.\r\n *\r\n * @default false\r\n * @since 4.5.9\r\n * @param value Draw above series?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"above\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n AxisTick.prototype.setDisabled = function (value) {\r\n var changed = _super.prototype.setDisabled.call(this, value);\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n }\r\n return changed;\r\n };\r\n return AxisTick;\r\n}(Tick));\r\nexport { AxisTick };\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[\"AxisTick\"] = AxisTick;\r\n//# sourceMappingURL=AxisTick.js.map","/**\r\n * Module, defining base Axis Renderer.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\r\nimport { AxisDataItem } from \"./Axis\";\r\nimport { AxisLine } from \"./AxisLine\";\r\nimport { AxisFill } from \"./AxisFill\";\r\nimport { Grid } from \"./Grid\";\r\nimport { AxisLabel } from \"./AxisLabel\";\r\nimport { AxisTick } from \"./AxisTick\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A base class for all axis renderers.\r\n *\r\n * @see {@link IAxisRendererEvents} for a list of available events\r\n * @see {@link IAxisRendererAdapters} for a list of available Adapters\r\n */\r\nvar AxisRenderer = /** @class */ (function (_super) {\r\n __extends(AxisRenderer, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\r\n function AxisRenderer() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * A related chart.\r\n */\r\n _this._chart = new MutableValueDisposer();\r\n _this.className = \"AxisRenderer\";\r\n // Set defaults\r\n _this.minGridDistance = 50;\r\n _this.inside = false;\r\n _this.inversed = false;\r\n _this.tooltipLocation = 0.5;\r\n _this.fullWidthTooltip = false;\r\n _this.cellStartLocation = 0;\r\n _this.cellEndLocation = 1;\r\n _this.minLabelPosition = 0;\r\n _this.maxLabelPosition = 1;\r\n _this.shouldClone = false;\r\n var gridContainer = _this.createChild(Container);\r\n gridContainer.shouldClone = false;\r\n gridContainer.layout = \"none\";\r\n //\tgridContainer.isMeasured = false;\r\n gridContainer.virtualParent = _this;\r\n gridContainer.width = percent(100);\r\n gridContainer.height = percent(100);\r\n _this.gridContainer = gridContainer;\r\n // not good without this\r\n gridContainer.events.on(\"maxsizechanged\", function () {\r\n if (_this.inited) {\r\n _this.invalidateAxisItems();\r\n }\r\n }, _this, false);\r\n var breakContainer = _this.createChild(Container);\r\n breakContainer.shouldClone = false;\r\n breakContainer.isMeasured = false;\r\n breakContainer.layout = \"none\";\r\n breakContainer.width = percent(100);\r\n breakContainer.height = percent(100);\r\n _this.breakContainer = breakContainer;\r\n var bulletsContainer = _this.createChild(Container);\r\n bulletsContainer.shouldClone = false;\r\n bulletsContainer.isMeasured = false;\r\n bulletsContainer.layout = \"none\";\r\n bulletsContainer.width = percent(100);\r\n bulletsContainer.height = percent(100);\r\n _this.bulletsContainer = bulletsContainer;\r\n _this.line = _this.createChild(AxisLine);\r\n _this.line.shouldClone = false;\r\n _this.line.strokeOpacity = 0;\r\n var baseGrid = _this.createChild(Grid);\r\n baseGrid.shouldClone = false;\r\n _this.baseGrid = baseGrid;\r\n // Make elements disposable\r\n var disposers = _this._disposers;\r\n disposers.push(baseGrid);\r\n disposers.push(_this.line);\r\n disposers.push(gridContainer);\r\n disposers.push(breakContainer);\r\n disposers.push(bulletsContainer);\r\n disposers.push(_this._chart);\r\n _this.ticks.template.disabled = true;\r\n _this.axisFills.template.disabled = true;\r\n _this.axisFills.template.interactionsEnabled = false;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(AxisRenderer.prototype, \"axis\", {\r\n /**\r\n * Axis of a renderer\r\n * @return axis Axis\r\n */\r\n get: function () {\r\n return this._axis;\r\n },\r\n /**\r\n * Axis of a renderer\r\n * @param axis Axis\r\n */\r\n set: function (axis) {\r\n this.setAxis(axis);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n AxisRenderer.prototype.setAxis = function (axis) {\r\n this._axis = axis;\r\n this.baseGrid.parent = axis;\r\n this.line.parent = axis;\r\n this.gridContainer.bind(\"opacity\", axis);\r\n };\r\n /**\r\n * Called when rendered is attached to an Axis, as well as a property of\r\n * Axis that might affect the appearance is updated.\r\n *\r\n * E.g. `axis.opposite`, `axis.inside`, etc.\r\n *\r\n * This method is called **before** draw, so that any related setting\r\n * changed in this method can be changed.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\r\n AxisRenderer.prototype.processRenderer = function () {\r\n this.events.on(\"sizechanged\", this.updateTooltip, this, false);\r\n this.events.on(\"positionchanged\", this.updateTooltip, this, false);\r\n this.labels.template.inside = this.inside;\r\n this.ticks.template.inside = this.inside;\r\n };\r\n /**\r\n * Updates Axis' tooltip.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\r\n AxisRenderer.prototype.updateTooltip = function () {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n Object.defineProperty(AxisRenderer.prototype, \"axisLength\", {\r\n /**\r\n * Returns actual length of the Axis, in pixels.\r\n *\r\n * @return Length (px)\r\n */\r\n get: function () {\r\n // This is a placeholder method for extending classes to override.\r\n return 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Re-positions an element to new coordinates.\r\n *\r\n * @ignore Exclude from docs\r\n * @param item A target element\r\n * @param point New coordinates\r\n */\r\n AxisRenderer.prototype.positionItem = function (item, point) {\r\n if (item) {\r\n item.moveTo(point);\r\n }\r\n };\r\n /**\r\n * Converts relative position on axis to point coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Point\r\n */\r\n AxisRenderer.prototype.positionToPoint = function (position, position2) {\r\n // This is a placeholder method for extending classes to override.\r\n return { x: 0, y: 0 };\r\n };\r\n /**\r\n * Converts relative position on axis to angle.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review / units)\r\n * @param position Position (0-1)\r\n * @return Angle\r\n */\r\n AxisRenderer.prototype.positionToAngle = function (position) {\r\n // This is a placeholder method for extending classes to override.\r\n return 0;\r\n };\r\n /**\r\n * Converts relative position (0-1) on axis to a pixel coordinate.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinate (px)\r\n */\r\n AxisRenderer.prototype.positionToCoordinate = function (position) {\r\n var coordinate;\r\n var axis = this.axis;\r\n var axisFullLength = axis.axisFullLength;\r\n if (axis.renderer.inversed) {\r\n coordinate = (axis.end - position) * axisFullLength;\r\n }\r\n else {\r\n coordinate = (position - axis.start) * axisFullLength;\r\n }\r\n return coordinate;\r\n };\r\n AxisRenderer.prototype.updateGridContainer = function () {\r\n };\r\n AxisRenderer.prototype.getHeight = function () {\r\n var gridContainer = this.gridContainer;\r\n if (gridContainer.parent) {\r\n return gridContainer.parent.pixelHeight;\r\n }\r\n return this.gridContainer.pixelHeight || 0;\r\n };\r\n AxisRenderer.prototype.getWidth = function () {\r\n var gridContainer = this.gridContainer;\r\n if (gridContainer.parent) {\r\n return gridContainer.parent.pixelWidth;\r\n }\r\n return this.gridContainer.pixelWidth || 0;\r\n };\r\n /**\r\n * Converts a coordinate in pixels to a relative position. (0-1)\r\n *\r\n * @param coordinate Coordinate (px)\r\n * @param coordinate2 Coordinate of a second axis, only needed for complex axes systems, like timeline (px)\r\n * @return Position (0-1)\r\n */\r\n AxisRenderer.prototype.coordinateToPosition = function (coordinate, coordinate2) {\r\n var position;\r\n var axis = this.axis;\r\n var axisFullLength = axis.axisFullLength;\r\n if (axis.renderer.inversed) {\r\n position = axis.end - coordinate / axisFullLength;\r\n }\r\n else {\r\n position = coordinate / axisFullLength + axis.start;\r\n }\r\n return $math.round(position, 5);\r\n };\r\n /**\r\n * Converts a point at specific coordinates to a relative position (0-1)\r\n * on the axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point Point\r\n * @return Position (0-1)\r\n */\r\n AxisRenderer.prototype.pointToPosition = function (point) {\r\n // This is a placeholder method for extending classes to override.\r\n return 0;\r\n };\r\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition Starting position\r\n * @param endPosition End position\r\n * @return SVG path\r\n */\r\n AxisRenderer.prototype.getPositionRangePath = function (startPosition, endPosition) {\r\n return \"\";\r\n };\r\n /**\r\n * Invalidates all axis data items, effectively causing them re-evaluated.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n */\r\n AxisRenderer.prototype.invalidateAxisItems = function () {\r\n var axis = this.axis;\r\n if (axis) {\r\n axis.invalidateDataItems();\r\n }\r\n };\r\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRenderer.prototype.updateGridElement = function (grid, position, endPosition) {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n /**\r\n * Updates and positions a tick element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param tick Tick element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRenderer.prototype.updateTickElement = function (tick, position, endPosition) {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n /**\r\n * Updates and positions axis bullet.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet AxisBullet element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRenderer.prototype.updateBullet = function (bullet, position, endPosition) {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n /**\r\n * Updates and positions a label element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param label Label element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\r\n AxisRenderer.prototype.updateLabelElement = function (label, position, endPosition, location) {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n /**\r\n * Updates and positions the axis fill element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param fill Fill element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\r\n AxisRenderer.prototype.updateFillElement = function (fill, position, endPosition) {\r\n fill.startPosition = position;\r\n fill.endPosition = endPosition;\r\n };\r\n /**\r\n * Updates and positions the axis line element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRenderer.prototype.updateAxisLine = function () {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRenderer.prototype.updateBaseGridElement = function () {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n /**\r\n * Updates and positions an axis break element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Break element\r\n */\r\n AxisRenderer.prototype.updateBreakElement = function (axisBreak) {\r\n this.positionItem(axisBreak.startLine, axisBreak.startPoint);\r\n this.toggleVisibility(axisBreak.startLine, axisBreak.startPosition, 0, 1);\r\n this.positionItem(axisBreak.endLine, axisBreak.endPoint);\r\n this.toggleVisibility(axisBreak.endLine, axisBreak.endPosition, 0, 1);\r\n };\r\n Object.defineProperty(AxisRenderer.prototype, \"minGridDistance\", {\r\n /**\r\n * @return Min distance (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"minGridDistance\");\r\n },\r\n /**\r\n * Minimum distance in pixels between grid elements.\r\n *\r\n * Use it to control density of the grid/labels on the axis.element.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/#Setting_the_density_of_the_the_grid_labels} for more info\r\n * @param value Min distance (px)\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"minGridDistance\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"chart\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Chart\r\n */\r\n get: function () {\r\n return this._chart.get();\r\n },\r\n /**\r\n * A chart, associated with the Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Chart\r\n */\r\n set: function (value) {\r\n this._chart.set(value, null);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Toggles visibility of an element, based on its current position and\r\n * min/max position settings.\r\n *\r\n * E.g. labels based on `minLabelPosition` and `maxLabelPosition`.\r\n *\r\n * @ignore Exclude from docs\r\n * @param sprite An element to toggle\r\n * @param position Elements current position\r\n * @param minPosition Min position setting\r\n * @param maxPosition Max position setting\r\n */\r\n AxisRenderer.prototype.toggleVisibility = function (sprite, position, minPosition, maxPosition) {\r\n var axis = this.axis;\r\n var dataItem = sprite.dataItem;\r\n if (dataItem && dataItem instanceof AxisDataItem) {\r\n if ($type.isNumber(dataItem.minPosition)) {\r\n minPosition = dataItem.minPosition;\r\n }\r\n if ($type.isNumber(dataItem.maxPosition)) {\r\n maxPosition = dataItem.maxPosition;\r\n }\r\n }\r\n var updatedStart = axis.start + (axis.end - axis.start) * (minPosition - 0.0001);\r\n var updatedEnd = axis.start + (axis.end - axis.start) * (maxPosition + 0.0001);\r\n if (!sprite.disabled) {\r\n if (position < updatedStart || position > updatedEnd) {\r\n sprite.__disabled = true;\r\n }\r\n else {\r\n sprite.__disabled = false;\r\n }\r\n }\r\n };\r\n /**\r\n * Creates visual elements for and axis break.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Axis break\r\n */\r\n AxisRenderer.prototype.createBreakSprites = function (axisBreak) {\r\n // This is a placeholder method for extending classes to override.\r\n };\r\n Object.defineProperty(AxisRenderer.prototype, \"axisFills\", {\r\n /**\r\n * A list of Axis' Fill elements.\r\n *\r\n * Those are fill elements that cover the space between every second set\r\n * of grid lines, and can be configured to create striped charts.\r\n *\r\n * Please note that these are disabled by default. To enable them, set\r\n * template to true.\r\n *\r\n * ```TypeScript\r\n * categoryAxis.renderer.axisFills.template.disabled = false;\r\n * ```\r\n * ```JavaScript\r\n * categoryAxis.renderer.axisFills.template.disabled = false;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * // ...\r\n * \"renderer\": {\r\n * \"axisFills\": {\r\n * \"disabled\": false\r\n * }\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/alternated-axis-fills/} this tutorial for more info.\r\n * @return Fill elements\r\n */\r\n get: function () {\r\n if (!this._axisFills) {\r\n var fill = this.createFill(this.axis);\r\n this._axisFills = new ListTemplate(fill);\r\n fill.applyOnClones = true;\r\n fill.events.on(\"enabled\", this.invalidateAxisItems, this, false);\r\n this._disposers.push(new ListDisposer(this._axisFills));\r\n this._disposers.push(this._axisFills.template);\r\n }\r\n return this._axisFills;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new fill element, suitable for this Axis Renderer type.\r\n *\r\n * @return Fill element\r\n */\r\n AxisRenderer.prototype.createFill = function (axis) {\r\n return new AxisFill(axis);\r\n };\r\n Object.defineProperty(AxisRenderer.prototype, \"grid\", {\r\n /**\r\n * A list of Axis' Grid elements.\r\n *\r\n * @return Grid elements\r\n */\r\n get: function () {\r\n if (!this._grid) {\r\n var grid = this.createGrid();\r\n this._grid = new ListTemplate(grid);\r\n grid.applyOnClones = true;\r\n grid.events.on(\"enabled\", this.invalidateAxisItems, this, false);\r\n this._disposers.push(new ListDisposer(this._grid));\r\n this._disposers.push(this._grid.template);\r\n }\r\n return this._grid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new grid element, suitable for this Axis Renderer type.\r\n *\r\n * @return Grid element\r\n */\r\n AxisRenderer.prototype.createGrid = function () {\r\n return new Grid();\r\n };\r\n Object.defineProperty(AxisRenderer.prototype, \"ticks\", {\r\n /**\r\n * A list of Axis' Tick elements.\r\n *\r\n * Please note that these are disabled by default. To enable them, set\r\n * template to true.\r\n *\r\n * ```TypeScript\r\n * categoryAxis.renderer.ticks.template.disabled = false;\r\n * ```\r\n * ```JavaScript\r\n * categoryAxis.renderer.ticks.template.disabled = false;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * // ...\r\n * \"renderer\": {\r\n * \"ticks\": {\r\n * \"disabled\": false\r\n * }\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @return Tick elements\r\n */\r\n get: function () {\r\n if (!this._ticks) {\r\n var tick = this.createTick();\r\n tick.applyOnClones = true;\r\n tick.isMeasured = false;\r\n tick.events.on(\"enabled\", this.invalidateAxisItems, this, false);\r\n this._ticks = new ListTemplate(tick);\r\n this._disposers.push(new ListDisposer(this._ticks));\r\n this._disposers.push(this._ticks.template);\r\n }\r\n return this._ticks;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new tick element, suitable for this Axis Renderer type.\r\n *\r\n * @return Tick element\r\n */\r\n AxisRenderer.prototype.createTick = function () {\r\n return new AxisTick();\r\n };\r\n Object.defineProperty(AxisRenderer.prototype, \"labels\", {\r\n /**\r\n * A list of Axis' Label elements.\r\n *\r\n * @return Label elements\r\n */\r\n get: function () {\r\n if (!this._labels) {\r\n var label = this.createLabel();\r\n this._labels = new ListTemplate(label);\r\n label.applyOnClones = true;\r\n label.events.on(\"enabled\", this.invalidateAxisItems, this, false);\r\n this._disposers.push(new ListDisposer(this._labels));\r\n this._disposers.push(this._labels.template);\r\n }\r\n return this._labels;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new label element, suitable for this Axis Renderer type.\r\n *\r\n * @return Label element\r\n */\r\n AxisRenderer.prototype.createLabel = function () {\r\n return new AxisLabel();\r\n };\r\n Object.defineProperty(AxisRenderer.prototype, \"inside\", {\r\n /**\r\n * @return Labels inside?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"inside\");\r\n },\r\n /**\r\n * Indicates whether Axis' labels and ticks should be drawn inside Plot area.\r\n *\r\n * Does not work with all renderers, like AxisRendererRadial.\r\n *\r\n * @param value Labels inside?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"inside\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidate();\r\n }\r\n }\r\n if (value) {\r\n this.width = 0;\r\n this.height = 0;\r\n }\r\n else {\r\n this.width = undefined;\r\n this.height = undefined;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"opposite\", {\r\n /**\r\n * @return Draw axis on opposite side?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"opposite\");\r\n },\r\n /**\r\n * Indicates whether Axis should be drawn on the opposite side of the plot\r\n * area than it would normally be drawn based on chart's settings.\r\n *\r\n * Does not work with all renderers, like [[AxisRendererRadial]] and\r\n * [[AxisRenderer Circular].\r\n *\r\n * @param value Draw axis on opposite side?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"opposite\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"fullWidthTooltip\", {\r\n /**\r\n * @return Full width tooltip?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"fullWidthTooltip\");\r\n },\r\n /**\r\n * Indicates if Axis tooltip should take the whole width of the axis cell.\r\n * (between two grid lines)\r\n *\r\n * NOTE: this setting is ignored on circular axis types.\r\n *\r\n * @param value Full width tooltip?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"fullWidthTooltip\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"tooltipLocation\", {\r\n /**\r\n * @return Tooltip location\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tooltipLocation\");\r\n },\r\n /**\r\n * Location within axis cell to show tooltip on. (0-1)\r\n *\r\n * 0 - show at the start\r\n * 0.5 - show right in the middle\r\n * 1 - show at the end\r\n *\r\n * @param value Tooltip location\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tooltipLocation\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"tooltipLocation2\", {\r\n /**\r\n * @return Tooltip location\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tooltipLocation2\");\r\n },\r\n /**\r\n * Location within secondary axis cell to show tooltip on. (0-1)\r\n *\r\n * 0 - show at the start\r\n * 0.5 - show right in the middle\r\n * 1 - show at the end\r\n *\r\n * @param value Tooltip location\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tooltipLocation2\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"cellStartLocation\", {\r\n /**\r\n * @return Cell start (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cellStartLocation\");\r\n },\r\n /**\r\n * Location for the cell start.\r\n *\r\n * Normally a \"cell\" is the whole available width in a category.\r\n *\r\n * If there are several clustered column-like series available, the whole\r\n * space is divided between each clustered column, or column stacks.\r\n *\r\n * `cellStartLocation` identifies where, within available space, the actual\r\n * cell starts.\r\n *\r\n * This, together with column series' `width` will affect actual width of\r\n * columns, and thus gaps between them.\r\n *\r\n * This will affect category-like axes only, like [[DateAxis]], or\r\n * [[CategoryAxis]].\r\n *\r\n * This is used to limit a space occupied by series like column.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/} for more info.\r\n * @param value Cell start (0-1)\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"cellStartLocation\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"cellEndLocation\", {\r\n /**\r\n * @return Cell end (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cellEndLocation\");\r\n },\r\n /**\r\n * Location for the cell end.\r\n *\r\n * Normally a \"cell\" is the whole available width in a category.\r\n *\r\n * If there are several clustered column-like series available, the whole\r\n * space is divided between each clustered column, or column stacks.\r\n *\r\n * `cellEndLocation` identifies where, within available space, the actual\r\n * cell ends.\r\n *\r\n * This, together with column series' `width` will affect actual width of\r\n * columns, and thus gaps between them.\r\n *\r\n * This will affect category-like axes only, like [[DateAxis]], or\r\n * [[CategoryAxis]].\r\n *\r\n * This is used to limit a space occupied by series like column.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/} for more info.\r\n * @param value Cell end (0-1)\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"cellEndLocation\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"inversed\", {\r\n /**\r\n * @return Flip axis?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"inversed\");\r\n },\r\n /**\r\n * Indicates if the scale of the axis should be flipped.\r\n *\r\n * @param value Flip axis?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"inversed\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"minLabelPosition\", {\r\n /**\r\n * @return Min label position (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"minLabelPosition\");\r\n },\r\n /**\r\n * Minimum position along the Axis, for labels.\r\n *\r\n * Labels, which have their position closer to the start of the Axis, will be\r\n * automatically hidden.\r\n *\r\n * E.g., setting this to 0.05 (5% of total axis length) would hide labels,\r\n * that would otherwise be drawn very near start of the Axis.\r\n *\r\n * This is especially usefull with `inside = true`, or if the chart hasn't\r\n * got any extra margins.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/} for more info.\r\n * @param value Min label position (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"minLabelPosition\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRenderer.prototype, \"maxLabelPosition\", {\r\n /**\r\n * @return Max label position (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maxLabelPosition\");\r\n },\r\n /**\r\n * Maximum position along the Axis, for labels.\r\n *\r\n * Labels, which have their position closer to the and of the Axis, will be\r\n * automatically hidden.\r\n *\r\n * E.g., setting this to 0.95 (95% of total axis length) would hide labels,\r\n * that would otherwise be drawn very near end of the Axis.\r\n *\r\n * This is especially usefull with `inside = true`, or if the chart hasn't\r\n * got any extra margins.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/} for more info.\r\n * @param value Max label position (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"maxLabelPosition\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all settings and related items from another object of the same\r\n * type.\r\n *\r\n * @param source Source object\r\n */\r\n AxisRenderer.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.grid.template.copyFrom(source.grid.template);\r\n this.ticks.template.copyFrom(source.ticks.template);\r\n this.labels.template.copyFrom(source.labels.template);\r\n this.axisFills.template.copyFrom(source.axisFills.template);\r\n this.line.copyFrom(source.line);\r\n this.baseGrid.copyFrom(source.baseGrid);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n AxisRenderer.prototype.toAxisPosition = function (value) {\r\n return value;\r\n };\r\n /**\r\n * Sets `visibility` property:\r\n *\r\n * * `true` - visible\r\n * * `false` - hidden\r\n *\r\n * @param value true - visible, false - hidden\r\n * @return Current visibility\r\n */\r\n AxisRenderer.prototype.setVisibility = function (value) {\r\n _super.prototype.setVisibility.call(this, value);\r\n this.bulletsContainer.visible = value;\r\n };\r\n return AxisRenderer;\r\n}(Container));\r\nexport { AxisRenderer };\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[\"AxisRenderer\"] = AxisRenderer;\r\n//# sourceMappingURL=AxisRenderer.js.map","/**\r\n * Axis Bullet module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to draw a positioned bullet (element) on an Axis.\r\n *\r\n * ```TypeScript\r\n * let range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n *\r\n * let flag = new am4plugins_bullets.FlagBullet();\r\n * flag.label.text = \"Hello\";\r\n *\r\n * range.bullet = flag;\r\n * ```\r\n * ```JavaScript\r\n * var range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n *\r\n * var flag = new am4plugins_bullets.FlagBullet();\r\n * flag.label.text = \"Hello\";\r\n *\r\n * range.bullet = flag;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * // ...\r\n * \"axisRanges\": [{\r\n * \"date\": new Date(2018, 0, 5),\r\n * \"bullet: {\r\n * \"type\": \"FlagBullet\",\r\n * \"label\": {\r\n * \"text\": \"Hello\"\r\n * }\r\n * }\r\n * }]\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @since 4.5.9\r\n * @see {@link IAxisBulletEvents} for a list of available events\r\n * @see {@link IAxisBulletAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar AxisBullet = /** @class */ (function (_super) {\r\n __extends(AxisBullet, _super);\r\n function AxisBullet() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"AxisBullet\";\r\n _this.location = 0.5;\r\n _this.isMeasured = false;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(AxisBullet.prototype, \"location\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"location\");\r\n },\r\n /**\r\n * Relative position within cell/range.\r\n *\r\n * Value range is from from `0` (beginning) to `1` (end).\r\n *\r\n * NOTE: `location` is relative to the parent axis range's scope, i.e.\r\n * between its `date` and `endDate` for [[DateAxis]], or `value`/`endValue`\r\n * ([[ValueAxis]]), or `category`/`endCategory` ([[categoryAxis]]).\r\n *\r\n * ```TypeScript\r\n * let range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n * range.endDate = new Date(2018, 0, 6);\r\n *\r\n * let bullet = new am4charts.AxisBullet();\r\n * bullet.location = 1;\r\n *\r\n * let flag = bullet.createChild(am4plugins_bullets.FlagBullet);\r\n * flag.label.text = \"Hello\";\r\n * ```\r\n * ```JavaScript\r\n * var range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n * range.endDate = new Date(2018, 0, 6);\r\n *\r\n * var bullet = new am4charts.AxisBullet();\r\n * bullet.location = 1;\r\n *\r\n * var flag = bullet.createChild(am4plugins_bullets.FlagBullet);\r\n * flag.label.text = \"Hello\";\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * // ...\r\n * \"axisRanges\": [{\r\n * \"date\": new Date(2018, 0, 5),\r\n * \"endDate\": new Date(2018, 0, 6),\r\n * \"bullet: {\r\n * \"type\": \"AxisBullet\",\r\n * \"location\": 1,\r\n * \"children\": [{\r\n * \"type\": \"FlagBullet\",\r\n * \"label\": {\r\n * \"text\": \"Hello\"\r\n * }\r\n * }]\r\n * }\r\n * }]\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @default 0.5\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"location\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n AxisBullet.prototype.setDisabled = function (value) {\r\n var changed = _super.prototype.setDisabled.call(this, value);\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n }\r\n return changed;\r\n };\r\n return AxisBullet;\r\n}(Container));\r\nexport { AxisBullet };\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[\"AxisBullet\"] = AxisBullet;\r\n//# sourceMappingURL=AxisBullet.js.map","/**\r\n * Module, defining Axis Renderer for vertical axes.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisRenderer } from \"./AxisRenderer\";\r\nimport { WavedLine } from \"../../core/elements/WavedLine\";\r\nimport { WavedRectangle } from \"../../core/elements/WavedRectangle\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { percent, Percent } from \"../../core/utils/Percent\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\r\nimport { AxisBullet } from \"./AxisBullet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A renderer for vertical axis.\r\n *\r\n * @see {@link IAxisRendererYEvents} for a list of available events\r\n * @see {@link IAxisRendererYAdapters} for a list of available Adapters\r\n */\r\nvar AxisRendererY = /** @class */ (function (_super) {\r\n __extends(AxisRendererY, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\r\n function AxisRendererY() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"AxisRendererY\";\r\n _this.minGridDistance = 40;\r\n _this.opposite = false;\r\n _this.height = percent(100);\r\n _this.labels.template.verticalCenter = \"middle\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n AxisRendererY.prototype.setAxis = function (axis) {\r\n _super.prototype.setAxis.call(this, axis);\r\n axis.layout = \"horizontal\";\r\n };\r\n /**\r\n * @ignore\r\n */\r\n AxisRendererY.prototype.updateGridContainer = function () {\r\n var axis = this.axis;\r\n if (axis) {\r\n var gridContainer = this.gridContainer;\r\n gridContainer.y = axis.pixelY;\r\n gridContainer.height = axis.axisLength;\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n AxisRendererY.prototype.toAxisPosition = function (value) {\r\n var axis = this.axis;\r\n if (axis) {\r\n var inversedPosition = 1 - value;\r\n var relativePositionSprite = axis.relativePositionSprite;\r\n var y = axis.pixelY;\r\n if (relativePositionSprite) {\r\n y = $utils.spritePointToSprite({ x: 0, y: this.pixelY }, this.parent, relativePositionSprite).y;\r\n }\r\n else {\r\n relativePositionSprite = axis.parent;\r\n }\r\n if (relativePositionSprite) {\r\n var relativeY = y / relativePositionSprite.innerHeight;\r\n var relativeHeight = axis.axisLength / relativePositionSprite.innerHeight;\r\n return 1 - (inversedPosition - relativeY) / relativeHeight;\r\n }\r\n }\r\n return value;\r\n };\r\n /**\r\n * Called when rendered is attached to an Axis, as well as a property of\r\n * Axis that might affect the appearance is updated.\r\n *\r\n * E.g. `axis.opposite`, `axis.inside`, etc.\r\n *\r\n * This method is called **before** draw, so that any related setting\r\n * changed in this method can be changed.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererY.prototype.processRenderer = function () {\r\n _super.prototype.processRenderer.call(this);\r\n var axis = this.axis;\r\n if (axis) {\r\n var title = axis.title;\r\n title.valign = \"middle\";\r\n if (!(axis.height instanceof Percent)) {\r\n axis.height = percent(100);\r\n }\r\n if (this.opposite) {\r\n title.rotation = 90;\r\n this.line.toBack();\r\n title.toFront();\r\n }\r\n else {\r\n title.rotation = -90;\r\n title.toBack();\r\n this.line.toFront();\r\n }\r\n }\r\n };\r\n /**\r\n * Updates some of the Axis tooltip's visual properties, related to\r\n * rendering of the Axis.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererY.prototype.updateTooltip = function () {\r\n var axis = this.axis;\r\n if (axis) {\r\n var bigNum = 2000;\r\n var bbx = 0;\r\n var bby = 0;\r\n var bbw = bigNum;\r\n var bbh = this.axisLength;\r\n // right\r\n if (this.opposite) {\r\n if (this.inside) {\r\n bbx = -bigNum;\r\n bbw = bigNum;\r\n }\r\n }\r\n // left\r\n else {\r\n if (!this.inside) {\r\n bbx = -bigNum;\r\n bbw = bigNum;\r\n }\r\n }\r\n this.axis.updateTooltip(\"horizontal\", { x: bbx, y: bby, width: bbw, height: bbh });\r\n }\r\n };\r\n Object.defineProperty(AxisRendererY.prototype, \"axisLength\", {\r\n /**\r\n * Returns actual length of the Axis, in pixels.\r\n *\r\n * @return Length (px)\r\n */\r\n get: function () {\r\n var axis = this.axis;\r\n return (axis.measuredHeight - axis.pixelPaddingTop - axis.pixelPaddingBottom) || 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts relative position on axis to point coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @param position2 Position (0-1) Position on the second axis\r\n * @return Point\r\n */\r\n AxisRendererY.prototype.positionToPoint = function (position, position2) {\r\n return { x: 0, y: this.positionToCoordinate(position) };\r\n };\r\n /**\r\n * Converts a point at specific coordinates to a relative position (0-1)\r\n * on the axis.\r\n *\r\n * @param point Point\r\n * @return Position (0-1)\r\n */\r\n AxisRendererY.prototype.pointToPosition = function (point) {\r\n return this.coordinateToPosition(point.y, point.x);\r\n };\r\n /**\r\n * Converts a coordinate in pixels to a relative position. (0-1)\r\n *\r\n * @param coordinate Coordinate (px)\r\n * @param coordinate2 Coordinate of a second axis, only needed for complex axes systems, like timeline (px)\r\n * @return Position (0-1)\r\n */\r\n AxisRendererY.prototype.coordinateToPosition = function (coordinate, coordinate2) {\r\n var position;\r\n var axis = this.axis;\r\n var axisFullLength = axis.axisFullLength;\r\n if (axis.renderer.inversed) {\r\n position = (1 - axis.start) - coordinate / axisFullLength;\r\n }\r\n else {\r\n position = coordinate / axisFullLength + (1 - axis.end);\r\n }\r\n return $math.round(position, 5);\r\n };\r\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition Starting position\r\n * @param endPosition End position\r\n * @return SVG path\r\n */\r\n AxisRendererY.prototype.getPositionRangePath = function (startPosition, endPosition) {\r\n var y1 = $math.fitToRange(this.positionToCoordinate(startPosition), 0, this.axisLength);\r\n var y2 = $math.fitToRange(this.positionToCoordinate(endPosition), 0, this.axisLength);\r\n var h = Math.abs(y2 - y1);\r\n var w = this.getWidth();\r\n var y = Math.min(y1, y2);\r\n var x = 0;\r\n return $path.rectToPath({\r\n x: x,\r\n y: y,\r\n width: w,\r\n height: h\r\n }, true);\r\n };\r\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererY.prototype.updateGridElement = function (grid, position, endPosition) {\r\n position = position + (endPosition - position) * grid.location;\r\n var point = this.positionToPoint(position);\r\n //\tpoint.y = $utils.spritePointToSprite({ x: 0, y: point.y }, this, this.gridContainer).y;\r\n grid.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: this.getWidth(), y: 0 });\r\n this.positionItem(grid, point);\r\n this.toggleVisibility(grid, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions a tick element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param tick Tick element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererY.prototype.updateTickElement = function (tick, position, endPosition) {\r\n position = position + (endPosition - position) * tick.location;\r\n var point = this.positionToPoint(position);\r\n var tickLength = tick.length;\r\n try {\r\n $utils.used(this.axis.title.measuredWidth);\r\n }\r\n catch (_a) {\r\n // void\r\n }\r\n point.x = $utils.spritePointToSprite({ x: this.line.pixelX, y: 0 }, this.line.parent, this.gridContainer).x;\r\n if (!this.opposite) {\r\n tickLength *= (tick.inside ? 1 : -1);\r\n }\r\n else {\r\n tickLength *= (tick.inside ? -1 : 1);\r\n }\r\n tick.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: tickLength, y: 0 });\r\n this.positionItem(tick, point);\r\n this.toggleVisibility(tick, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions the axis line element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererY.prototype.updateAxisLine = function () {\r\n this.line.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: 0, y: this.axisLength });\r\n };\r\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererY.prototype.updateBaseGridElement = function () {\r\n _super.prototype.updateBaseGridElement.call(this);\r\n var axis = this.axis;\r\n var w = this.getWidth();\r\n var h = this.axisLength;\r\n var y = axis.basePoint.y;\r\n var baseGrid = this.baseGrid;\r\n if (y < -0.2 || y > h + 0.2) {\r\n baseGrid.hide(0);\r\n }\r\n else {\r\n var x = $utils.spritePointToSprite({ x: 0, y: 0 }, this.gridContainer, baseGrid.parent).x;\r\n baseGrid.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: w, y: 0 });\r\n baseGrid.moveTo({ x: x, y: y });\r\n baseGrid.show(0);\r\n }\r\n };\r\n /**\r\n * Updates and positions a label element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param label Label element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\r\n AxisRendererY.prototype.updateLabelElement = function (label, position, endPosition, location) {\r\n if (!$type.hasValue(location)) {\r\n location = label.location;\r\n }\r\n position = position + (endPosition - position) * location;\r\n label.isMeasured = !label.inside;\r\n var point = this.positionToPoint(position);\r\n var horizontalCenter;\r\n var deltaX = 0;\r\n var maxWidth = this.gridContainer.maxWidth;\r\n if (this.opposite) {\r\n if (label.inside) {\r\n horizontalCenter = \"right\";\r\n if (label.align == \"left\") {\r\n deltaX = -maxWidth;\r\n horizontalCenter = \"left\";\r\n }\r\n if (label.align == \"center\") {\r\n deltaX = -maxWidth / 2;\r\n horizontalCenter = \"middle\";\r\n }\r\n }\r\n else {\r\n horizontalCenter = \"left\";\r\n }\r\n point.x = 0 + deltaX;\r\n }\r\n else {\r\n if (label.inside) {\r\n horizontalCenter = \"left\";\r\n if (label.align == \"right\") {\r\n deltaX = maxWidth;\r\n horizontalCenter = \"right\";\r\n }\r\n if (label.align == \"center\") {\r\n deltaX = maxWidth / 2;\r\n horizontalCenter = \"middle\";\r\n }\r\n }\r\n else {\r\n horizontalCenter = \"right\";\r\n }\r\n point.x = this.measuredWidth + deltaX;\r\n }\r\n if (label.rotation == 0) {\r\n // Apply fuzzy logic to verticalCenter only if labels are not rotated\r\n label.horizontalCenter = horizontalCenter;\r\n }\r\n this.positionItem(label, point);\r\n this.toggleVisibility(label, position, this.minLabelPosition, this.maxLabelPosition);\r\n };\r\n /**\r\n * Updates and positions an axis break element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Break element\r\n */\r\n AxisRendererY.prototype.updateBreakElement = function (axisBreak) {\r\n _super.prototype.updateBreakElement.call(this, axisBreak);\r\n var startLine = axisBreak.startLine;\r\n var endLine = axisBreak.endLine;\r\n var fillShape = axisBreak.fillShape;\r\n var startPoint = axisBreak.startPoint;\r\n var endPoint = axisBreak.endPoint;\r\n var x1 = axisBreak.pixelMarginLeft;\r\n var x2 = this.getWidth() - axisBreak.pixelMarginLeft - axisBreak.pixelMarginRight;\r\n startPoint.y = $math.fitToRange(startPoint.y, -1, this.axisLength + 1);\r\n endPoint.y = $math.fitToRange(endPoint.y, -1, this.axisLength + 1);\r\n if (startPoint.y == endPoint.y && (startPoint.y < 0 || startPoint.y > this.axisLength)) {\r\n axisBreak.fillShape.__disabled = true;\r\n }\r\n else {\r\n axisBreak.fillShape.__disabled = false;\r\n }\r\n var w = Math.abs(x2 - x1);\r\n startLine.x = x1;\r\n startLine.height = 0;\r\n startLine.width = w;\r\n endLine.x = x1;\r\n endLine.height = 0;\r\n endLine.width = w;\r\n fillShape.width = w;\r\n fillShape.height = Math.abs(endPoint.y - startPoint.y);\r\n fillShape.x = x1;\r\n fillShape.y = endPoint.y;\r\n };\r\n /**\r\n * Creates visual elements for and axis break.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Axis break\r\n */\r\n AxisRendererY.prototype.createBreakSprites = function (axisBreak) {\r\n axisBreak.startLine = new WavedLine();\r\n axisBreak.endLine = new WavedLine();\r\n var wavedRectangle = new WavedRectangle();\r\n wavedRectangle.setWavedSides(true, false, true, false);\r\n axisBreak.fillShape = wavedRectangle;\r\n };\r\n /**\r\n * Converts a position on the axis to a coordinate in pixels.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position (0-1)\r\n * @return Coordinate (px)\r\n */\r\n AxisRendererY.prototype.positionToCoordinate = function (position) {\r\n var coordinate;\r\n var axis = this.axis;\r\n var axisFullLength = axis.axisFullLength;\r\n if (!axis.renderer.inversed) {\r\n coordinate = (axis.end - position) * axisFullLength;\r\n }\r\n else {\r\n coordinate = (position - axis.start) * axisFullLength;\r\n }\r\n return coordinate;\r\n };\r\n /**\r\n * Updates and positions axis bullets.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet AxisBullet element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererY.prototype.updateBullet = function (bullet, position, endPosition) {\r\n var location = 0.5;\r\n if (bullet instanceof AxisBullet) {\r\n location = bullet.location;\r\n }\r\n position = position + (endPosition - position) * location;\r\n var point = this.positionToPoint(position);\r\n point.x = $utils.spritePointToSprite({ x: this.line.pixelX, y: 0 }, this.line.parent, this.gridContainer).x;\r\n this.positionItem(bullet, point);\r\n this.toggleVisibility(bullet, position, 0, 1);\r\n };\r\n return AxisRendererY;\r\n}(AxisRenderer));\r\nexport { AxisRendererY };\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[\"AxisRendererY\"] = AxisRendererY;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Put labels inside plot area.\r\n * Disable first and last labels.\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.widthS,\r\n state: function (target, stateId) {\r\n if (target instanceof AxisRendererY) {\r\n var state = target.states.create(stateId);\r\n state.properties.inside = true;\r\n state.properties.maxLabelPosition = 0.9;\r\n state.properties.minLabelPosition = 0.1;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n/**\r\n * Disable labels altogather on very small charts\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.widthXS,\r\n state: function (target, stateId) {\r\n if (target instanceof AxisRendererY) {\r\n var state = target.states.create(stateId);\r\n state.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=AxisRendererY.js.map","/**\r\n * A module which defines functionality related to Value Axis Break.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisBreak } from \"./AxisBreak\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Base class to define \"breaks\" on value axis.\r\n *\r\n * A \"break\" can be used to \"cut out\" specific ranges of the axis scale, e.g.\r\n * when comparing columns with relatively similar values, it would make sense\r\n * to cut out their mid section, so that their tip differences are more\r\n * prominent.\r\n *\r\n * @see {@link IValueAxisBreakEvents} for a list of available events\r\n * @see {@link IValueAxisBreakAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar ValueAxisBreak = /** @class */ (function (_super) {\r\n __extends(ValueAxisBreak, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ValueAxisBreak() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ValueAxisBreak\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(ValueAxisBreak.prototype, \"startPosition\", {\r\n /**\r\n * Pixel position of the break's start.\r\n *\r\n * @return Position (px)\r\n * @readonly\r\n */\r\n get: function () {\r\n if (this.axis) {\r\n return this.axis.valueToPosition(this.adjustedStartValue);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxisBreak.prototype, \"endPosition\", {\r\n /**\r\n * Pixel position of the break's end.\r\n *\r\n * @return Position (px)\r\n * @readonly\r\n */\r\n get: function () {\r\n if (this.axis) {\r\n return this.axis.valueToPosition(this.adjustedEndValue);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ValueAxisBreak;\r\n}(AxisBreak));\r\nexport { ValueAxisBreak };\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[\"ValueAxisBreak\"] = ValueAxisBreak;\r\n//# sourceMappingURL=ValueAxisBreak.js.map","/**\r\n * Value Axis module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Axis, AxisDataItem } from \"./Axis\";\r\nimport { AxisRendererY } from \"./AxisRendererY\";\r\nimport { MultiDisposer } from \"../../core/utils/Disposer\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { ValueAxisBreak } from \"./ValueAxisBreak\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[ValueAxis]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar ValueAxisDataItem = /** @class */ (function (_super) {\r\n __extends(ValueAxisDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ValueAxisDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ValueAxisDataItem\";\r\n _this.values.value = {};\r\n _this.values.endValue = {};\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(ValueAxisDataItem.prototype, \"value\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values[\"value\"].value;\r\n },\r\n /**\r\n * A data point's numeric value.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"value\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxisDataItem.prototype, \"endValue\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values[\"endValue\"].value;\r\n },\r\n /**\r\n * Data point's numeric end value.\r\n *\r\n * @param value End value\r\n */\r\n set: function (value) {\r\n this.setValue(\"endValue\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ValueAxisDataItem;\r\n}(AxisDataItem));\r\nexport { ValueAxisDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to create a value axis for the chart.\r\n *\r\n * ```TypeScript\r\n * // Create the axis\r\n * let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());\r\n *\r\n * // Set settings\r\n * valueAxis.title.text = \"Monthly Sales\";\r\n * ```\r\n * ```JavaScript\r\n * // Create the axis\r\n * var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());\r\n *\r\n * // Set settings\r\n * valueAxis.title.text = \"Monthly Sales\";\r\n * ```\r\n * ```JSON\r\n * \"yAxes\": [{\r\n * \"type\": \"ValueAxis\",\r\n * \"title\": {\r\n * \"text\": \"Monthly Sales\"\r\n * }\r\n * }]\r\n * ```\r\n *\r\n * @see {@link IValueAxisEvents} for a list of available Events\r\n * @see {@link IValueAxisAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar ValueAxis = /** @class */ (function (_super) {\r\n __extends(ValueAxis, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ValueAxis() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * [_stepDecimalPlaces description]\r\n *\r\n * @todo Description\r\n */\r\n _this._stepDecimalPlaces = 0;\r\n _this._prevStepDecimalPlaces = 0;\r\n _this._adjustLabelPrecision = true;\r\n /**\r\n * Base value for the axis.\r\n */\r\n _this._baseValue = 0;\r\n /**\r\n * Adjusted start in case we have breaks.\r\n *\r\n * @todo Description\r\n */\r\n _this._adjustedStart = 0;\r\n /**\r\n * Adjusted end in case we have breaks.\r\n *\r\n * @todo Description\r\n */\r\n _this._adjustedEnd = 1;\r\n _this._extremesChanged = false;\r\n _this._deltaMinMax = 1;\r\n /**\r\n * As calculating totals is expensive operation and not often needed, we\r\n * don't do it by default.\r\n *\r\n * In case you use `totalPercent` or `total` in your charts, this must be set\r\n * to `true`.\r\n *\r\n * @default false\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/xy-chart/#100_stacks} For using `calculateTotals` for 100% stacked series.\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-strings/#Placeholders_for_numeric_values} For using `calculateTotals` in labels.\r\n */\r\n _this.calculateTotals = false;\r\n _this.className = \"ValueAxis\";\r\n // Set field name\r\n _this.axisFieldName = \"value\";\r\n // Set defaults\r\n _this.setPropertyValue(\"maxZoomFactor\", 1000);\r\n _this.setPropertyValue(\"extraMin\", 0);\r\n _this.setPropertyValue(\"extraMax\", 0);\r\n _this.setPropertyValue(\"strictMinMax\", false);\r\n _this.setPropertyValue(\"maxPrecision\", Number.MAX_VALUE);\r\n _this.setPropertyValue(\"adjustLabelPrecision\", true);\r\n _this.setPropertyValue(\"extraTooltipPrecision\", 0);\r\n _this.keepSelection = false;\r\n _this.includeRangesInMinMax = false;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Holds reference to a function that accepts a DataItem as parameter.\r\n *\r\n * It can either return a fill opacity for a fill, or manipulate data item\r\n * directly, to create various highlighting scenarios.\r\n */\r\n ValueAxis.prototype.fillRule = function (dataItem) {\r\n var value = dataItem.value;\r\n var axis = dataItem.component;\r\n if (!dataItem.axisFill.disabled) {\r\n // rounding in left to solve floating point number\r\n if ($math.round(value / axis.step / 2, 5) == Math.round(value / axis.step / 2)) {\r\n dataItem.axisFill.__disabled = true;\r\n }\r\n else {\r\n dataItem.axisFill.__disabled = false;\r\n }\r\n }\r\n };\r\n /**\r\n * Returns a new/empty [[DataItem]] of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n ValueAxis.prototype.createDataItem = function () {\r\n return new ValueAxisDataItem();\r\n };\r\n /**\r\n * Returns a new/empty [[AxisBreak]] of the appropriate type.\r\n *\r\n * @return Axis break\r\n */\r\n ValueAxis.prototype.createAxisBreak = function () {\r\n return new ValueAxisBreak();\r\n };\r\n /**\r\n * [dataChangeUpdate description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n ValueAxis.prototype.dataChangeUpdate = function () {\r\n this.clearCache();\r\n if (!this.keepSelection) {\r\n if (this._start != 0 || this._end != 1) {\r\n this._start = 0;\r\n this._end = 1;\r\n this.dispatchImmediately(\"startendchanged\");\r\n }\r\n }\r\n else {\r\n if (this._start != 0) {\r\n this.dispatchImmediately(\"startchanged\");\r\n }\r\n if (this._end != 1) {\r\n this.dispatchImmediately(\"endchanged\");\r\n }\r\n if (this._start != 0 || this._end != 1) {\r\n this.dispatchImmediately(\"startendchanged\");\r\n }\r\n }\r\n this._maxZoomed = this._maxDefined;\r\n this._minZoomed = this._minDefined;\r\n this._maxAdjusted = this._maxDefined;\r\n this._minAdjusted = this._minDefined;\r\n };\r\n /**\r\n * Processes data items of the related Series.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ValueAxis.prototype.processSeriesDataItems = function () {\r\n // @todo: add some boolean (maybe autodedect) if we need these calculations or not. this place uses a lot of cpu\r\n if (this.calculateTotals) {\r\n var series = this.series.getIndex(0);\r\n var startIndex = series.startIndex;\r\n if (series.dataItems.length > 0) {\r\n if (startIndex > 0) {\r\n startIndex--;\r\n }\r\n var endIndex = series.endIndex;\r\n if (endIndex < series.dataItems.length) {\r\n endIndex++;\r\n }\r\n var _loop_1 = function (i) {\r\n // This has to be `var` in order to avoid garbage collection\r\n var total = {};\r\n var sum = {};\r\n this_1.series.each(function (series) {\r\n if (!series.excludeFromTotal) {\r\n var dataItem_1 = series.dataItems.getIndex(i);\r\n if (dataItem_1) {\r\n $object.each(dataItem_1.values, function (key) {\r\n var value = dataItem_1.values[key].workingValue; // can not use getWorkingValue here!\r\n if ($type.isNumber(value)) {\r\n if (!$type.isNumber(total[key])) {\r\n total[key] = Math.abs(value);\r\n }\r\n else {\r\n total[key] += Math.abs(value);\r\n }\r\n if (!$type.isNumber(sum[key])) {\r\n sum[key] = value;\r\n }\r\n else {\r\n sum[key] += value;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n });\r\n this_1.series.each(function (series) {\r\n if (!series.excludeFromTotal) {\r\n var dataItem_2 = series.dataItems.getIndex(i);\r\n if (dataItem_2) {\r\n $object.each(dataItem_2.values, function (key) {\r\n var value = dataItem_2.values[key].workingValue; // can not use getWorkingValue here!\r\n if ($type.isNumber(value)) {\r\n dataItem_2.setCalculatedValue(key, total[key], \"total\");\r\n dataItem_2.setCalculatedValue(key, 100 * value / total[key], \"totalPercent\");\r\n dataItem_2.setCalculatedValue(key, sum[key], \"sum\");\r\n }\r\n });\r\n }\r\n }\r\n });\r\n };\r\n var this_1 = this;\r\n // This has to be `var` in order to avoid garbage collection\r\n for (var i = startIndex; i < endIndex; ++i) {\r\n _loop_1(i);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Validates the whole axis. Causes it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n */\r\n ValueAxis.prototype.validate = function () {\r\n if (this.axisLength <= 0) {\r\n return;\r\n }\r\n _super.prototype.validate.call(this);\r\n this.getMinMax();\r\n this.fixAxisBreaks();\r\n this.calculateZoom();\r\n this.validateAxisElements();\r\n this.validateAxisRanges();\r\n this.validateBreaks();\r\n this.hideUnusedDataItems();\r\n this.renderer.invalidateLayout();\r\n // hide too close\r\n //this.hideTooCloseDataItems();\r\n };\r\n /**\r\n * Calculates all positions, related to axis as per current zoom.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ValueAxis.prototype.calculateZoom = function () {\r\n if ($type.isNumber(this.min) && $type.isNumber(this.max)) {\r\n var min = this.positionToValue(this.start);\r\n var max = this.positionToValue(this.end);\r\n var differece = this.adjustDifference(min, max);\r\n var minMaxStep = this.adjustMinMax(min, max, differece, this._gridCount, true);\r\n var stepDecimalPlaces = $utils.decimalPlaces(minMaxStep.step);\r\n this._stepDecimalPlaces = stepDecimalPlaces;\r\n min = $math.round(min, stepDecimalPlaces);\r\n max = $math.round(max, stepDecimalPlaces);\r\n minMaxStep = this.adjustMinMax(min, max, differece, this._gridCount, true);\r\n var step = minMaxStep.step;\r\n if (this.syncWithAxis) {\r\n var calculated = this.getCache(min + \"-\" + max);\r\n if ($type.isNumber(calculated)) {\r\n step = calculated;\r\n }\r\n }\r\n else {\r\n min = minMaxStep.min;\r\n max = minMaxStep.max;\r\n }\r\n if (this._minZoomed != min || this._maxZoomed != max || this._step != step) {\r\n this._minZoomed = min;\r\n this._maxZoomed = max;\r\n this._step = step;\r\n this.dispatchImmediately(\"selectionextremeschanged\");\r\n }\r\n }\r\n };\r\n /**\r\n * Validates Axis elements.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n ValueAxis.prototype.validateAxisElements = function () {\r\n var _this = this;\r\n if ($type.isNumber(this.max) && $type.isNumber(this.min)) {\r\n // first regular items\r\n var value_1 = this.minZoomed - this._step * 2;\r\n if (!this.logarithmic) {\r\n value_1 = Math.floor(value_1 / this._step) * this._step;\r\n }\r\n else {\r\n var differencePower = Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E;\r\n if (differencePower > 1) {\r\n value_1 = Math.pow(10, Math.log(this.min) * Math.LOG10E);\r\n }\r\n else {\r\n value_1 = Math.floor(this.minZoomed / this._step) * this._step;\r\n if (value_1 == 0) {\r\n value_1 = this.minZoomed;\r\n }\r\n }\r\n }\r\n var maxZoomed = this._maxZoomed + this._step;\r\n this.resetIterators();\r\n var dataItemsIterator_1 = this._dataItemsIterator;\r\n var i = 0;\r\n var precisionChanged = this._prevStepDecimalPlaces != this._stepDecimalPlaces;\r\n this._prevStepDecimalPlaces = this._stepDecimalPlaces;\r\n while (value_1 <= maxZoomed) {\r\n var axisBreak = this.isInBreak(value_1);\r\n if (!axisBreak) {\r\n var dataItem = dataItemsIterator_1.find(function (x) { return x.value === value_1; });\r\n if (dataItem.__disabled) {\r\n dataItem.__disabled = false;\r\n }\r\n //this.processDataItem(dataItem);\r\n this.appendDataItem(dataItem);\r\n dataItem.axisBreak = undefined;\r\n if (dataItem.value != value_1 || precisionChanged) {\r\n dataItem.value = value_1;\r\n dataItem.text = this.formatLabel(value_1);\r\n if (dataItem.label && dataItem.label.invalid) {\r\n dataItem.label.validate();\r\n }\r\n if (dataItem.value >= this.min && dataItem.value <= this.max) {\r\n if (dataItem.label) {\r\n if ((this.axisLetter == \"Y\" && dataItem.label.measuredWidth > this.ghostLabel.measuredWidth) || (this.axisLetter == \"X\" && dataItem.label.measuredHeight > this.ghostLabel.measuredHeight)) {\r\n this.ghostLabel.text = dataItem.label.currentText;\r\n this.ghostLabel.validate();\r\n }\r\n }\r\n }\r\n }\r\n this.validateDataElement(dataItem);\r\n }\r\n i++;\r\n if (!this.logarithmic) {\r\n value_1 += this._step;\r\n }\r\n else {\r\n var differencePower = Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E;\r\n if (differencePower > 1) {\r\n value_1 = Math.pow(10, Math.log(this.min) * Math.LOG10E + i);\r\n }\r\n else {\r\n value_1 += this._step;\r\n }\r\n }\r\n var stepPower = Math.pow(10, Math.floor(Math.log(Math.abs(this._step)) * Math.LOG10E));\r\n if (stepPower < 1) {\r\n // exponent is less then 1 too. Count decimals of exponent\r\n var decCount = Math.round(Math.abs(Math.log(Math.abs(stepPower)) * Math.LOG10E)) + 2;\r\n // round value to avoid floating point issues\r\n value_1 = $math.round(value_1, decCount);\r\n }\r\n }\r\n var axisBreaks = this._axisBreaks;\r\n if (axisBreaks) {\r\n // breaks later\r\n var renderer_1 = this.renderer;\r\n $iter.each(axisBreaks.iterator(), function (axisBreak) {\r\n if (axisBreak.breakSize > 0) {\r\n // only add grid if gap is bigger then minGridDistance\r\n if ($math.getDistance(axisBreak.startPoint, axisBreak.endPoint) > renderer_1.minGridDistance) {\r\n var breakValue_1 = axisBreak.adjustedMin;\r\n while (breakValue_1 <= axisBreak.adjustedMax) {\r\n if (breakValue_1 >= axisBreak.adjustedStartValue && breakValue_1 <= axisBreak.adjustedEndValue) {\r\n var dataItem = dataItemsIterator_1.find(function (x) { return x.value === breakValue_1; });\r\n if (dataItem.__disabled) {\r\n dataItem.__disabled = false;\r\n }\r\n //this.processDataItem(dataItem);\r\n _this.appendDataItem(dataItem);\r\n dataItem.axisBreak = axisBreak;\r\n if (dataItem.value != breakValue_1) {\r\n dataItem.value = breakValue_1;\r\n dataItem.text = _this.formatLabel(breakValue_1);\r\n if (dataItem.label && dataItem.label.invalid) {\r\n dataItem.label.validate();\r\n }\r\n }\r\n _this.validateDataElement(dataItem);\r\n }\r\n breakValue_1 += axisBreak.adjustedStep;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * Validates axis data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param dataItem Data item\r\n */\r\n ValueAxis.prototype.validateDataElement = function (dataItem) {\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n //dataItem.__disabled = false;\r\n dataItem.itemIndex = this._axisItemCount;\r\n this._axisItemCount++;\r\n var renderer = this.renderer;\r\n var value = dataItem.value;\r\n var endValue = dataItem.endValue;\r\n var position = this.valueToPosition(value);\r\n dataItem.position = position;\r\n var endPosition = position;\r\n var fillEndPosition = this.valueToPosition(value + this._step);\r\n if ($type.isNumber(endValue)) {\r\n endPosition = this.valueToPosition(endValue);\r\n fillEndPosition = endPosition;\r\n }\r\n // this point is needed to calculate distance to satisfy minGridDistance\r\n dataItem.point = renderer.positionToPoint(position);\r\n var tick = dataItem.tick;\r\n if (tick && !tick.disabled) {\r\n renderer.updateTickElement(tick, position, endPosition);\r\n }\r\n var grid = dataItem.grid;\r\n if (grid && !grid.disabled) {\r\n renderer.updateGridElement(grid, position, endPosition);\r\n }\r\n var label = dataItem.label;\r\n if (label && !label.disabled) {\r\n renderer.updateLabelElement(label, position, endPosition);\r\n }\r\n var fill = dataItem.axisFill;\r\n if (fill && !fill.disabled) {\r\n renderer.updateFillElement(fill, position, fillEndPosition);\r\n if (!dataItem.isRange) {\r\n this.fillRule(dataItem);\r\n }\r\n }\r\n if (dataItem.bullet) {\r\n renderer.updateBullet(dataItem.bullet, position, endPosition);\r\n }\r\n var mask = dataItem.mask;\r\n if (mask) {\r\n renderer.updateFillElement(mask, position, fillEndPosition);\r\n }\r\n };\r\n /**\r\n * Formats the value according to axis' own [[NumberFormatter]].\r\n *\r\n * @param value Source value\r\n * @return Formatted value\r\n */\r\n ValueAxis.prototype.formatLabel = function (value) {\r\n if (this.adjustLabelPrecision && value != 0) {\r\n return this.numberFormatter.format(value, undefined, this._stepDecimalPlaces);\r\n }\r\n else {\r\n return this.numberFormatter.format(value);\r\n }\r\n };\r\n Object.defineProperty(ValueAxis.prototype, \"basePoint\", {\r\n /**\r\n * Coordinates of the actual axis start.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Base point\r\n */\r\n get: function () {\r\n var baseValue = this.baseValue;\r\n var position = this.valueToPosition(baseValue);\r\n var basePoint = this.renderer.positionToPoint(position);\r\n return basePoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"baseValue\", {\r\n /**\r\n * @return base value\r\n */\r\n get: function () {\r\n var baseValue = this._baseValue;\r\n if (this.logarithmic) {\r\n baseValue = this.min;\r\n }\r\n if (!this._adapterO) {\r\n return baseValue;\r\n }\r\n else {\r\n return this._adapterO.apply(\"baseValue\", baseValue);\r\n }\r\n },\r\n /**\r\n * A base value.\r\n *\r\n * This is a threshold value that will divide \"positive\" and \"negative\"\r\n * value ranges.\r\n *\r\n * Other scale-related functionality also depend on base value. E.g. stacks,\r\n * value-dependent coloring, etc.\r\n *\r\n * @param value Base value\r\n */\r\n set: function (value) {\r\n this._baseValue = value;\r\n this.invalidateLayout();\r\n this.invalidateSeries();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts a numeric value to relative position on axis\r\n *\r\n * An alias to `valueToPosition()`.\r\n *\r\n * @param value Value\r\n * @return Position\r\n */\r\n ValueAxis.prototype.anyToPosition = function (value) {\r\n return this.valueToPosition(value);\r\n };\r\n /**\r\n * Converts a numeric value to orientation point (x, y, angle) on axis\r\n *\r\n * @param value Value\r\n * @return Orientation point\r\n */\r\n ValueAxis.prototype.valueToPoint = function (value) {\r\n var position = this.valueToPosition(value);\r\n var point = this.renderer.positionToPoint(position);\r\n var angle = this.renderer.positionToAngle(position);\r\n return { x: point.x, y: point.y, angle: angle };\r\n };\r\n /**\r\n * Converts a numeric value to orientation (x, y, angle) point on axis\r\n *\r\n * @param value Value\r\n * @return Orientation point\r\n */\r\n ValueAxis.prototype.anyToPoint = function (value) {\r\n return this.valueToPoint(value);\r\n };\r\n /**\r\n * Converts a numeric value to relative position on axis.\r\n *\r\n * @param value Value\r\n * @return relative position\r\n */\r\n ValueAxis.prototype.valueToPosition = function (value) {\r\n if ($type.isNumber(value)) {\r\n // todo: think if possible to take previous value and do not go through all previous breaks\r\n var min_1 = this.min;\r\n var max_1 = this.max;\r\n if ($type.isNumber(min_1) && $type.isNumber(max_1)) {\r\n var difference = this._difference;\r\n var axisBreaks = this._axisBreaks;\r\n if (axisBreaks && axisBreaks.length > 0) {\r\n $iter.eachContinue(axisBreaks.iterator(), function (axisBreak) {\r\n var startValue = axisBreak.adjustedStartValue;\r\n var endValue = axisBreak.adjustedEndValue;\r\n if ($type.isNumber(startValue) && $type.isNumber(endValue)) {\r\n if (value < startValue) {\r\n return false;\r\n }\r\n if ($math.intersect({ start: startValue, end: endValue }, { start: min_1, end: max_1 })) { // todo: check this once and set some flag in axisBreak\r\n startValue = Math.max(startValue, min_1);\r\n endValue = Math.min(endValue, max_1);\r\n var breakSize = axisBreak.breakSize;\r\n // value to the right of break end\r\n if (value > endValue) {\r\n min_1 += (endValue - startValue) * (1 - breakSize); // todo: maybe this can be done differently?\r\n }\r\n // value to the left of break start\r\n else if (value < startValue) {\r\n }\r\n // value within break\r\n else {\r\n value = startValue + (value - startValue) * breakSize;\r\n }\r\n }\r\n }\r\n return true;\r\n });\r\n }\r\n var position = void 0;\r\n if (!this.logarithmic) {\r\n position = (value - min_1) / difference;\r\n }\r\n else {\r\n position = (Math.log(value) * Math.LOG10E - Math.log(this.min) * Math.LOG10E) / ((Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E));\r\n }\r\n //position = $math.round(position, 10);\r\n return position;\r\n }\r\n }\r\n return 0;\r\n };\r\n /**\r\n * When fontSize of fontFamily changes we need to hard-invalidate all Labels of this container to position them properly.\r\n */\r\n ValueAxis.prototype.invalidateLabels = function () {\r\n _super.prototype.invalidateLabels.call(this);\r\n if (this.dataItems) {\r\n this.dataItems.each(function (dataItem) {\r\n dataItem.value = undefined;\r\n });\r\n this.invalidate();\r\n }\r\n };\r\n /**\r\n * Converts an relative position to a corresponding value within\r\n * axis' scale.\r\n *\r\n * @param position Position (px)\r\n * @return Value\r\n */\r\n ValueAxis.prototype.positionToValue = function (position) {\r\n position = $math.round(position, 10);\r\n var min = this.min;\r\n var max = this.max;\r\n if ($type.isNumber(min) && $type.isNumber(max)) {\r\n var difference_1 = max - min; //no need to adjust!\r\n var value_2 = null;\r\n var axisBreaks = this._axisBreaks;\r\n if (axisBreaks) {\r\n // in case we have some axis breaks\r\n if (axisBreaks.length > 0) {\r\n $iter.eachContinue(axisBreaks.iterator(), function (axisBreak) {\r\n var breakStartPosition = axisBreak.startPosition;\r\n var breakEndPosition = axisBreak.endPosition;\r\n var breakStartValue = axisBreak.adjustedStartValue;\r\n var breakEndValue = axisBreak.adjustedEndValue;\r\n if ($type.isNumber(breakStartValue) && $type.isNumber(breakEndValue)) {\r\n if (breakStartValue > max) {\r\n return false;\r\n }\r\n if ($math.intersect({ start: breakStartValue, end: breakEndValue }, { start: min, end: max })) {\r\n breakStartValue = $math.max(breakStartValue, min);\r\n breakEndValue = $math.min(breakEndValue, max);\r\n var breakSize = axisBreak.breakSize;\r\n difference_1 -= (breakEndValue - breakStartValue) * (1 - breakSize);\r\n // position to the right of break end\r\n if (position > breakEndPosition) {\r\n min += (breakEndValue - breakStartValue) * (1 - breakSize);\r\n }\r\n // position to the left of break start\r\n else if (position < breakStartPosition) {\r\n }\r\n // value within break\r\n else {\r\n var breakPosition = (position - breakStartPosition) / (breakEndPosition - breakStartPosition);\r\n value_2 = breakStartValue + breakPosition * (breakEndValue - breakStartValue);\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n });\r\n }\r\n }\r\n if (!$type.isNumber(value_2)) {\r\n if (this.logarithmic) {\r\n value_2 = Math.pow(Math.E, (position * ((Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E)) + Math.log(this.min) * Math.LOG10E) / Math.LOG10E);\r\n }\r\n else {\r\n value_2 = position * difference_1 + min;\r\n }\r\n }\r\n return value_2;\r\n }\r\n //}\r\n };\r\n /**\r\n * Converts an X coordinate to a relative value in axis' scale.\r\n *\r\n * @param x X (px)\r\n * @return Value\r\n */\r\n ValueAxis.prototype.xToValue = function (x) {\r\n return this.positionToValue(this.pointToPosition({ x: x, y: 0 }));\r\n };\r\n /**\r\n * Converts an Y coordinate to a relative value in axis' scale.\r\n *\r\n * @param y Y (px)\r\n * @return Value\r\n */\r\n ValueAxis.prototype.yToValue = function (y) {\r\n return this.positionToValue(this.pointToPosition({ x: 0, y: y }));\r\n };\r\n /**\r\n * Converts pixel coordinates to a relative position. (0-1)\r\n *\r\n * @param point Coorinates (px)\r\n * @return Position (0-1)\r\n */\r\n ValueAxis.prototype.pointToPosition = function (point) {\r\n if (this.renderer instanceof AxisRendererY) {\r\n return 1 - this.renderer.pointToPosition(point);\r\n }\r\n else {\r\n return this.renderer.pointToPosition(point);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n ValueAxis.prototype.animateMinMax = function (min, max) {\r\n return this.animate([{ property: \"_minAdjusted\", from: this._minAdjusted, to: min }, { property: \"_maxAdjusted\", from: this._maxAdjusted, to: max }], this.rangeChangeDuration, this.rangeChangeEasing);\r\n };\r\n /**\r\n * Calculates smallest and biggest value for the axis scale.\r\n * @ignore\r\n * @todo Description (review)\r\n */\r\n ValueAxis.prototype.getMinMax = function () {\r\n var _this = this;\r\n this.updateGridCount();\r\n var min = Number.POSITIVE_INFINITY;\r\n var max = Number.NEGATIVE_INFINITY;\r\n // only if min and max are not set from outside, we go through min and max influencers\r\n if (!$type.isNumber(this._minDefined) || !$type.isNumber(this._maxDefined)) {\r\n this.series.each(function (series) {\r\n if (!series.ignoreMinMax) {\r\n // check min\r\n var seriesMin = series.min(_this);\r\n if ($type.isNumber(seriesMin) && (seriesMin < min)) {\r\n min = seriesMin;\r\n }\r\n // check max\r\n var seriesMax = series.max(_this);\r\n if ($type.isNumber(seriesMax) && (seriesMax > max)) {\r\n max = seriesMax;\r\n }\r\n }\r\n });\r\n if (this.includeRangesInMinMax) {\r\n this.axisRanges.each(function (range) {\r\n if (!range.ignoreMinMax) {\r\n var minValue = $math.min(range.value, range.endValue);\r\n var maxValue = $math.max(range.value, range.endValue);\r\n if (minValue < min || !$type.isNumber(min)) {\r\n min = minValue;\r\n }\r\n if (maxValue > max || !$type.isNumber(max)) {\r\n max = maxValue;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n if (this.logarithmic) {\r\n if (min <= 0) {\r\n this.raiseCriticalError(new Error(\"Logarithmic value axis can not have values <= 0.\"), true);\r\n }\r\n }\r\n if (min == 0 && max == 0) {\r\n max = 0.9;\r\n min = -0.9;\r\n }\r\n // if defined from outside\r\n if ($type.isNumber(this._minDefined)) {\r\n min = this._minDefined;\r\n }\r\n if ($type.isNumber(this._maxDefined)) {\r\n max = this._maxDefined;\r\n }\r\n if (this._adapterO) {\r\n min = this._adapterO.apply(\"min\", min);\r\n }\r\n if (this._adapterO) {\r\n max = this._adapterO.apply(\"max\", max);\r\n }\r\n if (!$type.isNumber(min) || !$type.isNumber(max)) {\r\n return;\r\n }\r\n this._minReal = min;\r\n this._maxReal = max;\r\n if (min == Number.POSITIVE_INFINITY) {\r\n min = undefined;\r\n }\r\n if (max == Number.NEGATIVE_INFINITY) {\r\n max = undefined;\r\n }\r\n var dif = this.adjustDifference(min, max); // previously it was max-min, but not worked well\r\n min = this.fixMin(min);\r\n max = this.fixMax(max);\r\n // this happens if starLocation and endLocation are 0.5 and DateAxis has only one date\r\n if (max - min <= 1 / Math.pow(10, 15)) {\r\n if (max - min != 0) {\r\n this._deltaMinMax = (max - min) / 2;\r\n }\r\n else {\r\n // the number by which we need to raise 10 to get difference\r\n var exponent = Math.log(Math.abs(max)) * Math.LOG10E;\r\n // here we find a number which is power of 10 and has the same count of numbers as difference has\r\n var power = Math.pow(10, Math.floor(exponent));\r\n // reduce this number by 10 times\r\n power = power / 10;\r\n this._deltaMinMax = power;\r\n }\r\n min -= this._deltaMinMax;\r\n max += this._deltaMinMax;\r\n }\r\n min -= (max - min) * this.extraMin;\r\n max += (max - min) * this.extraMax;\r\n var strict = this.strictMinMax;\r\n if ($type.isNumber(this._maxDefined)) {\r\n strict = true;\r\n }\r\n var minMaxStep = this.adjustMinMax(min, max, dif, this._gridCount, strict);\r\n min = minMaxStep.min;\r\n max = minMaxStep.max;\r\n dif = max - min; //new\r\n // do it for the second time (importat!)\r\n minMaxStep = this.adjustMinMax(min, max, max - min, this._gridCount, true);\r\n min = minMaxStep.min;\r\n max = minMaxStep.max;\r\n // return min max if strict\r\n if (this.strictMinMax) {\r\n if ($type.isNumber(this._minDefined)) {\r\n min = this._minDefined;\r\n }\r\n else {\r\n min = this._minReal;\r\n }\r\n if ($type.isNumber(this._maxDefined)) {\r\n max = this._maxDefined;\r\n }\r\n else {\r\n max = this._maxReal;\r\n }\r\n if (max - min <= 0.00000001) {\r\n min -= this._deltaMinMax;\r\n max += this._deltaMinMax;\r\n }\r\n min -= (max - min) * this.extraMin;\r\n max += (max - min) * this.extraMax;\r\n }\r\n if (this._adapterO) {\r\n min = this._adapterO.apply(\"min\", min);\r\n }\r\n if (this._adapterO) {\r\n max = this._adapterO.apply(\"max\", max);\r\n }\r\n this._step = minMaxStep.step;\r\n // checking isNumber is good when all series are hidden\r\n if ((this._minAdjusted != min || this._maxAdjusted != max) && $type.isNumber(min) && $type.isNumber(max)) {\r\n var animation = this._minMaxAnimation;\r\n if (this._extremesChanged && $type.isNumber(this._minAdjusted) && $type.isNumber(this._maxAdjusted) && this.inited) {\r\n if ((animation && !animation.isFinished()) && this._finalMax == max && this._finalMin == min) {\r\n return;\r\n }\r\n else {\r\n this._finalMin = min;\r\n this._finalMax = max;\r\n animation = this.animateMinMax(min, max);\r\n if (animation && !animation.isFinished()) {\r\n animation.events.on(\"animationprogress\", this.validateDataItems, this);\r\n animation.events.on(\"animationended\", function () {\r\n //this.validateDataItems();\r\n _this.series.each(function (series) {\r\n series.validate();\r\n });\r\n _this.validateDataItems();\r\n _this.handleSelectionExtremesChange();\r\n });\r\n this._minMaxAnimation = animation;\r\n }\r\n else {\r\n this.series.each(function (series) {\r\n series.validate();\r\n });\r\n }\r\n this.validateDataItems();\r\n this.dispatchImmediately(\"extremeschanged\");\r\n this.handleSelectionExtremesChange();\r\n }\r\n }\r\n else {\r\n if ((animation && !animation.isFinished()) && this._finalMax == max && this._finalMin == min) {\r\n return;\r\n }\r\n else {\r\n this._minAdjusted = min;\r\n this._maxAdjusted = max;\r\n this._finalMin = min;\r\n this._finalMax = max;\r\n this.invalidateDataItems();\r\n this.dispatchImmediately(\"extremeschanged\");\r\n }\r\n }\r\n }\r\n this._extremesChanged = false;\r\n this._difference = this.adjustDifference(min, max);\r\n };\r\n /**\r\n * Adjusts the minimum value.\r\n *\r\n * This is a placeholder method for extending classes to override.\r\n *\r\n * For numeric values this does nothing, however for more complex types, like\r\n * dates, it may be necessary to adjust.\r\n *\r\n * @param value Value\r\n * @return Adjusted value\r\n */\r\n ValueAxis.prototype.fixMin = function (value) {\r\n return value;\r\n };\r\n /**\r\n * Adjusts the maximum value.\r\n *\r\n * This is a placeholder method for extending classes to override.\r\n *\r\n * For numeric values this does nothing, however for more complex types, like\r\n * dates, it may be necessary to adjust.\r\n *\r\n * @param value Value\r\n * @return Adjusted value\r\n */\r\n ValueAxis.prototype.fixMax = function (value) {\r\n return value;\r\n };\r\n /**\r\n * Adjusts actual min and max scale values so that the axis starts and ends\r\n * at \"nice\" values, unless `strictMinMax` is set.\r\n *\r\n * The `difference` can be something else than `max - min`, because of the\r\n * axis breaks.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param min [description]\r\n * @param max [description]\r\n * @param difference [description]\r\n * @param gridCount [description]\r\n * @param strictMode [description]\r\n * @return [description]\r\n */\r\n ValueAxis.prototype.adjustMinMax = function (min, max, difference, gridCount, strictMode) {\r\n // will fail if 0\r\n if (gridCount <= 1) {\r\n gridCount = 1;\r\n }\r\n gridCount = Math.round(gridCount);\r\n var initialMin = min;\r\n var initialMax = max;\r\n // in case min and max is the same, use max\r\n if (difference === 0) {\r\n difference = Math.abs(max);\r\n }\r\n // the number by which we need to raise 10 to get difference\r\n var exponent = Math.log(Math.abs(difference)) * Math.LOG10E;\r\n // here we find a number which is power of 10 and has the same count of numbers as difference has\r\n var power = Math.pow(10, Math.floor(exponent));\r\n // reduce this number by 10 times\r\n power = power / 10;\r\n var extra = power;\r\n if (strictMode) {\r\n extra = 0;\r\n }\r\n if (!this.logarithmic) {\r\n // round down min\r\n if (strictMode) {\r\n min = Math.floor(min / power) * power;\r\n // round up max\r\n max = Math.ceil(max / power) * power;\r\n }\r\n else {\r\n min = Math.ceil(min / power) * power - extra;\r\n // round up max\r\n max = Math.floor(max / power) * power + extra;\r\n }\r\n // don't let min go below 0 if real min is >= 0\r\n if (min < 0 && initialMin >= 0) {\r\n min = 0;\r\n }\r\n // don't let max go above 0 if real max is <= 0\r\n if (max > 0 && initialMax <= 0) {\r\n max = 0;\r\n }\r\n }\r\n else {\r\n if (min <= 0) {\r\n //throw Error(\"Logarithmic value axis can not have values <= 0.\");\r\n min = this.baseValue;\r\n }\r\n // @todo: think of a better way or to restrict zooming when no series are selected\r\n if (min == Infinity) {\r\n min = 1;\r\n }\r\n if (max == -Infinity) {\r\n max = 10;\r\n }\r\n min = Math.pow(10, Math.floor(Math.log(Math.abs(min)) * Math.LOG10E));\r\n max = Math.pow(10, Math.ceil(Math.log(Math.abs(max)) * Math.LOG10E));\r\n if (this.strictMinMax) {\r\n if (this._minDefined > 0) {\r\n min = this._minDefined;\r\n }\r\n if (this._maxDefined > 0) {\r\n max = this._maxDefined;\r\n }\r\n }\r\n }\r\n // repeat diff, exponent and power again with rounded values\r\n //difference = this.adjustDifference(min, max);\r\n /*\r\n\r\n if(min > initialMin){\r\n min = initialMin;\r\n }\r\n\r\n if(max < initialMax){\r\n max = initialMax;\r\n }\r\n */\r\n exponent = Math.log(Math.abs(difference)) * Math.LOG10E;\r\n power = Math.pow(10, Math.floor(exponent));\r\n power = power / 10;\r\n // approximate difference between two grid lines\r\n var step = Math.ceil((difference / gridCount) / power) * power;\r\n var stepPower = Math.pow(10, Math.floor(Math.log(Math.abs(step)) * Math.LOG10E));\r\n // TODO: in v3 I had fixStepE here, ommiting it for a while, need to think about other solution\r\n // the step should divide by 2, 5, and 10.\r\n var stepDivisor = Math.ceil(step / stepPower); // number 0 - 10\r\n if (stepDivisor > 5) {\r\n stepDivisor = 10;\r\n }\r\n else if (stepDivisor <= 5 && stepDivisor > 2) {\r\n stepDivisor = 5;\r\n }\r\n // now get real step\r\n step = Math.ceil(step / (stepPower * stepDivisor)) * stepPower * stepDivisor;\r\n if (this.maxPrecision < Number.MAX_VALUE && step != $math.ceil(step, this.maxPrecision)) {\r\n step = $math.ceil(step, this.maxPrecision);\r\n }\r\n var decCount = 0;\r\n // in case numbers are smaller than 1\r\n if (stepPower < 1) {\r\n // exponent is less then 1 too. Count decimals of exponent\r\n decCount = Math.round(Math.abs(Math.log(Math.abs(stepPower)) * Math.LOG10E)) + 1;\r\n // round step\r\n step = $math.round(step, decCount);\r\n }\r\n if (!this.logarithmic) {\r\n // final min and max\r\n var minCount = Math.floor(min / step);\r\n min = $math.round(step * minCount, decCount);\r\n var maxCount = void 0;\r\n if (!strictMode) {\r\n maxCount = Math.ceil(max / step);\r\n }\r\n else {\r\n maxCount = Math.floor(max / step);\r\n }\r\n if (maxCount == minCount) {\r\n maxCount++;\r\n }\r\n max = $math.round(step * maxCount, decCount);\r\n if (max < initialMax) {\r\n max = max + step;\r\n }\r\n if (min > initialMin) {\r\n min = min - step;\r\n }\r\n }\r\n return { min: min, max: max, step: step };\r\n };\r\n Object.defineProperty(ValueAxis.prototype, \"min\", {\r\n /**\r\n * @return Min value\r\n */\r\n get: function () {\r\n var min = this._minAdjusted;\r\n if (!$type.isNumber(min)) {\r\n min = this._minDefined;\r\n }\r\n return min;\r\n },\r\n /**\r\n * A minimum value for the axis scale.\r\n *\r\n * This value might be auto-adjusted by the Axis in order to accomodate the\r\n * grid nicely, i.e. plot area is divided by grid in nice equal cells.\r\n *\r\n * The above might be overridden by `strictMinMax` which will force exact\r\n * user-defined min and max values to be used for scale.\r\n *\r\n * @param value Min value\r\n */\r\n set: function (value) {\r\n if (this._minDefined != value) {\r\n this._minDefined = value;\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"minDefined\", {\r\n /**\r\n * Min value as defined by user's code, not auto-calculated.\r\n *\r\n * @readonly\r\n * @return Min value\r\n */\r\n get: function () {\r\n return this._minDefined;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"maxDefined\", {\r\n /**\r\n * Max value as defined by user's code, not auto-calculated.\r\n *\r\n * @readonly\r\n * @return Man value\r\n */\r\n get: function () {\r\n return this._maxDefined;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"extraMin\", {\r\n /**\r\n * @return {number}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"extraMin\");\r\n },\r\n /**\r\n * Allows relatively adjusting minimum value of the axis' scale.\r\n *\r\n * The value is relative to the actual range of values currently displayed\r\n * on the axis.\r\n *\r\n * E.g.: 0.5 will mean half of the current range. If we have axis displaying\r\n * from 100 to 200, we will now have axis displaying from 50 to 200 because\r\n * we asked to expand minimum value by 50% (0.5).\r\n *\r\n * @param {number}\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"extraMin\", value)) {\r\n this.invalidateDataItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"extraMax\", {\r\n /**\r\n * @return Min multiplier\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"extraMax\");\r\n },\r\n /**\r\n * Allows relatively adjusting maximum value of the axis' scale.\r\n *\r\n * The value is relative to the actual range of values currently displayed\r\n * on the axis.\r\n *\r\n * E.g.: 0.5 will mean half of the current range. If we have axis displaying\r\n * from 100 to 200, we will now have axis displaying from 100 to 250 because\r\n * we asked to expand maximum value by 50% (0.5).\r\n *\r\n * @param {number}\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"extraMax\", value)) {\r\n this.invalidateDataItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"step\", {\r\n /**\r\n * Current calculated delta in values between two adjacent grid lines (step).\r\n *\r\n * This is a read-only value and cannot be used to set actual step.\r\n *\r\n * @readonly\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/#Setting_the_density_of_the_the_grid_labels} For more information about modifying density of labels\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._step;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"max\", {\r\n /**\r\n * @return Max value\r\n */\r\n get: function () {\r\n var max = this._maxAdjusted;\r\n if (!$type.isNumber(max)) {\r\n max = this._maxDefined;\r\n }\r\n return max;\r\n },\r\n /**\r\n * A maximum value for the axis scale.\r\n *\r\n * This value might be auto-adjusted by the Axis in order to accomodate the\r\n * grid nicely, i.e. plot area is divided by grid in nice equal cells.\r\n *\r\n * The above might be overridden by `strictMinMax` which will force exact\r\n * user-defined min and max values to be used for scale.\r\n *\r\n * @param value Max value\r\n */\r\n set: function (value) {\r\n if (this._maxDefined != value) {\r\n this._maxDefined = value;\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"adjustLabelPrecision\", {\r\n /**\r\n * @return Adjust precision\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"adjustLabelPrecision\");\r\n },\r\n /**\r\n * By default the axis will adjust precision of all numbers to match number\r\n * of decimals in all its labels, e.g.: `1.0`, `1.5`, `2.0`.\r\n *\r\n * To disable set `adjustLabelPrecision` to `false`, to use whatever other\r\n * precision or number format settings are set.\r\n *\r\n * IMPORTANT: This setting will be ignored if your number format uses\r\n * modifiers, e.g. `\"#a\"`.\r\n *\r\n * @default true\r\n * @since 4.9.14\r\n * @param value Adjust precision\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"adjustLabelPrecision\", value)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Used for the Series to register itself as the user of this Axis.\r\n *\r\n * This will also decorate both the Series and Axis with event handlers, used\r\n * to redraw on Axis position/zoom change.\r\n *\r\n * A disposer for those events is returned, so that they can be disposed\r\n * together with Series.\r\n *\r\n * @ignore Exclude from docs\r\n * @param series Series\r\n * @return Disposer for events\r\n */\r\n ValueAxis.prototype.registerSeries = function (series) {\r\n return new MultiDisposer([\r\n _super.prototype.registerSeries.call(this, series),\r\n series.events.on(\"extremeschanged\", this.handleExtremesChange, this, false),\r\n series.events.on(\"selectionextremeschanged\", this.handleSelectionExtremesChange, this, false),\r\n this.events.on(\"extremeschanged\", series.invalidate, series, false)\r\n ]);\r\n };\r\n /**\r\n * Perform tasks after Axis zoom.\r\n */\r\n ValueAxis.prototype.handleSelectionExtremesChange = function () {\r\n var _this = this;\r\n var selectionMin;\r\n var selectionMax;\r\n var allHidden = true;\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (!series.ignoreMinMax && !series.isHidden) {\r\n if (series.visible && !series.isHiding) {\r\n allHidden = false;\r\n }\r\n var seriesSelectionMin = series.selectionMin(_this);\r\n var seriesSelectionMax = series.selectionMax(_this);\r\n if ($type.isNumber(seriesSelectionMin)) {\r\n if (!$type.isNumber(selectionMin) || (seriesSelectionMin < selectionMin)) {\r\n selectionMin = seriesSelectionMin;\r\n }\r\n }\r\n // check max\r\n if ($type.isNumber(seriesSelectionMax)) {\r\n if (!$type.isNumber(selectionMax) || (seriesSelectionMax > selectionMax)) {\r\n selectionMax = seriesSelectionMax;\r\n }\r\n }\r\n }\r\n });\r\n if (this.includeRangesInMinMax) {\r\n this.axisRanges.each(function (range) {\r\n if (!range.ignoreMinMax) {\r\n var minValue = $math.min(range.value, range.endValue);\r\n var maxValue = $math.max(range.value, range.endValue);\r\n if (minValue < selectionMax) {\r\n selectionMax = minValue;\r\n }\r\n if (maxValue > selectionMax) {\r\n selectionMax = maxValue;\r\n }\r\n }\r\n });\r\n }\r\n // this is not good, as if date axis is initially zoomed, selection of y axis is reset to 0, 1 at the end of this method\r\n //$iter.each(this.series.iterator(), (series) => {\r\n //\tif (!series.appeared) {\r\n //\t\tallHidden = true;\r\n //\t}\r\n //})\r\n if ($type.isNumber(this._minDefined)) {\r\n if (this.strictMinMax) {\r\n selectionMin = this._minDefined;\r\n }\r\n else {\r\n selectionMin = this.min;\r\n }\r\n }\r\n else if (this.strictMinMax) {\r\n selectionMin = this._minReal;\r\n }\r\n if ($type.isNumber(this._maxDefined)) {\r\n if (this.strictMinMax) {\r\n selectionMax = this._maxDefined;\r\n }\r\n else {\r\n selectionMax = this.max;\r\n }\r\n }\r\n else if (this.strictMinMax) {\r\n selectionMax = this._maxReal;\r\n }\r\n if (selectionMin == selectionMax) {\r\n selectionMin -= this._deltaMinMax;\r\n selectionMax += this._deltaMinMax;\r\n var minMaxStep2 = this.adjustMinMax(selectionMin, selectionMax, 0, this._gridCount, this.strictMinMax);\r\n selectionMin = minMaxStep2.min;\r\n selectionMax = minMaxStep2.max;\r\n }\r\n var dif = this.adjustDifference(selectionMin, selectionMax);\r\n var minMaxStep = this.adjustMinMax(selectionMin, selectionMax, dif, this._gridCount);\r\n selectionMin = minMaxStep.min;\r\n selectionMax = minMaxStep.max;\r\n selectionMin -= (selectionMax - selectionMin) * this.extraMin;\r\n selectionMax += (selectionMax - selectionMin) * this.extraMax;\r\n selectionMin = $math.fitToRange(selectionMin, this.min, this.max);\r\n selectionMax = $math.fitToRange(selectionMax, this.min, this.max);\r\n // do it for the second time !important\r\n dif = this.adjustDifference(selectionMin, selectionMax);\r\n minMaxStep = this.adjustMinMax(selectionMin, selectionMax, dif, this._gridCount, true);\r\n selectionMin = minMaxStep.min;\r\n selectionMax = minMaxStep.max;\r\n if (this.strictMinMax) {\r\n selectionMin = $math.max(selectionMin, this._minDefined);\r\n selectionMax = $math.min(selectionMax, this._maxDefined);\r\n }\r\n var step = minMaxStep.step;\r\n if (this.syncWithAxis) {\r\n minMaxStep = this.syncAxes(selectionMin, selectionMax, step);\r\n selectionMin = minMaxStep.min;\r\n selectionMax = minMaxStep.max;\r\n this.invalidate();\r\n }\r\n step = minMaxStep.step;\r\n // needed because of grouping\r\n this._difference = this.adjustDifference(this.min, this.max);\r\n var start = this.valueToPosition(selectionMin);\r\n var end = this.valueToPosition(selectionMax);\r\n // in case all series are hidden or hiding, full zoomout\r\n if (allHidden && !this.syncWithAxis) {\r\n start = 0;\r\n end = 1;\r\n }\r\n var declination = 0;\r\n if (this.syncWithAxis) {\r\n declination = 5;\r\n this.setCache(selectionMin + \"-\" + selectionMax, step);\r\n }\r\n else {\r\n this._step = step;\r\n this._minZoomed = selectionMin;\r\n this._maxZoomed = selectionMax;\r\n }\r\n if (!this.keepSelection) {\r\n this.zoom({ start: start, end: end }, false, false, declination);\r\n }\r\n };\r\n Object.defineProperty(ValueAxis.prototype, \"strictMinMax\", {\r\n /**\r\n * @return Use exact values?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"strictMinMax\");\r\n },\r\n /**\r\n * Indicates whether to blindly use exact `min` and `max` values set by user\r\n * when generating Axis scale.\r\n *\r\n * If not set, the Axis might slightly adjust those values to accomodate a\r\n * better looking grid.\r\n *\r\n * NOTE: if `min` and `max` are not set, setting `strictMinMax` to `true`\r\n * will result in fixing the scale of the axis to actual lowest and highest\r\n * values in the series within currently selected scope.\r\n *\r\n * @default false\r\n * @param value Use exact values?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"strictMinMax\", value)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"logarithmic\", {\r\n /**\r\n * @return Logarithmic scale?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"logarithmic\");\r\n },\r\n /**\r\n * Indicates if this axis should use a logarithmic scale.\r\n *\r\n * Please note that logarithmic axis can **only** accommodate values bigger\r\n * than zero.\r\n *\r\n * Having zero or negative values will result in error and failure of the\r\n * whole chart.\r\n *\r\n * @param value Logarithmic scale?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"logarithmic\", value)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"keepSelection\", {\r\n /**\r\n * @return Preseve zoom after data update?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"keepSelection\");\r\n },\r\n /**\r\n * Indicates if a current selection (zoom) should be kept across data updates.\r\n *\r\n * If your axis is zoomed while chart's data is updated, the axis will try\r\n * to retain the same start and end values.\r\n *\r\n * You can also use this to initially pre-zoom axis:\r\n *\r\n * ```TypeScript\r\n * axis.keepSelection = true;\r\n * axis.start = 0.5;\r\n * axis.end = 0.7;\r\n * ```\r\n * ```JavaScript\r\n * axis.keepSelection = true;\r\n * axis.start = 0.5;\r\n * axis.end = 0.7;\r\n * ```\r\n * ```JSON\r\n * {\r\n * \"xAxes\": [{\r\n * // ...\r\n * \"keepSelection\": true,\r\n * \"start\": 0.5,\r\n * \"end\": 0.7\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * The above will start the chart zoomed from the middle of the actual scope\r\n * to 70%.\r\n *\r\n * @since 4.1.1\r\n * @default flase\r\n * @param value Preseve zoom after data update?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"keepSelection\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"includeRangesInMinMax\", {\r\n /**\r\n * @return Include ranges?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"includeRangesInMinMax\");\r\n },\r\n /**\r\n * If set to `true`, values of axis ranges will be included when calculating\r\n * range of values / scale of the [[ValueAxis]].\r\n *\r\n * @default false\r\n * @since 4.4.9\r\n * @param value Include ranges?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"includeRangesInMinMax\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"maxPrecision\", {\r\n /**\r\n * @return max precision\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maxPrecision\");\r\n },\r\n /**\r\n * Maximum number of decimals to allow when placing grid lines and labels\r\n * on axis.\r\n *\r\n * Set it to `0` (zero) to force integer-only axis labels.\r\n *\r\n * @param {number}\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"maxPrecision\", value)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"extraTooltipPrecision\", {\r\n /**\r\n * @return Extra decimals\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"extraTooltipPrecision\");\r\n },\r\n /**\r\n * This setting allows using bigger precision for numbers displayed in axis\r\n * tooltip.\r\n *\r\n * Please note that this setting indicates additional decimal places to\r\n * automatically-calculated axis number precision.\r\n *\r\n * So if your axis displays numbers like 0.1, 0.2, etc. (one decimal place),\r\n * and you set `extraTooltipPrecision = 1`, tooltips will display numbers\r\n * like 0.12, 0.25, etc. (two decimal places).\r\n *\r\n * @default 0\r\n * @since 4.8.3\r\n * @param value Extra decimals\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"extraTooltipPrecision\", value)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Invalidates axis data items when series extremes change\r\n */\r\n ValueAxis.prototype.handleExtremesChange = function () {\r\n var _this = this;\r\n this._extremesChanged = true;\r\n this.getMinMax();\r\n if (this.ghostLabel) {\r\n var mw_1 = 0;\r\n this.dataItems.each(function (dataItem) {\r\n if (dataItem.label && dataItem.label.pixelWidth > mw_1) {\r\n _this.ghostLabel.text = dataItem.label.currentText;\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Returns relative position on axis for series' data item's value.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey ?\r\n * @return X coordinate (px)\r\n */\r\n ValueAxis.prototype.getX = function (dataItem, key, location, stackKey, range) {\r\n return this.renderer.positionToPoint(this.getPositionX(dataItem, key, location, stackKey, range)).x;\r\n };\r\n /**\r\n * Returns the X coordinate for series' data item's value.\r\n *\r\n * @since 4.5.14\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey ?\r\n * @return Relative position\r\n */\r\n ValueAxis.prototype.getPositionX = function (dataItem, key, location, stackKey, range) {\r\n var value = dataItem.getWorkingValue(key);\r\n if (!$type.hasValue(stackKey)) {\r\n stackKey = \"valueX\";\r\n }\r\n var stack = dataItem.getValue(stackKey, \"stack\");\r\n if (!$type.isNumber(value)) {\r\n value = this.baseValue;\r\n if (this.logarithmic) {\r\n if (stack > 0) {\r\n value = 0;\r\n }\r\n }\r\n }\r\n var position = this.valueToPosition(value + stack);\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns the Y coordinate for series' data item's value.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey Stack ID\r\n * @return Y coordinate (px)\r\n */\r\n ValueAxis.prototype.getY = function (dataItem, key, location, stackKey, range) {\r\n return this.renderer.positionToPoint(this.getPositionY(dataItem, key, location, stackKey, range)).y;\r\n };\r\n /**\r\n * Returns relative position on axis for series' data item's value.\r\n *\r\n * @since 4.5.14\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey Stack ID\r\n * @return Relative position\r\n */\r\n ValueAxis.prototype.getPositionY = function (dataItem, key, location, stackKey, range) {\r\n var value = dataItem.getWorkingValue(key);\r\n if (!$type.hasValue(stackKey)) {\r\n stackKey = \"valueY\";\r\n }\r\n var stack = dataItem.getValue(stackKey, \"stack\");\r\n if (!$type.isNumber(value)) {\r\n value = this.baseValue;\r\n if (this.logarithmic) {\r\n if (stack > 0) {\r\n value = 0;\r\n }\r\n }\r\n }\r\n var position = this.valueToPosition(value + stack);\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns an angle for series data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey Stack ID\r\n * @param range Range to fit in\r\n * @return Angle\r\n */\r\n ValueAxis.prototype.getAngle = function (dataItem, key, location, stackKey, range) {\r\n var value = dataItem.getWorkingValue(key);\r\n var stack = dataItem.getValue(stackKey, \"stack\");\r\n if (!$type.isNumber(value)) {\r\n value = this.baseValue;\r\n }\r\n var position = this.valueToPosition(value + stack);\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return this.positionToAngle(position);\r\n };\r\n /**\r\n * [getAnyRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param start [description]\r\n * @param end [description]\r\n * @param location [description]\r\n * @return [description]\r\n */\r\n ValueAxis.prototype.getAnyRangePath = function (start, end, location) {\r\n var startPosition = this.valueToPosition(start);\r\n var endPosition = this.valueToPosition(end);\r\n return this.getPositionRangePath(startPosition, endPosition); // Base class (Axis) gets range shape from AxisRenderer\r\n };\r\n /**\r\n * Returns text to show in a axis tooltip, based on specific position within\r\n * axis.\r\n *\r\n * The label will be formatted as per [[NumberFormatter]] set for the whole\r\n * chart, or explicitly for this Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position (px)\r\n * @return Label (numeric value)\r\n */\r\n ValueAxis.prototype.getTooltipText = function (position) {\r\n var value = $math.round(this.positionToValue(position), this._stepDecimalPlaces + this.extraTooltipPrecision);\r\n var valueStr = this.tooltip.numberFormatter.format(value);\r\n if (!this._adapterO) {\r\n return valueStr;\r\n }\r\n else {\r\n return this._adapterO.apply(\"getTooltipText\", valueStr);\r\n }\r\n };\r\n /**\r\n * Zooms axis to specific values.\r\n *\r\n * @param startValue Start value\r\n * @param endValue End value\r\n * @param skipRangeEvent Do not invoke events\r\n * @param instantly Do not play zoom animations\r\n */\r\n ValueAxis.prototype.zoomToValues = function (startValue, endValue, skipRangeEvent, instantly) {\r\n var start = (startValue - this.min) / (this.max - this.min);\r\n var end = (endValue - this.min) / (this.max - this.min);\r\n this.zoom({ start: start, end: end }, skipRangeEvent, instantly);\r\n };\r\n Object.defineProperty(ValueAxis.prototype, \"minZoomed\", {\r\n /**\r\n * A smallest value in axis scale within current zoom.\r\n *\r\n * @return Min zoom value\r\n */\r\n get: function () {\r\n if (!this.syncWithAxis) {\r\n return $math.max(this.min, this._minZoomed);\r\n }\r\n else {\r\n return this._minZoomed;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAxis.prototype, \"maxZoomed\", {\r\n /**\r\n * A biggest value in axis scale within current zoom.\r\n * @return [description]\r\n */\r\n get: function () {\r\n if (!this.syncWithAxis) {\r\n return $math.min(this.max, this._maxZoomed);\r\n }\r\n else {\r\n return this._maxZoomed;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates positioning of Axis breaks after something changes.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ValueAxis.prototype.fixAxisBreaks = function () {\r\n var _this = this;\r\n _super.prototype.fixAxisBreaks.call(this);\r\n var axisBreaks = this._axisBreaks;\r\n if (axisBreaks && axisBreaks.length > 0) {\r\n // process breaks\r\n axisBreaks.each(function (axisBreak) {\r\n var startValue = axisBreak.adjustedStartValue;\r\n var endValue = axisBreak.adjustedEndValue;\r\n // break difference\r\n var axisBreakDif = endValue - startValue;\r\n var axisBreakGridCount = Math.ceil(axisBreakDif * axisBreak.breakSize) * _this._gridCount / (_this.max - _this.min);\r\n // calculate min, max and step for axis break\r\n var breakMinMaxStep = _this.adjustMinMax(startValue, endValue, axisBreakDif, axisBreakGridCount, true);\r\n axisBreak.adjustedStep = breakMinMaxStep.step;\r\n axisBreak.adjustedMin = breakMinMaxStep.min;\r\n axisBreak.adjustedMax = breakMinMaxStep.max;\r\n });\r\n }\r\n this._difference = this.adjustDifference(this.min, this.max);\r\n };\r\n /**\r\n * Returns value based on position.\r\n *\r\n * Please note that `position` represents position within axis which may be\r\n * zoomed and not correspond to Cursor's `position`.\r\n *\r\n * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.\r\n * @param position Relative position on axis (0-1)\r\n * @return Position label\r\n */\r\n ValueAxis.prototype.getPositionLabel = function (position) {\r\n var value = this.positionToValue(position);\r\n return this.numberFormatter.format(value);\r\n };\r\n /**\r\n * Shows Axis tooltip at specific value\r\n *\r\n * @param value Value\r\n */\r\n ValueAxis.prototype.showTooltipAt = function (value) {\r\n this.showTooltipAtPosition(this.valueToPosition(value));\r\n };\r\n /**\r\n * Copies all properties and related data from a different instance of Axis.\r\n *\r\n * @param source Source Axis\r\n */\r\n ValueAxis.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.min = source.min;\r\n this.max = source.max;\r\n this.calculateTotals = source.calculateTotals;\r\n this._baseValue = source.baseValue;\r\n };\r\n Object.defineProperty(ValueAxis.prototype, \"syncWithAxis\", {\r\n /**\r\n * @return Target axis\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"syncWithAxis\");\r\n },\r\n /**\r\n * Enables syncing of grid with another axis.\r\n *\r\n * To enable, set to a reference of the other `ValueAxis`. This axis will try\r\n * to maintain its scale in such way that its grid matches target axis grid.\r\n *\r\n * IMPORTANT #1: At this stage it's an experimental feature. Use it at your\r\n * own risk, as it may not work in 100% of the scenarios.\r\n *\r\n * IMPORTANT #2: `syncWithAxis` is not compatible with `strictMinMax` and\r\n * `sequencedInterpolation` settings.\r\n *\r\n * @since 4.8.1\r\n * @param axis Target axis\r\n */\r\n set: function (axis) {\r\n var _this = this;\r\n if (this.setPropertyValue(\"syncWithAxis\", axis, true)) {\r\n if (axis) {\r\n this._disposers.push(axis.events.on(\"extremeschanged\", this.handleSelectionExtremesChange, this, false));\r\n this._disposers.push(axis.events.on(\"selectionextremeschanged\", this.handleSelectionExtremesChange, this, false));\r\n this.events.on(\"shown\", this.handleSelectionExtremesChange, this, false);\r\n this.events.on(\"maxsizechanged\", function () {\r\n _this.clearCache();\r\n _this._disposers.push(registry.events.once(\"exitframe\", function () {\r\n _this.handleSelectionExtremesChange();\r\n }));\r\n }, this, false);\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Syncs with a target axis.\r\n *\r\n * @param min Min\r\n * @param max Max\r\n * @param step Step\r\n */\r\n ValueAxis.prototype.syncAxes = function (min, max, step) {\r\n var axis = this.syncWithAxis;\r\n if (axis) {\r\n if (!$type.isNumber(min)) {\r\n min = this.min;\r\n }\r\n if (!$type.isNumber(max)) {\r\n max = this.max;\r\n }\r\n if (!$type.isNumber(step)) {\r\n step = this._step;\r\n }\r\n var count = Math.round((axis.maxZoomed - axis.minZoomed) / axis.step);\r\n var currentCount = Math.round((max - min) / step);\r\n if ($type.isNumber(count) && $type.isNumber(currentCount)) {\r\n var synced = false;\r\n var c = 0;\r\n var diff = (max - min) * 0.01;\r\n var omin = min;\r\n var omax = max;\r\n var ostep = step;\r\n while (synced != true) {\r\n synced = this.checkSync(omin, omax, ostep, count);\r\n c++;\r\n if (c > 1000) {\r\n synced = true;\r\n }\r\n if (!synced) {\r\n //omin = min - diff * c;\r\n if (c / 3 == Math.round(c / 3)) {\r\n omin = min - diff * c;\r\n if (min >= 0 && omin < 0) {\r\n omin = 0;\r\n }\r\n }\r\n else {\r\n omax = max + diff * c;\r\n if (omax <= 0 && omax > 0) {\r\n omax = 0;\r\n }\r\n }\r\n var minMaxStep = this.adjustMinMax(omin, omax, omax - omin, this._gridCount, true);\r\n omin = minMaxStep.min;\r\n omax = minMaxStep.max;\r\n ostep = minMaxStep.step;\r\n }\r\n else {\r\n min = omin;\r\n max = omax;\r\n step = ostep;\r\n }\r\n }\r\n }\r\n }\r\n return { min: min, max: max, step: step };\r\n };\r\n /**\r\n * Returns `true` if axis needs to be resunced with some other axis.\r\n */\r\n ValueAxis.prototype.checkSync = function (min, max, step, count) {\r\n var currentCount = (max - min) / step;\r\n for (var i = 1; i < count; i++) {\r\n if ($math.round(currentCount / i, 1) == count || currentCount * i == count) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n ValueAxis.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Set up axes\r\n if ($type.hasValue(config.syncWithAxis) && $type.isString(config.syncWithAxis)) {\r\n if (this.map.hasKey(config.syncWithAxis)) {\r\n config.syncWithAxis = this.map.getKey(config.syncWithAxis);\r\n }\r\n else {\r\n this.processingErrors.push(\"[ValueAxis] No axis with id \\\"\" + config.syncWithAxis + \"\\\" found for `syncWithAxis`\");\r\n delete config.xAxis;\r\n }\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n return ValueAxis;\r\n}(Axis));\r\nexport { ValueAxis };\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[\"ValueAxis\"] = ValueAxis;\r\nregistry.registeredClasses[\"ValueAxisDataItem\"] = ValueAxisDataItem;\r\n//# sourceMappingURL=ValueAxis.js.map","/**\r\n * DateAxisBreak includes functionality to add breaks on a [[DateAxis]].\r\n *\r\n * A \"break\" can be used to \"cut out\" specific ranges of the axis scale, e.g.\r\n * weekends and holidays out of the Date-based axis.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ValueAxisBreak } from \"./ValueAxisBreak\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to define breaks for [[DateAxis]].\r\n *\r\n * A \"break\" can be used to \"cut out\" specific ranges of the axis scale, e.g.\r\n * weekends and holidays out of the Date-based axis.\r\n *\r\n * @see {@link IDateAxisBreakEvents} for a list of available events\r\n * @see {@link IDateAxisBreakAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar DateAxisBreak = /** @class */ (function (_super) {\r\n __extends(DateAxisBreak, _super);\r\n /**\r\n * Constructor\r\n */\r\n function DateAxisBreak() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"DateAxisBreak\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(DateAxisBreak.prototype, \"startDate\", {\r\n /**\r\n * @return Start date\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startDate\");\r\n },\r\n /**\r\n * Starting date for the break.\r\n *\r\n * @param value Start date\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"startDate\", value)) {\r\n this.startValue = value.getTime();\r\n if (this.axis) {\r\n this.axis.invalidate();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxisBreak.prototype, \"endDate\", {\r\n /**\r\n * @return End date\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endDate\");\r\n },\r\n /**\r\n * Ending date for the break.\r\n *\r\n * @param value End date\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"endDate\", value)) {\r\n this.endValue = value.getTime();\r\n if (this.axis) {\r\n this.axis.invalidate();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return DateAxisBreak;\r\n}(ValueAxisBreak));\r\nexport { DateAxisBreak };\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[\"DateAxisBreak\"] = DateAxisBreak;\r\n//# sourceMappingURL=DateAxisBreak.js.map","/**\r\n * DateAxis module\r\n */\r\nimport { __assign, __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ValueAxis, ValueAxisDataItem } from \"./ValueAxis\";\r\nimport { List } from \"../../core/utils/List\";\r\nimport { Dictionary } from \"../../core/utils/Dictionary\";\r\nimport { DateAxisBreak } from \"./DateAxisBreak\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $time from \"../../core/utils/Time\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport { OrderedListTemplate } from \"../../core/utils/SortedList\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines data item for [[DateAxis]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar DateAxisDataItem = /** @class */ (function (_super) {\r\n __extends(DateAxisDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function DateAxisDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"DateAxisDataItem\";\r\n _this.applyTheme();\r\n _this.values.date = {};\r\n _this.values.endDate = {};\r\n return _this;\r\n }\r\n Object.defineProperty(DateAxisDataItem.prototype, \"date\", {\r\n /**\r\n * @return Date\r\n */\r\n get: function () {\r\n return this.dates[\"date\"];\r\n },\r\n /**\r\n * Date position of the data item.\r\n *\r\n * @param date Date\r\n */\r\n set: function (date) {\r\n this.setDate(\"date\", date);\r\n this.value = date.getTime();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxisDataItem.prototype, \"endDate\", {\r\n /**\r\n * @return End date\r\n */\r\n get: function () {\r\n return this.dates[\"endDate\"];\r\n },\r\n /**\r\n * End date for data item.\r\n *\r\n * @param date End date\r\n */\r\n set: function (date) {\r\n this.setDate(\"endDate\", date);\r\n this.endValue = date.getTime();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return DateAxisDataItem;\r\n}(ValueAxisDataItem));\r\nexport { DateAxisDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to create a date/time-based axis for the chart.\r\n *\r\n * ```TypeScript\r\n * // Create the axis\r\n * let xAxis = chart.xAxes.push(new am4charts.DateAxis());\r\n *\r\n * // Set settings\r\n * xAxis.title.text = \"Time\";\r\n * ```\r\n * ```JavaScript\r\n * // Create the axis\r\n * var valueAxis = chart.xAxes.push(new am4charts.DateAxis());\r\n *\r\n * // Set settings\r\n * valueAxis.title.text = \"Time\";\r\n * ```\r\n * ```JSON\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * \"title\": {\r\n * \"text\": \"Time\"\r\n * }\r\n * }]\r\n * ```\r\n *\r\n * @see {@link IDateAxisEvents} for a list of available Events\r\n * @see {@link IDateAxisAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/date-axis/} got `DateAxis` documention\r\n * @important\r\n */\r\nvar DateAxis = /** @class */ (function (_super) {\r\n __extends(DateAxis, _super);\r\n /**\r\n * Constructor\r\n */\r\n function DateAxis() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this._gapBreaks = false;\r\n /**\r\n * A list of date/time intervals for Date axis.\r\n *\r\n * This define various granularities available for the axis. For example\r\n * if you have an axis spanning an hour, and space for 6 grid lines / labels\r\n * the axis will choose the granularity of 10 minutes, displaying a label\r\n * every 10 minutes.\r\n *\r\n * Default intervals:\r\n *\r\n * ```JSON\r\n * [\r\n * { timeUnit: \"millisecond\", count: 1 },\r\n * { timeUnit: \"millisecond\", count: 5 },\r\n * { timeUnit: \"millisecond\", count: 10 },\r\n * { timeUnit: \"millisecond\", count: 50 },\r\n * { timeUnit: \"millisecond\", count: 100 },\r\n * { timeUnit: \"millisecond\", count: 500 },\r\n * { timeUnit: \"second\", count: 1 },\r\n * { timeUnit: \"second\", count: 5 },\r\n * { timeUnit: \"second\", count: 10 },\r\n * { timeUnit: \"second\", count: 30 },\r\n * { timeUnit: \"minute\", count: 1 },\r\n * { timeUnit: \"minute\", count: 5 },\r\n * { timeUnit: \"minute\", count: 10 },\r\n * { timeUnit: \"minute\", count: 30 },\r\n * { timeUnit: \"hour\", count: 1 },\r\n * { timeUnit: \"hour\", count: 3 },\r\n * { timeUnit: \"hour\", count: 6 },\r\n * { timeUnit: \"hour\", count: 12 },\r\n * { timeUnit: \"day\", count: 1 },\r\n * { timeUnit: \"day\", count: 2 },\r\n * { timeUnit: \"day\", count: 3 },\r\n * { timeUnit: \"day\", count: 4 },\r\n * { timeUnit: \"day\", count: 5 },\r\n * { timeUnit: \"week\", count: 1 },\r\n * { timeUnit: \"month\", count: 1 },\r\n * { timeUnit: \"month\", count: 2 },\r\n * { timeUnit: \"month\", count: 3 },\r\n * { timeUnit: \"month\", count: 6 },\r\n * { timeUnit: \"year\", count: 1 },\r\n * { timeUnit: \"year\", count: 2 },\r\n * { timeUnit: \"year\", count: 5 },\r\n * { timeUnit: \"year\", count: 10 },\r\n * { timeUnit: \"year\", count: 50 },\r\n * { timeUnit: \"year\", count: 100 }\r\n * ]\r\n * ```\r\n */\r\n _this.gridIntervals = new List();\r\n /**\r\n * If data aggregation is enabled by setting Axis' `groupData = true`, the\r\n * chart will try to aggregate data items into grouped data items.\r\n *\r\n * If there are more data items in selected period than `groupCount`, it will\r\n * group data items into bigger period.\r\n *\r\n * For example seconds might be grouped into 10-second aggregate data items.\r\n *\r\n * This setting indicates what group intervals can the chart group to.\r\n *\r\n * Default intervals:\r\n *\r\n * ```JSON\r\n * [\r\n * { timeUnit: \"millisecond\", count: 1},\r\n * { timeUnit: \"millisecond\", count: 10 },\r\n * { timeUnit: \"millisecond\", count: 100 },\r\n * { timeUnit: \"second\", count: 1 },\r\n * { timeUnit: \"second\", count: 10 },\r\n * { timeUnit: \"minute\", count: 1 },\r\n * { timeUnit: \"minute\", count: 10 },\r\n * { timeUnit: \"hour\", count: 1 },\r\n * { timeUnit: \"day\", count: 1 },\r\n * { timeUnit: \"week\", count: 1 },\r\n * { timeUnit: \"month\", count: 1 },\r\n * { timeUnit: \"year\", count: 1 }\r\n * ]\r\n * ```\r\n * `groupData = true` does not work in combination with `skipEmptyPeriods = true`.\r\n *\r\n * @since 4.7.0\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/date-axis/#Dynamic_data_item_grouping} for more information about dynamic data item grouping.\r\n */\r\n _this.groupIntervals = new List();\r\n /**\r\n * A collection of date formats to use when formatting different time units\r\n * on Date/time axis.\r\n *\r\n * Actual defaults will depend on the language locale set for the chart.\r\n *\r\n * To override format for a specific time unit, say days, you need to set\r\n * the appropriate key to a format string. E.g.:\r\n *\r\n * ```TypeScript\r\n * axis.dateFormats.setKey(\"day\", \"MMMM d, yyyy\");\r\n * ```\r\n * ```JavaScript\r\n * axis.dateFormats.setKey(\"day\", \"MMMM d, yyyy\");\r\n * ```\r\n * ```JSON\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * \"dateFormats\": {\r\n * \"day\": \"MMMM d, yyyy\"\r\n * }\r\n * }]\r\n * ```\r\n *\r\n * @see {@link DateFormatter}\r\n */\r\n _this.dateFormats = new Dictionary();\r\n /**\r\n * These formats are applied to labels that are first in a larger unit.\r\n *\r\n * For example, if we have a DateAxis with days on it, the first day of month\r\n * indicates a break in month - a start of the bigger period.\r\n *\r\n * For those labels, `periodChangeDateFormats` are applied instead of\r\n * `dateFormats`.\r\n *\r\n * This allows us implement convenient structures, like instead of:\r\n *\r\n * `Jan 1 - Jan 2 - Jan 3 - ...`\r\n *\r\n * We can have:\r\n *\r\n * `Jan - 1 - 2 - 3 - ...`\r\n *\r\n * This can be disabled by setting `markUnitChange = false`.\r\n */\r\n _this.periodChangeDateFormats = new Dictionary();\r\n /**\r\n * Actual interval (granularity) derived from the actual data.\r\n */\r\n _this._baseIntervalReal = { timeUnit: \"day\", count: 1 };\r\n /**\r\n */\r\n _this._prevSeriesTime = {};\r\n /**\r\n * [_minDifference description]\r\n *\r\n * @todo Description\r\n */\r\n _this._minDifference = {};\r\n /**\r\n * @ignore\r\n */\r\n _this._firstWeekDay = 1;\r\n /**\r\n * A collection of start timestamps to use as axis' min timestamp for\r\n * particular data item item periods.\r\n *\r\n * @since 4.7.0\r\n * @readonly\r\n */\r\n _this.groupMin = {};\r\n /**\r\n * A collection of start timestamps to use as axis' max timestamp for\r\n * particular data item item periods.\r\n *\r\n * @since 4.7.0\r\n * @readonly\r\n */\r\n _this.groupMax = {};\r\n _this.className = \"DateAxis\";\r\n _this.setPropertyValue(\"markUnitChange\", true);\r\n _this.snapTooltip = true;\r\n _this.tooltipPosition = \"pointer\";\r\n _this.setPropertyValue(\"groupData\", false);\r\n _this.groupCount = 200;\r\n _this.events.on(\"parentset\", _this.getDFFormatter, _this, false);\r\n // Translatable defaults are applied in `applyInternalDefaults()`\r\n // ...\r\n // Define default intervals\r\n _this.gridIntervals.pushAll([\r\n { timeUnit: \"millisecond\", count: 1 },\r\n { timeUnit: \"millisecond\", count: 5 },\r\n { timeUnit: \"millisecond\", count: 10 },\r\n { timeUnit: \"millisecond\", count: 50 },\r\n { timeUnit: \"millisecond\", count: 100 },\r\n { timeUnit: \"millisecond\", count: 500 },\r\n { timeUnit: \"second\", count: 1 },\r\n { timeUnit: \"second\", count: 5 },\r\n { timeUnit: \"second\", count: 10 },\r\n { timeUnit: \"second\", count: 30 },\r\n { timeUnit: \"minute\", count: 1 },\r\n { timeUnit: \"minute\", count: 5 },\r\n { timeUnit: \"minute\", count: 10 },\r\n { timeUnit: \"minute\", count: 15 },\r\n { timeUnit: \"minute\", count: 30 },\r\n { timeUnit: \"hour\", count: 1 },\r\n { timeUnit: \"hour\", count: 3 },\r\n { timeUnit: \"hour\", count: 6 },\r\n { timeUnit: \"hour\", count: 12 },\r\n { timeUnit: \"day\", count: 1 },\r\n { timeUnit: \"day\", count: 2 },\r\n { timeUnit: \"day\", count: 3 },\r\n { timeUnit: \"day\", count: 4 },\r\n { timeUnit: \"day\", count: 5 },\r\n { timeUnit: \"week\", count: 1 },\r\n { timeUnit: \"month\", count: 1 },\r\n { timeUnit: \"month\", count: 2 },\r\n { timeUnit: \"month\", count: 3 },\r\n { timeUnit: \"month\", count: 6 },\r\n { timeUnit: \"year\", count: 1 },\r\n { timeUnit: \"year\", count: 2 },\r\n { timeUnit: \"year\", count: 5 },\r\n { timeUnit: \"year\", count: 10 },\r\n { timeUnit: \"year\", count: 50 },\r\n { timeUnit: \"year\", count: 100 },\r\n { timeUnit: \"year\", count: 200 },\r\n { timeUnit: \"year\", count: 500 },\r\n { timeUnit: \"year\", count: 1000 },\r\n { timeUnit: \"year\", count: 2000 },\r\n { timeUnit: \"year\", count: 5000 },\r\n { timeUnit: \"year\", count: 10000 },\r\n { timeUnit: \"year\", count: 100000 }\r\n ]);\r\n _this.groupIntervals.pushAll([\r\n { timeUnit: \"millisecond\", count: 1 },\r\n { timeUnit: \"millisecond\", count: 10 },\r\n { timeUnit: \"millisecond\", count: 100 },\r\n { timeUnit: \"second\", count: 1 },\r\n { timeUnit: \"second\", count: 10 },\r\n { timeUnit: \"minute\", count: 1 },\r\n { timeUnit: \"minute\", count: 10 },\r\n { timeUnit: \"hour\", count: 1 },\r\n { timeUnit: \"day\", count: 1 },\r\n { timeUnit: \"week\", count: 1 },\r\n { timeUnit: \"month\", count: 1 },\r\n { timeUnit: \"year\", count: 1 }\r\n ]);\r\n // Set field name\r\n _this.axisFieldName = \"date\";\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * A function which applies fills to axis cells.\r\n *\r\n * Default function fills every second fill. You can set this to a function\r\n * that follows some other logic.\r\n *\r\n * Function should accept a [[DateAxisDataItem]] and modify its `axisFill`\r\n * property accordingly.\r\n */\r\n DateAxis.prototype.fillRule = function (dataItem) {\r\n var value = dataItem.value;\r\n var axis = dataItem.component;\r\n var gridInterval = axis._gridInterval;\r\n var gridDuration = $time.getDuration(gridInterval.timeUnit, gridInterval.count);\r\n if (Math.round((value - axis.min) / gridDuration) / 2 == Math.round(Math.round((value - axis.min) / gridDuration) / 2)) {\r\n dataItem.axisFill.__disabled = true;\r\n }\r\n else {\r\n dataItem.axisFill.__disabled = false;\r\n }\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n DateAxis.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Set default date formats\r\n if (!this.dateFormats.hasKey(\"millisecond\")) {\r\n this.dateFormats.setKey(\"millisecond\", this.language.translate(\"_date_millisecond\"));\r\n }\r\n if (!this.dateFormats.hasKey(\"second\")) {\r\n this.dateFormats.setKey(\"second\", this.language.translate(\"_date_second\"));\r\n }\r\n if (!this.dateFormats.hasKey(\"minute\")) {\r\n this.dateFormats.setKey(\"minute\", this.language.translate(\"_date_minute\"));\r\n }\r\n if (!this.dateFormats.hasKey(\"hour\")) {\r\n this.dateFormats.setKey(\"hour\", this.language.translate(\"_date_hour\"));\r\n }\r\n if (!this.dateFormats.hasKey(\"day\")) {\r\n this.dateFormats.setKey(\"day\", this.language.translate(\"_date_day\"));\r\n }\r\n if (!this.dateFormats.hasKey(\"week\")) {\r\n this.dateFormats.setKey(\"week\", this.language.translate(\"_date_day\")); // not a mistake\r\n }\r\n if (!this.dateFormats.hasKey(\"month\")) {\r\n this.dateFormats.setKey(\"month\", this.language.translate(\"_date_month\"));\r\n }\r\n if (!this.dateFormats.hasKey(\"year\")) {\r\n this.dateFormats.setKey(\"year\", this.language.translate(\"_date_year\"));\r\n }\r\n if (!this.periodChangeDateFormats.hasKey(\"millisecond\")) {\r\n this.periodChangeDateFormats.setKey(\"millisecond\", this.language.translate(\"_date_millisecond\"));\r\n }\r\n if (!this.periodChangeDateFormats.hasKey(\"second\")) {\r\n this.periodChangeDateFormats.setKey(\"second\", this.language.translate(\"_date_second\"));\r\n }\r\n if (!this.periodChangeDateFormats.hasKey(\"minute\")) {\r\n this.periodChangeDateFormats.setKey(\"minute\", this.language.translate(\"_date_minute\"));\r\n }\r\n if (!this.periodChangeDateFormats.hasKey(\"hour\")) {\r\n this.periodChangeDateFormats.setKey(\"hour\", this.language.translate(\"_date_day\"));\r\n }\r\n if (!this.periodChangeDateFormats.hasKey(\"day\")) {\r\n this.periodChangeDateFormats.setKey(\"day\", this.language.translate(\"_date_day\"));\r\n }\r\n if (!this.periodChangeDateFormats.hasKey(\"week\")) {\r\n this.periodChangeDateFormats.setKey(\"week\", this.language.translate(\"_date_day\"));\r\n }\r\n if (!this.periodChangeDateFormats.hasKey(\"month\")) {\r\n this.periodChangeDateFormats.setKey(\"month\", this.language.translate(\"_date_month\") + \" \" + this.language.translate(\"_date_year\"));\r\n }\r\n };\r\n /**\r\n * Returns a new/empty [[DataItem]] of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n DateAxis.prototype.createDataItem = function () {\r\n return new DateAxisDataItem();\r\n };\r\n /**\r\n * Returns a new/empty [[AxisBreak]] of the appropriate type.\r\n *\r\n * @return Axis break\r\n */\r\n DateAxis.prototype.createAxisBreak = function () {\r\n return new DateAxisBreak();\r\n };\r\n /**\r\n * Validates Axis' data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n DateAxis.prototype.validateDataItems = function () {\r\n // allows to keep selection of the same size\r\n var start = this.start;\r\n var end = this.end;\r\n var baseDuration = this.baseDuration;\r\n var periodCount = (this.max - this.min) / baseDuration;\r\n this._firstWeekDay = this.getFirstWeekDay();\r\n this.getDFFormatter();\r\n _super.prototype.validateDataItems.call(this);\r\n var mainBaseDuration = $time.getDuration(this.mainBaseInterval.timeUnit, this.mainBaseInterval.count);\r\n this.maxZoomFactor = (this.max - this.min) / mainBaseDuration;\r\n this._deltaMinMax = this.baseDuration / 2;\r\n // allows to keep selection of the same size\r\n var newPeriodCount = (this.max - this.min) / baseDuration;\r\n start = start + (end - start) * (1 - periodCount / newPeriodCount);\r\n this.zoom({ start: start, end: end }, false, true); // added instantlyto solve zoomout problem when we have axes gaps. @todo: check how this affects maxZoomFactor\r\n };\r\n /**\r\n * Handles process after zoom.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Does nothing?\r\n */\r\n DateAxis.prototype.handleSelectionExtremesChange = function () {\r\n };\r\n /**\r\n * Calculates all positions, related to axis as per current zoom.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n DateAxis.prototype.calculateZoom = function () {\r\n var _this = this;\r\n _super.prototype.calculateZoom.call(this);\r\n var difference = this.adjustDifference(this._minZoomed, this._maxZoomed);\r\n var dataSetChanged = false;\r\n // if data has to be grouped, choose interval and set dataset\r\n if (this.groupData && $type.hasValue(difference)) {\r\n var mainBaseInterval = this.mainBaseInterval;\r\n var modifiedDifference = difference + this.startLocation + (1 - this.endLocation) * this.baseDuration;\r\n var groupInterval = void 0;\r\n if (this.groupInterval) {\r\n groupInterval = __assign({}, this.groupInterval);\r\n }\r\n else {\r\n groupInterval = this.chooseInterval(0, modifiedDifference, this.groupCount, this.groupIntervals);\r\n if ($time.getDuration(groupInterval.timeUnit, groupInterval.count) < $time.getDuration(mainBaseInterval.timeUnit, mainBaseInterval.count)) {\r\n groupInterval = __assign({}, mainBaseInterval);\r\n }\r\n }\r\n this._groupInterval = groupInterval;\r\n var newId = groupInterval.timeUnit + groupInterval.count;\r\n if (this._currentDataSetId != newId) {\r\n this._currentDataSetId = newId;\r\n this.dispatch(\"groupperiodchanged\");\r\n }\r\n this.series.each(function (series) {\r\n if (series.baseAxis == _this) {\r\n if (series.setDataSet(_this._currentDataSetId)) {\r\n dataSetChanged = true;\r\n }\r\n }\r\n });\r\n }\r\n var gridInterval = this.chooseInterval(0, difference, this._gridCount);\r\n if ($time.getDuration(gridInterval.timeUnit, gridInterval.count) < this.baseDuration) {\r\n gridInterval = __assign({}, this.baseInterval);\r\n }\r\n this._gridInterval = gridInterval;\r\n this._nextGridUnit = $time.getNextUnit(gridInterval.timeUnit);\r\n // the following is needed to avoid grid flickering while scrolling\r\n this._intervalDuration = $time.getDuration(gridInterval.timeUnit, gridInterval.count);\r\n this._gridDate = $time.round(new Date(this.minZoomed - $time.getDuration(gridInterval.timeUnit, gridInterval.count)), gridInterval.timeUnit, gridInterval.count, this._firstWeekDay, this._df.utc, new Date(this.min));\r\n // tell series start/end\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (series.baseAxis == _this) {\r\n var field_1 = series.getAxisField(_this);\r\n var minZoomed = $time.round(new Date(_this._minZoomed + _this.baseDuration * 0.05), _this.baseInterval.timeUnit, _this.baseInterval.count, _this._firstWeekDay, _this._df.utc).getTime();\r\n var minZoomedStr = minZoomed.toString();\r\n var startDataItem = series.dataItemsByAxis.getKey(_this.uid).getKey(minZoomedStr + series.currentDataSetId);\r\n var startIndex = 0;\r\n if (_this.start != 0) {\r\n if (startDataItem) {\r\n startDataItem = _this.findFirst(startDataItem, minZoomed, field_1);\r\n startIndex = startDataItem.index;\r\n }\r\n else {\r\n startIndex = series.dataItems.findClosestIndex(_this._minZoomed, function (x) { return x[field_1]; }, \"left\");\r\n }\r\n }\r\n // 1 millisecond is removed so that if only first item is selected, it would not count in the second.\r\n var baseInterval = _this.baseInterval;\r\n var maxZoomed = $time.add($time.round(new Date(_this._maxZoomed), baseInterval.timeUnit, baseInterval.count, _this._firstWeekDay, _this._df.utc), baseInterval.timeUnit, baseInterval.count, _this._df.utc).getTime();\r\n var maxZoomedStr = maxZoomed.toString();\r\n var endDataItem = series.dataItemsByAxis.getKey(_this.uid).getKey(maxZoomedStr + series.currentDataSetId);\r\n var endIndex = series.dataItems.length;\r\n if (_this.end != 1) {\r\n if (endDataItem) {\r\n endIndex = endDataItem.index;\r\n }\r\n else {\r\n maxZoomed -= 1;\r\n endIndex = series.dataItems.findClosestIndex(maxZoomed, function (x) { return x[field_1]; }, \"right\");\r\n if (endIndex < series.dataItems.length) {\r\n endIndex++;\r\n }\r\n }\r\n }\r\n series.startIndex = startIndex;\r\n series.endIndex = endIndex;\r\n if (!dataSetChanged && series.dataRangeInvalid) {\r\n series.validateDataRange();\r\n }\r\n }\r\n });\r\n };\r\n DateAxis.prototype.findFirst = function (dataItem, time, key) {\r\n var index = dataItem.index;\r\n if (index > 0) {\r\n var series = dataItem.component;\r\n var previousDataItem = series.dataItems.getIndex(index - 1);\r\n var previousDate = previousDataItem[key];\r\n if (!previousDate || previousDate.getTime() < time) {\r\n return dataItem;\r\n }\r\n else {\r\n return this.findFirst(previousDataItem, time, key);\r\n }\r\n }\r\n else {\r\n return dataItem;\r\n }\r\n };\r\n /**\r\n * (Re)validates data.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n DateAxis.prototype.validateData = function () {\r\n _super.prototype.validateData.call(this);\r\n if (!$type.isNumber(this.baseInterval.count)) {\r\n this.baseInterval.count = 1;\r\n }\r\n };\r\n Object.defineProperty(DateAxis.prototype, \"minDifference\", {\r\n /**\r\n * @ignore\r\n */\r\n get: function () {\r\n var _this = this;\r\n var minDifference = Number.MAX_VALUE;\r\n this.series.each(function (series) {\r\n if (minDifference > _this._minDifference[series.uid]) {\r\n minDifference = _this._minDifference[series.uid];\r\n }\r\n });\r\n if (minDifference == Number.MAX_VALUE || minDifference == 0) {\r\n minDifference = $time.getDuration(\"day\");\r\n }\r\n return minDifference;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * [dataChangeUpdate description]\r\n *\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n DateAxis.prototype.seriesDataChangeUpdate = function (series) {\r\n this._minDifference[series.uid] = Number.MAX_VALUE;\r\n };\r\n /**\r\n * [postProcessSeriesDataItems description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n DateAxis.prototype.postProcessSeriesDataItems = function (series) {\r\n var _this = this;\r\n if (series) {\r\n this.seriesGroupUpdate(series);\r\n }\r\n else {\r\n this.series.each(function (series) {\r\n _this.seriesGroupUpdate(series);\r\n });\r\n }\r\n this.addEmptyUnitsBreaks();\r\n };\r\n DateAxis.prototype.seriesGroupUpdate = function (series) {\r\n var _this = this;\r\n if (JSON.stringify(series._baseInterval[this.uid]) != JSON.stringify(this.mainBaseInterval)) {\r\n series._baseInterval[this.uid] = this.mainBaseInterval;\r\n series.mainDataSet.each(function (dataItem) {\r\n _this.postProcessSeriesDataItem(dataItem);\r\n });\r\n if (this.groupData) {\r\n this.groupSeriesData(series);\r\n }\r\n }\r\n };\r\n /**\r\n * Calculates series group data.\r\n *\r\n * @param series Series\r\n * @ignore\r\n */\r\n DateAxis.prototype.groupSeriesData = function (series) {\r\n var _this = this;\r\n if (series.baseAxis == this && series.dataItems.length > 0 && !series.dataGrouped) {\r\n // make array of intervals which will be used;\r\n var intervals_1 = [];\r\n var mainBaseInterval = this.mainBaseInterval;\r\n var mainIntervalDuration_1 = $time.getDuration(mainBaseInterval.timeUnit, mainBaseInterval.count);\r\n this.groupIntervals.each(function (interval) {\r\n var intervalDuration = $time.getDuration(interval.timeUnit, interval.count);\r\n if (intervalDuration > mainIntervalDuration_1 && intervalDuration < (_this.max - _this.min)) {\r\n intervals_1.push(interval);\r\n }\r\n });\r\n if (series._dataSets) {\r\n series._dataSets.each(function (key, dataItems) {\r\n dataItems.each(function (dataItem) {\r\n dataItem.dispose();\r\n });\r\n dataItems.clear();\r\n });\r\n series._dataSets.clear();\r\n }\r\n $array.each(intervals_1, function (interval) {\r\n //let mainBaseInterval = this._mainBaseInterval;\r\n var key = \"date\" + _this.axisLetter;\r\n // create data set\r\n var dataSetId = interval.timeUnit + interval.count;\r\n // todo: check where this clone goes\r\n var dataSet = new OrderedListTemplate(series.mainDataSet.template.clone());\r\n series.dataSets.setKey(dataSetId, dataSet);\r\n series.dataGrouped = true;\r\n var dataItems = series.mainDataSet;\r\n var previousTime = Number.NEGATIVE_INFINITY;\r\n var i = 0;\r\n var newDataItem;\r\n var dataFields = [];\r\n $object.each(series.dataFields, function (dfkey, df) {\r\n var dfk = dfkey;\r\n if (dfk != key && dfk.indexOf(\"Show\") == -1) {\r\n dataFields.push(dfk);\r\n }\r\n });\r\n dataItems.each(function (dataItem) {\r\n var date = dataItem.getDate(key);\r\n if (date) {\r\n var time = date.getTime();\r\n var roundedDate = $time.round(new Date(time), interval.timeUnit, interval.count, _this._df.firstDayOfWeek, _this._df.utc);\r\n var currentTime = roundedDate.getTime();\r\n // changed period\t\t\t\t\t\t\t\t\r\n if (previousTime < currentTime) {\r\n newDataItem = dataSet.create();\r\n newDataItem.dataContext = {};\r\n newDataItem.setWorkingLocation(\"dateX\", series.dataItems.template.locations.dateX, 0);\r\n newDataItem.setWorkingLocation(\"openDateX\", series.dataItems.template.locations.openDateX, 0);\r\n newDataItem.setWorkingLocation(\"dateY\", series.dataItems.template.locations.dateY, 0);\r\n newDataItem.setWorkingLocation(\"openDateY\", series.dataItems.template.locations.openDateY, 0);\r\n newDataItem.component = series;\r\n // other Dates?\r\n newDataItem.setDate(key, roundedDate);\r\n newDataItem._index = i;\r\n i++;\r\n $array.each(dataFields, function (vkey) {\r\n //let groupFieldName = vkey + \"Group\";\r\n var dvalues = dataItem.values[vkey];\r\n if (dvalues) {\r\n var value = dvalues.value;\r\n var values = newDataItem.values[vkey];\r\n if ($type.isNumber(value)) {\r\n values.value = value;\r\n values.workingValue = value;\r\n values.open = value;\r\n values.close = value;\r\n values.low = value;\r\n values.high = value;\r\n values.sum = value;\r\n values.average = value;\r\n values.count = 1;\r\n }\r\n else {\r\n values.count = 0;\r\n }\r\n }\r\n });\r\n _this.postProcessSeriesDataItem(newDataItem, interval);\r\n $object.each(series.propertyFields, function (key, fieldValue) {\r\n var f = key;\r\n var value = dataItem.properties[key];\r\n if ($type.hasValue(value)) {\r\n newDataItem.hasProperties = true;\r\n newDataItem.setProperty(f, value);\r\n }\r\n });\r\n newDataItem.groupDataItems = [dataItem];\r\n previousTime = currentTime;\r\n }\r\n else {\r\n if (newDataItem) {\r\n $array.each(dataFields, function (vkey) {\r\n var groupFieldName = series.groupFields[vkey];\r\n var dvalues = dataItem.values[vkey];\r\n if (dvalues) {\r\n var value = dvalues.value;\r\n if ($type.isNumber(value)) {\r\n var values = newDataItem.values[vkey];\r\n if (!$type.isNumber(values.open)) {\r\n values.open = value;\r\n }\r\n values.close = value;\r\n if (values.low > value || !$type.isNumber(values.low)) {\r\n values.low = value;\r\n }\r\n if (values.high < value || !$type.isNumber(values.high)) {\r\n values.high = value;\r\n }\r\n if ($type.isNumber(values.sum)) {\r\n values.sum += value;\r\n }\r\n else {\r\n values.sum = value;\r\n }\r\n values.count++;\r\n values.average = values.sum / values.count;\r\n if ($type.isNumber(values[groupFieldName])) {\r\n values.value = values[groupFieldName];\r\n values.workingValue = values.value;\r\n }\r\n }\r\n }\r\n });\r\n $utils.copyProperties(dataItem.properties, newDataItem.properties);\r\n $object.each(series.propertyFields, function (key, fieldValue) {\r\n var f = key;\r\n var value = dataItem.properties[key];\r\n if ($type.hasValue(value)) {\r\n newDataItem.hasProperties = true;\r\n newDataItem.setProperty(f, value);\r\n }\r\n });\r\n newDataItem.groupDataItems.push(dataItem);\r\n }\r\n }\r\n }\r\n if (newDataItem) {\r\n $utils.copyProperties(dataItem.dataContext, newDataItem.dataContext);\r\n }\r\n });\r\n });\r\n this.calculateZoom();\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n DateAxis.prototype.getDFFormatter = function () {\r\n this._df = this.dateFormatter;\r\n };\r\n /**\r\n * [postProcessSeriesDataItem description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param dataItem Data item\r\n */\r\n DateAxis.prototype.postProcessSeriesDataItem = function (dataItem, interval) {\r\n var _this = this;\r\n // we need to do this for all series data items not only added recently, as baseInterval might change\r\n var intervalID = \"\";\r\n if (interval) {\r\n intervalID = interval.timeUnit + interval.count;\r\n }\r\n else {\r\n interval = this.mainBaseInterval;\r\n }\r\n var series = dataItem.component;\r\n var dataItemsByAxis = series.dataItemsByAxis.getKey(this.uid);\r\n $object.each(dataItem.dates, function (key) {\r\n var date = dataItem.getDate(key);\r\n var time = date.getTime();\r\n var startDate = $time.round(new Date(time), interval.timeUnit, interval.count, _this._firstWeekDay, _this._df.utc);\r\n var startTime = startDate.getTime();\r\n var endDate = $time.add(new Date(startTime), interval.timeUnit, interval.count, _this._df.utc);\r\n dataItem.setCalculatedValue(key, startTime, \"open\");\r\n dataItem.setCalculatedValue(key, endDate.getTime(), \"close\");\r\n dataItemsByAxis.setKey(startTime + intervalID, dataItem);\r\n });\r\n };\r\n /**\r\n * Collapses empty stretches of date/time scale by creating [[AxisBreak]]\r\n * elements for them.\r\n *\r\n * Can be used to automatically remove strethes without data, like weekends.\r\n *\r\n * No, need to call this manually. It will automatically be done if\r\n * `skipEmptyPeriods = true`.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n DateAxis.prototype.addEmptyUnitsBreaks = function () {\r\n var _this = this;\r\n if (this.skipEmptyPeriods && $type.isNumber(this.min) && $type.isNumber(this.max)) {\r\n var timeUnit = this.baseInterval.timeUnit;\r\n var count = this.baseInterval.count;\r\n if (this._axisBreaks) {\r\n this._axisBreaks.clear(); // TODO: what about breaks added by user?\r\n }\r\n var date = $time.round(new Date(this.min), timeUnit, count, this._firstWeekDay, this._df.utc);\r\n var axisBreak = void 0;\r\n var _loop_1 = function () {\r\n $time.add(date, timeUnit, count, this_1._df.utc);\r\n var startTime = date.getTime();\r\n var startTimeStr = startTime.toString();\r\n var hasData = $iter.contains(this_1.series.iterator(), function (series) {\r\n return !!series.dataItemsByAxis.getKey(_this.uid).getKey(startTimeStr + series.currentDataSetId);\r\n });\r\n // open break if not yet opened\r\n if (!hasData) {\r\n if (!axisBreak) {\r\n axisBreak = this_1.axisBreaks.create();\r\n axisBreak.startDate = new Date(startTime);\r\n this_1._gapBreaks = true;\r\n }\r\n }\r\n else {\r\n // close if already opened\r\n if (axisBreak) {\r\n // close at end time minus one millisecond\r\n axisBreak.endDate = new Date(startTime - 1);\r\n axisBreak = undefined;\r\n }\r\n }\r\n };\r\n var this_1 = this;\r\n while (date.getTime() < this.max - this.baseDuration) {\r\n _loop_1();\r\n }\r\n }\r\n };\r\n /**\r\n * Updates positioning of Axis breaks after something changes.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n DateAxis.prototype.fixAxisBreaks = function () {\r\n var _this = this;\r\n _super.prototype.fixAxisBreaks.call(this);\r\n var axisBreaks = this._axisBreaks;\r\n if (axisBreaks) {\r\n if (axisBreaks.length > 0) {\r\n // process breaks\r\n axisBreaks.each(function (axisBreak) {\r\n var breakGridCount = Math.ceil(_this._gridCount * (Math.min(_this.end, axisBreak.endPosition) - Math.max(_this.start, axisBreak.startPosition)) / (_this.end - _this.start));\r\n axisBreak.gridInterval = _this.chooseInterval(0, axisBreak.adjustedEndValue - axisBreak.adjustedStartValue, breakGridCount);\r\n var gridDate = $time.round(new Date(axisBreak.adjustedStartValue), axisBreak.gridInterval.timeUnit, axisBreak.gridInterval.count, _this._firstWeekDay, _this._df.utc);\r\n if (gridDate.getTime() > axisBreak.startDate.getTime()) {\r\n $time.add(gridDate, axisBreak.gridInterval.timeUnit, axisBreak.gridInterval.count, _this._df.utc);\r\n }\r\n axisBreak.gridDate = gridDate;\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n DateAxis.prototype.getFirstWeekDay = function () {\r\n if (this._df) {\r\n return this._df.firstDayOfWeek;\r\n }\r\n return 1;\r\n };\r\n /**\r\n * [getGridDate description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param date [description]\r\n * @param intervalCount [description]\r\n * @return [description]\r\n */\r\n DateAxis.prototype.getGridDate = function (date, intervalCount) {\r\n var timeUnit = this._gridInterval.timeUnit;\r\n var realIntervalCount = this._gridInterval.count;\r\n // round date\r\n $time.round(date, timeUnit, 1, this._firstWeekDay, this._df.utc);\r\n var prevTimestamp = date.getTime();\r\n var newDate = $time.copy(date);\r\n // modify date by adding intervalcount\r\n var timestamp = $time.add(newDate, timeUnit, intervalCount, this._df.utc).getTime();\r\n // if it's axis break, get first rounded date which is not in a break\r\n var axisBreak = this.isInBreak(timestamp);\r\n if (axisBreak && axisBreak.endDate) {\r\n newDate = new Date(axisBreak.endDate.getTime());\r\n $time.round(newDate, timeUnit, realIntervalCount, this._firstWeekDay, this._df.utc);\r\n if (newDate.getTime() < axisBreak.endDate.getTime()) {\r\n $time.add(newDate, timeUnit, realIntervalCount, this._df.utc);\r\n }\r\n timestamp = newDate.getTime();\r\n }\r\n // get duration between grid lines with break duration removed\r\n var durationBreaksRemoved = this.adjustDifference(prevTimestamp, timestamp);\r\n // calculate how many time units fit to this duration\r\n var countBreaksRemoved = Math.round(durationBreaksRemoved / $time.getDuration(timeUnit));\r\n // if less units fit, add one and repeat\r\n if (countBreaksRemoved < realIntervalCount) {\r\n return this.getGridDate(date, intervalCount + realIntervalCount);\r\n }\r\n return newDate;\r\n };\r\n /**\r\n * [getBreaklessDate description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param axisBreak [description]\r\n * @param timeUnit [description]\r\n * @param count [description]\r\n * @return [description]\r\n */\r\n DateAxis.prototype.getBreaklessDate = function (axisBreak, timeUnit, count) {\r\n var date = new Date(axisBreak.endValue);\r\n $time.round(date, timeUnit, count, this._firstWeekDay, this._df.utc);\r\n $time.add(date, timeUnit, count, this._df.utc);\r\n var timestamp = date.getTime();\r\n axisBreak = this.isInBreak(timestamp);\r\n if (axisBreak) {\r\n return this.getBreaklessDate(axisBreak, timeUnit, count);\r\n }\r\n return date;\r\n };\r\n /**\r\n * (Re)validates all Axis elements.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n */\r\n DateAxis.prototype.validateAxisElements = function () {\r\n var _this = this;\r\n if ($type.isNumber(this.max) && $type.isNumber(this.min)) {\r\n this.calculateZoom();\r\n // first regular items\r\n var timestamp = this._gridDate.getTime();\r\n var timeUnit = this._gridInterval.timeUnit;\r\n var intervalCount = this._gridInterval.count;\r\n var prevGridDate = $time.copy(this._gridDate);\r\n var dataItemsIterator_1 = this._dataItemsIterator;\r\n this.resetIterators();\r\n var _loop_2 = function () {\r\n var date = this_2.getGridDate($time.copy(prevGridDate), intervalCount);\r\n timestamp = date.getTime();\r\n var endDate = $time.copy(date); // you might think it's easier to add intervalduration to timestamp, however it won't work for months or years which are not of the same length\r\n endDate = $time.add(endDate, timeUnit, intervalCount, this_2._df.utc);\r\n var format = this_2.dateFormats.getKey(timeUnit);\r\n if (this_2.markUnitChange && prevGridDate) {\r\n if ($time.checkChange(date, prevGridDate, this_2._nextGridUnit, this_2._df.utc)) {\r\n if (timeUnit !== \"year\") {\r\n format = this_2.periodChangeDateFormats.getKey(timeUnit);\r\n }\r\n }\r\n }\r\n var text = this_2._df.format(date, format);\r\n var dataItem = dataItemsIterator_1.find(function (x) { return x.text === text; });\r\n if (dataItem.__disabled) {\r\n dataItem.__disabled = false;\r\n }\r\n this_2.appendDataItem(dataItem);\r\n dataItem.axisBreak = undefined;\r\n dataItem.date = date;\r\n dataItem.endDate = endDate;\r\n dataItem.text = text;\r\n this_2.validateDataElement(dataItem);\r\n prevGridDate = date;\r\n };\r\n var this_2 = this;\r\n while (timestamp <= this._maxZoomed) {\r\n _loop_2();\r\n }\r\n // breaks later\r\n var renderer_1 = this.renderer;\r\n if (this._axisBreaks) {\r\n $iter.each(this._axisBreaks.iterator(), function (axisBreak) {\r\n if (axisBreak.breakSize > 0) {\r\n var timeUnit_1 = axisBreak.gridInterval.timeUnit;\r\n var intervalCount_1 = axisBreak.gridInterval.count;\r\n // only add grid if gap is bigger then minGridDistance\r\n if ($math.getDistance(axisBreak.startPoint, axisBreak.endPoint) > renderer_1.minGridDistance * 4) {\r\n var timestamp_1 = axisBreak.gridDate.getTime();\r\n var prevGridDate_1;\r\n var count = 0;\r\n var _loop_3 = function () {\r\n var date = $time.copy(axisBreak.gridDate);\r\n timestamp_1 = $time.add(date, timeUnit_1, intervalCount_1 * count, _this._df.utc).getTime();\r\n count++;\r\n if (timestamp_1 > axisBreak.adjustedStartValue && timestamp_1 < axisBreak.adjustedEndValue) {\r\n var endDate = $time.copy(date); // you might think it's easier to add intervalduration to timestamp, however it won't work for months or years which are not of the same length\r\n endDate = $time.add(endDate, timeUnit_1, intervalCount_1, _this._df.utc);\r\n var format = _this.dateFormats.getKey(timeUnit_1);\r\n if (_this.markUnitChange && prevGridDate_1) {\r\n if ($time.checkChange(date, prevGridDate_1, _this._nextGridUnit, _this._df.utc)) {\r\n if (timeUnit_1 !== \"year\") {\r\n format = _this.periodChangeDateFormats.getKey(timeUnit_1);\r\n }\r\n }\r\n }\r\n var text_1 = _this._df.format(date, format);\r\n var dataItem = dataItemsIterator_1.find(function (x) { return x.text === text_1; });\r\n if (dataItem.__disabled) {\r\n dataItem.__disabled = false;\r\n }\r\n //this.processDataItem(dataItem);\r\n _this.appendDataItem(dataItem);\r\n dataItem.axisBreak = axisBreak;\r\n axisBreak.dataItems.moveValue(dataItem);\r\n dataItem.date = date;\r\n dataItem.endDate = endDate;\r\n dataItem.text = text_1;\r\n prevGridDate_1 = date;\r\n _this.validateDataElement(dataItem);\r\n }\r\n };\r\n while (timestamp_1 <= axisBreak.adjustedMax) {\r\n _loop_3();\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * Validates Axis data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n DateAxis.prototype.validateDataElement = function (dataItem) {\r\n dataItem.itemIndex = this._axisItemCount;\r\n this._axisItemCount++;\r\n if ($type.isNumber(this.max) && $type.isNumber(this.min)) {\r\n var renderer = this.renderer;\r\n var timestamp = dataItem.value;\r\n var endTimestamp = dataItem.endValue;\r\n if (!$type.isNumber(endTimestamp)) {\r\n endTimestamp = timestamp;\r\n }\r\n var position = this.valueToPosition(timestamp);\r\n var endPosition = this.valueToPosition(endTimestamp);\r\n var fillEndPosition = endPosition;\r\n if (!dataItem.isRange && this._gridInterval.count > this.baseInterval.count) {\r\n endPosition = position + (endPosition - position) / (this._gridInterval.count / this.baseInterval.count);\r\n }\r\n dataItem.position = position;\r\n var tick = dataItem.tick;\r\n if (tick && !tick.disabled) {\r\n renderer.updateTickElement(tick, position, endPosition);\r\n }\r\n var grid = dataItem.grid;\r\n if (grid && !grid.disabled) {\r\n renderer.updateGridElement(grid, position, endPosition);\r\n }\r\n var fill = dataItem.axisFill;\r\n if (fill && !fill.disabled) {\r\n renderer.updateFillElement(fill, position, fillEndPosition);\r\n if (!dataItem.isRange) {\r\n this.fillRule(dataItem);\r\n }\r\n }\r\n var mask = dataItem.mask;\r\n if (mask) {\r\n renderer.updateFillElement(mask, position, endPosition);\r\n }\r\n if (dataItem.bullet) {\r\n renderer.updateBullet(dataItem.bullet, position, endPosition);\r\n }\r\n var label = dataItem.label;\r\n if (label && !label.disabled) {\r\n var location_1 = label.location;\r\n if (location_1 == 0) {\r\n if (this._gridInterval.count == 1 && this._gridInterval.timeUnit != \"week\" && !dataItem.isRange) {\r\n location_1 = 0.5;\r\n }\r\n else {\r\n location_1 = 0;\r\n }\r\n }\r\n renderer.updateLabelElement(label, position, endPosition, location_1);\r\n }\r\n }\r\n };\r\n Object.defineProperty(DateAxis.prototype, \"baseDuration\", {\r\n /**\r\n * A duration in milliseconds of the `baseInterval`.\r\n *\r\n * @return Duration (ms)\r\n */\r\n get: function () {\r\n return $time.getDuration(this.baseInterval.timeUnit, this.baseInterval.count);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adjusts min/max values.\r\n *\r\n * @ignore Exclude from docs.\r\n * @todo Description (review)\r\n * @param min Min timestamp\r\n * @param max Max timestamp\r\n * @return Adjusted min/max step\r\n */\r\n DateAxis.prototype.adjustMinMax = function (min, max) {\r\n return { min: min, max: max, step: this.baseDuration };\r\n };\r\n /**\r\n * Adjusts the minimum timestamp as per cell start location.\r\n *\r\n * @param value Value\r\n * @return Adjusted value\r\n */\r\n DateAxis.prototype.fixMin = function (value) {\r\n // like this because months are not equal\r\n var interval = this.baseInterval;\r\n var startTime = $time.round(new Date(value), interval.timeUnit, interval.count, this._firstWeekDay, this._df.utc).getTime();\r\n var endTime = $time.add(new Date(startTime), interval.timeUnit, interval.count, this._df.utc).getTime();\r\n return startTime + (endTime - startTime) * this.startLocation;\r\n };\r\n /**\r\n * Adjusts the maximum timestamp as per cell start location.\r\n *\r\n * @param value Value\r\n * @return Adjusted value\r\n */\r\n DateAxis.prototype.fixMax = function (value) {\r\n // like this because months are not equal\r\n var interval = this.baseInterval;\r\n var startTime = $time.round(new Date(value), interval.timeUnit, interval.count, this._firstWeekDay, this._df.utc).getTime();\r\n var endTime = $time.add(new Date(startTime), interval.timeUnit, interval.count, this._df.utc).getTime();\r\n return startTime + (endTime - startTime) * this.endLocation;\r\n };\r\n /**\r\n * [chooseInterval description]\r\n *\r\n * @ignore Exclude from docs.\r\n * @todo Description\r\n * @param index [description]\r\n * @param duration [description]\r\n * @param gridCount [description]\r\n * @return [description]\r\n */\r\n DateAxis.prototype.chooseInterval = function (index, duration, gridCount, intervals) {\r\n if (!intervals) {\r\n intervals = this.gridIntervals;\r\n }\r\n var gridInterval = intervals.getIndex(index);\r\n var intervalDuration = $time.getDuration(gridInterval.timeUnit, gridInterval.count);\r\n var lastIndex = intervals.length - 1;\r\n if (index >= lastIndex) {\r\n return __assign({}, intervals.getIndex(lastIndex));\r\n }\r\n var count = Math.ceil(duration / intervalDuration);\r\n if (duration < intervalDuration && index > 0) {\r\n return __assign({}, intervals.getIndex(index - 1));\r\n }\r\n if (count <= gridCount) {\r\n return __assign({}, intervals.getIndex(index));\r\n }\r\n else {\r\n if (index + 1 < intervals.length) {\r\n return this.chooseInterval(index + 1, duration, gridCount, intervals);\r\n }\r\n else {\r\n return __assign({}, intervals.getIndex(index));\r\n }\r\n }\r\n };\r\n /**\r\n * Formats the value according to axis' own [[DateFormatter]].\r\n *\r\n * @param value Source value\r\n * @return Formatted value\r\n */\r\n DateAxis.prototype.formatLabel = function (value) {\r\n return this._df.format(value);\r\n };\r\n /**\r\n * Converts a Date to an asbolute pixel position within Axis.\r\n *\r\n * @param date Date\r\n * @return Position (px)\r\n */\r\n DateAxis.prototype.dateToPosition = function (date) {\r\n return this.valueToPosition(date.getTime());\r\n };\r\n /**\r\n * Converts a numeric timestamp or a `Date` to a relative position on axis.\r\n *\r\n * @param date Date or a timestamp\r\n * @return Relative position\r\n */\r\n DateAxis.prototype.anyToPosition = function (date) {\r\n if (date instanceof Date) {\r\n return this.dateToPosition(date);\r\n }\r\n else {\r\n return this.valueToPosition(date);\r\n }\r\n };\r\n /**\r\n * Converts date to orientation point (x, y, angle) on axis\r\n *\r\n * @param date Date\r\n * @return IOrientationPoint\r\n */\r\n DateAxis.prototype.dateToPoint = function (date) {\r\n var position = this.dateToPosition(date);\r\n var point = this.renderer.positionToPoint(position);\r\n var angle = this.renderer.positionToAngle(position);\r\n return { x: point.x, y: point.y, angle: angle };\r\n };\r\n /**\r\n * Converts a numeric value to orientation (x, y, angle) point on axis\r\n *\r\n * @param value Value\r\n * @return Orientation point\r\n */\r\n DateAxis.prototype.anyToPoint = function (date) {\r\n if (date instanceof Date) {\r\n return this.dateToPoint(date);\r\n }\r\n else {\r\n return this.valueToPoint(date);\r\n }\r\n };\r\n /**\r\n * Converts pixel position within Axis to a corresponding Date.\r\n *\r\n * @param position Position (px)\r\n * @return Date\r\n */\r\n DateAxis.prototype.positionToDate = function (position) {\r\n return new Date(this.positionToValue(position));\r\n };\r\n /**\r\n * Returns the relative position on axis for series' data item's value.\r\n *\r\n * @since 4.5.14\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @return Relative position\r\n */\r\n DateAxis.prototype.getPositionX = function (dataItem, key, location, stackKey, range) {\r\n var value = this.getTimeByLocation(dataItem, key, location);\r\n //let stack: number = dataItem.getValue(\"valueX\", \"stack\");\r\n if (!$type.isNumber(value)) {\r\n value = this.baseValue;\r\n }\r\n var position = this.valueToPosition(value);\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns relative position on axis for series' data item's value.\r\n *\r\n * @since 4.5.14\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @return Relative position\r\n */\r\n DateAxis.prototype.getPositionY = function (dataItem, key, location, stackKey, range) {\r\n var value = this.getTimeByLocation(dataItem, key, location);\r\n var stack = dataItem.getValue(\"valueX\", \"stack\");\r\n if (!$type.isNumber(value)) {\r\n value = this.baseValue;\r\n }\r\n var position = this.valueToPosition(value + stack);\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns an angle for series data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey Stack ID\r\n * @param range Range to fit in\r\n * @return Angle\r\n */\r\n DateAxis.prototype.getAngle = function (dataItem, key, location, stackKey, range) {\r\n var value = this.getTimeByLocation(dataItem, key, location);\r\n var stack = dataItem.getValue(stackKey, \"stack\");\r\n if (!$type.isNumber(value)) {\r\n value = this.baseValue;\r\n }\r\n var position = this.valueToPosition(value + stack);\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return this.positionToAngle(position);\r\n };\r\n /**\r\n * [getTimeByLocation description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @return [description]\r\n */\r\n DateAxis.prototype.getTimeByLocation = function (dataItem, key, location) {\r\n if (!$type.hasValue(key)) {\r\n return;\r\n }\r\n if (!$type.isNumber(location)) {\r\n location = dataItem.workingLocations[key];\r\n if (!$type.isNumber(location)) {\r\n location = 0;\r\n }\r\n }\r\n var startTime = dataItem.values[key][\"open\"];\r\n var endTime = dataItem.values[key][\"close\"];\r\n var workingValue = dataItem.values[key].workingValue;\r\n var value = dataItem.values[key].value;\r\n var difference = value - workingValue;\r\n startTime -= difference;\r\n endTime -= difference;\r\n if ($type.isNumber(startTime) && $type.isNumber(endTime)) {\r\n return startTime + (endTime - startTime) * location;\r\n }\r\n };\r\n /**\r\n * Processes a related series' data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param dataItem Data item\r\n */\r\n DateAxis.prototype.processSeriesDataItem = function (dataItem, axisLetter) {\r\n var series = dataItem.component;\r\n var time;\r\n var date = dataItem[\"date\" + axisLetter];\r\n if ($type.isNumber(this.timezoneOffset)) {\r\n date.setTime(date.getTime() + (date.getTimezoneOffset() - this.timezoneOffset) * 60000);\r\n dataItem.setValue(\"date\" + axisLetter, date.getTime(), 0);\r\n }\r\n if (date) {\r\n time = date.getTime();\r\n }\r\n else {\r\n return;\r\n }\r\n var openDate = dataItem[\"openDate\" + axisLetter];\r\n var prevSeriesTime = this._prevSeriesTime[series.uid];\r\n var openTime;\r\n if (openDate) {\r\n openTime = openDate.getTime();\r\n }\r\n if ($type.isNumber(openTime)) {\r\n var difference = Math.abs(time - openTime);\r\n if (this._minDifference[series.uid] > difference) {\r\n this._minDifference[series.uid] = difference;\r\n }\r\n }\r\n var differece = time - prevSeriesTime;\r\n if (differece > 0) {\r\n if (this._minDifference[series.uid] > differece) {\r\n this._minDifference[series.uid] = differece;\r\n }\r\n }\r\n this._prevSeriesTime[series.uid] = time;\r\n if (series._baseInterval[this.uid]) {\r\n this.postProcessSeriesDataItem(dataItem);\r\n }\r\n };\r\n /**\r\n * [updateAxisBySeries description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n DateAxis.prototype.updateAxisBySeries = function () {\r\n _super.prototype.updateAxisBySeries.call(this);\r\n var baseInterval = this.chooseInterval(0, this.minDifference, 1);\r\n // handle short months\r\n if (this.minDifference >= $time.getDuration(\"day\", 27) && baseInterval.timeUnit == \"week\") {\r\n baseInterval.timeUnit = \"month\";\r\n baseInterval.count = 1;\r\n }\r\n if (baseInterval.timeUnit == \"month\") {\r\n if (this.minDifference >= $time.getDuration(\"day\", 29 * 2) && baseInterval.count == 1) {\r\n baseInterval.count = 2;\r\n }\r\n if (this.minDifference >= $time.getDuration(\"day\", 29 * 3) && baseInterval.count == 2) {\r\n baseInterval.count = 3;\r\n }\r\n if (this.minDifference >= $time.getDuration(\"day\", 29 * 6) && baseInterval.count == 5) {\r\n baseInterval.count = 6;\r\n }\r\n }\r\n // handle daylight saving\r\n if (this.minDifference >= $time.getDuration(\"hour\", 23) && baseInterval.timeUnit == \"hour\") {\r\n baseInterval.timeUnit = \"day\";\r\n baseInterval.count = 1;\r\n }\r\n if (this.minDifference >= $time.getDuration(\"week\", 1) - $time.getDuration(\"hour\", 1) && baseInterval.timeUnit == \"day\") {\r\n baseInterval.timeUnit = \"week\";\r\n baseInterval.count = 1;\r\n }\r\n if (this.minDifference >= $time.getDuration(\"year\", 1) - $time.getDuration(\"day\", 1.01) && baseInterval.timeUnit == \"month\") {\r\n baseInterval.timeUnit = \"year\";\r\n baseInterval.count = 1;\r\n }\r\n this._baseIntervalReal = baseInterval;\r\n this._mainBaseInterval = baseInterval;\r\n // no need to invalidate\r\n };\r\n Object.defineProperty(DateAxis.prototype, \"baseInterval\", {\r\n /**\r\n * @return Base interval\r\n */\r\n get: function () {\r\n if (this._groupInterval) {\r\n return this._groupInterval;\r\n }\r\n else if (this._baseInterval) {\r\n return this._baseInterval;\r\n }\r\n else {\r\n return this._baseIntervalReal;\r\n }\r\n },\r\n /**\r\n * A base interval (granularity) of data.\r\n *\r\n * Used to indicate what are the base units of your data.\r\n *\r\n * For example, if you have a data set that has a data point every 5 minutes,\r\n * you may want to set this to `{ timeUnit: \"minute\", count: 5 }`.\r\n *\r\n * If not set, the Axis will try to determine the setting by its own, looking\r\n * at actual data.\r\n *\r\n * For best results, try to follow these values for `count`:\r\n *\r\n * When unit is \"month\", use 12 / count = round number\r\n * When unit is \"hour\", use 24 / count = round number\r\n * When unit is \"second\" and \"minute\", use 60 / count = round number\r\n *\r\n * @param timeInterval base interval\r\n */\r\n set: function (timeInterval) {\r\n if (JSON.stringify(this._baseInterval) != JSON.stringify(timeInterval)) {\r\n this._baseInterval = timeInterval;\r\n this._mainBaseInterval = timeInterval;\r\n if (!$type.isNumber(timeInterval.count)) {\r\n timeInterval.count = 1;\r\n }\r\n this.invalidate();\r\n this.postProcessSeriesDataItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"mainBaseInterval\", {\r\n /**\r\n * Indicates granularity of the data of source (unaggregated) data.\r\n *\r\n * @since 4.7.0\r\n * @return Granularity of the main data set\r\n */\r\n get: function () {\r\n if (this._baseInterval) {\r\n return this._baseInterval;\r\n }\r\n else if (this._mainBaseInterval) {\r\n return this._mainBaseInterval;\r\n }\r\n else {\r\n return this._baseIntervalReal;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"skipEmptyPeriods\", {\r\n /**\r\n * @return Remove empty stretches of time?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"skipEmptyPeriods\");\r\n },\r\n /**\r\n * If enabled, axis will automatically collapse empty (without data points)\r\n * periods of time, i.e. weekends.\r\n *\r\n * An \"empty\" period is considered a stretch of time in the length of current\r\n * `baseInterval` without a single data point in it.\r\n *\r\n * For each such empty period, axis will automatically create an\r\n * [[AxisBreak]]. By default they will be invisible. You can still configure\r\n * them by accessing `axis.breaks.template`.\r\n *\r\n * [More info about breaks](https://www.amcharts.com/docs/v4/concepts/axes/#Breaks).\r\n *\r\n * Important notes:\r\n * * If you set this property to `true`, you can not add your custom axis breaks to this axis anymore.\r\n * * Using this feature affects performance. Use only if you need it.\r\n * * Setting this to `true` will reset appearance of breaks. If you want to modify appearance, do it *after* you set `skipEmptyPeriods`.\r\n * * Some axis label overlapping might happen.\r\n * * This setting is not compatible with `groupData = true`.\r\n *\r\n * @default false\r\n * @param value Remove empty stretches of time?\r\n */\r\n set: function (value) {\r\n if (value) {\r\n var breakTemplate = this.axisBreaks.template;\r\n breakTemplate.startLine.disabled = true;\r\n breakTemplate.endLine.disabled = true;\r\n breakTemplate.fillShape.disabled = true;\r\n breakTemplate.breakSize = 0;\r\n }\r\n else {\r\n if (this._gapBreaks) {\r\n this.axisBreaks.clear();\r\n this._gapBreaks = false;\r\n }\r\n }\r\n if (this.setPropertyValue(\"skipEmptyPeriods\", value)) {\r\n this.invalidate();\r\n this.postProcessSeriesDataItems();\r\n this.invalidateSeries();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"tooltipDateFormat\", {\r\n /**\r\n * @return Date format\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tooltipDateFormat\");\r\n },\r\n /**\r\n * A special date format to apply axis tooltips.\r\n *\r\n * Will use same format as for labels, if not set.\r\n *\r\n * @param value Date format\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tooltipDateFormat\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"markUnitChange\", {\r\n /**\r\n * @return Use different format for period beginning?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"markUnitChange\");\r\n },\r\n /**\r\n * Use `periodChangeDateFormats` to apply different formats to the first\r\n * label in bigger time unit.\r\n *\r\n * @default true\r\n * @param value Use different format for period beginning?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"markUnitChange\", value)) {\r\n this.invalidateData();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns text to show in a tooltip, based on specific relative position\r\n * within axis.\r\n *\r\n * The label will be formatted as per [[DateFormatter]] set for the whole\r\n * chart, or explicitly for this Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position\r\n * @return Label (formatted date)\r\n */\r\n DateAxis.prototype.getTooltipText = function (position) {\r\n var text;\r\n var date = this.positionToDate(position);\r\n date = $time.round(date, this.baseInterval.timeUnit, this.baseInterval.count, this._firstWeekDay, this._df.utc, new Date(this.min));\r\n this.tooltipDate = date;\r\n if ($type.hasValue(this.tooltipDateFormat)) {\r\n text = this._df.format(date, this.tooltipDateFormat);\r\n }\r\n else {\r\n var dateFormat = this.dateFormats.getKey(this.baseInterval.timeUnit);\r\n if (dateFormat) {\r\n text = this._df.format(date, dateFormat);\r\n }\r\n else {\r\n text = this.getPositionLabel(position);\r\n }\r\n }\r\n if (!this._adapterO) {\r\n return text;\r\n }\r\n else {\r\n return this._adapterO.apply(\"getTooltipText\", text);\r\n }\r\n };\r\n /**\r\n * Takes an absolute position within axis and adjust it to a specific position within base interval. (cell)\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Source position\r\n * @param location Location in the cell\r\n * @return Adjusted position\r\n */\r\n DateAxis.prototype.roundPosition = function (position, location, axisLocation) {\r\n var baseInterval = this.baseInterval;\r\n var timeUnit = baseInterval.timeUnit;\r\n var count = baseInterval.count;\r\n var date = this.positionToDate(position);\r\n $time.round(date, timeUnit, count, this._firstWeekDay, this._df.utc);\r\n if (location > 0) {\r\n $time.add(date, timeUnit, location * count, this._df.utc);\r\n }\r\n if (axisLocation > 0 && axisLocation < 1) {\r\n date.setTime(date.getTime() + this.baseDuration * axisLocation);\r\n }\r\n if (this.isInBreak(date.getTime())) {\r\n while (date.getTime() < this.max) {\r\n $time.add(date, timeUnit, count, this._df.utc);\r\n if (!this.isInBreak(date.getTime())) {\r\n break;\r\n }\r\n }\r\n }\r\n return this.dateToPosition(date);\r\n };\r\n /**\r\n * Returns an relative position of the start of the cell (period), that specific position value falls into.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param position Relative position\r\n * @return Cell start relative position\r\n */\r\n DateAxis.prototype.getCellStartPosition = function (position) {\r\n return this.roundPosition(position, 0);\r\n };\r\n /**\r\n * Returns an relative position of the end of the cell (period), that specific position value falls into.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param position Relative position\r\n * @return Cell end relative position\r\n */\r\n DateAxis.prototype.getCellEndPosition = function (position) {\r\n return this.roundPosition(position, 1);\r\n //return this.dateToPosition($time.add(this.positionToDate(this.roundPosition(position, 1)), this.baseInterval.timeUnit, this.baseInterval.count));\r\n };\r\n /**\r\n * Returns a Series data item that corresponds to the specific pixel position\r\n * of the Axis.\r\n *\r\n * If `findNearest` (third parameter) is set to `true`, the method will try\r\n * to locate nearest available data item if none is found directly under\r\n * `position`.\r\n *\r\n * @param series Series\r\n * @param position Position (px)\r\n * @param findNearest Should axis try to find nearest tooltip if there is no data item at exact position\r\n * @return Data item\r\n */\r\n DateAxis.prototype.getSeriesDataItem = function (series, position, findNearest) {\r\n var value = this.positionToValue(position);\r\n var date = $time.round(new Date(value), this.baseInterval.timeUnit, this.baseInterval.count, this._firstWeekDay, this._df.utc);\r\n var dataItemsByAxis = series.dataItemsByAxis.getKey(this.uid);\r\n var dataItem = dataItemsByAxis.getKey(date.getTime().toString());\r\n // todo: alternatively we can find closiest here\r\n if (!dataItem && findNearest) {\r\n var key_1;\r\n if (this.axisLetter == \"Y\") {\r\n key_1 = \"dateY\";\r\n }\r\n else {\r\n key_1 = \"dateX\";\r\n }\r\n dataItem = series.dataItems.getIndex(series.dataItems.findClosestIndex(date.getTime(), function (x) {\r\n if (x[key_1]) {\r\n return x[key_1].getTime();\r\n }\r\n else {\r\n return -Infinity;\r\n }\r\n }, \"any\"));\r\n }\r\n return dataItem;\r\n };\r\n /**\r\n * Returns a formatted date based on position in axis scale.\r\n *\r\n * Please note that `position` represents position within axis which may be\r\n * zoomed and not correspond to Cursor's `position`.\r\n *\r\n * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.\r\n * @param position Relative position on axis (0-1)\r\n * @return Position label\r\n */\r\n DateAxis.prototype.getPositionLabel = function (position) {\r\n // @todo Better format recognition\r\n var date = this.positionToDate(position);\r\n return this._df.format(date, this.getCurrentLabelFormat());\r\n };\r\n /**\r\n * Returns label date format based on currently used time units\r\n *\r\n * @return Format\r\n */\r\n DateAxis.prototype.getCurrentLabelFormat = function () {\r\n return this.dateFormats.getKey(this._gridInterval ? this._gridInterval.timeUnit : \"day\");\r\n };\r\n /**\r\n * Initializes an Axis renderer.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n DateAxis.prototype.initRenderer = function () {\r\n _super.prototype.initRenderer.call(this);\r\n var renderer = this.renderer;\r\n if (renderer) {\r\n // Set defaults\r\n renderer.ticks.template.location = 0;\r\n renderer.grid.template.location = 0;\r\n renderer.labels.template.location = 0;\r\n renderer.baseGrid.disabled = true;\r\n }\r\n };\r\n Object.defineProperty(DateAxis.prototype, \"basePoint\", {\r\n /**\r\n * Coordinates of the actual axis start.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Base point\r\n */\r\n get: function () {\r\n return { x: 0, y: 0 };\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n DateAxis.prototype.animateMinMax = function (min, max) {\r\n var _this = this;\r\n var animation = this.animate([{ property: \"_minAdjusted\", from: this._minAdjusted, to: min }, { property: \"_maxAdjusted\", from: this._maxAdjusted, to: max }], this.rangeChangeDuration, this.rangeChangeEasing);\r\n animation.events.on(\"animationprogress\", function () {\r\n _this.dispatch(\"extremeschanged\");\r\n });\r\n return animation;\r\n };\r\n /**\r\n * Invalidates axis data items when series extremes change\r\n */\r\n DateAxis.prototype.handleExtremesChange = function () {\r\n _super.prototype.handleExtremesChange.call(this);\r\n if (this.groupData) {\r\n var id = this.baseInterval.timeUnit + this.baseInterval.count;\r\n this.groupMin[id] = this._finalMin;\r\n this.groupMax[id] = this._finalMax;\r\n }\r\n };\r\n /**\r\n * Zooms axis to specific Dates.\r\n *\r\n * @param startDate Start date\r\n * @param endValue End date\r\n * @param skipRangeEvent Do not invoke events\r\n * @param instantly Do not play zoom animations\r\n */\r\n DateAxis.prototype.zoomToDates = function (startDate, endDate, skipRangeEvent, instantly, adjust) {\r\n startDate = this._df.parse(startDate);\r\n endDate = this._df.parse(endDate);\r\n this.zoomToValues(startDate.getTime(), endDate.getTime(), skipRangeEvent, instantly, adjust);\r\n };\r\n /**\r\n * Zooms axis to specific values.\r\n *\r\n * @param startValue Start value\r\n * @param endValue End value\r\n * @param skipRangeEvent Do not invoke events\r\n * @param instantly Do not play zoom animations\r\n */\r\n DateAxis.prototype.zoomToValues = function (startValue, endValue, skipRangeEvent, instantly, adjust) {\r\n var _this = this;\r\n if (!this.groupData) {\r\n var start = (startValue - this.min) / (this.max - this.min);\r\n var end = (endValue - this.min) / (this.max - this.min);\r\n this.zoom({ start: start, end: end }, skipRangeEvent, instantly);\r\n }\r\n else {\r\n var difference = this.adjustDifference(startValue, endValue);\r\n var isEnd = false;\r\n if (endValue == this.max) {\r\n isEnd = true;\r\n }\r\n var isStart = false;\r\n if (startValue == this.min) {\r\n isStart = true;\r\n }\r\n if ($type.hasValue(difference)) {\r\n var mainBaseInterval = this.mainBaseInterval;\r\n var groupInterval_1 = this.chooseInterval(0, difference, this.groupCount, this.groupIntervals);\r\n if ((groupInterval_1.timeUnit == mainBaseInterval.timeUnit && groupInterval_1.count < mainBaseInterval.count) || $time.getDuration(groupInterval_1.timeUnit, 1) < $time.getDuration(mainBaseInterval.timeUnit, 1)) {\r\n groupInterval_1 = __assign({}, mainBaseInterval);\r\n }\r\n var id = groupInterval_1.timeUnit + groupInterval_1.count;\r\n var min_1 = this.groupMin[id];\r\n var max_1 = this.groupMax[id];\r\n if (!$type.isNumber(min_1) || !$type.isNumber(max_1)) {\r\n min_1 = Number.POSITIVE_INFINITY;\r\n max_1 = Number.NEGATIVE_INFINITY;\r\n this.series.each(function (series) {\r\n var seriesMin = series.min(_this);\r\n var seriesMax = series.max(_this);\r\n if (series._dataSets) {\r\n var ds = series._dataSets.getKey(groupInterval_1.timeUnit + groupInterval_1.count);\r\n if (ds) {\r\n var mindi = ds.getIndex(0);\r\n var maxdi = ds.getIndex(ds.length - 1);\r\n if (mindi) {\r\n if (series.xAxis == _this) {\r\n seriesMin = mindi.dateX.getTime();\r\n }\r\n else if (series.yAxis == _this) {\r\n seriesMin = mindi.dateY.getTime();\r\n }\r\n }\r\n if (maxdi) {\r\n if (series.xAxis == _this) {\r\n seriesMax = maxdi.dateX.getTime();\r\n }\r\n else if (series.yAxis == _this) {\r\n seriesMax = maxdi.dateY.getTime();\r\n }\r\n }\r\n }\r\n }\r\n seriesMax = $time.round($time.add(new Date(seriesMax), groupInterval_1.timeUnit, 1, _this._df.utc), groupInterval_1.timeUnit, 1, _this._df.firstDayOfWeek, _this._df.utc).getTime();\r\n if (seriesMin < min_1) {\r\n min_1 = seriesMin;\r\n }\r\n if (seriesMax > max_1) {\r\n max_1 = seriesMax;\r\n }\r\n });\r\n this.groupMin[id] = min_1;\r\n this.groupMax[id] = max_1;\r\n }\r\n startValue = $math.fitToRange(startValue, min_1, max_1);\r\n endValue = $math.fitToRange(endValue, min_1, max_1);\r\n if (adjust) {\r\n if (isEnd) {\r\n startValue = endValue - difference;\r\n startValue = $math.fitToRange(startValue, min_1, max_1);\r\n }\r\n if (isStart) {\r\n endValue = startValue + difference;\r\n endValue = $math.fitToRange(endValue, min_1, max_1);\r\n }\r\n }\r\n var start = (startValue - min_1) / (max_1 - min_1);\r\n var end = (endValue - min_1) / (max_1 - min_1);\r\n this.zoom({ start: start, end: end }, skipRangeEvent, instantly);\r\n }\r\n }\r\n };\r\n /**\r\n * Adds `baseInterval` to \"as is\" fields.\r\n *\r\n * @param field Field name\r\n * @return Assign as is?\r\n */\r\n DateAxis.prototype.asIs = function (field) {\r\n return field == \"baseInterval\" || _super.prototype.asIs.call(this, field);\r\n };\r\n /**\r\n * Copies all properties and related data from a different instance of Axis.\r\n *\r\n * @param source Source Axis\r\n */\r\n DateAxis.prototype.copyFrom = function (source) {\r\n var _this = this;\r\n _super.prototype.copyFrom.call(this, source);\r\n this.dateFormats = source.dateFormats;\r\n this.periodChangeDateFormats = source.periodChangeDateFormats;\r\n this.groupIntervals.clear();\r\n source.groupIntervals.each(function (interval) {\r\n _this.groupIntervals.push(__assign({}, interval));\r\n });\r\n this.gridIntervals.clear();\r\n source.gridIntervals.each(function (interval) {\r\n _this.gridIntervals.push(__assign({}, interval));\r\n });\r\n if (source._baseInterval) {\r\n this.baseInterval = source._baseInterval;\r\n }\r\n };\r\n /**\r\n * Shows Axis tooltip at specific relative position within Axis. (0-1)\r\n *\r\n * @param position Position (0-1)\r\n * @param local or global position\r\n */\r\n DateAxis.prototype.showTooltipAtPosition = function (position, local) {\r\n var _this = this;\r\n if (!local) {\r\n position = this.toAxisPosition(position);\r\n }\r\n if (this.snapTooltip) {\r\n // rounding is not good, pen/aac4e7f66f019d36b2447f050c600c13 (no last tootltip shown)\r\n var actualDate = this.positionToDate(position); //$time.round(this.positionToDate(position), this.baseInterval.timeUnit, 1, this.getFirstWeekDay(), this.dateFormatter.utc);\r\n var actualTime_1 = actualDate.getTime();\r\n var closestDate_1;\r\n this.series.each(function (series) {\r\n if (series.baseAxis == _this) {\r\n var dataItem = _this.getSeriesDataItem(series, position, true);\r\n if (dataItem) {\r\n var date = void 0;\r\n if (series.xAxis == _this) {\r\n date = dataItem.dateX;\r\n }\r\n if (series.yAxis == _this) {\r\n date = dataItem.dateY;\r\n }\r\n if (!closestDate_1) {\r\n closestDate_1 = date;\r\n }\r\n else {\r\n if (Math.abs(closestDate_1.getTime() - actualTime_1) > Math.abs(date.getTime() - actualTime_1)) {\r\n closestDate_1 = date;\r\n }\r\n }\r\n }\r\n }\r\n });\r\n if (closestDate_1) {\r\n var closestTime_1 = closestDate_1.getTime();\r\n closestDate_1 = $time.round(new Date(closestTime_1), this.baseInterval.timeUnit, this.baseInterval.count, this._firstWeekDay, this._df.utc);\r\n closestTime_1 = closestDate_1.getTime();\r\n var tooltipLocation = this.renderer.tooltipLocation;\r\n if (tooltipLocation == 0) {\r\n tooltipLocation = 0.0001;\r\n }\r\n closestDate_1 = new Date(closestDate_1.getTime() + this.baseDuration * tooltipLocation);\r\n position = this.dateToPosition(closestDate_1);\r\n if (this.chart.cursor && this.chart.cursor.snapToSeries) {\r\n //void\r\n }\r\n else {\r\n this.series.each(function (series) {\r\n var dataItem = series.dataItemsByAxis.getKey(_this.uid).getKey(closestTime_1 + series.currentDataSetId);\r\n var point = series.showTooltipAtDataItem(dataItem);\r\n if (point) {\r\n _this.chart._seriesPoints.push({ series: series, point: point });\r\n }\r\n else {\r\n // check, otherwise column tooltip will be hidden\r\n if (series.tooltipText || series.tooltipHTML) {\r\n series.hideTooltip();\r\n }\r\n }\r\n });\r\n }\r\n //this.chart.sortSeriesTooltips(seriesPoints);\r\n }\r\n }\r\n _super.prototype.showTooltipAtPosition.call(this, position, true);\r\n };\r\n Object.defineProperty(DateAxis.prototype, \"snapTooltip\", {\r\n /**\r\n * @return Should snap?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"snapTooltip\");\r\n },\r\n /**\r\n * Should the nearest tooltip be shown if no data item is found on the\r\n * current cursor position.\r\n *\r\n * @default true\r\n * @param value Should snap?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"snapTooltip\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"groupData\", {\r\n /**\r\n * @return Group data points?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"groupData\");\r\n },\r\n /**\r\n * Indicates if data should be aggregated to composide data items if there\r\n * are more data items in selected range than `groupCount`.\r\n *\r\n * Grouping will occur automatically, based on current selection range, and\r\n * will change dynamically when user zooms in/out the chart.\r\n *\r\n * NOTE: This works only if [[DateAxis]] is base axis of an [[XYSeries]].\r\n *\r\n * The related [[XYSeries]] also needs to be set up to take advantage of, by\r\n * setting its [`groupFields`](https://www.amcharts.com/docs/v4/reference/xyseries/#groupFields_property).\r\n *\r\n * The group intervals to aggregate data to is defined by `groupIntervals`\r\n * property.\r\n *\r\n * ```TypeScript\r\n * let dateAxis = chart.xAxes.push(new am4charts.DateAxis());\r\n * dateAxis.groupData = true;\r\n *\r\n * let valueAxis = chart.xAxes.push(new am4charts.valueAxis());\r\n *\r\n * let series = chart.series.push(new am4charts.LineSeries());\r\n * series.dataFields.dateX = \"date\";\r\n * series.dataFields.valueY = \"value\";\r\n * series.groupFields.valueY = \"average\";\r\n * ```\r\n * ```JavaScript\r\n * var dateAxis = chart.xAxes.push(new am4charts.DateAxis());\r\n * dateAxis.groupData = true;\r\n *\r\n * var valueAxis = chart.xAxes.push(new am4charts.valueAxis());\r\n *\r\n * var series = chart.series.push(new am4charts.LineSeries());\r\n * series.dataFields.dateX = \"date\";\r\n * series.dataFields.valueY = \"value\";\r\n * series.groupFields.valueY = \"average\";\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * \"groupData\": true\r\n * }],\r\n * \"yAxes\": [{\r\n * \"type\": \"ValueAxis\"\r\n * }],\r\n * \"series\": [{\r\n * \"type\": \"LineSeries\",\r\n * \"dataFields\": {\r\n * \"dateX\": \"date\",\r\n * \"valueY\": \"value\"\r\n * },\r\n * \"groupFields\": {\r\n * \"valueY\": \"average\"\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @default false\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/date-axis/#Dynamic_data_item_grouping} for more information about dynamic data item grouping.\r\n * @since 4.7.0\r\n * @param value Group data points?\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this.setPropertyValue(\"groupData\", value)) {\r\n this.series.each(function (series) {\r\n series.setDataSet(\"\");\r\n if (value && !series.dataGrouped && series.inited) {\r\n series._baseInterval[_this.uid] = _this.mainBaseInterval;\r\n _this.groupSeriesData(series);\r\n }\r\n });\r\n this._currentDataSetId = \"\";\r\n this._groupInterval = undefined;\r\n this.invalidate();\r\n this.invalidateSeries();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"groupInterval\", {\r\n /**\r\n * @return Interval\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"groupInterval\");\r\n },\r\n /**\r\n * Disables automatic selection of data grouping intervals and always uses\r\n * `groupInterval` if set. Works only if `groupData = true`.\r\n *\r\n * @since 4.9.24\r\n * @param value Interval\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"groupInterval\", value)) {\r\n this.invalidate();\r\n this.invalidateSeries();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"groupCount\", {\r\n /**\r\n * @return Number of data items\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"groupCount\");\r\n },\r\n /**\r\n * Indicates threshold of data items in selected range at which to start\r\n * aggregating data items if `groupData = true`.\r\n *\r\n * @default 200\r\n * @since 4.7.0\r\n * @param value Number of data items\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"groupCount\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"timezoneOffset\", {\r\n /**\r\n * @todo Timezone offset in minutes\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"timezoneOffset\");\r\n },\r\n /**\r\n *\r\n * Indicates by how many minutes the timestamps in your data are offset from GMT.\r\n * This is useful when you have timestamps as your data and you want all the users to see\r\n * the same result and not the time which was at users's location at the given timestamp.\r\n * Note, you do not need to set timezoneOffset both here and on DateFormatter, as this will\r\n * distort the result.\r\n *\r\n * @default undefined\r\n * @since 4.8.5\r\n * @param value Time zone offset in minutes\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"timezoneOffset\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DateAxis.prototype, \"gridInterval\", {\r\n /**\r\n * Current grid interval.\r\n *\r\n * @return Grid interval\r\n */\r\n get: function () {\r\n return this._gridInterval;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n DateAxis.prototype.makeGap = function (dataItem, previous) {\r\n var series = dataItem.component;\r\n if (dataItem && previous) {\r\n if (!series.connect && $type.isNumber(series.autoGapCount)) {\r\n if (series.baseAxis == this) {\r\n var date = dataItem.dates[\"date\" + this.axisLetter];\r\n var prevDate = previous.dates[\"date\" + this.axisLetter];\r\n if (date && prevDate) {\r\n var time = date.getTime();\r\n var prevTime = prevDate.getTime();\r\n if (time - prevTime > series.autoGapCount * this.baseDuration) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(DateAxis.prototype, \"baseValue\", {\r\n /**\r\n * @return base value\r\n */\r\n get: function () {\r\n return this.min;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return DateAxis;\r\n}(ValueAxis));\r\nexport { DateAxis };\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[\"DateAxis\"] = DateAxis;\r\nregistry.registeredClasses[\"DateAxisDataItem\"] = DateAxisDataItem;\r\n//# sourceMappingURL=DateAxis.js.map","/**\r\n * Module, defining Axis Renderer for vertical axes.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisRenderer } from \"./AxisRenderer\";\r\nimport { AxisBullet } from \"./AxisBullet\";\r\nimport { WavedLine } from \"../../core/elements/WavedLine\";\r\nimport { WavedRectangle } from \"../../core/elements/WavedRectangle\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { percent, Percent } from \"../../core/utils/Percent\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A renderer for horizontal axis.\r\n *\r\n * @see {@link IAxisRendererEvents} for a list of available events\r\n * @see {@link IAxisRendererAdapters} for a list of available Adapters\r\n */\r\nvar AxisRendererX = /** @class */ (function (_super) {\r\n __extends(AxisRendererX, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\r\n function AxisRendererX() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"AxisRendererX\";\r\n _this.minGridDistance = 120;\r\n _this.opposite = false;\r\n _this.rotation = 0;\r\n _this.width = percent(100);\r\n _this.labels.template.horizontalCenter = \"middle\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n AxisRendererX.prototype.setAxis = function (axis) {\r\n _super.prototype.setAxis.call(this, axis);\r\n axis.layout = \"vertical\";\r\n };\r\n /**\r\n * @ignore\r\n */\r\n AxisRendererX.prototype.updateGridContainer = function () {\r\n var axis = this.axis;\r\n if (axis) {\r\n var gridContainer = this.gridContainer;\r\n gridContainer.x = axis.pixelX;\r\n gridContainer.width = axis.axisLength;\r\n }\r\n };\r\n /**\r\n * Called when rendered is attached to an Axis, as well as a property of\r\n * Axis that might affect the appearance is updated.\r\n *\r\n * E.g. `axis.opposite`, `axis.inside`, etc.\r\n *\r\n * This method is called **before** draw, so that any related setting\r\n * changed in this method can be changed.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererX.prototype.processRenderer = function () {\r\n _super.prototype.processRenderer.call(this);\r\n // can not do this in init, as axis is set later\r\n var axis = this.axis;\r\n if (axis) {\r\n if (!(axis.width instanceof Percent)) {\r\n axis.width = percent(100);\r\n }\r\n // @todo Is thi sneeded?\r\n $utils.used(this.line);\r\n var title = axis.title;\r\n title.rotation = 0;\r\n title.align = \"center\";\r\n if (this.opposite) {\r\n this.line.toFront();\r\n title.toBack();\r\n }\r\n else {\r\n title.toFront();\r\n this.toBack();\r\n this.line.toBack();\r\n }\r\n }\r\n };\r\n /**\r\n * Updates some of the Axis tooltip's visual properties, related to\r\n * rendering of the Axis.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererX.prototype.updateTooltip = function () {\r\n var axis = this.axis;\r\n if (axis) {\r\n var bigNum = 1000;\r\n var bbx = this.line.pixelX;\r\n var bby = this.line.pixelY;\r\n var bbw = this.axisLength;\r\n var bbh = bigNum;\r\n // top\r\n if (this.opposite) {\r\n if (!this.inside) {\r\n bby = -bigNum;\r\n bbh = bigNum;\r\n }\r\n }\r\n // bottom\r\n else {\r\n if (this.inside) {\r\n bby = -bigNum;\r\n bbh = bigNum;\r\n }\r\n }\r\n this.axis.updateTooltip(\"vertical\", { x: bbx, y: bby, width: bbw, height: bbh });\r\n }\r\n };\r\n /**\r\n * Updates and positions a label element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param label Label element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\r\n AxisRendererX.prototype.updateLabelElement = function (label, position, endPosition, location) {\r\n if (!$type.hasValue(location)) {\r\n location = label.location;\r\n }\r\n position = position + (endPosition - position) * location;\r\n var point = this.positionToPoint(position);\r\n label.isMeasured = !label.inside;\r\n var deltaY = 0;\r\n var verticalCenter;\r\n var maxHeight = this.gridContainer.maxHeight;\r\n if (this.opposite) {\r\n if (label.inside) {\r\n verticalCenter = \"top\";\r\n if (label.valign == \"bottom\") {\r\n deltaY = maxHeight;\r\n verticalCenter = \"bottom\";\r\n }\r\n if (label.valign == \"middle\") {\r\n deltaY = maxHeight / 2;\r\n verticalCenter = \"middle\";\r\n }\r\n }\r\n else {\r\n verticalCenter = \"bottom\";\r\n }\r\n point.y = deltaY;\r\n }\r\n else {\r\n if (label.inside) {\r\n verticalCenter = \"bottom\";\r\n if (label.valign == \"top\") {\r\n deltaY = -maxHeight;\r\n verticalCenter = \"top\";\r\n }\r\n if (label.valign == \"middle\") {\r\n deltaY = -maxHeight / 2;\r\n verticalCenter = \"middle\";\r\n }\r\n }\r\n else {\r\n verticalCenter = \"top\";\r\n }\r\n point.y += deltaY;\r\n }\r\n if (label.rotation == 0) {\r\n // Apply fuzzy logic to verticalCenter only if labels are not rotated\r\n label.verticalCenter = verticalCenter;\r\n }\r\n this.positionItem(label, point);\r\n this.toggleVisibility(label, position, this.minLabelPosition, this.maxLabelPosition);\r\n };\r\n Object.defineProperty(AxisRendererX.prototype, \"axisLength\", {\r\n /**\r\n * Returns actual length of the Axis, in pixels.\r\n *\r\n * @return Length (px)\r\n */\r\n get: function () {\r\n var axis = this.axis;\r\n return (axis.measuredWidth - axis.pixelPaddingRight - axis.pixelPaddingLeft) || 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts relative position on axis to point coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @param position2 Position (0-1) Position on the second axis\r\n * @return Point\r\n */\r\n AxisRendererX.prototype.positionToPoint = function (position, position2) {\r\n return { x: this.positionToCoordinate(position), y: 0 };\r\n };\r\n /**\r\n * Converts a point at specific coordinates to a relative position (0-1)\r\n * on the axis.\r\n *\r\n * @param point Point\r\n * @return Position (0-1)\r\n */\r\n AxisRendererX.prototype.pointToPosition = function (point) {\r\n return this.coordinateToPosition(point.x, point.y);\r\n };\r\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition Starting position\r\n * @param endPosition End position\r\n * @return SVG path\r\n */\r\n AxisRendererX.prototype.getPositionRangePath = function (startPosition, endPosition) {\r\n var x1 = $math.fitToRange(this.positionToCoordinate(startPosition), 0, this.axisLength);\r\n var x2 = $math.fitToRange(this.positionToCoordinate(endPosition), 0, this.axisLength);\r\n var w = Math.abs(x2 - x1);\r\n var h = this.getHeight();\r\n var x = Math.min(x1, x2);\r\n var y = 0;\r\n return $path.rectToPath({\r\n x: x,\r\n y: y,\r\n width: w,\r\n height: h\r\n }, true);\r\n };\r\n /**\r\n * Updates and positions an axis break element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Break element\r\n */\r\n AxisRendererX.prototype.updateBreakElement = function (axisBreak) {\r\n _super.prototype.updateBreakElement.call(this, axisBreak);\r\n var startLine = axisBreak.startLine;\r\n var endLine = axisBreak.endLine;\r\n var fillShape = axisBreak.fillShape;\r\n var startPoint = axisBreak.startPoint;\r\n var endPoint = axisBreak.endPoint;\r\n var y1 = axisBreak.pixelMarginLeft;\r\n var y2 = this.getHeight() - axisBreak.pixelMarginTop - axisBreak.pixelMarginBottom;\r\n startPoint.x = $math.fitToRange(startPoint.x, -1, this.axisLength + 1);\r\n endPoint.x = $math.fitToRange(endPoint.x, -1, this.axisLength + 1);\r\n if (startPoint.x == endPoint.x && (startPoint.x < 0 || startPoint.x > this.axisLength)) {\r\n axisBreak.fillShape.__disabled = true;\r\n }\r\n else {\r\n axisBreak.fillShape.__disabled = false;\r\n }\r\n startLine.y = y1;\r\n startLine.width = 0;\r\n startLine.height = y2;\r\n endLine.y = y1;\r\n endLine.width = 0;\r\n endLine.height = y2;\r\n fillShape.height = y2;\r\n fillShape.width = Math.abs(endPoint.x - startPoint.x);\r\n fillShape.y = y1;\r\n fillShape.x = startPoint.x;\r\n };\r\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererX.prototype.updateGridElement = function (grid, position, endPosition) {\r\n position = position + (endPosition - position) * grid.location;\r\n var point = this.positionToPoint(position);\r\n //point.x = $utils.spritePointToSprite({x:point.x, y:0}, this, this.gridContainer).x;\r\n grid.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: 0, y: this.getHeight() });\r\n this.positionItem(grid, point);\r\n this.toggleVisibility(grid, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions a tick element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param tick Tick element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererX.prototype.updateTickElement = function (tick, position, endPosition) {\r\n position = position + (endPosition - position) * tick.location;\r\n var point = this.positionToPoint(position);\r\n var tickLength = tick.length;\r\n point.y = $utils.spritePointToSprite({ x: 0, y: this.line.pixelY }, this.line.parent, this.gridContainer).y;\r\n if (this.opposite) {\r\n tickLength *= (tick.inside ? 1 : -1);\r\n }\r\n else {\r\n tickLength *= (tick.inside ? -1 : 1);\r\n }\r\n tick.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: 0, y: tickLength });\r\n this.positionItem(tick, point);\r\n this.toggleVisibility(tick, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions the axis line element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererX.prototype.updateAxisLine = function () {\r\n this.line.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: this.axisLength, y: 0 });\r\n };\r\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererX.prototype.updateBaseGridElement = function () {\r\n _super.prototype.updateBaseGridElement.call(this);\r\n var axis = this.axis;\r\n var h = this.getHeight();\r\n var w = this.axisLength;\r\n var baseGrid = this.baseGrid;\r\n var x = axis.basePoint.x;\r\n if (x < -0.2 || x > w + 0.2) {\r\n baseGrid.hide(0);\r\n }\r\n else {\r\n var y = $utils.spritePointToSprite({ x: 0, y: 0 }, this.gridContainer, baseGrid.parent).y;\r\n baseGrid.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: 0, y: h });\r\n baseGrid.moveTo({ x: x, y: y });\r\n baseGrid.show(0);\r\n }\r\n };\r\n /**\r\n * Creates visual elements for and axis break.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Axis break\r\n */\r\n AxisRendererX.prototype.createBreakSprites = function (axisBreak) {\r\n axisBreak.startLine = new WavedLine();\r\n axisBreak.endLine = new WavedLine();\r\n var wavedRectangle = new WavedRectangle();\r\n wavedRectangle.setWavedSides(false, true, false, true);\r\n axisBreak.fillShape = wavedRectangle;\r\n };\r\n /**\r\n * @ignore\r\n */\r\n AxisRendererX.prototype.toAxisPosition = function (value) {\r\n var inversedPosition = value;\r\n var axis = this.axis;\r\n if (axis) {\r\n var relativePositionSprite = axis.relativePositionSprite;\r\n var x = axis.pixelX;\r\n if (relativePositionSprite) {\r\n x = $utils.spritePointToSprite({ x: this.pixelX, y: 0 }, this.parent, relativePositionSprite).x;\r\n }\r\n else {\r\n relativePositionSprite = axis.parent;\r\n }\r\n if (relativePositionSprite) {\r\n var relativeX = x / relativePositionSprite.innerWidth;\r\n var relativeWidth = axis.axisLength / relativePositionSprite.innerWidth;\r\n return (inversedPosition - relativeX) / relativeWidth;\r\n }\r\n }\r\n return value;\r\n };\r\n /**\r\n * Updates and positions axis bullets.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet AxisBullet element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererX.prototype.updateBullet = function (bullet, position, endPosition) {\r\n var location = 0.5;\r\n if (bullet instanceof AxisBullet) {\r\n location = bullet.location;\r\n }\r\n position = position + (endPosition - position) * location;\r\n var point = this.positionToPoint(position);\r\n point.y = $utils.spritePointToSprite({ x: 0, y: this.line.pixelY }, this.line.parent, this.gridContainer).y;\r\n this.positionItem(bullet, point);\r\n this.toggleVisibility(bullet, position, 0, 1);\r\n };\r\n return AxisRendererX;\r\n}(AxisRenderer));\r\nexport { AxisRendererX };\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[\"AxisRendererX\"] = AxisRendererX;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Put labels inside plot area.\r\n * Disable first and last labels.\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.heightXS,\r\n state: function (target, stateId) {\r\n if (target instanceof AxisRendererX) {\r\n var state = target.states.create(stateId);\r\n state.properties.inside = true;\r\n state.properties.maxLabelPosition = 0.9;\r\n state.properties.minLabelPosition = 0.1;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n/**\r\n * Disable labels altogather on very small charts\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.heightXXS,\r\n state: function (target, stateId) {\r\n if (target instanceof AxisRendererX) {\r\n var state = target.states.create(stateId);\r\n state.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=AxisRendererX.js.map","/**\r\n * A module which defines functionality related to Category Axis Break.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisBreak } from \"./AxisBreak\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Base class to define \"breaks\" in axes\r\n * @see {@link ICategoryAxisBreakEvents} for a list of available events\r\n * @see {@link ICategoryAxisBreakAdapters} for a list of available Adapters\r\n */\r\nvar CategoryAxisBreak = /** @class */ (function (_super) {\r\n __extends(CategoryAxisBreak, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CategoryAxisBreak() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"CategoryAxisBreak\";\r\n _this.properties.startLocation = 0.5;\r\n _this.properties.endLocation = 0.5;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(CategoryAxisBreak.prototype, \"startPosition\", {\r\n /**\r\n * Pixel position of the break's start.\r\n *\r\n * @return Position (px)\r\n * @readonly\r\n */\r\n get: function () {\r\n if (this.axis) {\r\n return this.axis.indexToPosition(this.adjustedStartValue, this.startLocation);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisBreak.prototype, \"endPosition\", {\r\n /**\r\n * Pixel position of the break's end.\r\n *\r\n * @return Position (px)\r\n * @readonly\r\n */\r\n get: function () {\r\n if (this.axis) {\r\n return this.axis.indexToPosition(this.adjustedEndValue, this.endLocation);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisBreak.prototype, \"startCategory\", {\r\n /**\r\n * @return Start category\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startCategory\");\r\n },\r\n /**\r\n * A category break starts on.\r\n *\r\n * @param value Start category\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"startCategory\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisBreak.prototype, \"endCategory\", {\r\n /**\r\n * @return End category\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endCategory\");\r\n },\r\n /**\r\n * A category break ends on.\r\n *\r\n * @param value End category\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"endCategory\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisBreak.prototype, \"startValue\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n var category = this.getPropertyValue(\"startCategory\");\r\n if (category) {\r\n return this.axis.categoryToIndex(category);\r\n }\r\n else {\r\n return this.getPropertyValue(\"startValue\");\r\n }\r\n },\r\n /**\r\n * An index of start category.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"startValue\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisBreak.prototype, \"endValue\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n var category = this.getPropertyValue(\"endCategory\");\r\n if (category) {\r\n return this.axis.categoryToIndex(category);\r\n }\r\n else {\r\n return this.getPropertyValue(\"endValue\");\r\n }\r\n },\r\n /**\r\n * An index of end category or a end value.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"endValue\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisBreak.prototype, \"startLocation\", {\r\n /**\r\n * @return Break start location\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startLocation\");\r\n },\r\n /**\r\n * Indicates where within starting category break should begin.\r\n *\r\n * Values range from `0` (start) to `1` (end), with default being `0.5` (middle).\r\n *\r\n * E.g. if you want to a break to fully encompass start and end categories,\r\n * you should set `startLocation = 0` and `endLocation = 1`.\r\n *\r\n * @since 4.9.17\r\n * @default 0.5\r\n * @param value Break start location\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"startLocation\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisBreak.prototype, \"endLocation\", {\r\n /**\r\n * @return Break end location\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endLocation\");\r\n },\r\n /**\r\n * Indicates where within ending category break should end.\r\n *\r\n * Values range from `0` (start) to `1` (end), with default being `0.5` (middle).\r\n *\r\n * E.g. if you want to a break to fully encompass start and end categories,\r\n * you should set `startLocation = 0` and `endLocation = 1`.\r\n *\r\n * @since 4.9.17\r\n * @default 0.5\r\n * @param value Break end location\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"endLocation\", value)) {\r\n if (this.axis) {\r\n this.axis.invalidateDataItems();\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CategoryAxisBreak;\r\n}(AxisBreak));\r\nexport { CategoryAxisBreak };\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[\"CategoryAxisBreak\"] = CategoryAxisBreak;\r\n//# sourceMappingURL=CategoryAxisBreak.js.map","/**\r\n * Category axis module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Axis, AxisDataItem } from \"./Axis\";\r\nimport { AxisRendererX } from \"./AxisRendererX\";\r\nimport { AxisRendererY } from \"./AxisRendererY\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { Dictionary } from \"../../core/utils/Dictionary\";\r\nimport { CategoryAxisBreak } from \"./CategoryAxisBreak\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[CategoryAxis]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar CategoryAxisDataItem = /** @class */ (function (_super) {\r\n __extends(CategoryAxisDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CategoryAxisDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.seriesDataItems = {};\r\n _this.className = \"CategoryAxisDataItem\";\r\n _this.text = \"{category}\";\r\n _this.locations.category = 0;\r\n _this.locations.endCategory = 1;\r\n _this.deltaPosition = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(CategoryAxisDataItem.prototype, \"category\", {\r\n /**\r\n * @return Category\r\n */\r\n get: function () {\r\n if (this._adapterO) {\r\n if (this._adapterO.isEnabled(\"category\")) {\r\n return this._adapterO.apply(\"category\", this.properties.category);\r\n }\r\n }\r\n return this.properties.category;\r\n },\r\n /**\r\n * Category.\r\n *\r\n * @param value Category\r\n */\r\n set: function (value) {\r\n var oldCategory = this.properties.category;\r\n this.setProperty(\"category\", value);\r\n if ($type.hasValue(oldCategory) && oldCategory != value) {\r\n if (this.component) {\r\n this.component.validateDataElement(this);\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisDataItem.prototype, \"endCategory\", {\r\n /**\r\n * @return End category\r\n */\r\n get: function () {\r\n return this.properties.endCategory;\r\n },\r\n /**\r\n * End category.\r\n *\r\n * Used for items that span several categories, like [[CategoryAxisBreak]].\r\n *\r\n * @param value End category\r\n */\r\n set: function (value) {\r\n this.setProperty(\"endCategory\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxisDataItem.prototype, \"deltaPosition\", {\r\n get: function () {\r\n return this.properties.deltaCoordinate;\r\n },\r\n set: function (value) {\r\n if (value != this.properties.deltaCoordinate) {\r\n this.setProperty(\"deltaCoordinate\", value);\r\n if (this.component) {\r\n this.component.invalidateDataItems();\r\n this.component.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CategoryAxisDataItem;\r\n}(AxisDataItem));\r\nexport { CategoryAxisDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to create a category-based axis for the chart.\r\n *\r\n * ```TypeScript\r\n * // Create the axis\r\n * let xAxis = chart.xAxes.push(new am4charts.CategoryAxis());\r\n *\r\n * // Set settings\r\n * xAxis.title.text = \"Clients\";\r\n * ```\r\n * ```JavaScript\r\n * // Create the axis\r\n * var valueAxis = chart.xAxes.push(new am4charts.CategoryAxis());\r\n *\r\n * // Set settings\r\n * valueAxis.title.text = \"Clients\";\r\n * ```\r\n * ```JSON\r\n * \"xAxes\": [{\r\n * \"type\": \"CategoryAxis\",\r\n * \"title\": {\r\n * \"text\": \"Clients\"\r\n * }\r\n * }]\r\n * ```\r\n *\r\n * @see {@link ICategoryAxisEvents} for a list of available Events\r\n * @see {@link ICategoryAxisAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar CategoryAxis = /** @class */ (function (_super) {\r\n __extends(CategoryAxis, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CategoryAxis() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * A collection that holds Axis' data items sorted by each category.\r\n */\r\n _this.dataItemsByCategory = new Dictionary();\r\n _this.className = \"CategoryAxis\";\r\n // Set field name\r\n _this.axisFieldName = \"category\";\r\n _this._lastDataItem = _this.createDataItem();\r\n _this._lastDataItem.component = _this;\r\n _this._disposers.push(_this._lastDataItem);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Returns a new/empty [[DataItem]] of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n CategoryAxis.prototype.createDataItem = function () {\r\n return new CategoryAxisDataItem();\r\n };\r\n /**\r\n * Returns a new/empty [[AxisBreak]] of the appropriate type.\r\n *\r\n * @return Axis break\r\n */\r\n CategoryAxis.prototype.createAxisBreak = function () {\r\n return new CategoryAxisBreak();\r\n };\r\n /**\r\n * Processes a related series' data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param dataItem Data item\r\n */\r\n CategoryAxis.prototype.processSeriesDataItem = function (dataItem, axisLetter) {\r\n _super.prototype.processSeriesDataItem.call(this, dataItem, axisLetter);\r\n var category = dataItem[\"category\" + this.axisLetter];\r\n if ($type.hasValue(category)) {\r\n var categoryAxisDataItem = this.dataItemsByCategory.getKey(category);\r\n if (categoryAxisDataItem) {\r\n var seriesId = dataItem.component.uid;\r\n var seriesDataItems = categoryAxisDataItem.seriesDataItems[seriesId];\r\n if (!seriesDataItems) {\r\n seriesDataItems = [];\r\n categoryAxisDataItem.seriesDataItems[seriesId] = seriesDataItems;\r\n }\r\n seriesDataItems.push(dataItem);\r\n }\r\n }\r\n else {\r\n dataItem.component.dataItems.remove(dataItem);\r\n }\r\n };\r\n /**\r\n * Validates the data range.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n */\r\n CategoryAxis.prototype.validateDataRange = function () {\r\n var _this = this;\r\n _super.prototype.validateDataRange.call(this);\r\n $iter.each(this._series.iterator(), function (series) {\r\n if ((series.xAxis instanceof CategoryAxis) && (series.yAxis instanceof CategoryAxis)) {\r\n series.invalidateDataRange();\r\n }\r\n else {\r\n var startIndex = _this.positionToIndex(_this.start);\r\n var endIndex = _this.positionToIndex(_this.end);\r\n if (endIndex >= _this.dataItems.length) {\r\n endIndex--;\r\n }\r\n var seriesId = series.uid;\r\n var minIndex = void 0;\r\n var maxIndex = void 0;\r\n for (var i = startIndex; i <= endIndex; i++) {\r\n var axisDataItem = _this.dataItems.getIndex(i);\r\n if (axisDataItem) {\r\n var seriesDataItems = axisDataItem.seriesDataItems[seriesId];\r\n if (seriesDataItems) {\r\n for (var i_1 = 0; i_1 < seriesDataItems.length; i_1++) {\r\n var seriesDataItem = seriesDataItems[i_1];\r\n if (seriesDataItem) {\r\n var index = seriesDataItem.index;\r\n if (!$type.isNumber(minIndex) || index < minIndex) {\r\n minIndex = index;\r\n }\r\n if (!$type.isNumber(maxIndex) || index > maxIndex) {\r\n maxIndex = index;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if ($type.isNumber(minIndex)) {\r\n series.startIndex = minIndex;\r\n }\r\n else {\r\n series.start = _this.start;\r\n }\r\n if ($type.isNumber(maxIndex)) {\r\n series.endIndex = maxIndex + 1;\r\n }\r\n else {\r\n series.end = _this.end;\r\n }\r\n // range might not change, but axis breaks might.\r\n if (_this._axisBreaks && _this._axisBreaks.length > 0) {\r\n series.invalidateDataRange();\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Validates the whole axis. Causes it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n */\r\n CategoryAxis.prototype.validate = function () {\r\n var _this = this;\r\n _super.prototype.validate.call(this);\r\n var dataCount = this.dataItems.length;\r\n var startIndex = $math.fitToRange(Math.floor(this.start * dataCount - 1), 0, dataCount);\r\n var endIndex = $math.fitToRange(Math.ceil(this.end * dataCount), 0, dataCount);\r\n if (this.renderer.invalid) {\r\n this.renderer.validate();\r\n }\r\n // find frequency at which we'll show items\r\n var maxCount = this.renderer.axisLength / this.renderer.minGridDistance;\r\n var frequency = Math.min(this.dataItems.length, Math.ceil((endIndex - startIndex) / maxCount));\r\n this._startIndex = Math.floor(startIndex / frequency) * frequency;\r\n this._endIndex = Math.ceil(this.end * dataCount);\r\n this.fixAxisBreaks();\r\n if (this._startIndex == this._endIndex) {\r\n this._endIndex++;\r\n }\r\n this._frequency = frequency;\r\n if (this.axisLength <= 0) {\r\n return;\r\n }\r\n this.maxZoomFactor = this.dataItems.length;\r\n if (this.dataItems.length <= 0) {\r\n this.maxZoomFactor = 1;\r\n }\r\n this.resetIterators();\r\n // it's important to use protected variables here, as getters will return 0 - length\r\n // TODO use iterator instead\r\n // @ todo: not solved cat axis item fading\r\n startIndex = $math.max(0, this._startIndex - this._frequency);\r\n endIndex = $math.min(this.dataItems.length, this._endIndex + this._frequency);\r\n var itemIndex = 0;\r\n for (var i = 0; i < startIndex; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n dataItem.__disabled = true;\r\n }\r\n for (var i = endIndex, len = this.dataItems.length; i < len; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n dataItem.__disabled = true;\r\n }\r\n for (var i = startIndex; i < endIndex; i++) {\r\n if (i < this.dataItems.length) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n if (i / this._frequency == Math.round(i / this._frequency)) {\r\n var axisBreak = this.isInBreak(i);\r\n if (!axisBreak) {\r\n this.appendDataItem(dataItem);\r\n this.validateDataElement(dataItem, itemIndex);\r\n }\r\n itemIndex++;\r\n }\r\n else {\r\n //previously we disabled all before, but this is better for cpu\r\n //this.validateDataElement(dataItem, itemIndex); // helps to solve shrinking // not good - creates all items\r\n dataItem.__disabled = true;\r\n }\r\n }\r\n }\r\n this.appendDataItem(this._lastDataItem);\r\n this.validateDataElement(this._lastDataItem, itemIndex + 1, this.dataItems.length);\r\n if (this._axisBreaks) {\r\n var axisBreaks = this._axisBreaks;\r\n axisBreaks.each(function (axisBreak) {\r\n var adjustedStartValue = axisBreak.adjustedStartValue;\r\n var adjustedEndValue = axisBreak.adjustedEndValue;\r\n if ($math.intersect({ start: adjustedStartValue, end: adjustedEndValue }, { start: _this._startIndex, end: _this._endIndex })) {\r\n for (var b = adjustedStartValue; b <= adjustedEndValue; b++) {\r\n var dataItem = _this.dataItems.getIndex(b);\r\n dataItem.__disabled = true;\r\n }\r\n var frequency_1 = $math.fitToRange(Math.ceil(_this._frequency / axisBreak.breakSize), 1, adjustedEndValue - adjustedStartValue);\r\n var itemIndex_1 = 0;\r\n if (axisBreak.breakSize > 0) {\r\n // TODO use iterator instead\r\n for (var b = adjustedStartValue; b <= adjustedEndValue; b = b + frequency_1) {\r\n var dataItem = _this.dataItems.getIndex(b);\r\n dataItem.__disabled = false;\r\n _this.appendDataItem(dataItem);\r\n _this.validateDataElement(dataItem, itemIndex_1);\r\n itemIndex_1++;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n this.validateBreaks();\r\n this.validateAxisRanges();\r\n this.ghostLabel.invalidate(); // solves font issue\r\n this.renderer.invalidateLayout();\r\n };\r\n /**\r\n * [validateDataElement description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param dataItem [description]\r\n * @param itemIndex [description]\r\n */\r\n CategoryAxis.prototype.validateDataElement = function (dataItem, itemIndex, index) {\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n dataItem.itemIndex = this._axisItemCount;\r\n this._axisItemCount++;\r\n //dataItem.__disabled = false;\r\n var renderer = this.renderer;\r\n if (!$type.isNumber(index)) {\r\n index = this.categoryToIndex(dataItem.category);\r\n }\r\n var endIndex = this.categoryToIndex(dataItem.endCategory);\r\n if (!$type.isNumber(endIndex)) {\r\n endIndex = index;\r\n }\r\n var position = this.indexToPosition(index, dataItem.locations.category);\r\n var endPosition = this.indexToPosition(endIndex, dataItem.locations.endCategory);\r\n dataItem.position = position;\r\n var fillEndIndex;\r\n var fillPosition;\r\n var fillEndPosition;\r\n if (dataItem.isRange) {\r\n fillEndIndex = endIndex;\r\n fillPosition = this.indexToPosition(index, dataItem.locations.category);\r\n fillEndPosition = this.indexToPosition(fillEndIndex, dataItem.locations.endCategory);\r\n }\r\n dataItem.point = renderer.positionToPoint(position);\r\n var tick = dataItem.tick;\r\n if (tick && !tick.disabled) {\r\n renderer.updateTickElement(tick, position, endPosition);\r\n }\r\n var grid = dataItem.grid;\r\n if (grid && !grid.disabled) {\r\n renderer.updateGridElement(grid, position, endPosition);\r\n }\r\n var label = dataItem.label;\r\n if (label && !label.disabled) {\r\n // theorethically this might result problems if category text changes, the range text won't change. But otherwise range.label.text = \"custom text\" wont' work, which is not intuitive.\r\n if (!dataItem.isRange || label.text == undefined) {\r\n dataItem.text = dataItem.text;\r\n }\r\n renderer.updateLabelElement(label, position, endPosition);\r\n if ((renderer instanceof AxisRendererY && dataItem.label.measuredWidth > this.ghostLabel.measuredWidth) || (renderer instanceof AxisRendererX && dataItem.label.measuredHeight > this.ghostLabel.measuredHeight)) {\r\n if (dataItem.label.html) {\r\n this.ghostLabel.html = dataItem.label.currentText;\r\n }\r\n else {\r\n this.ghostLabel.text = dataItem.label.currentText;\r\n }\r\n }\r\n }\r\n var fill = dataItem.axisFill;\r\n if (fill && !fill.disabled) {\r\n if (!dataItem.isRange) {\r\n fillEndIndex = index + this._frequency;\r\n fillPosition = this.indexToPosition(index, fill.location);\r\n fillEndPosition = this.indexToPosition(fillEndIndex, fill.location);\r\n }\r\n renderer.updateFillElement(fill, fillPosition, fillEndPosition);\r\n if (!dataItem.isRange) {\r\n this.fillRule(dataItem, itemIndex);\r\n }\r\n }\r\n if (dataItem.bullet) {\r\n renderer.updateBullet(dataItem.bullet, position, endPosition);\r\n }\r\n var mask = dataItem.mask;\r\n if (mask) {\r\n renderer.updateFillElement(mask, fillPosition, fillEndPosition);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n CategoryAxis.prototype.disposeData = function () {\r\n this.dataItemsByCategory.clear();\r\n _super.prototype.disposeData.call(this);\r\n };\r\n /**\r\n * Processes the axis data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n * @param dataContext The raw data that corresponds to this data item\r\n */\r\n CategoryAxis.prototype.processDataItem = function (dataItem, dataContext) {\r\n if (dataItem) {\r\n // creat a collection for fast access\r\n _super.prototype.processDataItem.call(this, dataItem, dataContext);\r\n // check if such category already exists\r\n //let existingDataItem: CategoryAxisDataItem = this.dataItemsByCategory.getKey(dataItem.category);\r\n //if (existingDataItem && existingDataItem != dataItem) {\r\n //\tthis.dataItems.remove(existingDataItem);\r\n //}\r\n if ($type.hasValue(dataItem.category)) {\r\n this.dataItemsByCategory.setKey(dataItem.category, dataItem);\r\n }\r\n }\r\n };\r\n CategoryAxis.prototype.getDataItem = function (dataContext) {\r\n var category = (dataContext[this.dataFields.category]);\r\n if ($type.hasValue(category)) {\r\n var dataItem = this.dataItemsByCategory.getKey(category);\r\n if (dataItem) {\r\n return dataItem;\r\n }\r\n else {\r\n return this.dataItems.create();\r\n }\r\n }\r\n };\r\n /**\r\n * Converts a category index to an actual screen coordinate on the axis.\r\n *\r\n * `location` identifies relative location within category. 0 - beginning,\r\n * 0.5 - middle, 1 - end, and anything inbetween.\r\n *\r\n * @param index Index\r\n * @param location Location (0-1)\r\n * @return Position (px)\r\n */\r\n CategoryAxis.prototype.indexToPosition = function (index, location) {\r\n if (!$type.isNumber(location)) {\r\n location = 0.5;\r\n }\r\n var startIndex = this.startIndex;\r\n var endIndex = this.endIndex;\r\n var difference = this.adjustDifference(startIndex, endIndex);\r\n var startLocation = this.startLocation;\r\n var endLocation = this.endLocation;\r\n difference -= startLocation;\r\n difference -= (1 - endLocation);\r\n if (this._axisBreaks) {\r\n var axisBreaks = this._axisBreaks;\r\n $iter.eachContinue(axisBreaks.iterator(), function (axisBreak) {\r\n var breakStartIndex = axisBreak.adjustedStartValue;\r\n var breakEndIndex = axisBreak.adjustedEndValue;\r\n if (index < startIndex || !$type.isNumber(breakStartIndex) || !$type.isNumber(breakEndIndex)) {\r\n return false;\r\n }\r\n if ($math.intersect({ start: breakStartIndex, end: breakEndIndex }, { start: startIndex, end: endIndex })) {\r\n breakStartIndex = Math.max(startIndex, breakStartIndex);\r\n breakEndIndex = Math.min(endIndex, breakEndIndex);\r\n var breakSize = axisBreak.breakSize;\r\n // value to the right of break end\r\n if (index > breakEndIndex) {\r\n startIndex += (breakEndIndex - breakStartIndex) * (1 - breakSize);\r\n }\r\n // value to the left of break start\r\n else if (index < breakStartIndex) {\r\n }\r\n // value within break\r\n else {\r\n index = breakStartIndex + (index - breakStartIndex) * breakSize;\r\n }\r\n }\r\n return true;\r\n });\r\n }\r\n var deltaPosition = 0;\r\n var dataItem = this.dataItems.getIndex(index);\r\n if (dataItem) {\r\n deltaPosition = dataItem.deltaPosition;\r\n }\r\n return $math.round(deltaPosition + (index + location - startLocation - startIndex) / difference, 5);\r\n };\r\n /**\r\n * Converts a string category name to relative position on axis.\r\n *\r\n * `location` identifies relative location within category. 0 - beginning,\r\n * 0.5 - middle, 1 - end, and anything inbetween.\r\n *\r\n * @param category Category name\r\n * @param location Location (0-1)\r\n * @return Position\r\n */\r\n CategoryAxis.prototype.categoryToPosition = function (category, location) {\r\n var index = this.categoryToIndex(category);\r\n return this.indexToPosition(index, location);\r\n };\r\n /**\r\n * Converts a string category name to a orientation point (x, y, angle) on axis\r\n *\r\n * `location` identifies relative location within category. 0 - beginning,\r\n * 0.5 - middle, 1 - end, and anything inbetween.\r\n * @param category Category name\r\n * @param location Location (0-1)\r\n * @return Orientation point\r\n */\r\n CategoryAxis.prototype.categoryToPoint = function (category, location) {\r\n var position = this.categoryToPosition(category, location);\r\n var point = this.renderer.positionToPoint(position);\r\n var angle = this.renderer.positionToAngle(position);\r\n return { x: point.x, y: point.y, angle: angle };\r\n };\r\n /**\r\n * Converts a string category name to a orientation point (x, y, angle) on axis\r\n *\r\n * `location` identifies relative location within category. 0 - beginning,\r\n * 0.5 - middle, 1 - end, and anything inbetween.\r\n * @param category Category name\r\n * @param location Location (0-1)\r\n * @return Orientation point\r\n */\r\n CategoryAxis.prototype.anyToPoint = function (category, location) {\r\n return this.categoryToPoint(category, location);\r\n };\r\n /**\r\n * Converts a string category name to relative position on axis.\r\n *\r\n * An alias to `categoryToPosition()`.\r\n *\r\n * @param category Category name\r\n * @param location Location (0-1)\r\n * @return Relative position\r\n */\r\n CategoryAxis.prototype.anyToPosition = function (category, location) {\r\n return this.categoryToPosition(category, location);\r\n };\r\n /**\r\n * Converts named category to an index of data item it corresponds to.\r\n *\r\n * @param category Category\r\n * @return Data item index\r\n */\r\n CategoryAxis.prototype.categoryToIndex = function (category) {\r\n if ($type.hasValue(category)) {\r\n var dataItem = this.dataItemsByCategory.getKey(category);\r\n if (dataItem) {\r\n return dataItem.index;\r\n }\r\n }\r\n };\r\n /**\r\n * Zooms the axis to specific named ctaegories.\r\n *\r\n * @param startCategory Start category\r\n * @param endCategory End category\r\n */\r\n CategoryAxis.prototype.zoomToCategories = function (startCategory, endCategory) {\r\n this.zoomToIndexes(this.categoryToIndex(startCategory), this.categoryToIndex(endCategory) + 1);\r\n };\r\n /**\r\n * [getAnyRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param start [description]\r\n * @param end [description]\r\n * @param startLocation [description]\r\n * @param endLocation [description]\r\n * @return [description]\r\n */\r\n CategoryAxis.prototype.getAnyRangePath = function (start, end, startLocation, endLocation) {\r\n var startPos = this.categoryToPosition(start, startLocation);\r\n var endPos = this.categoryToPosition(end, endLocation);\r\n return this.getPositionRangePath(startPos, endPos); // Base class (Axis) gets range shape from AxisRenderer\r\n };\r\n /**\r\n * Takes an absolute position (px) within axis and adjust it to a specific\r\n * `location` within category it corresponds to.\r\n *\r\n * @param position Source position (px)\r\n * @param location Location within category (0-1)\r\n * @return Adjusted position (px)\r\n */\r\n CategoryAxis.prototype.roundPosition = function (position, location) {\r\n var index = this.positionToIndex(position);\r\n return this.indexToPosition(index, location);\r\n };\r\n /**\r\n * Finds and returns first series data item with specific category\r\n * @param series Target series\r\n * @param category Category\r\n * @return XYSeriesDataItem data item\r\n */\r\n CategoryAxis.prototype.getFirstSeriesDataItem = function (series, category) {\r\n for (var i = 0; i < series.dataItems.length; i++) {\r\n var dataItem = series.dataItems.getIndex(i);\r\n if (series.xAxis == this) {\r\n if (dataItem.categoryX == category) {\r\n return dataItem;\r\n }\r\n }\r\n if (series.yAxis == this) {\r\n if (dataItem.categoryY == category) {\r\n return dataItem;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Finds and returns last series data item with specific category.\r\n * @param series Target series\r\n * @param category Category\r\n * @return XYSeriesDataItem data item\r\n */\r\n CategoryAxis.prototype.getLastSeriesDataItem = function (series, category) {\r\n for (var i = series.dataItems.length - 1; i >= 0; i--) {\r\n var dataItem = series.dataItems.getIndex(i);\r\n if (series.xAxis == this) {\r\n if (dataItem.categoryX == category) {\r\n return dataItem;\r\n }\r\n }\r\n if (series.yAxis == this) {\r\n if (dataItem.categoryY == category) {\r\n return dataItem;\r\n }\r\n }\r\n }\r\n };\r\n // todo: optimize\r\n CategoryAxis.prototype.getSeriesDataItemByCategory = function (category, series) {\r\n var _this = this;\r\n var seriesDataItem;\r\n series.dataItems.each(function (dataItem) {\r\n if (series.xAxis == _this) {\r\n if (dataItem.categoryX == category) {\r\n seriesDataItem = dataItem;\r\n }\r\n }\r\n else if (series.yAxis == _this) {\r\n if (dataItem.categoryY == category) {\r\n seriesDataItem = dataItem;\r\n }\r\n }\r\n });\r\n return seriesDataItem;\r\n };\r\n /**\r\n * Returns a data item from Series that corresponds to a specific absolute\r\n * position on the Axis.\r\n *\r\n * @param series Target series\r\n * @param position Position (px)\r\n * @return XYSeriesDataItem data item\r\n */\r\n CategoryAxis.prototype.getSeriesDataItem = function (series, position, findNearest) {\r\n var _this = this;\r\n if ($type.isNumber(position)) {\r\n var index_1 = this.positionToIndex(position);\r\n if (index_1 >= this.dataItems.length) {\r\n index_1--;\r\n }\r\n var dataItem = this.dataItems.getIndex(index_1);\r\n if (dataItem) {\r\n var category_1 = dataItem.category;\r\n var sdi_1;\r\n var seriesDataItem = series.dataItems.getIndex(index_1);\r\n if (seriesDataItem) {\r\n if (series.xAxis == this) {\r\n if (seriesDataItem.categoryX == category_1) {\r\n return seriesDataItem;\r\n }\r\n }\r\n if (series.yAxis == this) {\r\n if (seriesDataItem.categoryY == category_1) {\r\n return seriesDataItem;\r\n }\r\n }\r\n }\r\n series.dataItems.each(function (dataItem) {\r\n if (series.xAxis == _this) {\r\n if (dataItem.categoryX == category_1) {\r\n if (!sdi_1) {\r\n sdi_1 = dataItem;\r\n }\r\n if (Math.abs(index_1 - sdi_1.index) > Math.abs(index_1 - dataItem.index)) {\r\n sdi_1 = dataItem;\r\n }\r\n }\r\n }\r\n if (series.yAxis == _this) {\r\n if (dataItem.categoryY == category_1) {\r\n if (!sdi_1) {\r\n sdi_1 = dataItem;\r\n }\r\n if (Math.abs(index_1 - sdi_1.index) > Math.abs(index_1 - dataItem.index)) {\r\n sdi_1 = dataItem;\r\n }\r\n }\r\n }\r\n });\r\n //@todo\r\n if (findNearest) {\r\n }\r\n return sdi_1;\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the X coordinate for series' data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Category\r\n * @param location Location (0-1)\r\n * @return X coordinate (px)\r\n */\r\n CategoryAxis.prototype.getX = function (dataItem, key, location, stackKey, range) {\r\n var position = this.getPositionX(dataItem, key, location, stackKey, range);\r\n if ($type.isNaN(position)) {\r\n return this.basePoint.x;\r\n }\r\n else {\r\n return this.renderer.positionToPoint(position).x;\r\n }\r\n };\r\n /**\r\n * Returns relative position on axis for series' data item.\r\n *\r\n * @since 4.5.14\r\n * @param dataItem Data item\r\n * @param key Category\r\n * @param location Location (0-1)\r\n * @return Relative position\r\n */\r\n CategoryAxis.prototype.getPositionX = function (dataItem, key, location, stackKey, range) {\r\n var position;\r\n if ($type.hasValue(key)) {\r\n position = this.categoryToPosition(dataItem.categories[key], location);\r\n }\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns the Y coordinate for series' data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Category\r\n * @param location Location (0-1)\r\n * @return Y coordinate (px)\r\n */\r\n CategoryAxis.prototype.getY = function (dataItem, key, location, stackKey, range) {\r\n var position = this.getPositionY(dataItem, key, location, stackKey, range);\r\n if ($type.isNaN(position)) {\r\n return this.basePoint.y;\r\n }\r\n else {\r\n return this.renderer.positionToPoint(position).y;\r\n }\r\n };\r\n /**\r\n * Returns relative position on axis for series' data item.\r\n *\r\n * @since 4.5.14\r\n * @param dataItem Data item\r\n * @param key Category\r\n * @param location Location (0-1)\r\n * @return Relative position\r\n */\r\n CategoryAxis.prototype.getPositionY = function (dataItem, key, location, stackKey, range) {\r\n var position;\r\n if ($type.hasValue(key)) {\r\n position = this.categoryToPosition(dataItem.categories[key], location);\r\n }\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns an angle for series data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Category\r\n * @param location Location (0-1)\r\n * @param stackKey Stack key (?)\r\n * @param range Range to fit in\r\n * @return Angle\r\n */\r\n CategoryAxis.prototype.getAngle = function (dataItem, key, location, stackKey, range) {\r\n var position = this.categoryToPosition(dataItem.categories[key], location);\r\n if (range) {\r\n position = $math.fitToRange(position, range.start, range.end);\r\n }\r\n return this.positionToAngle(position);\r\n };\r\n /**\r\n * Returns an absolute pixel coordinate of the start of the cell (category),\r\n * that specific position value falls into.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param position Position (px)\r\n * @return Cell start position (px)\r\n */\r\n CategoryAxis.prototype.getCellStartPosition = function (position) {\r\n return this.roundPosition(position, 0);\r\n };\r\n /**\r\n * Returns an absolute pixel coordinate of the end of the cell (category),\r\n * that specific position value falls into.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param position Position (px)\r\n * @return Cell end position (px)\r\n */\r\n CategoryAxis.prototype.getCellEndPosition = function (position) {\r\n return this.roundPosition(position, 1);\r\n };\r\n /**\r\n * Returns text to show in a category tooltip, based on specific position\r\n * within axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position (px)\r\n * @return Label (category)\r\n */\r\n CategoryAxis.prototype.getTooltipText = function (position) {\r\n var dataItem = this.dataItems.getIndex(this.positionToIndex(position));\r\n if (dataItem) {\r\n this.tooltipDataItem = dataItem;\r\n this.tooltip.dataItem = dataItem;\r\n if (this.tooltipText) {\r\n return this.tooltipText;\r\n }\r\n if (!this._adapterO) {\r\n return dataItem.category;\r\n }\r\n else {\r\n return this._adapterO.apply(\"getTooltipText\", dataItem.category);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns an index of the category that corresponds to specific pixel\r\n * position within axis.\r\n *\r\n * @param position Position (px)\r\n * @return Category index\r\n */\r\n CategoryAxis.prototype.positionToIndex = function (position) {\r\n position = $math.round(position, 10);\r\n if (position < 0) {\r\n position = 0;\r\n }\r\n if (position > 1) {\r\n position = 1;\r\n }\r\n var startIndex = this.startIndex;\r\n var endIndex = this.endIndex;\r\n var difference = endIndex - startIndex - this.startLocation - (1 - this.endLocation);\r\n position += 1 / difference * this.startLocation;\r\n var index = null;\r\n if (this._axisBreaks) {\r\n var axisBreaks = this._axisBreaks;\r\n // in case we have some axis breaks\r\n $iter.eachContinue(axisBreaks.iterator(), function (axisBreak) {\r\n var breakStartPosition = axisBreak.startPosition;\r\n var breakEndPosition = axisBreak.endPosition;\r\n var breakStartIndex = axisBreak.adjustedStartValue;\r\n var breakEndIndex = axisBreak.adjustedEndValue;\r\n breakStartIndex = $math.max(breakStartIndex, startIndex);\r\n breakEndIndex = $math.min(breakEndIndex, endIndex);\r\n var breakSize = axisBreak.breakSize;\r\n difference -= (breakEndIndex - breakStartIndex) * (1 - breakSize);\r\n // position to the right of break end\r\n if (position > breakEndPosition) {\r\n startIndex += (breakEndIndex - breakStartIndex) * (1 - breakSize);\r\n }\r\n // position to the left of break start\r\n else if (position < breakStartPosition) {\r\n }\r\n // value within break\r\n else {\r\n var breakPosition = (position - breakStartPosition) / (breakEndPosition - breakStartPosition);\r\n index = breakStartIndex + Math.round(breakPosition * (breakEndIndex - breakStartIndex));\r\n return false;\r\n }\r\n return true;\r\n });\r\n }\r\n if (!$type.isNumber(index)) {\r\n index = Math.floor(position * difference + startIndex);\r\n }\r\n if (index >= this.dataItems.length) {\r\n index = this.dataItems.length - 1;\r\n }\r\n // not good, when panning out of bounds, each time one less item gets selected\r\n //if (index >= endIndex) {\r\n //\tindex--;\r\n //}\r\n return index;\r\n };\r\n /**\r\n * Returns category based on position.\r\n *\r\n * Please note that `position` represents position within axis which may be\r\n * zoomed and not correspond to Cursor's `position`.\r\n *\r\n * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.\r\n *\r\n * This is a synonim of `getPositionLabel()` implemented here for consistentcy.\r\n *\r\n * @since 4.3.8\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.\r\n * @param position Relative position on axis (0-1)\r\n * @return Position label\r\n */\r\n CategoryAxis.prototype.positionToCategory = function (position) {\r\n return this.getPositionLabel(position);\r\n };\r\n /**\r\n * Returns category based on position.\r\n *\r\n * Please note that `position` represents position within axis which may be\r\n * zoomed and not correspond to Cursor's `position`.\r\n *\r\n * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.\r\n * @param position Relative position on axis (0-1)\r\n * @return Position label\r\n */\r\n CategoryAxis.prototype.getPositionLabel = function (position) {\r\n var dataItem = this.dataItems.getIndex(this.positionToIndex(position));\r\n if (dataItem) {\r\n return dataItem.category;\r\n }\r\n };\r\n Object.defineProperty(CategoryAxis.prototype, \"basePoint\", {\r\n /**\r\n * Coordinates of the actual axis start.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Base point\r\n */\r\n get: function () {\r\n // This makes base grid to be drawn at the end of the axis and adds extra\r\n // grid which we need to nicely close the chart.\r\n return this.renderer.positionToPoint(1);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes Axis' renderer.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n CategoryAxis.prototype.initRenderer = function () {\r\n _super.prototype.initRenderer.call(this);\r\n var renderer = this.renderer;\r\n renderer.baseGrid.disabled = true;\r\n };\r\n Object.defineProperty(CategoryAxis.prototype, \"frequency\", {\r\n /**\r\n * Current frequency of labels of the axis.\r\n *\r\n * Normally it would be 1, but when labels start to be hidden due\r\n * to `minGridDistance` this read-only property will increase.\r\n *\r\n * @readonly\r\n * @since 4.2.0\r\n * @return Label frequency\r\n */\r\n get: function () {\r\n return this._frequency;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CategoryAxis.prototype, \"sortBySeries\", {\r\n /**\r\n * @return Sort categories?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"sortBySeries\");\r\n },\r\n /**\r\n * If set to a reference of [[ColumnSeries]] the categories will be sorted\r\n * by actual values.\r\n *\r\n * The categories are ordered in descending order (from highest values to\r\n * lowest). To reverse the order, use axis renderer's `inversed` setting.\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * categoryAxis.sortBySeries = series;\r\n * categoryAxis.renderer.inversed = true;\r\n * ```\r\n * ```JavaScript\r\n * categoryAxis.sortBySeries = series;\r\n * categoryAxis.renderer.inversed = true;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * // ...\r\n * \"sortBySeries\": \"s1\",\r\n * \"renderer\": {\r\n * // ...\r\n * \"inversed\": true\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @since 4.8.7\r\n * @param value Sort categories?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"sortBySeries\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n CategoryAxis.prototype.processConfig = function (config) {\r\n if (config) {\r\n if ($type.hasValue(config.sortBySeries) && $type.isString(config.sortBySeries)) {\r\n if (this.map.hasKey(config.sortBySeries)) {\r\n config.sortBySeries = this.map.getKey(config.sortBySeries);\r\n }\r\n else {\r\n this.addDelayedMap(\"sortBySeries\", config.sortBySeries);\r\n delete config.sortBySeries;\r\n }\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n return CategoryAxis;\r\n}(Axis));\r\nexport { CategoryAxis };\r\n/**\r\n * Register class, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"CategoryAxis\"] = CategoryAxis;\r\nregistry.registeredClasses[\"CategoryAxisDataItem\"] = CategoryAxisDataItem;\r\n//# sourceMappingURL=CategoryAxis.js.map","/**\r\n * XY series module.\r\n */\r\nimport { __extends, __values } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Series, SeriesDataItem } from \"./Series\";\r\nimport { Sprite, visualProperties } from \"../../core/Sprite\";\r\nimport { ValueAxis } from \"../axes/ValueAxis\";\r\nimport { Dictionary } from \"../../core/utils/Dictionary\";\r\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\r\nimport { XYChart } from \"../types/XYChart\";\r\nimport { CategoryAxis } from \"../axes/CategoryAxis\";\r\nimport { DateAxis } from \"../axes/DateAxis\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $time from \"../../core/utils/Time\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport { options } from \"../../core/Options\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[XYSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar XYSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(XYSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function XYSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"XYSeriesDataItem\";\r\n _this.values.customValue = {};\r\n _this.values.valueX = { stack: 0 };\r\n _this.values.valueY = { stack: 0 };\r\n _this.values.openValueX = {};\r\n _this.values.openValueY = {};\r\n _this.values.dateX = {};\r\n _this.values.dateY = {};\r\n _this.values.openDateX = {};\r\n _this.values.openDateY = {};\r\n _this.setLocation(\"dateX\", 0.5, 0);\r\n _this.setLocation(\"dateY\", 0.5, 0);\r\n _this.setLocation(\"categoryX\", 0.5, 0);\r\n _this.setLocation(\"categoryY\", 0.5, 0);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"valueX\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.valueX.value;\r\n },\r\n /**\r\n * Item's numeric value on X value axis.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"valueX\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"customValue\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.customValue.value;\r\n },\r\n /**\r\n * Item's custom numeric value.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"customValue\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"valueY\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.valueY.value;\r\n },\r\n /**\r\n * Item's numeric value on Y value axis.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"valueY\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"dateX\", {\r\n /**\r\n * @return Date\r\n */\r\n get: function () {\r\n return this.getDate(\"dateX\");\r\n },\r\n /**\r\n * Item's date value on X date-based axis.\r\n *\r\n * @param date Date\r\n */\r\n set: function (date) {\r\n this.setDate(\"dateX\", date);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"dateY\", {\r\n /**\r\n * @return Date\r\n */\r\n get: function () {\r\n return this.getDate(\"dateY\");\r\n },\r\n /**\r\n * Item's date value on Y date-based axis.\r\n *\r\n * @param date Date\r\n */\r\n set: function (date) {\r\n this.setDate(\"dateY\", date);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"categoryX\", {\r\n /**\r\n * @return Category\r\n */\r\n get: function () {\r\n return this.categories.categoryX;\r\n },\r\n /**\r\n * Item's category on X category axis.\r\n *\r\n * @param category Category\r\n */\r\n set: function (category) {\r\n this.setCategory(\"categoryX\", category);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"categoryY\", {\r\n /**\r\n * @return Category\r\n */\r\n get: function () {\r\n return this.categories.categoryY;\r\n },\r\n /**\r\n * Item's category on Y category axis.\r\n *\r\n * @param category Category\r\n */\r\n set: function (category) {\r\n this.setCategory(\"categoryY\", category);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"openValueX\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.openValueX.value;\r\n },\r\n /**\r\n * Item's open numeric value on X value axis.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"openValueX\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"openValueY\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.openValueY.value;\r\n },\r\n /**\r\n * Item's open numeric value on Y value axis.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"openValueY\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"openDateX\", {\r\n /**\r\n * @return Date\r\n */\r\n get: function () {\r\n return this.getDate(\"openDateX\");\r\n },\r\n /**\r\n * Item's open date value on X date-based axis.\r\n *\r\n * @param date Date\r\n */\r\n set: function (date) {\r\n this.setDate(\"openDateX\", date);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"openDateY\", {\r\n /**\r\n * @return Date\r\n */\r\n get: function () {\r\n return this.getDate(\"openDateY\");\r\n },\r\n /**\r\n * Item's open date value on Y date-based axis.\r\n *\r\n * @param date Date\r\n */\r\n set: function (date) {\r\n this.setDate(\"openDateY\", date);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"openCategoryX\", {\r\n /**\r\n * @return Category\r\n */\r\n get: function () {\r\n return this.categories.openCategoryX;\r\n },\r\n /**\r\n * Item's open category on X category axis.\r\n *\r\n * @param category Category\r\n */\r\n set: function (category) {\r\n this.setCategory(\"openCategoryX\", category);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeriesDataItem.prototype, \"openCategoryY\", {\r\n /**\r\n * @return Category\r\n */\r\n get: function () {\r\n return this.categories.openCategoryY;\r\n },\r\n /**\r\n * Item's open category on Y category axis.\r\n *\r\n * @param category Category\r\n */\r\n set: function (category) {\r\n this.setCategory(\"openCategoryY\", category);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Return smallest value out of all item's value fields.\r\n *\r\n * @ignore Exclude from docs\r\n * @param fields Fields to check in\r\n * @param working Include working (temporary) values\r\n * @param stackValue If item is in a stack, the value item starts as\r\n * @return Value\r\n */\r\n XYSeriesDataItem.prototype.getMin = function (fields, working, stackValue) {\r\n var _this = this;\r\n //if (this.visible) { // dumped because of non smooth zooming\r\n var min;\r\n if (!$type.isNumber(stackValue)) {\r\n stackValue = 0;\r\n }\r\n $array.each(fields, function (field) {\r\n var value;\r\n if (working) {\r\n value = _this.getWorkingValue(field);\r\n }\r\n else {\r\n value = _this.getValue(field);\r\n }\r\n value += stackValue;\r\n if (value < min || !$type.isNumber(min)) {\r\n min = value;\r\n }\r\n });\r\n return min;\r\n //}\r\n };\r\n /**\r\n * Return biggest value out of all item's value fields.\r\n *\r\n * @ignore Exclude from docs\r\n * @param fields Fields to check in\r\n * @param working Include working (temporary) values\r\n * @param stackValue If item is in a stack, the value item starts as\r\n * @return Value\r\n */\r\n XYSeriesDataItem.prototype.getMax = function (fields, working, stackValue) {\r\n var _this = this;\r\n //if (this.visible) { // dumped because of non smooth zooming\r\n var max;\r\n if (!$type.isNumber(stackValue)) {\r\n stackValue = 0;\r\n }\r\n $array.each(fields, function (field) {\r\n var value;\r\n if (working) {\r\n value = _this.getWorkingValue(field);\r\n }\r\n else {\r\n value = _this.getValue(field);\r\n }\r\n value += stackValue;\r\n if (value > max || !$type.isNumber(max)) {\r\n max = value;\r\n }\r\n });\r\n return max;\r\n //}\r\n };\r\n return XYSeriesDataItem;\r\n}(SeriesDataItem));\r\nexport { XYSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines Series for [[XYChart]].\r\n *\r\n * @see {@link IXYSeriesEvents} for a list of available Events\r\n * @see {@link IXYSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar XYSeries = /** @class */ (function (_super) {\r\n __extends(XYSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function XYSeries() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Indicates which of the series' `dataFields` to calculate aggregate values\r\n * for.\r\n *\r\n * Available data fields for all [[XYSeries]] are:\r\n * `valueX`, `valueY`, `openValueX`, and `openValueY`.\r\n *\r\n * [[CandlestickSeries]] adds:\r\n * `lowValueX`, `lowValueY`, `highValueX`, and `highValueY`.\r\n *\r\n * Available options:\r\n * `\"open\"`, `\"close\"`, `\"low\"`, `\"high\"`, `\"average\"`, `\"sum\"`.\r\n *\r\n * Defaults are as follows:\r\n * * `valueX`: `\"close\"`\r\n * * `valueY`: `\"close\"`\r\n * * `openValueX`: `\"open\"`\r\n * * `openValueY`: `\"open\"`\r\n * * `lowValueX`: `\"low\"`\r\n * * `lowValueY`: `\"low\"`\r\n * * `highValueX`: `\"high\"`\r\n * * `highValueY`: `\"high\"`\r\n *\r\n * Is required only if data being plotted on a `DateAxis` and\r\n * its `groupData` is set to `true`.\r\n *\r\n * ```TypeScript\r\n * let dateAxis = chart.xAxes.push(new am4charts.DateAxis());\r\n * dateAxis.groupData = true;\r\n *\r\n * let valueAxis = chart.xAxes.push(new am4charts.valueAxis());\r\n *\r\n * let series = chart.series.push(new am4charts.LineSeries());\r\n * series.dataFields.dateX = \"date\";\r\n * series.dataFields.valueY = \"value\";\r\n * series.groupFields.valueY = \"average\";\r\n * ```\r\n * ```JavaScript\r\n * var dateAxis = chart.xAxes.push(new am4charts.DateAxis());\r\n * dateAxis.groupData = true;\r\n *\r\n * var valueAxis = chart.xAxes.push(new am4charts.valueAxis());\r\n *\r\n * var series = chart.series.push(new am4charts.LineSeries());\r\n * series.dataFields.dateX = \"date\";\r\n * series.dataFields.valueY = \"value\";\r\n * series.groupFields.valueY = \"average\";\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * \"groupData\": true\r\n * }],\r\n * \"yAxes\": [{\r\n * \"type\": \"ValueAxis\"\r\n * }],\r\n * \"series\": [{\r\n * \"type\": \"LineSeries\",\r\n * \"dataFields\": {\r\n * \"dateX\": \"date\",\r\n * \"valueY\": \"value\"\r\n * },\r\n * \"groupFields\": {\r\n * \"valueY\": \"average\"\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * The above setup will ensure, that if there are many data items within\r\n * selected range, they will be grouped into aggregated data points, using\r\n * average value of all the values.\r\n *\r\n * For example if we have 2 years worth of daily data (~700 data items), when\r\n * fully zoomed out, the chart would show ~100 data items instead: one for\r\n * each week in those two years.\r\n *\r\n * Grouping will occur automatically, based on current selection range, and\r\n * will change dynamically when user zooms in/out the chart.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/date-axis/#Dynamic_data_item_grouping} for more information about dynamic data item grouping.\r\n * @since 4.7.0\r\n */\r\n _this.groupFields = {};\r\n /**\r\n * X axis the series is attached to.\r\n */\r\n _this._xAxis = new MutableValueDisposer();\r\n /**\r\n * Y axis the series is attached to.\r\n */\r\n _this._yAxis = new MutableValueDisposer();\r\n /**\r\n * [_xValueFields description]\r\n *\r\n * @todo Description\r\n */\r\n _this._xValueFields = [];\r\n /**\r\n * [_yValueFields description]\r\n *\r\n * @todo Description\r\n */\r\n _this._yValueFields = [];\r\n /**\r\n * @ignore\r\n */\r\n _this._baseInterval = {};\r\n /**\r\n * @ignore\r\n */\r\n _this.dataGrouped = false;\r\n /**\r\n * @ignore\r\n */\r\n _this.usesShowFields = false;\r\n /**\r\n * @ignore\r\n */\r\n _this._dataSetChanged = false;\r\n _this._maxxX = 100000;\r\n _this._maxxY = 100000;\r\n _this._propertiesChanged = false;\r\n _this.className = \"XYSeries\";\r\n _this.isMeasured = false;\r\n _this.groupFields.valueX = \"close\";\r\n _this.groupFields.valueY = \"close\";\r\n _this.groupFields.customValue = \"close\";\r\n _this.groupFields.openValueX = \"open\";\r\n _this.groupFields.openValueY = \"open\";\r\n _this.cursorTooltipEnabled = true;\r\n _this.cursorHoverEnabled = true;\r\n _this.excludeFromTotal = false;\r\n _this.mainContainer.mask = new Sprite();\r\n _this.mainContainer.mask.setElement(_this.paper.add(\"path\"));\r\n _this.stacked = false;\r\n _this.snapTooltip = false;\r\n _this._showBullets = false;\r\n _this.tooltip.pointerOrientation = \"horizontal\";\r\n _this.hideTooltipWhileZooming = true;\r\n _this.setPropertyValue(\"maskBullets\", true);\r\n _this.tooltip.events.on(\"hidden\", function () {\r\n _this.returnBulletDefaultState();\r\n }, undefined, false);\r\n _this._disposers.push(_this._xAxis);\r\n _this._disposers.push(_this._yAxis);\r\n _this.observe(visualProperties, function () {\r\n if (_this.inited) {\r\n _this._propertiesChanged = true;\r\n if (_this.legendDataItem) {\r\n _this.legendDataItem.childrenCreated = false;\r\n }\r\n if (_this.chart && _this.chart.legend) {\r\n _this.chart.legend.invalidateDataItems();\r\n }\r\n _this.invalidate();\r\n }\r\n }, undefined, false);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n XYSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"X/Y Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n XYSeries.prototype.createDataItem = function () {\r\n return new XYSeriesDataItem();\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYSeries.prototype.resetExtremes = function () {\r\n this._tmin.clear();\r\n this._tmax.clear();\r\n this._smin.clear();\r\n this._smax.clear();\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYSeries.prototype.dataChangeUpdate = function () {\r\n this.dataGrouped = false;\r\n this._baseInterval = {};\r\n this._currentDataSetId = \"\";\r\n this.resetExtremes();\r\n if (this.xAxis) {\r\n this.xAxis.seriesDataChangeUpdate(this);\r\n }\r\n if (this.yAxis) {\r\n this.yAxis.seriesDataChangeUpdate(this);\r\n }\r\n };\r\n /**\r\n * (Re)validates the series' data.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYSeries.prototype.validateData = function () {\r\n this._baseInterval = {};\r\n var dataFields = this.dataFields;\r\n if (dataFields.valueYShow || dataFields.openValueXShow || dataFields.openValueXShow || dataFields.openValueYShow) {\r\n this.usesShowFields = true;\r\n }\r\n else {\r\n this.usesShowFields = false;\r\n }\r\n this.defineFields();\r\n if (this.data.length > 0) {\r\n this.dataChangeUpdate();\r\n }\r\n _super.prototype.validateData.call(this);\r\n this.updateItemReaderText();\r\n if (this.chart) {\r\n if (!$type.hasValue(this.dataFields[this._xField]) || !$type.hasValue(this.dataFields[this._yField])) {\r\n throw Error(\"Data fields for series \\\"\" + (this.name ? this.name : this.uid) + \"\\\" are not properly defined.\");\r\n }\r\n }\r\n // 4.7.21 solves 51540\r\n if (this.inited && this.isHidden) {\r\n this.hide(0);\r\n }\r\n this.dataGrouped = false;\r\n };\r\n /**\r\n * Processes data item.\r\n *\r\n * @param dataItem Data item\r\n * @param dataContext Raw data\r\n * @param index Index of the data item\r\n */\r\n XYSeries.prototype.processDataItem = function (dataItem, dataContext) {\r\n try {\r\n _super.prototype.processDataItem.call(this, dataItem, dataContext);\r\n this.xAxis.processSeriesDataItem(dataItem, \"X\");\r\n this.yAxis.processSeriesDataItem(dataItem, \"Y\");\r\n this.setInitialWorkingValues(dataItem);\r\n }\r\n catch (e) {\r\n if (this._chart) {\r\n this._chart.raiseCriticalError(e);\r\n }\r\n }\r\n };\r\n /**\r\n *\r\n * When validating raw data, instead of processing data item, we update it\r\n *\r\n * @ignore Exclude from docs\r\n * @param item\r\n */\r\n XYSeries.prototype.updateDataItem = function (dataItem) {\r\n _super.prototype.updateDataItem.call(this, dataItem);\r\n //dataItem.events.disable();\r\n this.xAxis.processSeriesDataItem(dataItem, \"X\");\r\n this.yAxis.processSeriesDataItem(dataItem, \"Y\");\r\n //dataItem.events.enable();\t\t\r\n };\r\n /**\r\n * Inits data item's working values.\r\n *\r\n * @param dataItem Data item\r\n * @param index Data item's index\r\n */\r\n XYSeries.prototype.setInitialWorkingValues = function (dataItem) {\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYSeries.prototype.disposeData = function () {\r\n _super.prototype.disposeData.call(this);\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (xAxis) {\r\n var dataItemsX = this.dataItemsByAxis.getKey(xAxis.uid);\r\n if (dataItemsX) {\r\n dataItemsX.clear();\r\n }\r\n if (xAxis instanceof CategoryAxis) {\r\n this.clearCatAxis(xAxis);\r\n }\r\n }\r\n if (yAxis) {\r\n var dataItemsY = this.dataItemsByAxis.getKey(yAxis.uid);\r\n if (dataItemsY) {\r\n dataItemsY.clear();\r\n }\r\n if (yAxis instanceof CategoryAxis) {\r\n this.clearCatAxis(yAxis);\r\n }\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYSeries.prototype.clearCatAxis = function (axis) {\r\n var uid = this.uid;\r\n axis.dataItems.each(function (dataItem) {\r\n if (dataItem.seriesDataItems[uid]) {\r\n dataItem.seriesDataItems[uid] = [];\r\n }\r\n });\r\n };\r\n /**\r\n * Sets up which data fields to use for data access.\r\n */\r\n XYSeries.prototype.defineFields = function () {\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (xAxis && yAxis) {\r\n var xAxisFieldName = xAxis.axisFieldName;\r\n var xField = (xAxisFieldName + \"X\");\r\n var xOpenField = (\"open\" + $utils.capitalize(xAxisFieldName) + \"X\");\r\n var yAxisFieldName = yAxis.axisFieldName;\r\n var yField = (yAxisFieldName + \"Y\");\r\n var yOpenField = (\"open\" + $utils.capitalize(yAxisFieldName) + \"Y\");\r\n this._xField = xField;\r\n this._yField = yField;\r\n if (this.dataFields[xOpenField]) {\r\n this._xOpenField = xOpenField;\r\n }\r\n if (this.dataFields[yOpenField]) {\r\n this._yOpenField = yOpenField;\r\n }\r\n if (!this.dataFields[yOpenField] && this.baseAxis == yAxis) {\r\n this._yOpenField = yField;\r\n }\r\n if (!this.dataFields[xOpenField] && this.baseAxis == xAxis) {\r\n this._xOpenField = xField;\r\n }\r\n if (this.stacked && this.baseAxis == xAxis) {\r\n this._xOpenField = xField;\r\n }\r\n if (this.stacked && this.baseAxis == yAxis) {\r\n this._yOpenField = yField;\r\n }\r\n if ((xAxis instanceof CategoryAxis) && (yAxis instanceof CategoryAxis)) {\r\n if (!this._yOpenField) {\r\n this._yOpenField = yField;\r\n }\r\n }\r\n this._xValueFields = [];\r\n this._yValueFields = [];\r\n this.addValueField(xAxis, this._xValueFields, this._xField);\r\n this.addValueField(xAxis, this._xValueFields, this._xOpenField);\r\n this.addValueField(yAxis, this._yValueFields, this._yField);\r\n this.addValueField(yAxis, this._yValueFields, this._yOpenField);\r\n }\r\n };\r\n /**\r\n * [axis description]\r\n *\r\n * @todo Description\r\n * @param axis Axis\r\n * @param fields Fields (?)\r\n * @param field Field\r\n */\r\n XYSeries.prototype.addValueField = function (axis, fields, field) {\r\n if (axis instanceof ValueAxis) {\r\n if ($type.hasValue(this.dataFields[field]) && fields.indexOf(field) == -1) {\r\n fields.push(field);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets category field from the category axis.\r\n *\r\n * User might set field for category axis only, but not for series. In such\r\n * case, we take field value from axis and set it for series.\r\n *\r\n * @param field Field\r\n * @param axis Axis\r\n */\r\n XYSeries.prototype.setCategoryAxisField = function (field, axis) {\r\n if (!$type.hasValue(this.dataFields[field])) {\r\n this.dataFields[field] = axis.dataFields.category;\r\n }\r\n };\r\n /**\r\n * Sets date field from the date axis.\r\n *\r\n * User might set field for category axis only, but not for series. In such\r\n * case, we take field value from axis and set it for series.\r\n *\r\n * @param field Field\r\n * @param axis Axis\r\n */\r\n XYSeries.prototype.setDateAxisField = function (field, axis) {\r\n if (!$type.hasValue(this.dataFields[field])) {\r\n this.dataFields[field] = axis.dataFields.date;\r\n }\r\n };\r\n /**\r\n * Performs after-draw tasks, e.g. creates masks.\r\n */\r\n XYSeries.prototype.afterDraw = function () {\r\n _super.prototype.afterDraw.call(this);\r\n this.createMask();\r\n };\r\n /**\r\n * Create a mask for the series.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYSeries.prototype.createMask = function () {\r\n // this mask from which we cut out ranges. does not work well if ranges overlap.\r\n if (this.mainContainer.mask) {\r\n var path_1 = this.getMaskPath();\r\n // @todo: this approach won't work well on circluar or other non x/y axes\r\n $iter.each(this.axisRanges.iterator(), function (range) {\r\n if (range.axisFill.fillPath) {\r\n range.axisFill.validate();\r\n path_1 += range.axisFill.fillPath;\r\n }\r\n });\r\n this.mainContainer.mask.path = path_1;\r\n }\r\n };\r\n /**\r\n * Returns an SVG path to use as series mask.\r\n *\r\n * @return SVG path\r\n */\r\n XYSeries.prototype.getMaskPath = function () {\r\n if (this.xAxis && this.yAxis) {\r\n return $path.rectToPath({\r\n x: 0,\r\n y: 0,\r\n width: this.xAxis.axisLength,\r\n height: this.yAxis.axisLength\r\n });\r\n }\r\n return \"\";\r\n };\r\n /**\r\n * Returns axis data field to use.\r\n *\r\n * @param axis Axis\r\n * @return Field name\r\n */\r\n XYSeries.prototype.getAxisField = function (axis) {\r\n if (axis == this.xAxis) {\r\n return this.xField;\r\n }\r\n if (axis == this.yAxis) {\r\n return this.yField;\r\n }\r\n };\r\n /**\r\n * Validates data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYSeries.prototype.validateDataItems = function () {\r\n var chart = this.chart;\r\n if (chart) {\r\n this._maxxX = $math.max(100000, chart.plotContainer.maxWidth * 2);\r\n this._maxxY = $math.max(100000, chart.plotContainer.maxHeight * 2);\r\n }\r\n // this helps date axis to check which baseInterval we should use\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (xAxis && yAxis) {\r\n xAxis.updateAxisBySeries();\r\n yAxis.updateAxisBySeries();\r\n }\r\n _super.prototype.validateDataItems.call(this);\r\n if (xAxis && yAxis) {\r\n xAxis.postProcessSeriesDataItems(this);\r\n yAxis.postProcessSeriesDataItems(this);\r\n }\r\n };\r\n /**\r\n * Validates data range.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYSeries.prototype.validateDataRange = function () {\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (xAxis && yAxis) {\r\n if (xAxis.dataRangeInvalid) {\r\n xAxis.validateDataRange();\r\n }\r\n if (yAxis.dataRangeInvalid) {\r\n yAxis.validateDataRange();\r\n }\r\n }\r\n _super.prototype.validateDataRange.call(this);\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYSeries.prototype.validate = function () {\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (xAxis && yAxis) {\r\n if (xAxis.invalid) {\r\n xAxis.validate();\r\n }\r\n if (yAxis.invalid) {\r\n yAxis.validate();\r\n }\r\n this.y = yAxis.pixelY;\r\n this.x = xAxis.pixelX;\r\n this._showBullets = true;\r\n var minBulletDistance = this.minBulletDistance;\r\n if ($type.isNumber(minBulletDistance)) {\r\n if (this.baseAxis.axisLength / (this.endIndex - this.startIndex) < minBulletDistance) {\r\n this._showBullets = false;\r\n }\r\n }\r\n }\r\n this.updateTooltip();\r\n _super.prototype.validate.call(this);\r\n var chart = this.chart;\r\n var maskBullets = this.maskBullets;\r\n if (chart && maskBullets) {\r\n if (chart.className == \"XYChart\") {\r\n if (chart.leftAxesContainer.layout == \"vertical\" || chart.rightAxesContainer.layout == \"vertical\") {\r\n if (this.yAxis) {\r\n this.bulletsContainer.mask = this.yAxis.renderer.gridContainer;\r\n }\r\n else {\r\n this.bulletsContainer.mask = undefined;\r\n }\r\n }\r\n if (chart.topAxesContainer.layout == \"horizontal\" || chart.bottomAxesContainer.layout == \"horizontal\") {\r\n if (this.xAxis) {\r\n this.bulletsContainer.mask = this.xAxis.renderer.gridContainer;\r\n }\r\n else {\r\n this.bulletsContainer.mask = undefined;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n Object.defineProperty(XYSeries.prototype, \"xAxis\", {\r\n /**\r\n * @return Axis\r\n */\r\n get: function () {\r\n if (this.chart) {\r\n if (!this._xAxis.get()) {\r\n var axis = this.chart.xAxes.getIndex(0);\r\n if (!axis) {\r\n throw Error(\"There are no X axes on chart.\");\r\n }\r\n this.xAxis = axis;\r\n }\r\n return this._xAxis.get();\r\n }\r\n },\r\n /**\r\n * X axis the series is attached to.\r\n *\r\n * @param axis Axis\r\n */\r\n set: function (axis) {\r\n this.setXAxis(axis);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n XYSeries.prototype.setXAxis = function (axis) {\r\n var oldAxis = this._xAxis.get();\r\n if (oldAxis != axis) {\r\n if (oldAxis) {\r\n this.dataItemsByAxis.removeKey(oldAxis.uid);\r\n // TODO why is this here ?\r\n this._xAxis.dispose();\r\n // temp @todo: why it is not disposed?\r\n oldAxis.series.removeValue(this);\r\n }\r\n this._xAxis.set(axis, axis.registerSeries(this));\r\n this.dataItemsByAxis.setKey(axis.uid, new Dictionary());\r\n this.invalidateData();\r\n }\r\n };\r\n Object.defineProperty(XYSeries.prototype, \"yAxis\", {\r\n /**\r\n * @return Axis\r\n */\r\n get: function () {\r\n if (this.chart) {\r\n if (!this._yAxis.get()) {\r\n var axis = this.chart.yAxes.getIndex(0);\r\n if (!axis) {\r\n throw Error(\"There are no Y axes on chart.\");\r\n }\r\n this.yAxis = axis;\r\n }\r\n return this._yAxis.get();\r\n }\r\n },\r\n /**\r\n * Y axis the series is attached to.\r\n *\r\n * @param axis Axis\r\n */\r\n set: function (axis) {\r\n this.setYAxis(axis);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n XYSeries.prototype.setYAxis = function (axis) {\r\n var oldAxis = this._yAxis.get();\r\n if (oldAxis != axis) {\r\n if (oldAxis) {\r\n this.dataItemsByAxis.removeKey(oldAxis.uid);\r\n // TODO why is this here ?\r\n this._yAxis.dispose();\r\n // temp @todo: why it is not disposed?\r\n oldAxis.series.removeValue(this);\r\n }\r\n this._yAxis.set(axis, axis.registerSeries(this));\r\n if (axis.chart instanceof XYChart) {\r\n axis.chart.handleYAxisSet(this);\r\n }\r\n this.dataItemsByAxis.setKey(axis.uid, new Dictionary());\r\n this.invalidateData();\r\n }\r\n };\r\n Object.defineProperty(XYSeries.prototype, \"baseAxis\", {\r\n /**\r\n * @return Axis\r\n */\r\n get: function () {\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (!this._baseAxis && xAxis && yAxis) {\r\n if (yAxis instanceof DateAxis) {\r\n this._baseAxis = yAxis;\r\n }\r\n if (xAxis instanceof DateAxis) {\r\n this._baseAxis = xAxis;\r\n }\r\n if (yAxis instanceof CategoryAxis) {\r\n this._baseAxis = yAxis;\r\n }\r\n if (xAxis instanceof CategoryAxis) {\r\n this._baseAxis = xAxis;\r\n }\r\n if (!this._baseAxis) {\r\n this._baseAxis = xAxis;\r\n }\r\n }\r\n return this._baseAxis;\r\n },\r\n /**\r\n * The main (base) axis.\r\n *\r\n * This is the axis that series fills will go to, or grow animations will\r\n * happen from.\r\n *\r\n * @param value Axis\r\n */\r\n set: function (value) {\r\n if (this._baseAxis != value) {\r\n this._baseAxis = value;\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds one or several (array) of data items to the existing data.\r\n *\r\n * @param rawDataItem One or many raw data item objects\r\n */\r\n XYSeries.prototype.addData = function (rawDataItem, removeCount, skipRaw) {\r\n _super.prototype.addData.call(this, rawDataItem, removeCount, skipRaw);\r\n var scrollbarSeries = this.scrollbarSeries;\r\n if (scrollbarSeries) {\r\n this.scrollbarSeries.addData(rawDataItem, removeCount, true);\r\n }\r\n };\r\n XYSeries.prototype.setData = function (value) {\r\n _super.prototype.setData.call(this, value);\r\n if (this.scrollbarSeries) {\r\n this.scrollbarSeries.setData(value);\r\n }\r\n };\r\n /**\r\n * Makes the chart use particular data set.\r\n *\r\n * If `id` is not provided or there is no such data set, main data will be\r\n * used.\r\n *\r\n * @ignore\r\n * @since 4.7.0\r\n * @param id Data set id\r\n */\r\n XYSeries.prototype.setDataSet = function (id) {\r\n var changed = _super.prototype.setDataSet.call(this, id);\r\n if (changed) {\r\n this._dataSetChanged = true;\r\n var dataItems = this.dataItems;\r\n this.resetExtremes();\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n this._prevStartIndex = undefined;\r\n this._prevEndIndex = undefined;\r\n this._startIndex = undefined;\r\n this._endIndex = undefined;\r\n if (!this.appeared) {\r\n this.processValues(false); // this will slow down!\r\n }\r\n if (xAxis instanceof DateAxis && xAxis == this.baseAxis) {\r\n this._tmin.setKey(xAxis.uid, dataItems.getIndex(0).dateX.getTime());\r\n this._tmax.setKey(xAxis.uid, dataItems.getIndex(dataItems.length - 1).dateX.getTime());\r\n this.dispatch(\"extremeschanged\");\r\n }\r\n if (yAxis instanceof DateAxis && yAxis == this.baseAxis) {\r\n this._tmin.setKey(yAxis.uid, dataItems.getIndex(0).dateY.getTime());\r\n this._tmax.setKey(yAxis.uid, dataItems.getIndex(dataItems.length - 1).dateY.getTime());\r\n this.dispatch(\"extremeschanged\");\r\n }\r\n }\r\n return changed;\r\n };\r\n /**\r\n * Processes values after data items' were added.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItems Data items\r\n */\r\n XYSeries.prototype.processValues = function (working) {\r\n _super.prototype.processValues.call(this, working);\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (!xAxis || !yAxis) {\r\n return;\r\n }\r\n var dataItems = this.dataItems;\r\n var minX = Infinity;\r\n var maxX = -Infinity;\r\n var minY = Infinity;\r\n var maxY = -Infinity;\r\n var startIndex = this.startIndex;\r\n var endIndex = this.endIndex;\r\n var workingStartIndex = startIndex;\r\n var workingEndIndex = endIndex;\r\n if (!working) {\r\n startIndex = 0;\r\n endIndex = this.dataItems.length;\r\n }\r\n for (var i = startIndex; i < endIndex; i++) {\r\n var dataItem = dataItems.getIndex(i);\r\n this.getStackValue(dataItem, working);\r\n var stackX = dataItem.getValue(\"valueX\", \"stack\");\r\n var stackY = dataItem.getValue(\"valueY\", \"stack\");\r\n minX = $math.min(dataItem.getMin(this._xValueFields, working, stackX), minX);\r\n minY = $math.min(dataItem.getMin(this._yValueFields, working, stackY), minY);\r\n maxX = $math.max(dataItem.getMax(this._xValueFields, working, stackX), maxX);\r\n maxY = $math.max(dataItem.getMax(this._yValueFields, working, stackY), maxY);\r\n // if it's stacked, pay attention to stack value\r\n if (this.stacked) {\r\n if (this.baseAxis == xAxis) {\r\n if (stackY < minY) {\r\n minY = stackY;\r\n }\r\n if (stackY > maxY) {\r\n maxY = stackY;\r\n }\r\n }\r\n if (this.baseAxis == yAxis) {\r\n if (stackX < minX) {\r\n minX = stackX;\r\n }\r\n if (stackX > maxX) {\r\n maxX = stackX;\r\n }\r\n }\r\n }\r\n }\r\n // this is mainly for value axis to calculate total and perecent.total of each series category\r\n xAxis.processSeriesDataItems();\r\n yAxis.processSeriesDataItems();\r\n var xAxisId = xAxis.uid;\r\n var yAxisId = yAxis.uid;\r\n if (this.xAxis instanceof ValueAxis && (minX == Infinity || maxX == -Infinity)) {\r\n return;\r\n }\r\n if (this.yAxis instanceof ValueAxis && (minY == Infinity || maxY == -Infinity)) {\r\n return;\r\n }\r\n if (!working) {\r\n if (this._tmin.getKey(xAxisId) != minX || this._tmax.getKey(xAxisId) != maxX || this._tmin.getKey(yAxisId) != minY || this._tmax.getKey(yAxisId) != maxY) {\r\n this._tmin.setKey(xAxisId, minX);\r\n this._tmax.setKey(xAxisId, maxX);\r\n this._tmin.setKey(yAxisId, minY);\r\n this._tmax.setKey(yAxisId, maxY);\r\n var stackedSeries = this.stackedSeries;\r\n if (stackedSeries) {\r\n if (stackedSeries.isDisposed()) {\r\n this.stackedSeries = undefined;\r\n }\r\n else {\r\n stackedSeries.processValues(false);\r\n }\r\n }\r\n this.dispatchImmediately(\"extremeschanged\");\r\n }\r\n }\r\n if (startIndex != workingStartIndex || endIndex != workingEndIndex) {\r\n minX = Infinity;\r\n maxX = -Infinity;\r\n minY = Infinity;\r\n maxY = -Infinity;\r\n for (var i = workingStartIndex; i < workingEndIndex; i++) {\r\n var dataItem = dataItems.getIndex(i);\r\n this.getStackValue(dataItem, working);\r\n var stackX = dataItem.getValue(\"valueX\", \"stack\");\r\n var stackY = dataItem.getValue(\"valueY\", \"stack\");\r\n minX = $math.min(dataItem.getMin(this._xValueFields, working, stackX), minX);\r\n minY = $math.min(dataItem.getMin(this._yValueFields, working, stackY), minY);\r\n maxX = $math.max(dataItem.getMax(this._xValueFields, working, stackX), maxX);\r\n maxY = $math.max(dataItem.getMax(this._yValueFields, working, stackY), maxY);\r\n // if it's stacked, pay attention to stack value\r\n if (this.stacked) {\r\n if (this.baseAxis == xAxis) {\r\n if (stackY < minY) {\r\n minY = stackY;\r\n }\r\n if (stackY > maxY) {\r\n maxY = stackY;\r\n }\r\n }\r\n if (this.baseAxis == yAxis) {\r\n if (stackX < minX) {\r\n minX = stackX;\r\n }\r\n if (stackX > maxX) {\r\n maxX = stackX;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (this.xAxis instanceof ValueAxis && (minX == Infinity || maxX == -Infinity)) {\r\n return;\r\n }\r\n if (this.yAxis instanceof ValueAxis && (minY == Infinity || maxY == -Infinity)) {\r\n return;\r\n }\r\n if (this._smin.getKey(xAxisId) != minX || this._smax.getKey(xAxisId) != maxX || this._smin.getKey(yAxisId) != minY || this._smax.getKey(yAxisId) != maxY) {\r\n this._smin.setKey(xAxisId, minX);\r\n this._smax.setKey(xAxisId, maxX);\r\n this._smin.setKey(yAxisId, minY);\r\n this._smax.setKey(yAxisId, maxY);\r\n if (this.appeared || this.start != 0 || this.end != 1 || this.dataItems != this.mainDataSet) {\r\n /// new, helps to handle issues with change percent\r\n var changed = false;\r\n if (yAxis instanceof ValueAxis && !(yAxis instanceof DateAxis)) {\r\n var tmin = this._tmin.getKey(yAxisId);\r\n if (!$type.isNumber(tmin) || ((this.usesShowFields || this._dataSetChanged) && minY < tmin) || (this.stackedSeries && !this.isHidden)) {\r\n this._tmin.setKey(yAxisId, minY);\r\n changed = true;\r\n }\r\n var tmax = this._tmax.getKey(yAxisId);\r\n if (!$type.isNumber(tmax) || ((this.usesShowFields || this._dataSetChanged) && maxY > tmax) || (this.stackedSeries && !this.isHidden)) {\r\n this._tmax.setKey(yAxisId, maxY);\r\n changed = true;\r\n }\r\n }\r\n if (xAxis instanceof ValueAxis && !(xAxis instanceof DateAxis)) {\r\n var tmin = this._tmin.getKey(xAxisId);\r\n if (!$type.isNumber(tmin) || ((this.usesShowFields || this._dataSetChanged) && minX < tmin) || (this.stackedSeries && !this.isHidden)) {\r\n this._tmin.setKey(xAxisId, minX);\r\n changed = true;\r\n }\r\n var tmax = this._tmax.getKey(xAxisId);\r\n if (!$type.isNumber(tmax) || ((this.usesShowFields || this._dataSetChanged) && maxX > tmax) || (this.stackedSeries && !this.isHidden)) {\r\n this._tmax.setKey(xAxisId, maxX);\r\n changed = true;\r\n }\r\n }\r\n if (changed) {\r\n this.dispatchImmediately(\"extremeschanged\");\r\n }\r\n if (this.start == 0 && this.end == 1) {\r\n // yes, its ok. otherwise min/max won't be updated when zooming out\r\n this._dataSetChanged = false;\r\n }\r\n this.dispatchImmediately(\"selectionextremeschanged\");\r\n }\r\n }\r\n if (!working && this.stacked) {\r\n this.processValues(true);\r\n }\r\n };\r\n /**\r\n * Hides element's [[Tooltip]].\r\n *\r\n * @see {@link Tooltip}\r\n */\r\n XYSeries.prototype.hideTooltip = function () {\r\n _super.prototype.hideTooltip.call(this);\r\n this.returnBulletDefaultState();\r\n this._prevTooltipDataItem = undefined;\r\n };\r\n /**\r\n * Shows series tooltip at specific position.\r\n *\r\n * @param xPosition X\r\n * @param yPosition Y\r\n */\r\n XYSeries.prototype.showTooltipAtPosition = function (xPosition, yPosition) {\r\n var dataItem;\r\n if (this.visible && !this.isHiding && !this.isShowing) {\r\n var xAxis = this._xAxis.get();\r\n var yAxis = this._yAxis.get();\r\n if (xAxis == this.baseAxis) {\r\n dataItem = xAxis.getSeriesDataItem(this, xAxis.toAxisPosition(xPosition), this.snapTooltip);\r\n }\r\n if (yAxis == this.baseAxis) {\r\n dataItem = yAxis.getSeriesDataItem(this, yAxis.toAxisPosition(yPosition), this.snapTooltip);\r\n }\r\n var point = this.showTooltipAtDataItem(dataItem);\r\n if (point) {\r\n return point;\r\n }\r\n // so that if tooltip is shown on columns or bullets for it not to be hidden\r\n if (!this.tooltipText) {\r\n return;\r\n }\r\n }\r\n this.hideTooltip();\r\n };\r\n XYSeries.prototype.getAdjustedXLocation = function (dataItem, field, bulletLocationX) {\r\n return dataItem.locations[field];\r\n };\r\n XYSeries.prototype.getAdjustedYLocation = function (dataItem, field, bulletLocationY) {\r\n return dataItem.locations[field];\r\n };\r\n /**\r\n * Shows series tooltip at specific dataItem.\r\n *\r\n * @param dataItem\r\n */\r\n XYSeries.prototype.showTooltipAtDataItem = function (dataItem) {\r\n var e_1, _a;\r\n var cursor = this.chart.cursor;\r\n if (cursor && cursor.hideSeriesTooltipsOnSelection && cursor.selection.visible && cursor.downPoint) {\r\n this.hideTooltip();\r\n return;\r\n }\r\n this.returnBulletDefaultState(dataItem);\r\n if (dataItem && dataItem.visible) {\r\n this.updateLegendValue(dataItem);\r\n if (this.cursorTooltipEnabled) {\r\n this.tooltipDataItem = dataItem;\r\n // todo: add tooltipXField and tooltipYField.\r\n var tooltipXField = this.tooltipXField;\r\n var tooltipYField = this.tooltipYField;\r\n if ($type.hasValue(dataItem[tooltipXField]) && $type.hasValue(dataItem[tooltipYField])) {\r\n var tooltipPoint = this.getPoint(dataItem, tooltipXField, tooltipYField, this.getAdjustedXLocation(dataItem, tooltipXField), this.getAdjustedYLocation(dataItem, tooltipYField));\r\n if (tooltipPoint) {\r\n if (this.chart.className == \"XYChart\" && (tooltipPoint.y < -1 || tooltipPoint.y > this.yAxis.pixelHeight + 1 || tooltipPoint.x < -1 || tooltipPoint.x > this.xAxis.pixelWidth + 1)) {\r\n // void\r\n }\r\n else {\r\n this.tooltipX = tooltipPoint.x;\r\n this.tooltipY = tooltipPoint.y;\r\n if (this._prevTooltipDataItem != dataItem) {\r\n this.dispatchImmediately(\"tooltipshownat\", {\r\n type: \"tooltipshownat\",\r\n target: this,\r\n dataItem: dataItem\r\n });\r\n this._prevTooltipDataItem = dataItem;\r\n }\r\n if (this.cursorHoverEnabled) {\r\n try {\r\n for (var _b = __values(dataItem.sprites), _c = _b.next(); !_c.done; _c = _b.next()) {\r\n var sprite = _c.value;\r\n if (!sprite.parent.visible || sprite.isHidden || sprite.__disabled || sprite.disabled || sprite.isHiding) {\r\n }\r\n else {\r\n if (!sprite.interactions.isRealHover) {\r\n sprite.dispatchImmediately(\"over\");\r\n sprite.interactions.isRealHover = true;\r\n }\r\n sprite.isHover = true;\r\n }\r\n }\r\n }\r\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\r\n finally {\r\n try {\r\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\r\n }\r\n finally { if (e_1) throw e_1.error; }\r\n }\r\n }\r\n if (this.showTooltip()) {\r\n return $utils.spritePointToSvg({ x: tooltipPoint.x, y: tooltipPoint.y }, this);\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n this.updateLegendValue(dataItem, true);\r\n }\r\n };\r\n /**\r\n * Returns default state to bullets when tooltip is shown at some other data\r\n * item or hidden\r\n */\r\n XYSeries.prototype.returnBulletDefaultState = function (dataItem) {\r\n var e_2, _a;\r\n if (this._prevTooltipDataItem && this._prevTooltipDataItem != dataItem) {\r\n try {\r\n for (var _b = __values(this._prevTooltipDataItem.sprites), _c = _b.next(); !_c.done; _c = _b.next()) {\r\n var sprite = _c.value;\r\n if (!sprite.isDisposed()) {\r\n var fireEvent = sprite.interactions.isRealHover;\r\n sprite.isHover = false;\r\n if (fireEvent) {\r\n sprite.dispatchImmediately(\"out\");\r\n }\r\n }\r\n else {\r\n this._prevTooltipDataItem = undefined;\r\n }\r\n }\r\n }\r\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\r\n finally {\r\n try {\r\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\r\n }\r\n finally { if (e_2) throw e_2.error; }\r\n }\r\n }\r\n };\r\n XYSeries.prototype.shouldCreateBullet = function (dataItem, bulletTemplate) {\r\n // use series xField/yField if bullet doesn't have fields set\r\n var xField = bulletTemplate.xField;\r\n if (!$type.hasValue(xField)) {\r\n xField = this.xField;\r\n }\r\n var yField = bulletTemplate.yField;\r\n if (!$type.hasValue(yField)) {\r\n yField = this.yField;\r\n }\r\n if ((this.xAxis instanceof ValueAxis && !dataItem.hasValue([xField])) || (this.yAxis instanceof ValueAxis && !dataItem.hasValue([yField]))) {\r\n return false;\r\n }\r\n if (bulletTemplate.disabled) {\r\n var disabledField = bulletTemplate.propertyFields.disabled;\r\n var dataContext = dataItem.dataContext;\r\n if (dataContext && dataContext[disabledField] === false) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYSeries.prototype.updateTooltip = function () {\r\n if (!this.hideTooltipWhileZooming && this.tooltip && !this.tooltip.isHidden && !this.isHiding && !this.isHidden && this.tooltipDataItem) {\r\n this.showTooltipAtDataItem(this.tooltipDataItem);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYSeries.prototype.positionBullet = function (bullet) {\r\n _super.prototype.positionBullet.call(this, bullet);\r\n var dataItem = bullet.dataItem;\r\n // use series xField/yField if bullet doesn't have fields set\r\n var xField = bullet.xField;\r\n if (!$type.hasValue(xField)) {\r\n xField = this.xField;\r\n }\r\n var yField = bullet.yField;\r\n if (!$type.hasValue(yField)) {\r\n yField = this.yField;\r\n }\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if ((xAxis instanceof ValueAxis && !dataItem.hasValue([xField])) || (yAxis instanceof ValueAxis && !dataItem.hasValue([yField]))) {\r\n bullet.visible = false;\r\n }\r\n else {\r\n var bulletLocationX = this.getBulletLocationX(bullet, xField);\r\n var bulletLocationY = this.getBulletLocationY(bullet, yField);\r\n var point = this.getPoint(dataItem, xField, yField, bulletLocationX, bulletLocationY);\r\n if (point) {\r\n var xOpenField = this.xOpenField;\r\n var yOpenField = this.yOpenField;\r\n var positionX = void 0;\r\n var positionY = void 0;\r\n if (xAxis instanceof DateAxis) {\r\n if (!$type.isNumber(bulletLocationX)) {\r\n bulletLocationX = 0;\r\n }\r\n var openValue = void 0;\r\n var closeValue = dataItem.getWorkingValue(xField);\r\n if (!xOpenField) {\r\n if (xAxis == this.baseAxis) {\r\n openValue = xAxis.baseValue;\r\n }\r\n }\r\n else {\r\n openValue = dataItem.getWorkingValue(xOpenField);\r\n }\r\n if (!$type.isNumber(openValue)) {\r\n openValue = closeValue;\r\n }\r\n var stack = dataItem.getValue(\"valueX\", \"stack\");\r\n openValue += stack;\r\n closeValue += stack;\r\n if (openValue == closeValue) {\r\n var baseInterval = xAxis.baseInterval;\r\n var dateFormatter = xAxis.dateFormatter;\r\n openValue = $time.round(new Date(openValue), baseInterval.timeUnit, baseInterval.count, dateFormatter.firstDayOfWeek, dateFormatter.utc).getTime();\r\n closeValue = $time.add(new Date(openValue), baseInterval.timeUnit, baseInterval.count, dateFormatter.utc).getTime();\r\n }\r\n var middleValue = void 0;\r\n if (xAxis == this.baseAxis) {\r\n middleValue = openValue + (closeValue - openValue) * bulletLocationX;\r\n }\r\n else {\r\n middleValue = openValue + (closeValue - openValue) * (1 - bulletLocationX);\r\n }\r\n positionX = xAxis.valueToPosition(middleValue);\r\n }\r\n else if (xAxis instanceof ValueAxis) {\r\n if (!$type.isNumber(bulletLocationX)) {\r\n bulletLocationX = 0;\r\n }\r\n var openValue = void 0;\r\n var closeValue = dataItem.getWorkingValue(xField);\r\n if (!xOpenField) {\r\n openValue = xAxis.baseValue;\r\n }\r\n else {\r\n openValue = dataItem.getWorkingValue(xOpenField);\r\n }\r\n var stack = dataItem.getValue(\"valueX\", \"stack\");\r\n openValue += stack;\r\n closeValue += stack;\r\n var middleValue = openValue + (closeValue - openValue) * (1 - bulletLocationX);\r\n positionX = xAxis.valueToPosition(middleValue);\r\n }\r\n else if (xAxis instanceof CategoryAxis) {\r\n var rightLocation = this.getAdjustedXLocation(dataItem, xField, bullet.locationX);\r\n var leftLocation = this.getAdjustedXLocation(dataItem, xOpenField, bullet.locationX);\r\n positionX = xAxis.categoryToPosition(dataItem[xField], rightLocation);\r\n var openPositionX = void 0;\r\n if (xOpenField) {\r\n openPositionX = xAxis.categoryToPosition(dataItem[xOpenField], leftLocation);\r\n }\r\n if (!$type.isNumber(openPositionX)) {\r\n openPositionX = 1;\r\n }\r\n positionX = openPositionX + (positionX - openPositionX) * bulletLocationX;\r\n }\r\n if (yAxis instanceof DateAxis) {\r\n if (!$type.isNumber(bulletLocationY)) {\r\n bulletLocationY = 0;\r\n }\r\n var openValue = void 0;\r\n var closeValue = dataItem.getWorkingValue(yField);\r\n if (!yOpenField) {\r\n if (yAxis == this.baseAxis) {\r\n openValue = yAxis.baseValue;\r\n }\r\n }\r\n else {\r\n openValue = dataItem.getWorkingValue(yOpenField);\r\n }\r\n if (!$type.isNumber(openValue)) {\r\n openValue = closeValue;\r\n }\r\n var stack = dataItem.getValue(\"valueY\", \"stack\");\r\n openValue += stack;\r\n closeValue += stack;\r\n if (openValue == closeValue) {\r\n var baseInterval = yAxis.baseInterval;\r\n var dateFormatter = yAxis.dateFormatter;\r\n openValue = $time.round(new Date(openValue), baseInterval.timeUnit, baseInterval.count, dateFormatter.firstDayOfWeek, dateFormatter.utc).getTime();\r\n closeValue = $time.add(new Date(openValue), baseInterval.timeUnit, baseInterval.count, dateFormatter.utc).getTime();\r\n }\r\n var middleValue = void 0;\r\n if (yAxis == this.baseAxis) {\r\n middleValue = openValue + (closeValue - openValue) * bulletLocationY;\r\n }\r\n else {\r\n middleValue = openValue + (closeValue - openValue) * (1 - bulletLocationY);\r\n }\r\n positionY = yAxis.valueToPosition(middleValue);\r\n }\r\n else if (yAxis instanceof ValueAxis) {\r\n if (!$type.isNumber(bulletLocationY)) {\r\n bulletLocationY = 0;\r\n }\r\n var openValue = void 0;\r\n var closeValue = dataItem.getWorkingValue(yField);\r\n if (!yOpenField) {\r\n openValue = yAxis.baseValue;\r\n }\r\n else {\r\n openValue = dataItem.getWorkingValue(yOpenField);\r\n }\r\n var stack = dataItem.getValue(\"valueY\", \"stack\");\r\n openValue += stack;\r\n closeValue += stack;\r\n var middleValue = openValue + (closeValue - openValue) * (1 - bulletLocationY);\r\n positionY = yAxis.valueToPosition(middleValue);\r\n }\r\n else if (yAxis instanceof CategoryAxis) {\r\n positionY = yAxis.categoryToPosition(dataItem[yField], bulletLocationY);\r\n var topLocation = this.getAdjustedYLocation(dataItem, yField, bullet.locationY);\r\n var bottomLocation = this.getAdjustedYLocation(dataItem, yOpenField, bullet.locationY);\r\n positionY = yAxis.categoryToPosition(dataItem[yField], topLocation);\r\n var openPositionY = void 0;\r\n if (yOpenField) {\r\n openPositionY = yAxis.categoryToPosition(dataItem[yOpenField], bottomLocation);\r\n }\r\n if (!$type.isNumber(openPositionY)) {\r\n openPositionY = 1;\r\n }\r\n positionY = openPositionY + (positionY - openPositionY) * bulletLocationY;\r\n }\r\n bullet.visible = true;\r\n this.positionBulletReal(bullet, positionX, positionY);\r\n }\r\n else {\r\n bullet.visible = false;\r\n }\r\n }\r\n };\r\n XYSeries.prototype.positionBulletReal = function (bullet, positionX, positionY) {\r\n bullet.x = this.xAxis.renderer.positionToPoint(positionX, positionY).x;\r\n bullet.y = this.yAxis.renderer.positionToPoint(positionY, positionX).y;\r\n };\r\n /**\r\n * returns bullet x location\r\n * @ignore\r\n */\r\n XYSeries.prototype.getBulletLocationX = function (bullet, field) {\r\n var bulletLocation = bullet.locationX;\r\n var dataItem = bullet.dataItem;\r\n if (!$type.isNumber(bulletLocation)) {\r\n bulletLocation = dataItem.workingLocations[field];\r\n }\r\n return bulletLocation;\r\n };\r\n /**\r\n * Returns bullet x location\r\n * @ignore\r\n */\r\n XYSeries.prototype.getBulletLocationY = function (bullet, field) {\r\n var bulletLocation = bullet.locationY;\r\n var dataItem = bullet.dataItem;\r\n if (!$type.isNumber(bulletLocation)) {\r\n bulletLocation = dataItem.workingLocations[field];\r\n }\r\n return bulletLocation;\r\n };\r\n /**\r\n * This method must be called if you update Series' data fields that might\r\n * affect stacking of the series.\r\n *\r\n * Since individual `dataField` changes are not being monitored, you need\r\n * todo it manually for changes to take affect.\r\n *\r\n * @since 4.7.21\r\n */\r\n XYSeries.prototype.updateStacking = function () {\r\n var _this = this;\r\n this.invalidateDataItems();\r\n if (this.chart) {\r\n this.chart.series.each(function (series) {\r\n if (series.baseAxis == _this.baseAxis) {\r\n series.stackedSeries = undefined;\r\n series.invalidateDataItems();\r\n series.invalidateProcessedData();\r\n }\r\n });\r\n }\r\n };\r\n Object.defineProperty(XYSeries.prototype, \"stacked\", {\r\n /**\r\n * @return Can be stacked?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"stacked\");\r\n },\r\n /**\r\n * Can items from this series be included into stacks?\r\n *\r\n * Note: proper stacking is only possible if series have the same number\r\n * of data items. To ensure this, don't set data directly on series\r\n * but do this on chart instead.\r\n *\r\n * @default false\r\n * @param stacked Can be stacked?\r\n */\r\n set: function (stacked) {\r\n if (this.setPropertyValue(\"stacked\", stacked, true)) {\r\n this.updateStacking();\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (!stacked) {\r\n var field_1;\r\n if (xAxis != this.baseAxis && xAxis instanceof ValueAxis) {\r\n field_1 = this.xField;\r\n }\r\n if (yAxis != this.baseAxis && yAxis instanceof ValueAxis) {\r\n field_1 = this.yField;\r\n }\r\n if (field_1) {\r\n this.dataItems.each(function (dataItem) {\r\n dataItem.setCalculatedValue(field_1, 0, \"stack\");\r\n });\r\n }\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"snapTooltip\", {\r\n /**\r\n * @return Should snap?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"snapTooltip\");\r\n },\r\n /**\r\n * Should the nearest tooltip be shown if no data item is found on the\r\n * current cursor position? In order this to work, you should set snapTooltip = false on the series baseAxis.\r\n *\r\n * @default false\r\n * @param value Should snap?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"snapTooltip\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Shows hidden series.\r\n *\r\n * @param duration Duration of reveal animation (ms)\r\n * @return Animation\r\n */\r\n XYSeries.prototype.show = function (duration) {\r\n var _this = this;\r\n var fields;\r\n if (this.xAxis instanceof ValueAxis && this.xAxis != this.baseAxis) {\r\n fields = this._xValueFields;\r\n }\r\n if (this.yAxis instanceof ValueAxis && this.yAxis != this.baseAxis) {\r\n fields = this._yValueFields;\r\n }\r\n var startIndex = this.startIndex;\r\n var endIndex = this.endIndex;\r\n var delay = 0;\r\n var interpolationDuration = this.defaultState.transitionDuration;\r\n if ($type.isNumber(duration)) {\r\n interpolationDuration = duration;\r\n }\r\n if (!options.animationsEnabled) {\r\n interpolationDuration = 0;\r\n }\r\n var anim;\r\n $iter.each($iter.indexed(this.dataItems.iterator()), function (a) {\r\n var i = a[0];\r\n var dataItem = a[1];\r\n var realDuration = interpolationDuration;\r\n if (i < _this.startIndex - 10 || i > _this.endIndex + 10) {\r\n realDuration = 0;\r\n delay = 0;\r\n }\r\n if (_this.sequencedInterpolation && realDuration > 0) {\r\n delay = _this.sequencedInterpolationDelay * i + interpolationDuration * (i - startIndex) / (endIndex - startIndex);\r\n }\r\n anim = dataItem.show(realDuration, delay, fields);\r\n });\r\n // other data sets\r\n this.dataSets.each(function (key, dataSet) {\r\n if (dataSet != _this.dataItems) {\r\n dataSet.each(function (dataItem) {\r\n dataItem.events.disable();\r\n dataItem.show(0, 0, fields);\r\n dataItem.events.enable();\r\n });\r\n }\r\n });\r\n if (this.mainDataSet != this.dataItems) {\r\n this.mainDataSet.each(function (dataItem) {\r\n dataItem.events.disable();\r\n dataItem.show(0, 0, fields);\r\n dataItem.events.enable();\r\n });\r\n }\r\n var animation = _super.prototype.show.call(this, duration);\r\n if (anim && !anim.isFinished()) {\r\n animation = anim;\r\n }\r\n if (this.hidden) {\r\n this.dispatchImmediately(\"selectionextremeschanged\");\r\n this.hidden = false;\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Hides series.\r\n *\r\n * @param duration Duration of hiding animation (ms)\r\n * @return Animation\r\n */\r\n XYSeries.prototype.hide = function (duration) {\r\n var _this = this;\r\n var fields;\r\n var value;\r\n var xAxis = this.xAxis;\r\n if (xAxis instanceof ValueAxis && xAxis != this.baseAxis) {\r\n fields = this._xValueFields;\r\n // animate to zero if 0 is within zoomMin/zoomMax\r\n if (this.stacked || (xAxis.minZoomed < xAxis.baseValue && xAxis.maxZoomed > xAxis.baseValue) || this.stackedSeries) {\r\n value = xAxis.baseValue;\r\n }\r\n else {\r\n value = xAxis.min;\r\n }\r\n }\r\n var yAxis = this.yAxis;\r\n if (yAxis instanceof ValueAxis && yAxis != this.baseAxis) {\r\n fields = this._yValueFields;\r\n // animate to zero if 0 is within zoomMin/zoomMax\r\n if (this.stacked || (yAxis.minZoomed < yAxis.baseValue && yAxis.maxZoomed > yAxis.baseValue) || this.stackedSeries) {\r\n value = yAxis.baseValue;\r\n }\r\n else {\r\n value = yAxis.min;\r\n }\r\n }\r\n //if ($type.hasValue(fields)) {\r\n var startIndex = this.startIndex;\r\n var endIndex = this.endIndex;\r\n var interpolationDuration = this.hiddenState.transitionDuration;\r\n if ($type.isNumber(duration)) {\r\n interpolationDuration = duration;\r\n }\r\n if (!options.animationsEnabled) {\r\n interpolationDuration = 0;\r\n }\r\n var delay = 0;\r\n var anim;\r\n $iter.each($iter.indexed(this.dataItems.iterator()), function (a) {\r\n var i = a[0];\r\n var dataItem = a[1];\r\n var realDuration = interpolationDuration;\r\n if (i < _this.startIndex - 10 || i > _this.endIndex + 10) {\r\n realDuration = 0;\r\n }\r\n if (realDuration == 0) {\r\n dataItem.hide(0, 0, value, fields);\r\n }\r\n else {\r\n if (_this.sequencedInterpolation && realDuration > 0) {\r\n delay = _this.sequencedInterpolationDelay * i + interpolationDuration * (i - startIndex) / (endIndex - startIndex);\r\n }\r\n anim = dataItem.hide(realDuration, delay, value, fields);\r\n }\r\n });\r\n var animation = _super.prototype.hide.call(this, interpolationDuration);\r\n if (animation && !animation.isFinished()) {\r\n animation.delay(delay);\r\n }\r\n if (anim && !anim.isFinished()) {\r\n animation = anim;\r\n }\r\n // helps to avoid flicker. otherwise columns will show up at full size and only on next frame will animate from 0\r\n this.validateDataElements();\r\n //}\r\n return animation;\r\n };\r\n /**\r\n * [handleDataItemWorkingValueChange description]\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYSeries.prototype.handleDataItemWorkingValueChange = function (dataItem, name) {\r\n _super.prototype.handleDataItemWorkingValueChange.call(this, dataItem, name);\r\n // to calculate stack values\r\n var axisSeries = this.baseAxis.series;\r\n $iter.each(axisSeries.iterator(), function (series) {\r\n if (series.stacked || series.stackedSeries) {\r\n series.invalidateProcessedData();\r\n }\r\n });\r\n };\r\n /**\r\n * [getStackValue description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param dataItem Data item\r\n */\r\n XYSeries.prototype.getStackValue = function (dataItem, working) {\r\n // todo: here wer stack x and y values only. question is - what should we do with other values, like openX, openY?\r\n // if this series is not stacked or new stack begins, return.\r\n var _this = this;\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (!this.stacked || !xAxis || !yAxis) {\r\n return;\r\n }\r\n else {\r\n // it might seem that it's better to go through base axis series, but we do not maintain the same order as in chart.series there.\r\n var chart = this.chart;\r\n var index = chart.series.indexOf(this);\r\n var field_2;\r\n if (xAxis != this.baseAxis && xAxis instanceof ValueAxis) {\r\n field_2 = this.xField;\r\n }\r\n if (yAxis != this.baseAxis && yAxis instanceof ValueAxis) {\r\n field_2 = this.yField;\r\n }\r\n if (!field_2) {\r\n return;\r\n }\r\n //this is good for removing series, otherwise stack values will remain the same and chart won't pay atention when adding/removing series\t\t\t\r\n dataItem.setCalculatedValue(field_2, 0, \"stack\");\r\n $iter.eachContinue(chart.series.range(0, index).backwards().iterator(), function (prevSeries) {\r\n // stacking is only possible if both axes are the same\r\n if (prevSeries.xAxis == xAxis && prevSeries.yAxis == yAxis) {\r\n // saving value\r\n prevSeries.stackedSeries = _this;\r\n var prevDataItem = prevSeries.dataItems.getIndex(dataItem.index); // indexes should match\r\n if (prevDataItem && prevDataItem.hasValue(_this._xValueFields) && prevDataItem.hasValue(_this._yValueFields)) {\r\n var value = dataItem.getValue(field_2);\r\n var prevValue = void 0;\r\n var prevRealValue = prevDataItem.getValue(field_2) + prevDataItem.getValue(field_2, \"stack\");\r\n if (working) {\r\n prevValue = prevDataItem.getWorkingValue(field_2) + prevDataItem.getValue(field_2, \"stack\");\r\n }\r\n else {\r\n prevValue = prevDataItem.getValue(field_2) + prevDataItem.getValue(field_2, \"stack\");\r\n }\r\n if ((value >= 0 && prevRealValue >= 0) || (value < 0 && prevRealValue < 0)) {\r\n //dataItem.events.disable();\r\n dataItem.setCalculatedValue(field_2, prevValue, \"stack\");\r\n //dataItem.events.enable();\r\n return false;\r\n }\r\n }\r\n else if (!prevSeries.stacked) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n });\r\n }\r\n };\r\n Object.defineProperty(XYSeries.prototype, \"xField\", {\r\n /**\r\n * [xField description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._xField;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"yField\", {\r\n /**\r\n * [yField description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._yField;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"xOpenField\", {\r\n /**\r\n * [xOpenField description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._xOpenField;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"yOpenField\", {\r\n /**\r\n * [yOpenField description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this._yOpenField;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"tooltipXField\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n if (this._tooltipXField) {\r\n return this._tooltipXField;\r\n }\r\n return this._xField;\r\n },\r\n /**\r\n * [tooltipXField description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n this._tooltipXField = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"tooltipYField\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\r\n get: function () {\r\n if (this._tooltipYField) {\r\n return this._tooltipYField;\r\n }\r\n return this._yField;\r\n },\r\n /**\r\n * [tooltipYField description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n this._tooltipYField = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns lowest value in the series for the specific axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axis Axis\r\n * @return value\r\n */\r\n XYSeries.prototype.min = function (axis) {\r\n return this._tmin.getKey(axis.uid);\r\n };\r\n /**\r\n * Returns highest value in the series for the specific axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axis Axis\r\n * @return value\r\n */\r\n XYSeries.prototype.max = function (axis) {\r\n return this._tmax.getKey(axis.uid);\r\n };\r\n /**\r\n * Returns lowest value in the series for the specific axis within current\r\n * selection.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axis Axis\r\n * @return value\r\n */\r\n XYSeries.prototype.selectionMin = function (axis) {\r\n var value = this._smin.getKey(axis.uid);\r\n if (!$type.isNumber(value)) {\r\n value = this.min(axis);\r\n }\r\n return value;\r\n };\r\n /**\r\n * Returns highest value in the series for the specific axis within current\r\n * selection.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axis Axis\r\n * @return value\r\n */\r\n XYSeries.prototype.selectionMax = function (axis) {\r\n var value = this._smax.getKey(axis.uid);\r\n if (!$type.isNumber(value)) {\r\n value = this.max(axis);\r\n }\r\n return value;\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n XYSeries.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Set up base axes\r\n if ($type.hasValue(config.baseAxis) && $type.isString(config.baseAxis)) {\r\n if (this.map.hasKey(config.baseAxis)) {\r\n config.baseAxis = this.map.getKey(config.baseAxis);\r\n }\r\n else {\r\n this.processingErrors.push(\"[XYSeries (\" + (this.name || \"unnamed\") + \")] No axis with id \\\"\" + config.baseAxis + \"\\\" found for `baseAxis`.\");\r\n delete config.baseAxis;\r\n }\r\n }\r\n // Set up axes\r\n if ($type.hasValue(config.xAxis) && $type.isString(config.xAxis)) {\r\n if (this.map.hasKey(config.xAxis)) {\r\n config.xAxis = this.map.getKey(config.xAxis);\r\n }\r\n else {\r\n this.processingErrors.push(\"[XYSeries (\" + (this.name || \"unnamed\") + \")] No axis with id \\\"\" + config.xAxis + \"\\\" found for `xAxis`.\");\r\n delete config.xAxis;\r\n }\r\n }\r\n if ($type.hasValue(config.yAxis) && $type.isString(config.yAxis)) {\r\n if (this.map.hasKey(config.yAxis)) {\r\n config.yAxis = this.map.getKey(config.yAxis);\r\n }\r\n else {\r\n this.processingErrors.push(\"[XYSeries (\" + (this.name || \"unnamed\") + \")] No axis with id \\\"\" + config.yAxis + \"\\\" found for `yAxis`.\");\r\n delete config.yAxis;\r\n }\r\n }\r\n // Set up axis ranges\r\n if ($type.hasValue(config.axisRanges) && $type.isArray(config.axisRanges)) {\r\n for (var i = 0, len = config.axisRanges.length; i < len; i++) {\r\n var range = config.axisRanges[i];\r\n if (!$type.hasValue(range.type)) {\r\n range.type = \"AxisDataItem\";\r\n }\r\n if ($type.hasValue(range.axis) && $type.isString(range.axis) && this.map.hasKey(range.axis)) {\r\n range.component = this.map.getKey(range.axis);\r\n }\r\n else if ($type.hasValue(range.component) && $type.isString(range.component) && this.map.hasKey(range.component)) {\r\n range.component = this.map.getKey(range.component);\r\n }\r\n }\r\n }\r\n // Parse date fields based on the series fields\r\n if (!$type.hasValue(config.dataFields) || !$type.isObject(config.dataFields)) {\r\n this.processingErrors.push(\"`dataFields` is not set for series [\" + (this.name || \"unnamed\") + \"]\");\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n /**\r\n * Returns an [[IPoint]] coordinates of the specific Serie's data point.\r\n *\r\n * @param dataItem Data item\r\n * @param xKey Name of X data field\r\n * @param yKey Name of Y data field\r\n * @param locationX X location\r\n * @param locationY Y location\r\n * @param stackKeyX ?\r\n * @param stackKeyY ?\r\n * @returns Coordinates\r\n */\r\n XYSeries.prototype.getPoint = function (dataItem, xKey, yKey, locationX, locationY, stackKeyX, stackKeyY) {\r\n if (this.xAxis && this.yAxis) {\r\n var x = this.xAxis.getX(dataItem, xKey, locationX);\r\n var y = this.yAxis.getY(dataItem, yKey, locationY);\r\n x = $math.fitToRange(x, -this._maxxX, this._maxxX); // from geometric point of view this is not right, but practically it's ok. this is done to avoid too big objects.\r\n y = $math.fitToRange(y, -this._maxxY, this._maxxY); // from geometric point of view this is not right, but practically it's ok. this is done to avoid too big objects.\r\n return { x: x, y: y };\r\n }\r\n };\r\n /**\r\n * Updates item reader text based on the type and set up of axis.\r\n */\r\n XYSeries.prototype.updateItemReaderText = function () {\r\n // We do not want to overwrite this if `itemReaderText` was changed by\r\n // user code.\r\n if (this._itemReaderTextChanged) {\r\n return;\r\n }\r\n var text = \"\";\r\n $object.each(this.dataFields, function (key, val) {\r\n text += \"{\" + key + \"} \";\r\n });\r\n this.itemReaderText = text;\r\n this._itemReaderTextChanged = false;\r\n };\r\n Object.defineProperty(XYSeries.prototype, \"cursorTooltipEnabled\", {\r\n /**\r\n * @return Display tooltip?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cursorTooltipEnabled\");\r\n },\r\n /**\r\n * Indicates if series should display a tooltip for chart's cursor.\r\n *\r\n * If set to `true` (default), the tooltips set for all series item's\r\n * elements like columns and bullets will be automatically shown\r\n * when [[XYCursor]] passes over category/date, even if its not hovered\r\n * directly over the item.\r\n *\r\n * Set this to `false` to disable such behavior and display item-specific\r\n * tooltips only when hovered directly over them\r\n *\r\n * @default true\r\n * @param value Display tooltip?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"cursorTooltipEnabled\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"cursorHoverEnabled\", {\r\n /**\r\n * @return Hover enabled?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cursorHoverEnabled\");\r\n },\r\n /**\r\n * Indicates if series should apply hover state on bullets/columns/etc when\r\n * cursor is over the data item.\r\n *\r\n * If set to `true` (default) and chart cursor is enabled on th chart,\r\n * hovering over date/category will trigger hover states on related Series\r\n * items like bullets and columns.\r\n *\r\n * @default true\r\n * @since 4.2.2\r\n * @param value Hover enabled?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"cursorHoverEnabled\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"excludeFromTotal\", {\r\n /**\r\n * @return Exclude from totals?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"excludeFromTotal\");\r\n },\r\n /**\r\n * Indicates if series' values should be excluded when calculating totals.\r\n *\r\n * @default false\r\n * @since 4.4.9\r\n * @param value Exclude from totals?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"excludeFromTotal\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"hideTooltipWhileZooming\", {\r\n /**\r\n * @return Hide tooltip while zooming?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"hideTooltipWhileZooming\");\r\n },\r\n /**\r\n * Indicates if series' tooltip should be hidden while series axis range is\r\n * animating (zooming).\r\n *\r\n * @default true\r\n * @since 4.7.16\r\n * @param value Hide tooltip while zooming?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"hideTooltipWhileZooming\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYSeries.prototype, \"maskBullets\", {\r\n /**\r\n * @return Mask bullets?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maskBullets\");\r\n },\r\n /**\r\n * Indicates if series' bullets should be masked.\r\n *\r\n * @default true\r\n * @since 4.7.17\r\n * @param value Mask bullets?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"maskBullets\", value);\r\n var chart = this.chart;\r\n if (chart) {\r\n if (value) {\r\n this.bulletsContainer.parent = chart.bulletsContainer;\r\n }\r\n else {\r\n this.bulletsContainer.parent = chart.axisBulletsContainer;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all properties from another instance of [[Series]].\r\n *\r\n * @param source Source series\r\n */\r\n XYSeries.prototype.copyFrom = function (source) {\r\n this.groupFields = $utils.copyProperties(source.groupFields, {});\r\n _super.prototype.copyFrom.call(this, source);\r\n };\r\n /**\r\n * Destroys this object and all related data.\r\n */\r\n XYSeries.prototype.dispose = function () {\r\n if (this.scrollbarSeries) {\r\n this.scrollbarSeries.dispose();\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n return XYSeries;\r\n}(Series));\r\nexport { XYSeries };\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[\"XYSeries\"] = XYSeries;\r\nregistry.registeredClasses[\"XYSeriesDataItem\"] = XYSeriesDataItem;\r\n//# sourceMappingURL=XYSeries.js.map","/**\r\n * A module with functionality for buildin a scrollbar with an XY graph in it.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Scrollbar } from \"../../core/elements/Scrollbar\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { List } from \"../../core/utils/List\";\r\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\r\nimport { XYChart } from \"../types/XYChart\";\r\nimport { ValueAxis } from \"../axes/ValueAxis\";\r\nimport { DateAxis } from \"../axes/DateAxis\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { DesaturateFilter } from \"../../core/rendering/filters/DesaturateFilter\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { color } from \"../../core/utils/Color\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A special version of the Scrollbar that has an XY chart in it.\r\n *\r\n * Used mainly as an advanced scrollbar with a preview for other XY charts.\r\n *\r\n * However, can be used as standalone element.\r\n *\r\n * @see {@link IXYChartScrollbarEvents} for a list of available events\r\n * @see {@link IXYChartScrollbarAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar XYChartScrollbar = /** @class */ (function (_super) {\r\n __extends(XYChartScrollbar, _super);\r\n /**\r\n * Constructor\r\n */\r\n function XYChartScrollbar() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * A chart element Scrollbar is for.\r\n */\r\n _this._chart = new MutableValueDisposer();\r\n _this.className = \"XYChartScrollbar\";\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.padding(0, 0, 0, 0);\r\n var scrollbarChart = _this.createChild(XYChart);\r\n scrollbarChart.shouldClone = false;\r\n scrollbarChart.margin(0, 0, 0, 0);\r\n scrollbarChart.padding(0, 0, 0, 0);\r\n scrollbarChart.interactionsEnabled = false;\r\n _this._scrollbarChart = scrollbarChart;\r\n if (!$utils.isIE()) {\r\n var filter = new DesaturateFilter();\r\n filter.filterUnits = \"userSpaceOnUse\";\r\n scrollbarChart.plotContainer.filters.push(filter);\r\n }\r\n _this._disposers.push(_this._scrollbarChart);\r\n _this.minHeight = 60;\r\n _this.minWidth = 60;\r\n var unselectedOverlay = _this.createChild(Sprite);\r\n unselectedOverlay.shouldClone = false;\r\n unselectedOverlay.setElement(_this.paper.add(\"path\"));\r\n unselectedOverlay.fill = interfaceColors.getFor(\"background\");\r\n unselectedOverlay.fillOpacity = 0.8;\r\n unselectedOverlay.interactionsEnabled = false;\r\n unselectedOverlay.isMeasured = false;\r\n unselectedOverlay.toBack();\r\n _this._unselectedOverlay = unselectedOverlay;\r\n _this._disposers.push(_this._unselectedOverlay);\r\n scrollbarChart.toBack();\r\n _this.background.cornerRadius(0, 0, 0, 0);\r\n var thumbBackground = _this.thumb.background;\r\n thumbBackground.cornerRadius(0, 0, 0, 0);\r\n thumbBackground.fillOpacity = 0;\r\n thumbBackground.fill = interfaceColors.getFor(\"background\");\r\n var hoverState = thumbBackground.states.getKey(\"hover\");\r\n if (hoverState) {\r\n hoverState.properties.fillOpacity = 0.2;\r\n }\r\n var downState = thumbBackground.states.getKey(\"down\");\r\n if (downState) {\r\n downState.properties.fillOpacity = 0.4;\r\n }\r\n _this._disposers.push(_this._chart);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(XYChartScrollbar.prototype, \"series\", {\r\n /**\r\n * A list of series that are used to draw graph(s) on the scrollbar.\r\n *\r\n * @readonly\r\n * @return Series\r\n */\r\n get: function () {\r\n if (!this._series) {\r\n this._series = new List();\r\n this._disposers.push(this._series.events.on(\"inserted\", this.handleSeriesAdded, this, false));\r\n this._disposers.push(this._series.events.on(\"removed\", this.handleSeriesRemoved, this, false));\r\n }\r\n return this._series;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Decorates a new series when they are pushed into a `series` list.\r\n *\r\n * @param event Event\r\n */\r\n XYChartScrollbar.prototype.handleSeriesAdded = function (event) {\r\n var _this = this;\r\n var sourceSeries = event.newValue;\r\n if (!sourceSeries.xAxis || !sourceSeries.yAxis) {\r\n return;\r\n }\r\n var scrollbarChart = this.scrollbarChart;\r\n scrollbarChart.zoomOutButton.disabled = true;\r\n this.chart = sourceSeries.chart;\r\n // Ensure that scrollbar chart shares the same locale as parent chart\r\n scrollbarChart.language.locale = this.chart.language.locale;\r\n var addXAxis = true;\r\n var addYAxis = true;\r\n // check if we haven't added clone of x or y axis before\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (series != sourceSeries) {\r\n if (series.xAxis == sourceSeries.xAxis && _this.scrollbarChart.xAxes.length > 0) {\r\n addXAxis = false;\r\n }\r\n if (series.yAxis == sourceSeries.yAxis && _this.scrollbarChart.yAxes.length > 0) {\r\n addYAxis = false;\r\n }\r\n }\r\n });\r\n sourceSeries.events.on(\"beforedisposed\", function () {\r\n _this.series.removeValue(sourceSeries);\r\n });\r\n var interfaceColors = new InterfaceColorSet();\r\n var series = sourceSeries.clone();\r\n if ($utils.isIE()) {\r\n series.stroke = color(\"#aaaaaa\");\r\n series.fill = series.stroke;\r\n series.propertyFields.fill = undefined;\r\n series.propertyFields.stroke = undefined;\r\n }\r\n sourceSeries.scrollbarSeries = series;\r\n if (addXAxis) {\r\n var xAxis = sourceSeries.xAxis.clone();\r\n scrollbarChart.xAxes.moveValue(xAxis);\r\n xAxis.title.disabled = true;\r\n xAxis.rangeChangeDuration = 0;\r\n //xAxis.id = sourceSeries.uid;\r\n var renderer = xAxis.renderer;\r\n renderer.ticks.template.disabled = true;\r\n renderer.inside = true;\r\n renderer.labels.template.inside = true;\r\n renderer.line.strokeOpacity = 0;\r\n renderer.minLabelPosition = 0.02;\r\n renderer.maxLabelPosition = 0.98;\r\n renderer.line.disabled = true;\r\n renderer.axisFills.template.disabled = true;\r\n renderer.baseGrid.disabled = true;\r\n renderer.grid.template.strokeOpacity = 0.05;\r\n renderer.minWidth = undefined;\r\n renderer.minHeight = undefined;\r\n renderer.padding(0, 0, 0, 0);\r\n renderer.chart = scrollbarChart;\r\n renderer.margin(0, 0, 0, 0);\r\n xAxis.width = percent(100);\r\n var labelsTemplate = renderer.labels.template;\r\n labelsTemplate.fillOpacity = 0.5;\r\n xAxis.maxZoomCount = undefined;\r\n xAxis.minZoomCount = undefined;\r\n if (xAxis instanceof DateAxis) {\r\n var vAxis_1 = xAxis;\r\n var sourceAxis = sourceSeries.xAxis;\r\n vAxis_1.groupCount = sourceAxis.groupCount * 5;\r\n vAxis_1.min = undefined;\r\n vAxis_1.max = undefined;\r\n this._disposers.push(vAxis_1.clonedFrom.events.on(\"extremeschanged\", function () {\r\n if ($type.isNumber(vAxis_1.clonedFrom.minDefined)) {\r\n vAxis_1.min = vAxis_1.clonedFrom.minDefined;\r\n }\r\n if ($type.isNumber(vAxis_1.clonedFrom.maxDefined)) {\r\n vAxis_1.max = vAxis_1.clonedFrom.maxDefined;\r\n }\r\n }, undefined, false));\r\n }\r\n else if (xAxis instanceof ValueAxis) {\r\n var vAxis_2 = xAxis;\r\n vAxis_2.min = undefined;\r\n vAxis_2.max = undefined;\r\n if (!$type.isNumber(vAxis_2.clonedFrom.minDefined)) {\r\n vAxis_2.min = undefined;\r\n }\r\n if (!$type.isNumber(vAxis_2.clonedFrom.maxDefined)) {\r\n vAxis_2.max = undefined;\r\n }\r\n this._disposers.push(vAxis_2.clonedFrom.events.on(\"extremeschanged\", function () {\r\n if ($type.isNumber(vAxis_2.clonedFrom.minDefined)) {\r\n vAxis_2.min = vAxis_2.clonedFrom.min;\r\n }\r\n if ($type.isNumber(vAxis_2.clonedFrom.maxDefined)) {\r\n vAxis_2.max = vAxis_2.clonedFrom.max;\r\n }\r\n }, undefined, false));\r\n }\r\n series.xAxis = xAxis;\r\n }\r\n else {\r\n this.scrollbarChart.xAxes.each(function (xAxis) {\r\n if (xAxis.clonedFrom == sourceSeries.xAxis) {\r\n series.xAxis = xAxis;\r\n }\r\n });\r\n }\r\n if (addYAxis) {\r\n var yAxis = sourceSeries.yAxis.clone();\r\n scrollbarChart.yAxes.moveValue(yAxis);\r\n yAxis.title.disabled = true;\r\n yAxis.rangeChangeDuration = 0;\r\n var renderer = yAxis.renderer;\r\n renderer.ticks.template.disabled = true;\r\n renderer.inside = true;\r\n renderer.labels.template.inside = true;\r\n renderer.line.strokeOpacity = 0;\r\n renderer.minLabelPosition = 0.02;\r\n renderer.maxLabelPosition = 0.98;\r\n renderer.line.disabled = true;\r\n renderer.axisFills.template.disabled = true;\r\n renderer.grid.template.stroke = interfaceColors.getFor(\"background\");\r\n renderer.baseGrid.disabled = true;\r\n renderer.grid.template.strokeOpacity = 0.05;\r\n renderer.minWidth = undefined;\r\n renderer.minHeight = undefined;\r\n renderer.chart = scrollbarChart;\r\n renderer.padding(0, 0, 0, 0);\r\n renderer.margin(0, 0, 0, 0);\r\n yAxis.height = percent(100);\r\n var labelsTemplate = renderer.labels.template;\r\n labelsTemplate.fillOpacity = 0.5;\r\n series.yAxis = yAxis;\r\n yAxis.maxZoomCount = undefined;\r\n yAxis.minZoomCount = undefined;\r\n if (yAxis instanceof DateAxis) {\r\n var vAxis_3 = yAxis;\r\n vAxis_3.min = undefined;\r\n vAxis_3.max = undefined;\r\n var sourceAxis = sourceSeries.yAxis;\r\n yAxis.groupCount = sourceAxis.groupCount * 5;\r\n this._disposers.push(vAxis_3.clonedFrom.events.on(\"extremeschanged\", function () {\r\n if ($type.isNumber(vAxis_3.clonedFrom.minDefined)) {\r\n vAxis_3.min = vAxis_3.clonedFrom.minDefined;\r\n }\r\n if ($type.isNumber(vAxis_3.clonedFrom.maxDefined)) {\r\n vAxis_3.max = vAxis_3.clonedFrom.maxDefined;\r\n }\r\n }));\r\n }\r\n else if (yAxis instanceof ValueAxis) {\r\n var vAxis_4 = yAxis;\r\n vAxis_4.min = undefined;\r\n vAxis_4.max = undefined;\r\n if (!$type.isNumber(vAxis_4.clonedFrom.minDefined)) {\r\n vAxis_4.min = undefined;\r\n }\r\n if (!$type.isNumber(vAxis_4.clonedFrom.maxDefined)) {\r\n vAxis_4.max = undefined;\r\n }\r\n this._disposers.push(vAxis_4.clonedFrom.events.on(\"extremeschanged\", function () {\r\n if ($type.isNumber(vAxis_4.clonedFrom.minDefined)) {\r\n vAxis_4.min = vAxis_4.clonedFrom.minDefined;\r\n }\r\n if ($type.isNumber(vAxis_4.clonedFrom.maxDefined)) {\r\n vAxis_4.max = vAxis_4.clonedFrom.maxDefined;\r\n }\r\n }));\r\n }\r\n }\r\n else {\r\n this.scrollbarChart.yAxes.each(function (yAxis) {\r\n if (yAxis.clonedFrom == sourceSeries.yAxis) {\r\n series.yAxis = yAxis;\r\n }\r\n });\r\n }\r\n series.rangeChangeDuration = 0;\r\n series.interpolationDuration = 0;\r\n series.defaultState.transitionDuration = 0;\r\n series.showOnInit = false;\r\n this._disposers.push(series.events.on(\"validated\", this.zoomOutAxes, this, false));\r\n // data might be set drectly on series\r\n this._disposers.push(sourceSeries.events.on(\"datavalidated\", function () {\r\n if (series.data != sourceSeries.data) { // data setter doesn't check this\r\n series.data = sourceSeries.data;\r\n }\r\n }, undefined, false));\r\n series.defaultState.properties.visible = true;\r\n scrollbarChart.series.push(series);\r\n this.updateByOrientation();\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYChartScrollbar.prototype.updateByOrientation = function () {\r\n var _this = this;\r\n if (this._scrollbarChart) {\r\n $iter.each(this._scrollbarChart.xAxes.iterator(), function (xAxis) {\r\n var renderer = xAxis.renderer;\r\n if (_this.orientation == \"vertical\") {\r\n renderer.grid.template.disabled = true;\r\n renderer.labels.template.disabled = true;\r\n renderer.minGridDistance = 10;\r\n }\r\n else {\r\n renderer.grid.template.disabled = false;\r\n renderer.labels.template.disabled = false;\r\n renderer.minGridDistance = xAxis.clonedFrom.renderer.minGridDistance;\r\n }\r\n });\r\n $iter.each(this._scrollbarChart.yAxes.iterator(), function (yAxis) {\r\n var renderer = yAxis.renderer;\r\n if (_this.orientation == \"horizontal\") {\r\n renderer.grid.template.disabled = true;\r\n renderer.labels.template.disabled = true;\r\n renderer.minGridDistance = 10;\r\n }\r\n else {\r\n renderer.grid.template.disabled = false;\r\n renderer.labels.template.disabled = false;\r\n renderer.minGridDistance = yAxis.clonedFrom.renderer.minGridDistance;\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Cleans up after series are removed from Scrollbar.\r\n *\r\n * @param event Event\r\n */\r\n XYChartScrollbar.prototype.handleSeriesRemoved = function (event) {\r\n var sourceSeries = event.oldValue;\r\n var scrollbarChart = this.scrollbarChart;\r\n scrollbarChart.series.each(function (series) {\r\n if (series && series.clonedFrom == sourceSeries) {\r\n scrollbarChart.series.removeValue(series);\r\n }\r\n });\r\n if (scrollbarChart.series.length == 0) {\r\n scrollbarChart.xAxes.clear();\r\n scrollbarChart.yAxes.clear();\r\n }\r\n try {\r\n sourceSeries.events.off(\"validated\", this.zoomOutAxes, this);\r\n }\r\n catch (err) {\r\n }\r\n };\r\n Object.defineProperty(XYChartScrollbar.prototype, \"scrollbarChart\", {\r\n /**\r\n * A chart element that is used to display graphs in the Scrollbar.\r\n *\r\n * This is not the same as `chart`. It's a totally independent instance of\r\n * [[XYChart]] with separate config, series, etc.\r\n *\r\n * It can be configured just like any other [[XYChart]].\r\n *\r\n * @readonly\r\n * @return Scrollbar's internal chart\r\n */\r\n get: function () {\r\n return this._scrollbarChart;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYChartScrollbar.prototype, \"chart\", {\r\n /**\r\n * @return Chart\r\n */\r\n get: function () {\r\n return this._chart.get();\r\n },\r\n /**\r\n * A chart that Scrollbar belongs to.\r\n *\r\n * @param chart Chart\r\n */\r\n set: function (chart) {\r\n if (this._chart.get() !== chart) {\r\n this._chart.set(chart, chart.events.on(\"datavalidated\", this.handleDataChanged, this, false));\r\n this.handleDataChanged();\r\n this._scrollbarChart.dataProvider = chart; // this makes scrollbar chart do not validate data untill charts' data is validated\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYChartScrollbar.prototype, \"unselectedOverlay\", {\r\n /**\r\n * A [[Sprite]] object representing overlay that is used to dim area of the\r\n * scrollbar that is currently not selected.\r\n *\r\n * Use its `fillOpacity` to set opacity of the fill, with `0` (zero)\r\n * completely disabling the dimming, and `1` making unselected area completely\r\n * blank.\r\n *\r\n * @since 4.6.1\r\n * @readonly\r\n * @return Unselected area curtain element\r\n */\r\n get: function () {\r\n return this._unselectedOverlay;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates Scrollbar's internal chart's data when the main chart's data\r\n * changes.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChartScrollbar.prototype.handleDataChanged = function () {\r\n if (this.chart.data != this.scrollbarChart.data) {\r\n this.scrollbarChart.data = this.chart.data;\r\n }\r\n else {\r\n // add data is handled in XYChart\r\n // invalidating all data caused the problem: https://github.com/amcharts/amcharts4/issues/2096\r\n this.scrollbarChart.invalidateRawData();\r\n }\r\n };\r\n /**\r\n * Zooms out all axes on the internal chart.\r\n */\r\n XYChartScrollbar.prototype.zoomOutAxes = function () {\r\n var scrollbarChart = this.scrollbarChart;\r\n $iter.each(scrollbarChart.xAxes.iterator(), function (x) {\r\n x.zoom({ start: 0, end: 1 }, true, true);\r\n });\r\n $iter.each(scrollbarChart.yAxes.iterator(), function (y) {\r\n y.zoom({ start: 0, end: 1 }, true, true);\r\n });\r\n };\r\n /**\r\n * Updates scrollbar thumb.\r\n */\r\n XYChartScrollbar.prototype.updateThumb = function () {\r\n _super.prototype.updateThumb.call(this);\r\n if (this._unselectedOverlay) {\r\n var thumb = this.thumb;\r\n var x = thumb.pixelX || 0;\r\n var y = thumb.pixelY || 0;\r\n var w = thumb.pixelWidth || 0;\r\n var h = thumb.pixelHeight || 0;\r\n var path = \"\";\r\n if (this.orientation == \"horizontal\") {\r\n path = $path.rectToPath({\r\n x: -1,\r\n y: 0,\r\n width: x,\r\n height: h\r\n });\r\n path += $path.rectToPath({\r\n x: x + w,\r\n y: 0,\r\n width: (this.pixelWidth || 0) - x - w,\r\n height: h\r\n });\r\n }\r\n else {\r\n path = $path.rectToPath({\r\n x: 0,\r\n y: 0,\r\n width: w,\r\n height: y\r\n });\r\n path += $path.rectToPath({\r\n x: 0,\r\n y: y + h,\r\n width: w,\r\n height: (this.pixelHeight || 0) - y - h\r\n });\r\n }\r\n this._unselectedOverlay.path = path;\r\n }\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n XYChartScrollbar.prototype.processConfig = function (config) {\r\n if (config) {\r\n if ($type.hasValue(config.series) && $type.isArray(config.series)) {\r\n for (var i = 0, len = config.series.length; i < len; i++) {\r\n var series = config.series[i];\r\n if ($type.hasValue(series) && $type.isString(series)) {\r\n if (this.map.hasKey(series)) {\r\n config.series[i] = this.map.getKey(series);\r\n }\r\n else {\r\n throw Error(\"XYChartScrollbar error: Series with id `\" + series + \"` does not exist.\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n return XYChartScrollbar;\r\n}(Scrollbar));\r\nexport { XYChartScrollbar };\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[\"XYChartScrollbar\"] = XYChartScrollbar;\r\n//# sourceMappingURL=XYChartScrollbar.js.map","/**\r\n * XY Chart module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { SerialChart, SerialChartDataItem } from \"./SerialChart\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { List, ListDisposer } from \"../../core/utils/List\";\r\nimport { Color } from \"../../core/utils/Color\";\r\nimport { ValueAxis } from \"../axes/ValueAxis\";\r\nimport { DateAxis } from \"../axes/DateAxis\";\r\nimport { AxisRendererX } from \"../axes/AxisRendererX\";\r\nimport { AxisRendererY } from \"../axes/AxisRendererY\";\r\nimport { CategoryAxis } from \"../axes/CategoryAxis\";\r\nimport { XYSeries } from \"../series/XYSeries\";\r\nimport { Disposer } from \"../../core/utils/Disposer\";\r\nimport { ZoomOutButton } from \"../../core/elements/ZoomOutButton\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { XYChartScrollbar } from \"../elements/XYChartScrollbar\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\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 * as $number from \"../../core/utils/Number\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[XYChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar XYChartDataItem = /** @class */ (function (_super) {\r\n __extends(XYChartDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function XYChartDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"XYChartDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return XYChartDataItem;\r\n}(SerialChartDataItem));\r\nexport { XYChartDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates an XY chart, and any derivative chart, like Serial, Date-based, etc.\r\n *\r\n * Basically this is a chart type, that is used to display any chart\r\n * information in a square plot area.\r\n *\r\n * The horizontal and vertical scale is determined by the type of Axis.\r\n *\r\n * The plot types are determined by type of Series.\r\n *\r\n * ```TypeScript\r\n * // Includes\r\n * import * as am4core from \"@amcharts/amcharts4/core\";\r\n * import * as am4charts from \"@amcharts/amcharts4/charts\";\r\n *\r\n * // Create chart\r\n * let chart = am4core.create(\"chartdiv\", am4charts.XYChart);\r\n *\r\n * // Add Data\r\n * chart.data = [{\r\n * \"country\": \"USA\",\r\n * \"visits\": 3025\r\n * }, {\r\n * \t\"country\": \"China\",\r\n * \t\"visits\": 1882\r\n * }, {\r\n * \t\"country\": \"Japan\",\r\n * \t\"visits\": 1809\r\n * }];\r\n *\r\n * // Add category axis\r\n * let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());\r\n * categoryAxis.dataFields.category = \"country\";\r\n *\r\n * // Add value axis\r\n * let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());\r\n *\r\n * // Add series\r\n * let series = chart.series.push(new am4charts.ColumnSeries());\r\n * series.name = \"Web Traffic\";\r\n * series.dataFields.categoryX = \"country\";\r\n * series.dataFields.valueY = \"visits\";\r\n * ```\r\n * ```JavaScript\r\n * // Create chart\r\n * var chart = am4core.create(\"chartdiv\", am4charts.XYChart);\r\n *\r\n * // The following would work as well:\r\n * // var chart = am4core.create(\"chartdiv\", \"XYChart\");\r\n *\r\n * // Add Data\r\n * chart.data = [{\r\n * \"country\": \"USA\",\r\n * \"visits\": 3025\r\n * }, {\r\n * \t\"country\": \"China\",\r\n * \t\"visits\": 1882\r\n * }, {\r\n * \t\"country\": \"Japan\",\r\n * \t\"visits\": 1809\r\n * }];\r\n *\r\n * // Add category axis\r\n * var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());\r\n * categoryAxis.dataFields.category = \"country\";\r\n *\r\n * // Add value axis\r\n * var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());\r\n *\r\n * // Add series\r\n * var series = chart.series.push(new am4charts.ColumnSeries());\r\n * series.name = \"Web Traffic\";\r\n * series.dataFields.categoryX = \"country\";\r\n * series.dataFields.valueY = \"visits\";\r\n * ```\r\n * ```JSON\r\n * var chart = am4core.createFromConfig({\r\n *\r\n * \t// Category axis\r\n * \t\"xAxes\": [{\r\n * \t\t\"type\": \"CategoryAxis\",\r\n * \t\t\"dataFields\": {\r\n * \t\t\t\"category\": \"country\"\r\n * \t\t}\r\n * \t}],\r\n *\r\n * \t// Value axis\r\n * \t\"yAxes\": [{\r\n * \t\t\"type\": \"ValueAxis\"\r\n * \t}],\r\n *\r\n * \t// Series\r\n * \t\"series\": [{\r\n * \t\t\"type\": \"ColumnSeries\",\r\n * \t\t\"dataFields\": {\r\n * \t\t\t\"categoryX\": \"country\",\r\n * \t\t\t\"valueY\": \"visits\"\r\n * \t\t},\r\n * \t\t\"name\": \"Web Traffic\"\r\n * \t}],\r\n *\r\n * \t// Cursor\r\n * \t\"cursor\": {},\r\n *\r\n * \t// Data\r\n * \t\"data\": [{\r\n * \t\t\"country\": \"USA\",\r\n * \t\t\"visits\": 3025\r\n * \t}, {\r\n * \t\t\"country\": \"China\",\r\n * \t\t\"visits\": 1882\r\n * \t}, {\r\n * \t\t\"country\": \"Japan\",\r\n * \t\t\"visits\": 1809\r\n * \t}]\r\n *\r\n * }, \"chartdiv\", \"XYChart\");\r\n * ```\r\n *\r\n *\r\n * @see {@link IXYChartEvents} for a list of available Events\r\n * @see {@link IXYChartAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/xy-chart/} for documentation\r\n * @important\r\n */\r\nvar XYChart = /** @class */ (function (_super) {\r\n __extends(XYChart, _super);\r\n /**\r\n * Constructor\r\n */\r\n function XYChart() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Defines the type of horizontal axis rederer.\r\n */\r\n _this._axisRendererX = AxisRendererX;\r\n /**\r\n * Defines the type of vertical axis rederer.\r\n */\r\n _this._axisRendererY = AxisRendererY;\r\n /**\r\n * @ignore\r\n */\r\n _this._seriesPoints = [];\r\n _this.className = \"XYChart\";\r\n // Set defaults\r\n //this.margin(10, 10, 10, 10);\r\n _this.maskBullets = true;\r\n _this.arrangeTooltips = true;\r\n // Create main chart container\r\n var chartContainer = _this.chartContainer;\r\n chartContainer.layout = \"vertical\";\r\n _this.padding(15, 15, 15, 15);\r\n // Create top axes container\r\n var topAxesCont = chartContainer.createChild(Container);\r\n topAxesCont.shouldClone = false;\r\n topAxesCont.layout = \"vertical\";\r\n topAxesCont.width = percent(100);\r\n topAxesCont.zIndex = 1;\r\n _this.topAxesContainer = topAxesCont;\r\n // Create vertical axes and plot area container\r\n // Plot area and vertical axes share the whole width of the chart,\r\n // so we need to put then into a separate container so that layouting\r\n // engine takes care of the positioning\r\n var yAxesAndPlotCont = chartContainer.createChild(Container);\r\n yAxesAndPlotCont.shouldClone = false;\r\n yAxesAndPlotCont.layout = \"horizontal\";\r\n yAxesAndPlotCont.width = percent(100);\r\n yAxesAndPlotCont.height = percent(100);\r\n yAxesAndPlotCont.zIndex = 0;\r\n _this.yAxesAndPlotContainer = yAxesAndPlotCont;\r\n // Create a container for bottom axes\r\n var bottomAxesCont = chartContainer.createChild(Container);\r\n bottomAxesCont.shouldClone = false;\r\n bottomAxesCont.width = percent(100);\r\n bottomAxesCont.layout = \"vertical\";\r\n bottomAxesCont.zIndex = 1;\r\n _this.bottomAxesContainer = bottomAxesCont;\r\n // Create a container for left-side axes\r\n var leftAxesCont = yAxesAndPlotCont.createChild(Container);\r\n leftAxesCont.shouldClone = false;\r\n leftAxesCont.layout = \"horizontal\";\r\n leftAxesCont.height = percent(100);\r\n leftAxesCont.contentAlign = \"right\";\r\n leftAxesCont.events.on(\"transformed\", _this.updateXAxesMargins, _this, false);\r\n leftAxesCont.zIndex = 1;\r\n _this.leftAxesContainer = leftAxesCont;\r\n // Create a container for plot area\r\n var plotCont = yAxesAndPlotCont.createChild(Container);\r\n plotCont.shouldClone = false;\r\n plotCont.height = percent(100);\r\n plotCont.width = percent(100);\r\n // Create transparend background for plot container so that hover works\r\n // on all of it\r\n plotCont.background.fillOpacity = 0;\r\n _this.plotContainer = plotCont;\r\n // must go below plot container\r\n _this.mouseWheelBehavior = \"none\";\r\n _this._cursorContainer = plotCont;\r\n // Create a container for right-side axes\r\n var rightAxesCont = yAxesAndPlotCont.createChild(Container);\r\n rightAxesCont.shouldClone = false;\r\n rightAxesCont.layout = \"horizontal\";\r\n rightAxesCont.height = percent(100);\r\n rightAxesCont.zIndex = 1;\r\n rightAxesCont.events.on(\"transformed\", _this.updateXAxesMargins, _this, false);\r\n _this.rightAxesContainer = rightAxesCont;\r\n _this.seriesContainer.parent = plotCont;\r\n _this.bulletsContainer.parent = plotCont;\r\n var zoomOutButton = plotCont.createChild(ZoomOutButton);\r\n zoomOutButton.shouldClone = false;\r\n zoomOutButton.align = \"right\";\r\n zoomOutButton.valign = \"top\";\r\n zoomOutButton.zIndex = Number.MAX_SAFE_INTEGER;\r\n zoomOutButton.marginTop = 5;\r\n zoomOutButton.marginRight = 5;\r\n zoomOutButton.hide(0);\r\n _this.zoomOutButton = zoomOutButton;\r\n // Create a container for bullets\r\n var axisBulletsContainer = _this.plotContainer.createChild(Container);\r\n axisBulletsContainer.shouldClone = false;\r\n axisBulletsContainer.width = percent(100);\r\n axisBulletsContainer.height = percent(100);\r\n axisBulletsContainer.isMeasured = false;\r\n axisBulletsContainer.zIndex = 4;\r\n axisBulletsContainer.layout = \"none\";\r\n _this.axisBulletsContainer = axisBulletsContainer;\r\n _this._bulletMask = _this.plotContainer;\r\n _this.events.on(\"beforedatavalidated\", function () {\r\n _this.series.each(function (series) {\r\n series.dataGrouped = false;\r\n series._baseInterval = {};\r\n });\r\n }, _this, false);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n XYChart.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n this.zoomOutButton.exportable = false;\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"X/Y chart\");\r\n }\r\n };\r\n /**\r\n * Draws the chart.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n this.seriesContainer.toFront();\r\n this.bulletsContainer.toFront();\r\n if (this.maskBullets) {\r\n this.bulletsContainer.mask = this._bulletMask;\r\n }\r\n this.updateSeriesLegend();\r\n };\r\n /**\r\n * Triggers a redrawing of all chart's series.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart.prototype.updatePlotElements = function () {\r\n $iter.each(this.series.iterator(), function (series) {\r\n series.invalidate();\r\n });\r\n };\r\n /**\r\n * Triggers data (re)validation which in turn can cause a redraw of the\r\n * whole chart or just aprticular series / elements.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart.prototype.validateData = function () {\r\n // tell axes that data changed\r\n if (this._parseDataFrom == 0) {\r\n $iter.each(this.xAxes.iterator(), function (axis) {\r\n axis.dataChangeUpdate();\r\n });\r\n $iter.each(this.yAxes.iterator(), function (axis) {\r\n axis.dataChangeUpdate();\r\n });\r\n $iter.each(this.series.iterator(), function (series) {\r\n series.dataChangeUpdate();\r\n });\r\n }\r\n _super.prototype.validateData.call(this);\r\n };\r\n /**\r\n * Updates margins for horizontal axes based on settings and available space.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart.prototype.updateXAxesMargins = function () {\r\n var leftAxesWidth = this.leftAxesContainer.measuredWidth;\r\n var rightAxesWidth = this.rightAxesContainer.measuredWidth;\r\n var bottomAxesCont = this.bottomAxesContainer;\r\n if (bottomAxesCont.paddingLeft != leftAxesWidth || bottomAxesCont.paddingRight != rightAxesWidth) {\r\n bottomAxesCont.paddingLeft = leftAxesWidth;\r\n bottomAxesCont.paddingRight = rightAxesWidth;\r\n }\r\n var topAxesCont = this.topAxesContainer;\r\n if (topAxesCont.paddingLeft != leftAxesWidth || topAxesCont.paddingRight != rightAxesWidth) {\r\n topAxesCont.paddingLeft = leftAxesWidth;\r\n topAxesCont.paddingRight = rightAxesWidth;\r\n }\r\n };\r\n /**\r\n * Triggers a re-initialization of this element.\r\n *\r\n * Will result in complete redrawing of the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart.prototype.reinit = function () {\r\n _super.prototype.reinit.call(this);\r\n this.series.each(function (series) {\r\n series.appeared = false;\r\n });\r\n };\r\n /**\r\n * Triggers an update on the horizontal axis when one of its properties\r\n * change.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event An event object\r\n */\r\n XYChart.prototype.handleXAxisChange = function (event) {\r\n this.updateXAxis(event.target);\r\n };\r\n /**\r\n * Triggers an update on the vertical axis when one of its properties\r\n * change.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event An event object\r\n */\r\n XYChart.prototype.handleYAxisChange = function (event) {\r\n this.updateYAxis(event.target);\r\n };\r\n /**\r\n * Sets up a new horizontal (X) axis when it is added to the chart.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Axis insert event\r\n */\r\n XYChart.prototype.processXAxis = function (event) {\r\n var axis = event.newValue;\r\n axis.chart = this;\r\n if (!axis.renderer) {\r\n axis.renderer = new this._axisRendererX();\r\n axis.renderer.observe([\"opposite\", \"inside\", \"inversed\", \"minGridDistance\"], this.handleXAxisChange, this, false);\r\n }\r\n axis.axisLetter = \"X\";\r\n axis.events.on(\"startendchanged\", this.handleXAxisRangeChange, this, false);\r\n //axis.events.on(\"endchanged\", this.handleXAxisRangeChange, this, false);\r\n // Although axis does not use data directly, we set dataProvider here\r\n // (but not add to chart data users) to hold up rendering before data\r\n // is parsed (system handles this)\r\n axis.dataProvider = this;\r\n this.updateXAxis(axis.renderer);\r\n this.processAxis(axis);\r\n };\r\n /**\r\n * Sets up a new vertical (Y) axis when it is added to the chart.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Axis insert event\r\n */\r\n XYChart.prototype.processYAxis = function (event) {\r\n var axis = event.newValue;\r\n axis.chart = this;\r\n if (!axis.renderer) {\r\n axis.renderer = new this._axisRendererY();\r\n axis.renderer.observe([\"opposite\", \"inside\", \"inversed\", \"minGridDistance\"], this.handleYAxisChange, this, false);\r\n }\r\n axis.axisLetter = \"Y\";\r\n axis.events.on(\"startendchanged\", this.handleYAxisRangeChange, this, false);\r\n //axis.events.on(\"endchanged\", this.handleYAxisRangeChange, this, false);\r\n // Although axis does not use data directly, we set dataProvider here\r\n // (but not add to chart data users) to hold up rendering before data\r\n // is parsed (system handles this)\r\n axis.dataProvider = this;\r\n this.updateYAxis(axis.renderer);\r\n this.processAxis(axis);\r\n };\r\n /**\r\n * Updates horizontal (X) scrollbar and other horizontal axis whenever axis'\r\n * value range changes.\r\n */\r\n XYChart.prototype.handleXAxisRangeChange = function () {\r\n var range = this.getCommonAxisRange(this.xAxes);\r\n if (this.scrollbarX) {\r\n this.zoomAxes(this.xAxes, range, true);\r\n }\r\n this.toggleZoomOutButton();\r\n this.updateScrollbar(this.scrollbarX, range);\r\n };\r\n /**\r\n * Shows or hides the Zoom Out button depending on whether the chart is fully\r\n * zoomed out or not.\r\n */\r\n XYChart.prototype.toggleZoomOutButton = function () {\r\n if (this.zoomOutButton) {\r\n var show_1 = false;\r\n $iter.eachContinue(this.xAxes.iterator(), function (axis) {\r\n if (axis.toggleZoomOutButton) {\r\n if (axis.maxZoomCount > 0) {\r\n var minZoomFactor = axis.maxZoomFactor / axis.maxZoomCount;\r\n if ($math.round(axis.end - axis.start, 3) < 1 / minZoomFactor) {\r\n show_1 = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n if ($math.round(axis.start, 3) > 0 || $math.round(axis.end, 3) < 1) {\r\n show_1 = true;\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n });\r\n $iter.eachContinue(this.yAxes.iterator(), function (axis) {\r\n if (axis.toggleZoomOutButton) {\r\n if (axis.maxZoomCount > 0) {\r\n var minZoomFactor = axis.maxZoomFactor / axis.maxZoomCount;\r\n if ($math.round(axis.end - axis.start, 3) < 1 / minZoomFactor) {\r\n show_1 = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n if ($math.round(axis.start, 3) > 0 || $math.round(axis.end, 3) < 1) {\r\n show_1 = true;\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n });\r\n if (!this.seriesAppeared) {\r\n show_1 = false;\r\n }\r\n if (show_1) {\r\n this.zoomOutButton.show();\r\n }\r\n else {\r\n this.zoomOutButton.hide();\r\n }\r\n }\r\n };\r\n /**\r\n * @ignore\r\n * moved this check to a separate method so that we could override it in TreeMapSeries\r\n */\r\n XYChart.prototype.seriesAppeared = function () {\r\n var appeared = false;\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (!series.appeared) {\r\n appeared = false;\r\n return false;\r\n }\r\n });\r\n return appeared;\r\n };\r\n /**\r\n * Updates vertical (Y) scrollbar and other horizontal axis whenever axis'\r\n * value range changes.\r\n */\r\n XYChart.prototype.handleYAxisRangeChange = function () {\r\n var range = this.getCommonAxisRange(this.yAxes);\r\n if (this.scrollbarY) {\r\n this.zoomAxes(this.yAxes, range, true);\r\n }\r\n this.toggleZoomOutButton();\r\n this.updateScrollbar(this.scrollbarY, range);\r\n };\r\n /**\r\n * Updates a relative scrollbar whenever data range of the axis changes.\r\n *\r\n * @param scrollbar Scrollbar instance\r\n * @param range New data (values) range of the axis\r\n */\r\n XYChart.prototype.updateScrollbar = function (scrollbar, range) {\r\n if (scrollbar) {\r\n scrollbar.skipRangeEvents();\r\n scrollbar.start = range.start;\r\n scrollbar.end = range.end;\r\n }\r\n };\r\n /**\r\n * Returns a common range of values between a list of axes.\r\n *\r\n * This is used to synchronize the zoom between multiple axes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axes A list of axes\r\n * @return Common value range\r\n */\r\n XYChart.prototype.getCommonAxisRange = function (axes) {\r\n var start;\r\n var end;\r\n axes.each(function (axis) {\r\n if (!axis.zoomable || (axis instanceof ValueAxis && axis.syncWithAxis)) {\r\n }\r\n else {\r\n var axisStart = axis.start;\r\n var axisEnd = axis.end;\r\n if (axis.renderer.inversed) {\r\n axisStart = 1 - axis.end;\r\n axisEnd = 1 - axis.start;\r\n }\r\n if (!$type.isNumber(start) || (axisStart < start)) {\r\n start = axisStart;\r\n }\r\n if (!$type.isNumber(end) || (axisEnd > end)) {\r\n end = axisEnd;\r\n }\r\n }\r\n });\r\n return { start: start, end: end };\r\n };\r\n /**\r\n * Triggers (re)rendering of the horizontal (X) axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axis Axis\r\n */\r\n XYChart.prototype.updateXAxis = function (renderer) {\r\n var axis = renderer.axis;\r\n if (renderer.opposite) {\r\n axis.parent = this.topAxesContainer;\r\n axis.toFront();\r\n }\r\n else {\r\n axis.parent = this.bottomAxesContainer;\r\n axis.toBack();\r\n }\r\n if (axis.renderer) {\r\n axis.renderer.processRenderer();\r\n }\r\n };\r\n /**\r\n * Triggers (re)rendering of the vertical (Y) axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axis Axis\r\n */\r\n XYChart.prototype.updateYAxis = function (renderer) {\r\n var axis = renderer.axis;\r\n if (renderer.opposite) {\r\n axis.parent = this.rightAxesContainer;\r\n axis.toBack();\r\n }\r\n else {\r\n axis.parent = this.leftAxesContainer;\r\n axis.toFront();\r\n }\r\n if (axis.renderer) {\r\n axis.renderer.processRenderer();\r\n }\r\n };\r\n /**\r\n * Decorates an Axis for use with this chart, e.g. sets proper renderer\r\n * and containers for placement.\r\n *\r\n * @param axis Axis\r\n */\r\n XYChart.prototype.processAxis = function (axis) {\r\n var _this = this;\r\n // Value axis does not use data directly, only category axis does\r\n if (axis instanceof CategoryAxis) {\r\n this._dataUsers.moveValue(axis);\r\n }\r\n var renderer = axis.renderer;\r\n renderer.gridContainer.parent = this.plotContainer;\r\n renderer.gridContainer.toBack();\r\n renderer.breakContainer.parent = this.plotContainer;\r\n renderer.breakContainer.toFront();\r\n renderer.breakContainer.zIndex = 10;\r\n axis.addDisposer(new Disposer(function () {\r\n _this.dataUsers.removeValue(axis);\r\n }));\r\n renderer.bulletsContainer.parent = this.axisBulletsContainer;\r\n this._disposers.push(axis.events.on(\"positionchanged\", function () {\r\n var point = $utils.spritePointToSprite({ x: 0, y: 0 }, axis, _this.axisBulletsContainer);\r\n if (axis.renderer instanceof AxisRendererY) {\r\n renderer.bulletsContainer.y = point.y;\r\n }\r\n if (axis.renderer instanceof AxisRendererX) {\r\n renderer.bulletsContainer.x = point.x;\r\n }\r\n }, undefined, false));\r\n this.plotContainer.events.on(\"maxsizechanged\", function () {\r\n if (_this.inited) {\r\n axis.invalidateDataItems();\r\n _this.updateSeriesMasks();\r\n }\r\n }, axis, false);\r\n };\r\n /**\r\n * This is done because for some reason IE doesn't change mask if path of a\r\n * mask changes.\r\n */\r\n XYChart.prototype.updateSeriesMasks = function () {\r\n if ($utils.isIE()) {\r\n this.series.each(function (series) {\r\n var mask = series.mainContainer.mask;\r\n series.mainContainer.mask = undefined;\r\n series.mainContainer.mask = mask;\r\n });\r\n }\r\n };\r\n XYChart.prototype.handleSeriesRemoved = function (event) {\r\n var series = event.oldValue;\r\n if (series) {\r\n if (series.xAxis) {\r\n series.xAxis.series.removeValue(series);\r\n series.xAxis.invalidateProcessedData();\r\n }\r\n if (series.yAxis) {\r\n series.yAxis.series.removeValue(series);\r\n series.yAxis.invalidateProcessedData();\r\n }\r\n // otherwise extremes won't change\r\n this.series.each(function (series) {\r\n series.resetExtremes();\r\n });\r\n }\r\n _super.prototype.handleSeriesRemoved.call(this, event);\r\n };\r\n Object.defineProperty(XYChart.prototype, \"xAxes\", {\r\n /**\r\n * A list of horizontal (X) axes.\r\n *\r\n * @return List of axes\r\n */\r\n get: function () {\r\n if (!this._xAxes) {\r\n this._xAxes = new List();\r\n this._xAxes.events.on(\"inserted\", this.processXAxis, this, false);\r\n this._xAxes.events.on(\"removed\", this.handleAxisRemoval, this, false);\r\n this._disposers.push(new ListDisposer(this._xAxes, false));\r\n }\r\n return this._xAxes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n XYChart.prototype.handleAxisRemoval = function (event) {\r\n var axis = event.oldValue;\r\n this.dataUsers.removeValue(axis); // need to remove, as it might not be disposed\r\n if (axis.autoDispose) {\r\n axis.dispose();\r\n }\r\n };\r\n Object.defineProperty(XYChart.prototype, \"yAxes\", {\r\n /**\r\n * A list of vertical (Y) axes.\r\n *\r\n * @return List of axes\r\n */\r\n get: function () {\r\n if (!this._yAxes) {\r\n this._yAxes = new List();\r\n this._yAxes.events.on(\"inserted\", this.processYAxis, this, false);\r\n this._yAxes.events.on(\"removed\", this.handleAxisRemoval, this, false);\r\n this._disposers.push(new ListDisposer(this._yAxes, false));\r\n }\r\n return this._yAxes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Decorates a new [[XYSeries]] object with required parameters when it is\r\n * added to the chart.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n XYChart.prototype.handleSeriesAdded = function (event) {\r\n try {\r\n _super.prototype.handleSeriesAdded.call(this, event);\r\n var series = event.newValue;\r\n if (this.xAxes.length == 0 || this.yAxes.length == 0) {\r\n registry.removeFromInvalidComponents(series);\r\n series.dataInvalid = false;\r\n }\r\n $utils.used(series.xAxis); // this is enough to get axis, handled in getter\r\n $utils.used(series.yAxis); // this is enough to get axis, handled in getter\r\n series.maskBullets = series.maskBullets;\r\n if (series.fill == undefined) {\r\n if (this.patterns) {\r\n if (!$type.hasValue(series.stroke)) {\r\n series.stroke = this.colors.next();\r\n }\r\n series.fill = this.patterns.next();\r\n if ($type.hasValue(series.fillOpacity)) {\r\n series.fill.backgroundOpacity = series.fillOpacity;\r\n }\r\n if (series.stroke instanceof Color) {\r\n series.fill.stroke = series.stroke;\r\n series.fill.fill = series.stroke;\r\n }\r\n }\r\n else {\r\n series.fill = this.colors.next();\r\n }\r\n }\r\n if (!$type.hasValue(series.stroke)) {\r\n series.stroke = series.fill;\r\n }\r\n }\r\n catch (e) {\r\n this.raiseCriticalError(e);\r\n }\r\n };\r\n Object.defineProperty(XYChart.prototype, \"cursor\", {\r\n /**\r\n * @return Cursor\r\n */\r\n get: function () {\r\n return this._cursor;\r\n },\r\n /**\r\n * Chart's [[Cursor]].\r\n *\r\n * @param cursor Cursor\r\n */\r\n set: function (cursor) {\r\n if (this._cursor != cursor) {\r\n if (this._cursor) {\r\n this.removeDispose(this._cursor);\r\n }\r\n this._cursor = cursor;\r\n if (cursor) {\r\n // TODO this is wrong, fix it\r\n this._disposers.push(cursor);\r\n cursor.chart = this;\r\n cursor.shouldClone = false;\r\n cursor.parent = this._cursorContainer;\r\n cursor.events.on(\"cursorpositionchanged\", this.handleCursorPositionChange, this, false);\r\n cursor.events.on(\"zoomstarted\", this.handleCursorZoomStart, this, false);\r\n cursor.events.on(\"zoomended\", this.handleCursorZoomEnd, this, false);\r\n cursor.events.on(\"panstarted\", this.handleCursorPanStart, this, false);\r\n cursor.events.on(\"panning\", this.handleCursorPanning, this, false);\r\n cursor.events.on(\"panended\", this.handleCursorPanEnd, this, false);\r\n cursor.events.on(\"behaviorcanceled\", this.handleCursorCanceled, this, false);\r\n cursor.events.on(\"hidden\", this.handleHideCursor, this, false);\r\n cursor.zIndex = Number.MAX_SAFE_INTEGER - 1;\r\n if (this.tapToActivate) {\r\n // We need this in order to setup cursor properly\r\n this.setTapToActivate(this.tapToActivate);\r\n }\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Performs tasks when the cursor's position changes, e.g. shows proper\r\n * tooltips on axes and series.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart.prototype.handleCursorPositionChange = function () {\r\n var cursor = this.cursor;\r\n if (cursor.visible && !cursor.isHiding) {\r\n var xPosition_1 = this.cursor.xPosition;\r\n var yPosition_1 = this.cursor.yPosition;\r\n this.showSeriesTooltip({\r\n x: xPosition_1,\r\n y: yPosition_1\r\n });\r\n var exceptAxes_1 = [];\r\n var snapToSeries = cursor.snapToSeries;\r\n if (snapToSeries && !cursor.downPoint) {\r\n if (snapToSeries instanceof XYSeries) {\r\n snapToSeries = [snapToSeries];\r\n }\r\n var dataItems_1 = [];\r\n $array.each(snapToSeries, function (snpSeries) {\r\n var xAxis = snpSeries.xAxis;\r\n var yAxis = snpSeries.yAxis;\r\n if (xAxis instanceof ValueAxis && !(xAxis instanceof DateAxis) && yAxis instanceof ValueAxis && !(yAxis instanceof DateAxis)) {\r\n snpSeries.dataItems.each(function (dataItem) {\r\n dataItems_1.push(dataItem);\r\n });\r\n $array.move(exceptAxes_1, snpSeries.yAxis);\r\n $array.move(exceptAxes_1, snpSeries.xAxis);\r\n }\r\n else {\r\n if (snpSeries.baseAxis == snpSeries.xAxis) {\r\n $array.move(exceptAxes_1, snpSeries.yAxis);\r\n dataItems_1.push(xAxis.getSeriesDataItem(snpSeries, xAxis.toAxisPosition(xPosition_1), true));\r\n }\r\n if (snpSeries.baseAxis == snpSeries.yAxis) {\r\n $array.move(exceptAxes_1, snpSeries.xAxis);\r\n dataItems_1.push(yAxis.getSeriesDataItem(snpSeries, yAxis.toAxisPosition(yPosition_1), true));\r\n }\r\n }\r\n });\r\n var closestDataItem_1 = this.getClosest(dataItems_1, xPosition_1, yPosition_1);\r\n if (closestDataItem_1) {\r\n this.series.each(function (series) {\r\n var closestSeries = closestDataItem_1.component;\r\n if (series != closestSeries) {\r\n series.hideTooltip();\r\n if (series.xAxis != closestSeries.xAxis) {\r\n series.xAxis.hideTooltip();\r\n }\r\n if (series.yAxis != closestSeries.yAxis) {\r\n series.yAxis.hideTooltip();\r\n }\r\n }\r\n });\r\n closestDataItem_1.component.showTooltipAtDataItem(closestDataItem_1);\r\n cursor.handleSnap(closestDataItem_1.component);\r\n }\r\n }\r\n //}\r\n this._seriesPoints = [];\r\n if (this._cursorXPosition != xPosition_1) {\r\n this.showAxisTooltip(this.xAxes, xPosition_1, exceptAxes_1);\r\n }\r\n if (this._cursorYPosition != yPosition_1) {\r\n this.showAxisTooltip(this.yAxes, yPosition_1, exceptAxes_1);\r\n }\r\n if (this.arrangeTooltips) {\r\n this.sortSeriesTooltips(this._seriesPoints);\r\n }\r\n if (this.legend) {\r\n this.legend.afterDraw();\r\n }\r\n }\r\n };\r\n XYChart.prototype.getClosest = function (dataItems, xPosition, yPosition) {\r\n var minDistance = Infinity;\r\n var closestDataItem;\r\n $array.eachContinue(dataItems, function (dataItem) {\r\n if (dataItem) {\r\n var xAxis = dataItem.component.xAxis;\r\n var yAxis = dataItem.component.yAxis;\r\n var xPos = xAxis.positionToCoordinate(xAxis.toGlobalPosition(xAxis.toAxisPosition(xPosition)));\r\n var yPos = yAxis.positionToCoordinate(yAxis.toGlobalPosition(yAxis.toAxisPosition(yPosition)));\r\n var xField = dataItem.component.xField;\r\n var yField = dataItem.component.yField;\r\n if (xAxis instanceof ValueAxis && !$type.isNumber(dataItem.getValue(xField))) {\r\n return true;\r\n }\r\n if (yAxis instanceof ValueAxis && !$type.isNumber(dataItem.getValue(yField))) {\r\n return true;\r\n }\r\n var dxPosition = xAxis.positionToCoordinate(xAxis.toGlobalPosition(xAxis.getPositionX(dataItem, xField, dataItem.locations[xField], \"valueX\")));\r\n var dyPosition = yAxis.positionToCoordinate(yAxis.toGlobalPosition(yAxis.getPositionY(dataItem, yField, dataItem.locations[yField], \"valueY\")));\r\n var distance = Math.sqrt(Math.pow(xPos - dxPosition, 2) + Math.pow(yPos - dyPosition, 2));\r\n if (distance < minDistance) {\r\n minDistance = distance;\r\n closestDataItem = dataItem;\r\n }\r\n return true;\r\n }\r\n });\r\n return closestDataItem;\r\n };\r\n /**\r\n * Hides all cursor-related tooltips when the cursor itself is hidden.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart.prototype.handleHideCursor = function () {\r\n this.hideObjectTooltip(this.xAxes);\r\n this.hideObjectTooltip(this.yAxes);\r\n this.hideObjectTooltip(this.series);\r\n this._cursorXPosition = undefined;\r\n this._cursorYPosition = undefined;\r\n this.updateSeriesLegend();\r\n };\r\n /**\r\n * Updates values for each series' legend item.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart.prototype.updateSeriesLegend = function () {\r\n $iter.each(this.series.iterator(), function (series) {\r\n series.updateLegendValue();\r\n });\r\n };\r\n /**\r\n * Hides a tooltip for a list of objects.\r\n *\r\n * @ignore Exclude from docs\r\n * @param sprites A list of sprites to hide tooltip for\r\n */\r\n XYChart.prototype.hideObjectTooltip = function (sprites) {\r\n $iter.each(sprites.iterator(), function (sprite) {\r\n sprite.hideTooltip(0);\r\n });\r\n };\r\n /**\r\n * Shows a tooltip for all chart's series, using specific coordinates as a\r\n * reference point.\r\n *\r\n * The tooltip might be shown at different coordinates depending on the\r\n * actual data point's position, overlapping with other tooltips, etc.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Reference point\r\n */\r\n XYChart.prototype.showSeriesTooltip = function (position) {\r\n var _this = this;\r\n if (!position) {\r\n this.series.each(function (series) {\r\n series.hideTooltip();\r\n });\r\n return;\r\n }\r\n var seriesPoints = [];\r\n this.series.each(function (series) {\r\n //if (series.tooltipText || series.tooltipHTML) { // not good, bullets are not hovered then\r\n if ((series.xAxis instanceof DateAxis && series.xAxis.snapTooltip) || (series.yAxis instanceof DateAxis && series.yAxis.snapTooltip)) {\r\n // void\r\n }\r\n else {\r\n var point = series.showTooltipAtPosition(position.x, position.y);\r\n if (point) {\r\n series.tooltip.setBounds($utils.spriteRectToSvg({ x: 0, y: 0, width: _this.pixelWidth, height: _this.pixelHeight }, _this));\r\n seriesPoints.push({ series: series, point: point });\r\n }\r\n }\r\n //}\r\n });\r\n if (this.arrangeTooltips) {\r\n this.sortSeriesTooltips(seriesPoints);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYChart.prototype.sortSeriesTooltips = function (seriesPoints) {\r\n if (seriesPoints.length > 0) {\r\n var cursor_1 = this.cursor;\r\n if (cursor_1 && $type.isNumber(cursor_1.maxTooltipDistance)) {\r\n var cursorPoint_1 = $utils.spritePointToSvg({ x: cursor_1.point.x, y: cursor_1.point.y }, cursor_1);\r\n var nearestSeries_1;\r\n var nearestPoint_1;\r\n var smallestDistance_1 = Infinity;\r\n $array.each(seriesPoints, function (seriesPoint) {\r\n var series = seriesPoint.series;\r\n var fixedPoint = seriesPoint.point;\r\n if (fixedPoint) {\r\n var point = { x: fixedPoint.x, y: fixedPoint.y };\r\n var distance = Math.abs($math.getDistance(point, cursorPoint_1));\r\n if (distance < smallestDistance_1) {\r\n nearestPoint_1 = point;\r\n smallestDistance_1 = distance;\r\n nearestSeries_1 = series;\r\n }\r\n }\r\n });\r\n var newSeriesPoints_1 = [];\r\n if (nearestSeries_1) {\r\n $array.each(seriesPoints, function (seriesPoint) {\r\n if (Math.abs($math.getDistance(seriesPoint.point, nearestPoint_1)) <= Math.abs(cursor_1.maxTooltipDistance)) {\r\n newSeriesPoints_1.push({ series: seriesPoint.series, point: seriesPoint.point });\r\n }\r\n else {\r\n var tooltipDataItem = seriesPoint.series.tooltipDataItem;\r\n if (tooltipDataItem) {\r\n $array.each(tooltipDataItem.sprites, function (sprite) {\r\n sprite.isHover = false;\r\n sprite.handleOutReal(); // to avoid flicker\r\n });\r\n }\r\n seriesPoint.series.tooltip.hide(0);\r\n }\r\n });\r\n if (cursor_1.maxTooltipDistance < 0) {\r\n if (newSeriesPoints_1.length > 0) {\r\n $array.each(newSeriesPoints_1, function (np) {\r\n if (nearestSeries_1 != np.series) {\r\n np.series.tooltip.hide(0);\r\n }\r\n });\r\n }\r\n newSeriesPoints_1 = [{ series: nearestSeries_1, point: nearestPoint_1 }];\r\n }\r\n }\r\n seriesPoints = newSeriesPoints_1;\r\n }\r\n var topLeft_1 = $utils.spritePointToSvg({ x: -0.5, y: -0.5 }, this.plotContainer);\r\n var bottomRight_1 = $utils.spritePointToSvg({ x: this.plotContainer.pixelWidth + 0.5, y: this.plotContainer.pixelHeight + 0.5 }, this.plotContainer);\r\n var sum_1 = 0;\r\n var filteredSeriesPoints_1 = [];\r\n $array.each(seriesPoints, function (seriesPoint) {\r\n var point = seriesPoint.point;\r\n if (point && $math.isInRectangle(point, { x: topLeft_1.x, y: topLeft_1.y, width: bottomRight_1.x - topLeft_1.x, height: bottomRight_1.y - topLeft_1.y })) {\r\n filteredSeriesPoints_1.push({ point: point, series: seriesPoint.series });\r\n sum_1 += point.y;\r\n }\r\n });\r\n seriesPoints = filteredSeriesPoints_1;\r\n var firstSeries = this.series.getIndex(0);\r\n var inversed = false;\r\n if (firstSeries && firstSeries.yAxis && firstSeries.yAxis.renderer.inversed) {\r\n inversed = true;\r\n }\r\n if (inversed) {\r\n seriesPoints.sort(function (a, b) { return $number.order(a.point.y, b.point.y); });\r\n }\r\n else {\r\n seriesPoints.sort(function (a, b) { return $number.order(b.point.y, a.point.y); });\r\n seriesPoints.reverse();\r\n }\r\n var averageY = sum_1 / seriesPoints.length;\r\n var maxY = $utils.svgPointToDocument({ x: 0, y: 0 }, this.svgContainer.SVGContainer).y;\r\n if (seriesPoints.length > 0) {\r\n var top_1 = topLeft_1.y;\r\n var bottom = bottomRight_1.y;\r\n // TODO is this needed ?\r\n $utils.spritePointToDocument({ x: 0, y: top_1 }, this);\r\n var dropped = false;\r\n if (averageY > top_1 + (bottom - top_1) / 2) {\r\n var nextHeight = bottom;\r\n for (var i = seriesPoints.length - 1; i >= 0; i--) {\r\n var series = seriesPoints[i].series;\r\n var tooltip = series.tooltip;\r\n var pointY = seriesPoints[i].point.y;\r\n tooltip.setBounds({ x: 0, y: -maxY, width: this.pixelWidth, height: nextHeight + maxY });\r\n if (tooltip.invalid) {\r\n tooltip.validate();\r\n }\r\n tooltip.toBack();\r\n nextHeight = $utils.spritePointToSvg({ x: 0, y: tooltip.label.pixelY - tooltip.pixelY + pointY - tooltip.pixelMarginTop }, tooltip).y;\r\n if (nextHeight < -maxY) {\r\n dropped = true;\r\n break;\r\n }\r\n }\r\n }\r\n if (averageY <= top_1 + (bottom - top_1) / 2 || dropped) {\r\n var nextY = top_1;\r\n for (var i = 0, len = seriesPoints.length; i < len; i++) {\r\n var series = seriesPoints[i].series;\r\n var pointY = seriesPoints[i].point.y;\r\n var tooltip = series.tooltip;\r\n tooltip.setBounds({ x: 0, y: nextY, width: this.pixelWidth, height: bottom });\r\n if (tooltip.invalid) {\r\n tooltip.validate();\r\n }\r\n tooltip.toBack();\r\n nextY = $utils.spritePointToSvg({ x: 0, y: tooltip.label.pixelY + tooltip.label.measuredHeight - tooltip.pixelY + pointY + tooltip.pixelMarginBottom }, tooltip).y;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Shows tooltips for a list of axes at specific position.\r\n *\r\n * Position might be X coordinate for horizontal axes, and Y coordinate for\r\n * vertical axes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axes List of axes to show tooltip on\r\n * @param position Position (px)\r\n */\r\n XYChart.prototype.showAxisTooltip = function (axes, position, except) {\r\n var _this = this;\r\n $iter.each(axes.iterator(), function (axis) {\r\n if (!except || except.indexOf(axis) == -1) {\r\n if (_this.dataItems.length > 0 || axis.dataItems.length > 0) {\r\n axis.showTooltipAtPosition(position);\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Recalculates the value range for the axis taking into account zoom level & inversed.\r\n *\r\n * @param axis Axis\r\n * @param range Range\r\n * @return Modified range\r\n */\r\n XYChart.prototype.getUpdatedRange = function (axis, range) {\r\n if (!axis) {\r\n return;\r\n }\r\n var start;\r\n var end;\r\n var inversed = axis.renderer.inversed;\r\n if (inversed) {\r\n $math.invertRange(range);\r\n start = 1 - axis.end;\r\n end = 1 - axis.start;\r\n }\r\n else {\r\n start = axis.start;\r\n end = axis.end;\r\n }\r\n var difference = end - start;\r\n return {\r\n start: start + range.start * difference,\r\n end: start + range.end * difference\r\n };\r\n };\r\n /**\r\n * Performs zoom and other operations when user finishes zooming using chart\r\n * cursor, e.g. zooms axes.\r\n *\r\n * @param event Cursor's event\r\n */\r\n XYChart.prototype.handleCursorZoomEnd = function (event) {\r\n var cursor = this.cursor;\r\n var behavior = cursor.behavior;\r\n if (behavior == \"zoomX\" || behavior == \"zoomXY\") {\r\n var xRange = cursor.xRange;\r\n if (xRange && this.xAxes.length > 0) {\r\n xRange = this.getUpdatedRange(this.xAxes.getIndex(0), xRange);\r\n xRange.priority = \"start\";\r\n this.zoomAxes(this.xAxes, xRange);\r\n }\r\n }\r\n if (behavior == \"zoomY\" || behavior == \"zoomXY\") {\r\n var yRange = cursor.yRange;\r\n if (yRange && this.yAxes.length > 0) {\r\n yRange = this.getUpdatedRange(this.yAxes.getIndex(0), yRange);\r\n yRange.priority = \"start\";\r\n this.zoomAxes(this.yAxes, yRange);\r\n }\r\n }\r\n this.handleHideCursor();\r\n };\r\n /**\r\n * Performs zoom and other operations when user is panning chart plot using chart cursor.\r\n *\r\n * @param event Cursor's event\r\n */\r\n XYChart.prototype.handleCursorPanStart = function (event) {\r\n var xAxis = this.xAxes.getIndex(0);\r\n if (xAxis) {\r\n this._panStartXRange = { start: xAxis.start, end: xAxis.end };\r\n }\r\n var yAxis = this.yAxes.getIndex(0);\r\n if (yAxis) {\r\n this._panStartYRange = { start: yAxis.start, end: yAxis.end };\r\n }\r\n };\r\n /**\r\n * Performs zoom and other operations when user ends panning\r\n *\r\n * @param event Cursor's event\r\n */\r\n XYChart.prototype.handleCursorPanEnd = function (event) {\r\n var cursor = this.cursor;\r\n var behavior = cursor.behavior;\r\n if (this._panEndXRange && (behavior == \"panX\" || behavior == \"panXY\")) {\r\n var panEndRange = this._panEndXRange;\r\n var delta = 0;\r\n if (panEndRange.start < 0) {\r\n delta = panEndRange.start;\r\n }\r\n if (panEndRange.end > 1) {\r\n delta = panEndRange.end - 1;\r\n }\r\n this.zoomAxes(this.xAxes, { start: panEndRange.start - delta, end: panEndRange.end - delta }, false, true);\r\n this._panEndXRange = undefined;\r\n this._panStartXRange = undefined;\r\n }\r\n if (this._panEndYRange && (behavior == \"panY\" || behavior == \"panXY\")) {\r\n var panEndRange = this._panEndYRange;\r\n var delta = 0;\r\n if (panEndRange.start < 0) {\r\n delta = panEndRange.start;\r\n }\r\n if (panEndRange.end > 1) {\r\n delta = panEndRange.end - 1;\r\n }\r\n this.zoomAxes(this.yAxes, { start: panEndRange.start - delta, end: panEndRange.end - delta }, false, true);\r\n this._panEndYRange = undefined;\r\n this._panStartYRange = undefined;\r\n }\r\n };\r\n XYChart.prototype.handleCursorCanceled = function () {\r\n this._panEndXRange = undefined;\r\n this._panStartXRange = undefined;\r\n };\r\n /**\r\n * Performs zoom and other operations when user is panning chart plot using chart cursor.\r\n *\r\n * @param event Cursor's event\r\n */\r\n XYChart.prototype.handleCursorPanning = function (event) {\r\n var cursor = this.cursor;\r\n var behavior = cursor.behavior;\r\n var maxPanOut = cursor.maxPanOut;\r\n if (this._panStartXRange && (behavior == \"panX\" || behavior == \"panXY\")) {\r\n var panStartRange = this._panStartXRange;\r\n var range = cursor.xRange;\r\n var axisRange = this.getCommonAxisRange(this.xAxes);\r\n var difference = (panStartRange.end - panStartRange.start);\r\n var delta = range.start * (axisRange.end - axisRange.start);\r\n var newStart = Math.max(-maxPanOut, delta + panStartRange.start);\r\n var newEnd = Math.min(delta + panStartRange.end, 1 + maxPanOut);\r\n if (newStart <= 0) {\r\n newEnd = newStart + difference;\r\n }\r\n if (newEnd >= 1) {\r\n newStart = newEnd - difference;\r\n }\r\n var newRange = {\r\n start: newStart,\r\n end: newEnd\r\n };\r\n this._panEndXRange = newRange;\r\n this.zoomAxes(this.xAxes, newRange, false, false, cursor.maxPanOut);\r\n }\r\n if (this._panStartYRange && (behavior == \"panY\" || behavior == \"panXY\")) {\r\n var panStartRange = this._panStartYRange;\r\n var range = cursor.yRange;\r\n var axisRange = this.getCommonAxisRange(this.yAxes);\r\n var difference = panStartRange.end - panStartRange.start;\r\n var delta = range.start * (axisRange.end - axisRange.start);\r\n var newStart = Math.max(-maxPanOut, delta + panStartRange.start);\r\n var newEnd = Math.min(delta + panStartRange.end, 1 + maxPanOut);\r\n if (newStart <= 0) {\r\n newEnd = newStart + difference;\r\n }\r\n if (newEnd >= 1) {\r\n newStart = newEnd - difference;\r\n }\r\n var newRange = {\r\n start: newStart,\r\n end: newEnd\r\n };\r\n this._panEndYRange = newRange;\r\n this.zoomAxes(this.yAxes, newRange, false, false, cursor.maxPanOut);\r\n }\r\n this.handleHideCursor();\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYChart.prototype.handleYAxisSet = function (series) {\r\n };\r\n /**\r\n * Performs zoom and other operations when user starts zooming using chart\r\n * cursor, e.g. zooms axes.\r\n *\r\n * @param event Cursor's event\r\n */\r\n XYChart.prototype.handleCursorZoomStart = function (event) {\r\n // Nothing here\r\n // This method is here only as a \"placeholder\" for extending classes to\r\n // override if necessary\r\n };\r\n Object.defineProperty(XYChart.prototype, \"scrollbarX\", {\r\n /**\r\n * @return Scrollbar\r\n */\r\n get: function () {\r\n return this._scrollbarX;\r\n },\r\n /**\r\n * Horizontal (X) scrollbar.\r\n *\r\n * @param scrollbar Scrollbar\r\n */\r\n set: function (scrollbar) {\r\n var _this = this;\r\n if (this._scrollbarX) {\r\n this.removeDispose(this._scrollbarX);\r\n }\r\n this._scrollbarX = scrollbar;\r\n if (scrollbar) {\r\n this._disposers.push(scrollbar);\r\n scrollbar.parent = this.topAxesContainer;\r\n scrollbar.shouldClone = false;\r\n scrollbar.startGrip.exportable = false;\r\n scrollbar.endGrip.exportable = false;\r\n scrollbar.toBack();\r\n scrollbar.orientation = \"horizontal\";\r\n scrollbar.events.on(\"rangechanged\", this.handleXScrollbarChange, this, false);\r\n // accessibility related\r\n scrollbar.adapter.add(\"positionValue\", function (arg) {\r\n var xAxis = _this.xAxes.getIndex(0);\r\n if (xAxis) {\r\n arg.value = xAxis.getPositionLabel(xAxis.renderer.inversed\r\n ? 1 - arg.position\r\n : arg.position);\r\n }\r\n return arg;\r\n });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYChart.prototype, \"scrollbarY\", {\r\n /**\r\n * @return Scrollbar\r\n */\r\n get: function () {\r\n return this._scrollbarY;\r\n },\r\n /**\r\n * Vertical (Y) scrollbar.\r\n *\r\n * @param scrollbar Scrollbar\r\n */\r\n set: function (scrollbar) {\r\n var _this = this;\r\n if (this._scrollbarY) {\r\n this.removeDispose(this._scrollbarY);\r\n }\r\n this._scrollbarY = scrollbar;\r\n if (scrollbar) {\r\n this._disposers.push(scrollbar);\r\n scrollbar.parent = this.rightAxesContainer;\r\n scrollbar.startGrip.exportable = false;\r\n scrollbar.shouldClone = false;\r\n scrollbar.endGrip.exportable = false;\r\n scrollbar.toFront();\r\n scrollbar.orientation = \"vertical\";\r\n scrollbar.events.on(\"rangechanged\", this.handleYScrollbarChange, this, false);\r\n // accessibility related\r\n scrollbar.adapter.add(\"positionValue\", function (arg) {\r\n var yAxis = _this.yAxes.getIndex(0);\r\n if (yAxis) {\r\n arg.value = yAxis.getPositionLabel(arg.position);\r\n }\r\n return arg;\r\n });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Zooms axes affected by the horizontal (X) scrollbar when the selection\r\n * on it changes.\r\n *\r\n * @param event Scrollbar range change event\r\n */\r\n XYChart.prototype.handleXScrollbarChange = function (event) {\r\n if (this.inited) {\r\n var scrollbar = event.target;\r\n var range = scrollbar.range;\r\n if (range.start == 0) {\r\n range.priority = \"start\";\r\n }\r\n if (range.end == 1) {\r\n range.priority = \"end\";\r\n }\r\n range = this.zoomAxes(this.xAxes, range);\r\n scrollbar.fixRange(range);\r\n }\r\n };\r\n /**\r\n * Zooms axes affected by the vertical (Y) scrollbar when the selection\r\n * on it changes.\r\n *\r\n * @param event Scrollbar range change event\r\n */\r\n XYChart.prototype.handleYScrollbarChange = function (event) {\r\n if (this.inited) {\r\n var scrollbar = event.target;\r\n var range = scrollbar.range;\r\n if (range.end == 1) {\r\n range.priority = \"end\";\r\n }\r\n if (range.start == 0) {\r\n range.priority = \"start\";\r\n }\r\n range = this.zoomAxes(this.yAxes, range);\r\n scrollbar.fixRange(range);\r\n }\r\n };\r\n /**\r\n * Zooms axes that are affected by to specific relative range.\r\n *\r\n * @param axes List of axes to zoom\r\n * @param range Range of values to zoom to (0-1)\r\n * @param instantly If set to `true` will skip zooming animation\r\n * @return Recalculated range that is common to all involved axes\r\n */\r\n XYChart.prototype.zoomAxes = function (axes, range, instantly, round, declination) {\r\n var realRange = { start: 0, end: 1 };\r\n this.showSeriesTooltip(); // hides\r\n if (!this.dataInvalid) {\r\n $iter.each(axes.iterator(), function (axis) {\r\n if (axis.zoomable) {\r\n if (axis.renderer.inversed) {\r\n range = $math.invertRange(range);\r\n }\r\n axis.hideTooltip(0);\r\n if (round) {\r\n //let diff = range.end - range.start;\r\n if (axis instanceof CategoryAxis) {\r\n var cellWidth = axis.getCellEndPosition(0) - axis.getCellStartPosition(0);\r\n range.start = axis.roundPosition(range.start + cellWidth / 2 - (axis.startLocation) * cellWidth, axis.startLocation);\r\n range.end = axis.roundPosition(range.end - cellWidth / 2 + (1 - axis.endLocation) * cellWidth, axis.endLocation);\r\n }\r\n else {\r\n range.start = axis.roundPosition(range.start + 0.0001, 0, axis.startLocation);\r\n range.end = axis.roundPosition(range.end + 0.0001, 0, axis.endLocation);\r\n }\r\n }\r\n var axisRange = axis.zoom(range, instantly, instantly, declination);\r\n if (axis.renderer.inversed) {\r\n axisRange = $math.invertRange(axisRange);\r\n }\r\n realRange = axisRange;\r\n }\r\n });\r\n }\r\n return realRange;\r\n };\r\n Object.defineProperty(XYChart.prototype, \"maskBullets\", {\r\n /**\r\n * @return Mask bullet container?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maskBullets\");\r\n },\r\n /**\r\n * Indicates if bullet container is masked.\r\n *\r\n * If it is set to `true`, any bullets that do not fit into bullet container\r\n * will be clipped off. Settting to `false` will allow bullets to \"spill out\"\r\n * of the plot area so they are not cut off.\r\n *\r\n * @param value Mask bullet container?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"maskBullets\", value, true) && this.bulletsContainer) {\r\n if (value) {\r\n this.bulletsContainer.mask = this._bulletMask;\r\n }\r\n else {\r\n this.bulletsContainer.mask = undefined;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYChart.prototype, \"arrangeTooltips\", {\r\n /**\r\n * @return Arrange tooltips?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"arrangeTooltips\");\r\n },\r\n /**\r\n * Indicates if chart should arrange series tooltips so that they would not\r\n * overlap.\r\n *\r\n * If set to `true` (default), the chart will adjust vertical positions of\r\n * all simultaneously shown tooltips to avoid overlapping.\r\n *\r\n * However, if you have a vertically-arranged chart, it might not make sense,\r\n * because tooltips would most probably not be aligned horizontally. In this\r\n * case it would probably be a good idea to set this setting to `false`.\r\n *\r\n * @default true\r\n * @param value Arrange tooltips?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"arrangeTooltips\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Handles mouse wheel event.\r\n *\r\n * @param event Original event\r\n */\r\n XYChart.prototype.handleWheel = function (event) {\r\n var plotContainer = this.plotContainer;\r\n var svgPoint = $utils.documentPointToSvg(event.point, this.htmlContainer, this.svgContainer.cssScale);\r\n var plotPoint = $utils.svgPointToSprite(svgPoint, plotContainer);\r\n var shift = event.shift.y;\r\n this.handleWheelReal(shift, this.mouseWheelBehavior, plotPoint);\r\n };\r\n /**\r\n * Handles mouse wheel event.\r\n *\r\n * @param event Original event\r\n */\r\n XYChart.prototype.handleHorizontalWheel = function (event) {\r\n var plotContainer = this.plotContainer;\r\n var svgPoint = $utils.documentPointToSvg(event.point, this.htmlContainer, this.svgContainer.cssScale);\r\n var plotPoint = $utils.svgPointToSprite(svgPoint, plotContainer);\r\n this.handleWheelReal(event.shift.x, this.horizontalMouseWheelBehavior, plotPoint);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYChart.prototype.handleWheelReal = function (shift, mouseWheelBehavior, plotPoint) {\r\n if (shift != 0) {\r\n var plotContainer = this.plotContainer;\r\n var rangeX = this.getCommonAxisRange(this.xAxes);\r\n var rangeY = this.getCommonAxisRange(this.yAxes);\r\n var shiftStep = 0.1;\r\n var maxPanOut = 0;\r\n if (mouseWheelBehavior == \"panX\" || mouseWheelBehavior == \"panXY\") {\r\n var differenceX = rangeX.end - rangeX.start;\r\n var newStartX = Math.max(-maxPanOut, rangeX.start + shiftStep * shift / 100 * (rangeX.end - rangeX.start));\r\n var newEndX = Math.min(rangeX.end + shiftStep * shift / 100 * (rangeX.end - rangeX.start), 1 + maxPanOut);\r\n if (newStartX <= 0) {\r\n newEndX = newStartX + differenceX;\r\n }\r\n if (newEndX >= 1) {\r\n newStartX = newEndX - differenceX;\r\n }\r\n this.zoomAxes(this.xAxes, { start: newStartX, end: newEndX });\r\n }\r\n if (mouseWheelBehavior == \"panY\" || mouseWheelBehavior == \"panXY\") {\r\n shift *= -1;\r\n var differenceY = rangeY.end - rangeY.start;\r\n var newStartY = Math.max(-maxPanOut, rangeY.start + shiftStep * shift / 100 * (rangeY.end - rangeY.start));\r\n var newEndY = Math.min(rangeY.end + shiftStep * shift / 100 * (rangeY.end - rangeY.start), 1 + maxPanOut);\r\n if (newStartY <= 0) {\r\n newEndY = newStartY + differenceY;\r\n }\r\n if (newEndY >= 1) {\r\n newStartY = newEndY - differenceY;\r\n }\r\n this.zoomAxes(this.yAxes, { start: newStartY, end: newEndY });\r\n }\r\n if (mouseWheelBehavior == \"zoomX\" || mouseWheelBehavior == \"zoomXY\") {\r\n var locationX = plotPoint.x / plotContainer.maxWidth;\r\n var location2X = this.xAxes.getIndex(0).toAxisPosition(locationX);\r\n var newStartX = Math.max(-maxPanOut, rangeX.start - shiftStep * (rangeX.end - rangeX.start) * shift / 100 * locationX);\r\n newStartX = Math.min(newStartX, location2X);\r\n var newEndX = Math.min(rangeX.end + shiftStep * (rangeX.end - rangeX.start) * shift / 100 * (1 - locationX), 1 + maxPanOut);\r\n newEndX = Math.max(newEndX, location2X);\r\n this.zoomAxes(this.xAxes, { start: newStartX, end: newEndX });\r\n }\r\n if (mouseWheelBehavior == \"zoomY\" || mouseWheelBehavior == \"zoomXY\") {\r\n var locationY = plotPoint.y / plotContainer.maxHeight;\r\n var location2Y = this.yAxes.getIndex(0).toAxisPosition(locationY);\r\n var newStartY = Math.max(-maxPanOut, rangeY.start - shiftStep * (rangeY.end - rangeY.start) * shift / 100 * (1 - locationY));\r\n newStartY = Math.min(newStartY, location2Y);\r\n var newEndY = Math.min(rangeY.end + shiftStep * shift / 100 * locationY * (rangeY.end - rangeY.start), 1 + maxPanOut);\r\n newEndY = Math.max(newEndY, location2Y);\r\n this.zoomAxes(this.yAxes, { start: newStartY, end: newEndY });\r\n }\r\n }\r\n };\r\n Object.defineProperty(XYChart.prototype, \"mouseWheelBehavior\", {\r\n /**\r\n * @return Mouse wheel behavior\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"mouseWheelBehavior\");\r\n },\r\n /**\r\n * Specifies action for when mouse wheel is used when over the chart.\r\n *\r\n * Options: Options: `\"zoomX\"`, `\"zoomY\"`, `\"zoomXY\"`, `\"panX\"`, `\"panY\"`,`\"panXY\"`, `\"none\"` (default).\r\n *\r\n * You can control sensitivity of wheel zooming via `mouseOptions`.\r\n *\r\n * @default \"none\"\r\n * @see {@link https://www.amcharts.com/docs/v4/reference/sprite/#mouseOptions_property} More information about `mouseOptions`\r\n * @param mouse wheel behavior\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"mouseWheelBehavior\", value)) {\r\n if (value != \"none\") {\r\n this._mouseWheelDisposer = this.plotContainer.events.on(\"wheel\", this.handleWheel, this, false);\r\n this._disposers.push(this._mouseWheelDisposer);\r\n }\r\n else {\r\n if (this._mouseWheelDisposer) {\r\n this.plotContainer.wheelable = false;\r\n this.plotContainer.hoverable = false;\r\n this._mouseWheelDisposer.dispose();\r\n }\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYChart.prototype, \"horizontalMouseWheelBehavior\", {\r\n /**\r\n * @return Horizontal mouse wheel behavior\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"horizontalMouseWheelBehavior\");\r\n },\r\n /**\r\n * Specifies action for when horizontal mouse wheel is used when over the chart.\r\n *\r\n * Options: Options: `\"zoomX\"`, `\"zoomY\"`, `\"zoomXY\"`, `\"panX\"`, `\"panY\"`, `\"panXY\"`, `\"none\"` (default).\r\n *\r\n * @default \"none\"\r\n * @see {@link https://www.amcharts.com/docs/v4/reference/sprite/#mouseOptions_property} More information about `mouseOptions`\r\n * @param mouse wheel behavior\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"horizontalMouseWheelBehavior\", value)) {\r\n if (value != \"none\") {\r\n this._mouseWheelDisposer2 = this.plotContainer.events.on(\"wheel\", this.handleHorizontalWheel, this, false);\r\n this._disposers.push(this._mouseWheelDisposer2);\r\n }\r\n else {\r\n if (this._mouseWheelDisposer2) {\r\n this.plotContainer.wheelable = false;\r\n this.plotContainer.hoverable = false;\r\n this._mouseWheelDisposer2.dispose();\r\n }\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This function is called by the [[DataSource]]'s `dateFields` adapater\r\n * so that particular chart types can popuplate this setting with their\r\n * own type-specific data fields so they are parsed properly.\r\n *\r\n * @param fields Array of date fields\r\n * @return Array of date fields populated with chart's date fields\r\n */\r\n XYChart.prototype.dataSourceDateFields = function (fields) {\r\n var _this = this;\r\n // Process parent\r\n fields = _super.prototype.dataSourceDateFields.call(this, fields);\r\n // Check if we have any series with date-fields\r\n $iter.each(this.series.iterator(), function (series) {\r\n fields = _this.populateDataSourceFields(fields, series.dataFields, [\"dateX\", \"dateY\", \"openDateX\", \"openDateY\"]);\r\n });\r\n return fields;\r\n };\r\n /**\r\n * This function is called by the [[DataSource]]'s `numberFields` adapater\r\n * so that particular chart types can popuplate this setting with their\r\n * own type-specific data fields so they are parsed properly.\r\n *\r\n * @param value Array of number fields\r\n * @return Array of number fields populated with chart's number fields\r\n */\r\n XYChart.prototype.dataSourceNumberFields = function (fields) {\r\n var _this = this;\r\n fields = _super.prototype.dataSourceDateFields.call(this, fields);\r\n // Check if we have any series with date-fields\r\n $iter.each(this.series.iterator(), function (series) {\r\n fields = _this.populateDataSourceFields(fields, series.dataFields, [\"valueX\", \"valueY\", \"openValueX\", \"openValueY\"]);\r\n });\r\n return fields;\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n XYChart.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Save axis ranges for later processing\r\n var xAxes = [];\r\n var yAxes = [];\r\n // Set up axes\r\n if ($type.hasValue(config.xAxes) && $type.isArray(config.xAxes)) {\r\n for (var i = 0, len = config.xAxes.length; i < len; i++) {\r\n if (!config.xAxes[i].type) {\r\n throw Error(\"[XYChart error] No type set for xAxes[\" + i + \"].\");\r\n }\r\n else if ($type.hasValue(config.xAxes[i][\"axisRanges\"])) {\r\n // Maybe convert string dates?\r\n for (var x = 0, len_1 = config.xAxes[i][\"axisRanges\"].length; x < len_1; x++) {\r\n var range = config.xAxes[i][\"axisRanges\"][x];\r\n if ($type.hasValue(range.date) && $type.isString(range.date)) {\r\n range.date = this.dateFormatter.parse(range.date);\r\n }\r\n if ($type.hasValue(range.endDate) && $type.isString(range.endDate)) {\r\n range.endDate = this.dateFormatter.parse(range.endDate);\r\n }\r\n }\r\n xAxes.push({\r\n axisRanges: config.xAxes[i][\"axisRanges\"],\r\n index: i\r\n });\r\n delete (config.xAxes[i][\"axisRanges\"]);\r\n }\r\n }\r\n }\r\n if ($type.hasValue(config.yAxes) && $type.isArray(config.yAxes)) {\r\n for (var i = 0, len = config.yAxes.length; i < len; i++) {\r\n if (!config.yAxes[i].type) {\r\n throw Error(\"[XYChart error] No type set for yAxes[\" + i + \"].\");\r\n }\r\n else if ($type.hasValue(config.yAxes[i][\"axisRanges\"])) {\r\n // Maybe convert string dates?\r\n for (var x = 0, len_2 = config.yAxes[i][\"axisRanges\"].length; x < len_2; x++) {\r\n var range = config.yAxes[i][\"axisRanges\"][x];\r\n if ($type.hasValue(range.date) && $type.isString(range.date)) {\r\n range.date = this.dateFormatter.parse(range.date);\r\n }\r\n if ($type.hasValue(range.endDate) && $type.isString(range.endDate)) {\r\n range.endDate = this.dateFormatter.parse(range.endDate);\r\n }\r\n }\r\n yAxes.push({\r\n axisRanges: config.yAxes[i][\"axisRanges\"],\r\n index: i\r\n });\r\n delete (config.yAxes[i][\"axisRanges\"]);\r\n }\r\n }\r\n }\r\n // Set up series\r\n if ($type.hasValue(config.series) && $type.isArray(config.series)) {\r\n for (var i = 0, len = config.series.length; i < len; i++) {\r\n config.series[i].type = config.series[i].type || \"LineSeries\";\r\n }\r\n }\r\n // Set up cursor\r\n if ($type.hasValue(config.cursor) && !$type.hasValue(config.cursor.type)) {\r\n config.cursor.type = \"XYCursor\";\r\n }\r\n // Set up scrollbars\r\n if ($type.hasValue(config.scrollbarX) && !$type.hasValue(config.scrollbarX.type)) {\r\n config.scrollbarX.type = \"Scrollbar\";\r\n }\r\n if ($type.hasValue(config.scrollbarY) && !$type.hasValue(config.scrollbarY.type)) {\r\n config.scrollbarY.type = \"Scrollbar\";\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n // Finish up with ranges.\r\n // We need to do this here because series are processed last in JSON\r\n // config. Therefore their respective objects are not yet are available\r\n // when axis (and respectively their ranges) are being processed.\r\n if (yAxes.length) {\r\n for (var i = 0, len = yAxes.length; i < len; i++) {\r\n this.yAxes.getIndex(yAxes[i].index).config = {\r\n axisRanges: yAxes[i].axisRanges\r\n };\r\n }\r\n }\r\n if (xAxes.length) {\r\n for (var i = 0, len = xAxes.length; i < len; i++) {\r\n this.xAxes.getIndex(xAxes[i].index).config = {\r\n axisRanges: xAxes[i].axisRanges\r\n };\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * This function is used to sort element's JSON config properties, so that\r\n * some properties that absolutely need to be processed last, can be put at\r\n * the end.\r\n *\r\n * @ignore Exclude from docs\r\n * @param a Element 1\r\n * @param b Element 2\r\n * @return Sorting number\r\n */\r\n XYChart.prototype.configOrder = function (a, b) {\r\n if (a == b) {\r\n return 0;\r\n }\r\n // Must come last\r\n else if (a == \"scrollbarX\") {\r\n return 1;\r\n }\r\n else if (b == \"scrollbarX\") {\r\n return -1;\r\n }\r\n else if (a == \"scrollbarY\") {\r\n return 1;\r\n }\r\n else if (b == \"scrollbarY\") {\r\n return -1;\r\n }\r\n else if (a == \"cursor\") {\r\n return 1;\r\n }\r\n else if (b == \"cursor\") {\r\n return -1;\r\n }\r\n else if (a == \"series\") {\r\n return 1;\r\n }\r\n else if (b == \"series\") {\r\n return -1;\r\n }\r\n else {\r\n return _super.prototype.configOrder.call(this, a, b);\r\n }\r\n };\r\n /**\r\n * Creates a new Series of type suitable for this chart.\r\n *\r\n * @return New series\r\n */\r\n XYChart.prototype.createSeries = function () {\r\n return new XYSeries();\r\n };\r\n Object.defineProperty(XYChart.prototype, \"zoomOutButton\", {\r\n /**\r\n * @return Zoom out button\r\n */\r\n get: function () {\r\n return this._zoomOutButton;\r\n },\r\n /**\r\n * A [[Button]] element that is used for zooming out the chart.\r\n *\r\n * This button appears only when chart is zoomed in, and disappears\r\n * autoamatically when it is zoome dout.\r\n *\r\n * @param button Zoom out button\r\n */\r\n set: function (button) {\r\n var _this = this;\r\n this._zoomOutButton = button;\r\n if (button) {\r\n button.events.on(\"hit\", function () {\r\n _this.zoomAxes(_this.xAxes, { start: 0, end: 1 });\r\n _this.zoomAxes(_this.yAxes, { start: 0, end: 1 });\r\n }, undefined, false);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all parameters from another [[XYChart]].\r\n *\r\n * @param source Source XYChart\r\n */\r\n XYChart.prototype.copyFrom = function (source) {\r\n var _this = this;\r\n source.xAxes.each(function (axis) {\r\n _this.xAxes.push(axis.clone());\r\n });\r\n source.yAxes.each(function (axis) {\r\n _this.yAxes.push(axis.clone());\r\n });\r\n //this.xAxes.copyFrom(source.xAxes);\r\n //this.yAxes.copyFrom(source.yAxes);\r\n _super.prototype.copyFrom.call(this, source);\r\n //this.zoomOutButton.copyFrom(source.zoomOutButton);\r\n if (source.cursor) {\r\n this.cursor = source.cursor.clone();\r\n }\r\n if (source.scrollbarX) {\r\n this.scrollbarX = source.scrollbarX.clone();\r\n }\r\n if (source.scrollbarY) {\r\n this.scrollbarY = source.scrollbarY.clone();\r\n }\r\n //@todo copy all container properties\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYChart.prototype.disposeData = function () {\r\n _super.prototype.disposeData.call(this);\r\n var scrollbarX = this.scrollbarX;\r\n if (scrollbarX && scrollbarX instanceof XYChartScrollbar) {\r\n scrollbarX.scrollbarChart.disposeData();\r\n }\r\n var scrollbarY = this.scrollbarY;\r\n if (scrollbarY && scrollbarY instanceof XYChartScrollbar) {\r\n scrollbarY.scrollbarChart.disposeData();\r\n }\r\n this.xAxes.each(function (axis) {\r\n axis.disposeData();\r\n });\r\n this.yAxes.each(function (axis) {\r\n axis.disposeData();\r\n });\r\n };\r\n /**\r\n * Adds one or several (array) of data items to the existing data.\r\n *\r\n * @param rawDataItem One or many raw data item objects\r\n */\r\n XYChart.prototype.addData = function (rawDataItem, removeCount) {\r\n if (this.scrollbarX instanceof XYChartScrollbar) {\r\n this.addScrollbarData(this.scrollbarX, removeCount);\r\n }\r\n if (this.scrollbarY instanceof XYChartScrollbar) {\r\n this.addScrollbarData(this.scrollbarY, removeCount);\r\n }\r\n _super.prototype.addData.call(this, rawDataItem, removeCount);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYChart.prototype.addScrollbarData = function (scrollbar, removeCount) {\r\n var chart = scrollbar.scrollbarChart;\r\n chart._parseDataFrom = chart.data.length;\r\n chart.invalidateData();\r\n };\r\n /**\r\n * @ignore\r\n */\r\n XYChart.prototype.removeScrollbarData = function (scrollbar, removeCount) {\r\n var chart = scrollbar.scrollbarChart;\r\n if ($type.isNumber(removeCount)) {\r\n while (removeCount > 0) {\r\n var dataItem = this.dataItems.getIndex(0);\r\n if (dataItem) {\r\n chart.dataItems.remove(dataItem);\r\n }\r\n chart.dataUsers.each(function (dataUser) {\r\n var dataItem = dataUser.dataItems.getIndex(0);\r\n if (dataItem) {\r\n dataUser.dataItems.remove(dataItem);\r\n }\r\n });\r\n chart._parseDataFrom--;\r\n removeCount--;\r\n }\r\n chart.invalidateData();\r\n }\r\n };\r\n /**\r\n * Removes elements from the beginning of data\r\n *\r\n * @param count number of elements to remove\r\n */\r\n XYChart.prototype.removeData = function (count) {\r\n if (this.scrollbarX instanceof XYChartScrollbar) {\r\n this.removeScrollbarData(this.scrollbarX, count);\r\n }\r\n if (this.scrollbarY instanceof XYChartScrollbar) {\r\n this.removeScrollbarData(this.scrollbarY, count);\r\n }\r\n _super.prototype.removeData.call(this, count);\r\n };\r\n /**\r\n * @param value Tap to activate?\r\n */\r\n XYChart.prototype.setTapToActivate = function (value) {\r\n _super.prototype.setTapToActivate.call(this, value);\r\n if (this.cursor) {\r\n this.cursor.interactions.isTouchProtected = value;\r\n this.plotContainer.interactions.isTouchProtected = value;\r\n }\r\n };\r\n XYChart.prototype.handleTapToActivate = function () {\r\n _super.prototype.handleTapToActivate.call(this);\r\n if (this.cursor) {\r\n this.cursor.interactions.isTouchProtected = false;\r\n this.plotContainer.interactions.isTouchProtected = false;\r\n }\r\n };\r\n XYChart.prototype.handleTapToActivateDeactivation = function () {\r\n _super.prototype.handleTapToActivateDeactivation.call(this);\r\n if (this.cursor) {\r\n this.cursor.interactions.isTouchProtected = true;\r\n this.plotContainer.interactions.isTouchProtected = true;\r\n }\r\n };\r\n return XYChart;\r\n}(SerialChart));\r\nexport { XYChart };\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[\"XYChart\"] = XYChart;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Remove horizontal scrollbar on narrow charts.\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.maybeXS,\r\n state: function (target, stateId) {\r\n if (target instanceof XYChart && target.scrollbarX) {\r\n var state = target.states.create(stateId);\r\n var sbstate = target.scrollbarX.states.create(stateId);\r\n sbstate.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n/**\r\n * Remove vertical scrollbar on short charts.\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.maybeXS,\r\n state: function (target, stateId) {\r\n if (target instanceof XYChart && target.scrollbarY) {\r\n var state = target.states.create(stateId);\r\n var sbstate = target.scrollbarY.states.create(stateId);\r\n sbstate.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=XYChart.js.map","/**\r\n * Line series segment module.\r\n * @todo Add description about what this is\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { Sprite, visualProperties } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport { color } from \"../../core/utils/Color\";\r\nimport * as $smoothing from \"../../core/rendering/Smoothing\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Represents a line series segment.\r\n *\r\n * A line segment can be used to apply different properties to a part of the\r\n * line series, between two data points.\r\n *\r\n * @see {@link ILineSeriesSegmentEvents} for a list of available events\r\n * @see {@link ILineSeriesSegmentAdapters} for a list of available Adapters\r\n * @todo Example\r\n */\r\nvar LineSeriesSegment = /** @class */ (function (_super) {\r\n __extends(LineSeriesSegment, _super);\r\n /**\r\n * Constructor\r\n */\r\n function LineSeriesSegment() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"LineSeriesSegment\";\r\n // Set defaults\r\n _this.isMeasured = false;\r\n _this.interactionsEnabled = false;\r\n _this.layout = \"none\";\r\n // Create fill element\r\n var fillSprite = _this.createChild(Sprite);\r\n _this.fillSprite = fillSprite;\r\n fillSprite.shouldClone = false;\r\n fillSprite.setElement(_this.paper.add(\"path\"));\r\n fillSprite.isMeasured = false;\r\n _this._disposers.push(fillSprite);\r\n // Create line element\r\n var strokeSprite = _this.createChild(Sprite);\r\n _this.strokeSprite = strokeSprite;\r\n strokeSprite.shouldClone = false;\r\n strokeSprite.fill = color();\r\n strokeSprite.setElement(_this.paper.add(\"path\"));\r\n strokeSprite.isMeasured = false;\r\n _this._disposers.push(strokeSprite);\r\n return _this;\r\n }\r\n /**\r\n * Draws the series segment.\r\n *\r\n * @ignore Exclude from docs\r\n * @param points Points to connect\r\n * @param closePoints ?\r\n * @param smoothnessX Horizontal bezier setting (?)\r\n * @param smoothnessY Vertical bezier setting (?)\r\n */\r\n LineSeriesSegment.prototype.drawSegment = function (points, closePoints, smoothnessX, smoothnessY) {\r\n if (!this.disabled) {\r\n if (points.length > 0 && closePoints.length > 0) {\r\n // first moveTo helps to avoid Chrome straight line in the mask bug.\r\n var path = $path.moveTo({ x: points[0].x - 0.2, y: points[0].y - 0.2 }) + $path.moveTo(points[0]) + new $smoothing.Tension(smoothnessX, smoothnessY).smooth(points);\r\n if (this.strokeOpacity == 0 || this.strokeSprite.strokeOpacity == 0) {\r\n // like this and not if != 0, otherwise ranges stroke won't be drawn.\r\n }\r\n else {\r\n this.strokeSprite.path = path;\r\n }\r\n if (this.fillOpacity > 0 || this.fillSprite.fillOpacity > 0) { // helps to avoid drawing fill object if fill is not visible\r\n path += $path.lineTo(closePoints[0]) + new $smoothing.Tension(smoothnessX, smoothnessY).smooth(closePoints);\r\n path += $path.lineTo(points[0]);\r\n path += $path.closePath();\r\n this.fillSprite.path = path;\r\n }\r\n }\r\n else {\r\n this.fillSprite.path = \"\";\r\n this.strokeSprite.path = \"\";\r\n }\r\n }\r\n };\r\n /**\r\n * Copies properties from a [[Sprite]] to both line and fill elements.\r\n *\r\n * @param source Source [[Sprite]] to copy properties from\r\n */\r\n LineSeriesSegment.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n var lineElement = this.strokeSprite;\r\n $object.copyProperties(source, lineElement.properties, visualProperties);\r\n lineElement.events.copyFrom(source.strokeSprite.events);\r\n lineElement.fillOpacity = 0;\r\n var fillElement = this.fillSprite;\r\n $object.copyProperties(source, fillElement.properties, visualProperties);\r\n fillElement.events.copyFrom(source.fillSprite.events);\r\n fillElement.strokeOpacity = 0;\r\n };\r\n return LineSeriesSegment;\r\n}(Container));\r\nexport { LineSeriesSegment };\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[\"LineSeriesSegment\"] = LineSeriesSegment;\r\n//# sourceMappingURL=LineSeriesSegment.js.map","/**\r\n * DurationAxis module\r\n */\r\nimport { __extends, __values } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ValueAxis, ValueAxisDataItem } from \"./ValueAxis\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines data item for [[DurationAxis]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar DurationAxisDataItem = /** @class */ (function (_super) {\r\n __extends(DurationAxisDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function DurationAxisDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"DurationAxisDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return DurationAxisDataItem;\r\n}(ValueAxisDataItem));\r\nexport { DurationAxisDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Used to create an axis that shows time durations.\r\n *\r\n * ```TypeScript\r\n * // Create the axis\r\n * let xAxis = chart.xAxes.push(new am4charts.DurationAxis());\r\n *\r\n * // Set settings\r\n * xAxis.title.text = \"Time\";\r\n * ```\r\n * ```JavaScript\r\n * // Create the axis\r\n * var valueAxis = chart.xAxes.push(new am4charts.DurationAxis());\r\n *\r\n * // Set settings\r\n * valueAxis.title.text = \"Time\";\r\n * ```\r\n * ```JSON\r\n * \"xAxes\": [{\r\n * \"type\": \"DurationAxis\",\r\n * \"title\": {\r\n * \"text\": \"Time\"\r\n * }\r\n * }]\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-duration/} for mor information about duration formatters.\r\n * @see {@link IDurationAxisEvents} for a list of available Events\r\n * @see {@link IDurationAxisAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar DurationAxis = /** @class */ (function (_super) {\r\n __extends(DurationAxis, _super);\r\n /**\r\n * Constructor\r\n */\r\n function DurationAxis() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * A base unit (granularity) of data.\r\n *\r\n * Used to indicate what are the base units of your data.\r\n */\r\n _this._baseUnit = \"second\";\r\n _this.className = \"DurationAxis\";\r\n _this.setPropertyValue(\"maxZoomFactor\", 1000000);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Formats the value according to axis' own [[DurationFormatter]].\r\n *\r\n * @param value Source value\r\n * @return Formatted value\r\n */\r\n DurationAxis.prototype.formatLabel = function (value, format) {\r\n return this.durationFormatter.format(value, format || this.axisDurationFormat);\r\n };\r\n /**\r\n * Adjusts actual min and max scale values so that the axis starts and ends\r\n * at \"nice\" values, unless `strictMinMax` is set.\r\n *\r\n * The `difference` can be something else than `max - min`, because of the\r\n * axis breaks.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param min [description]\r\n * @param max [description]\r\n * @param difference [description]\r\n * @param gridCount [description]\r\n * @param strictMode [description]\r\n * @return [description]\r\n */\r\n DurationAxis.prototype.adjustMinMax = function (min, max, difference, gridCount, strictMode) {\r\n var e_1, _a;\r\n var minMaxStep;\r\n var timeUnit = this.baseUnit;\r\n // we don't allow to go to smaller units, setting so to avoid invalidation\r\n this.setPropertyValue(\"maxPrecision\", 0);\r\n if (timeUnit == \"millisecond\" || timeUnit == \"second\" || timeUnit == \"minute\" || timeUnit == \"hour\") {\r\n // will fail if 0\r\n if (gridCount <= 1) {\r\n gridCount = 1;\r\n }\r\n gridCount = Math.round(gridCount);\r\n var initialMin = min;\r\n var initialMax = max;\r\n // in case min and max is the same, use max\r\n if (difference === 0) {\r\n difference = Math.abs(max);\r\n }\r\n var step = difference / gridCount;\r\n var divisors = [60, 30, 20, 15, 10, 2, 1];\r\n var realDivisor = 1;\r\n if (timeUnit == \"hour\") {\r\n divisors = [24, 12, 6, 4, 2, 1];\r\n }\r\n try {\r\n for (var divisors_1 = __values(divisors), divisors_1_1 = divisors_1.next(); !divisors_1_1.done; divisors_1_1 = divisors_1.next()) {\r\n var divisor = divisors_1_1.value;\r\n if (difference / divisor > gridCount) {\r\n realDivisor = divisor;\r\n break;\r\n }\r\n }\r\n }\r\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\r\n finally {\r\n try {\r\n if (divisors_1_1 && !divisors_1_1.done && (_a = divisors_1.return)) _a.call(divisors_1);\r\n }\r\n finally { if (e_1) throw e_1.error; }\r\n }\r\n var count = Math.ceil(((max - min) / realDivisor) / gridCount);\r\n var exponent = Math.log(Math.abs(count)) * Math.LOG10E;\r\n var power = Math.pow(10, Math.floor(exponent)) / 10;\r\n var reducedCount = count / power;\r\n // find closest to divisor\r\n var closest = $math.closest(divisors, reducedCount);\r\n count = closest * power;\r\n step = realDivisor * count;\r\n // TODO can this be removed ?\r\n this.durationFormatter.getValueUnit(step, this.baseUnit);\r\n min = Math.floor(min / step) * step;\r\n max = Math.ceil(max / step) * step;\r\n if (strictMode) {\r\n min -= step;\r\n if (min < 0 && initialMin >= 0) {\r\n min = 0;\r\n }\r\n max += step;\r\n if (max > 0 && initialMax <= 0) {\r\n max = 0;\r\n }\r\n }\r\n minMaxStep = { min: min, max: max, step: step };\r\n }\r\n else {\r\n minMaxStep = _super.prototype.adjustMinMax.call(this, min, max, difference, gridCount, strictMode);\r\n }\r\n // choose duration formatter based on step\r\n this.axisDurationFormat = this.durationFormatter.getFormat(minMaxStep.step, minMaxStep.max, this.baseUnit);\r\n return minMaxStep;\r\n };\r\n Object.defineProperty(DurationAxis.prototype, \"tooltipDurationFormat\", {\r\n /**\r\n * @return Duration format for axis labels\r\n */\r\n get: function () {\r\n return this._tooltipDurationFormat;\r\n },\r\n /**\r\n * A special duration format to apply axis tooltips.\r\n *\r\n * Will use same format as for labels, if not set.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-duration/} for mor information.\r\n * @param value Duration format for axis labels\r\n */\r\n set: function (value) {\r\n this._tooltipDurationFormat = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns text to show in a axis tooltip, based on specific position within\r\n * axis.\r\n *\r\n * The label will be formatted as per [[NumberFormatter]] set for the whole\r\n * chart, or explicitly for this Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position (px)\r\n * @return Label (numeric value)\r\n */\r\n DurationAxis.prototype.getTooltipText = function (position) {\r\n var value = $math.round(this.positionToValue(position), this._stepDecimalPlaces);\r\n var valueStr = this.formatLabel(value, this.tooltipDurationFormat);\r\n if (!this._adapterO) {\r\n return valueStr;\r\n }\r\n else {\r\n return this._adapterO.apply(\"getTooltipText\", valueStr);\r\n }\r\n };\r\n Object.defineProperty(DurationAxis.prototype, \"baseUnit\", {\r\n /**\r\n * @return Base unit\r\n */\r\n get: function () {\r\n return this._baseUnit;\r\n },\r\n /**\r\n * A base unit (granularity) of data.\r\n *\r\n * Used to indicate what are the base units of your data.\r\n *\r\n * Available options: \"millisecond\", \"second\" (default), \"minute\", \"hour\",\r\n * \"day\", \"week\", \"month\", \"year\".\r\n *\r\n * @default \"second\"\r\n * @param timeUnit\r\n */\r\n set: function (timeUnit) {\r\n if (this._baseUnit != timeUnit) {\r\n this._baseUnit = timeUnit;\r\n this.durationFormatter.baseUnit = timeUnit;\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all properties and related data from a different instance of Axis.\r\n *\r\n * @param source Source Axis\r\n */\r\n DurationAxis.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.baseUnit = source.baseUnit;\r\n };\r\n return DurationAxis;\r\n}(ValueAxis));\r\nexport { DurationAxis };\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[\"DurationAxis\"] = DurationAxis;\r\nregistry.registeredClasses[\"DurationAxisDataItem\"] = DurationAxisDataItem;\r\n//# sourceMappingURL=DurationAxis.js.map","/**\r\n * Line series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { XYSeries, XYSeriesDataItem } from \"./XYSeries\";\r\nimport { visualProperties } from \"../../core/Sprite\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { LineSeriesSegment } from \"./LineSeriesSegment\";\r\nimport { ValueAxis } from \"../axes/ValueAxis\";\r\nimport { DateAxis } from \"../axes/DateAxis\";\r\nimport { DurationAxis } from \"../axes/DurationAxis\";\r\nimport { CategoryAxis } from \"../axes/CategoryAxis\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { Line } from \"../../core/elements/Line\";\r\nimport { Label } from \"../../core/elements/Label\";\r\nimport { Rectangle } from \"../../core/elements/Rectangle\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport { Bullet } from \"../elements/Bullet\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[LineSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar LineSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(LineSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function LineSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"LineSeriesDataItem\";\r\n return _this;\r\n }\r\n return LineSeriesDataItem;\r\n}(XYSeriesDataItem));\r\nexport { LineSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a line graph.\r\n *\r\n * @see {@link ILineSeriesEvents} for a list of available Events\r\n * @see {@link ILineSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar LineSeries = /** @class */ (function (_super) {\r\n __extends(LineSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function LineSeries() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Minimum distance in pixels between two adjacent points.\r\n *\r\n * If the distance is less than this setting, a point is skipped.\r\n *\r\n * This allows acceptable performance with huge amounts of data points.\r\n *\r\n * @default 0.5\r\n */\r\n _this.minDistance = 0.5;\r\n _this.segments = new ListTemplate(_this.createSegment());\r\n _this.segments.template.applyOnClones = true;\r\n _this._disposers.push(new ListDisposer(_this.segments));\r\n _this._disposers.push(_this.segments.template);\r\n _this._segmentsIterator = new $iter.ListIterator(_this.segments, function () { return _this.segments.create(); });\r\n _this._segmentsIterator.createNewItems = true;\r\n _this.className = \"LineSeries\";\r\n _this.strokeOpacity = 1;\r\n _this.fillOpacity = 0;\r\n _this.connect = true;\r\n _this.tensionX = 1;\r\n _this.tensionY = 1;\r\n _this.autoGapCount = 1.1;\r\n _this.segmentsContainer = _this.mainContainer.createChild(Container);\r\n _this.segmentsContainer.isMeasured = false;\r\n // line series might have multiple segments and it has a separate sprite for fill and stroke for each segment. So we need to observe all the changes on series and set them on the segments\r\n // todo: we need list here, otherwise everything will be redrawn event on change of properties like tooltipX or similar.\r\n // this.addEventListener(SpriteEvent.PROPERTY_CHANGED, this.validateDataElements, false, this);\r\n _this.bulletsContainer.toFront();\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n LineSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Line Series\");\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n LineSeries.prototype.createSegment = function () {\r\n return new LineSeriesSegment();\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n LineSeries.prototype.createDataItem = function () {\r\n return new LineSeriesDataItem();\r\n };\r\n /**\r\n * Inits data item's working values.\r\n *\r\n * @param dataItem Data item\r\n * @param index Data item's index\r\n */\r\n LineSeries.prototype.setInitialWorkingValues = function (dataItem) {\r\n // this makes data items animate when added\r\n var yAxis = this._yAxis.get();\r\n var xAxis = this._xAxis.get();\r\n if (this.appeared && this.visible) {\r\n var previousDataItem = this.dataItems.getIndex(dataItem.index - 1);\r\n dataItem.component = this; // as these values are set before, we don't know component yet\r\n if (this.baseAxis == xAxis) {\r\n if (yAxis instanceof ValueAxis) {\r\n var initialY = yAxis.minZoomed;\r\n if (previousDataItem) {\r\n initialY = previousDataItem.values[\"valueY\"].workingValue;\r\n }\r\n // this makes line animate from previous point to newly added point\r\n dataItem.setWorkingValue(\"valueY\", initialY, 0);\r\n dataItem.setWorkingValue(\"valueY\", dataItem.values.valueY.value);\r\n if (xAxis instanceof DateAxis) {\r\n dataItem.setWorkingLocation(\"dateX\", dataItem.locations.dateX - 1, 0); // instantly move it to previous\r\n dataItem.setWorkingLocation(\"dateX\", dataItem.locations.dateX); // animate to it's location\r\n }\r\n else if (xAxis instanceof DurationAxis) {\r\n if (previousDataItem) {\r\n var value = dataItem.valueX;\r\n dataItem.setWorkingValue(\"valueX\", previousDataItem.valueX, 0); // instantly move it to previous\r\n dataItem.setWorkingValue(\"valueX\", value); // animate to new value\r\n }\r\n }\r\n }\r\n }\r\n if (this.baseAxis == yAxis) {\r\n if (xAxis instanceof ValueAxis) {\r\n var initialX = xAxis.minZoomed;\r\n if (previousDataItem) {\r\n initialX = previousDataItem.values[\"valueX\"].workingValue;\r\n }\r\n dataItem.setWorkingValue(\"valueX\", initialX, 0);\r\n dataItem.setWorkingValue(\"valueX\", dataItem.values.valueX.value);\r\n if (yAxis instanceof DateAxis) {\r\n dataItem.setWorkingLocation(\"dateY\", dataItem.locations.dateX - 1, 0); // instantly move it to previous\r\n dataItem.setWorkingLocation(\"dateY\", dataItem.locations.dateY); // animate to it's location\r\n }\r\n else if (yAxis instanceof DurationAxis) {\r\n if (previousDataItem) {\r\n var value = dataItem.valueY;\r\n dataItem.setWorkingValue(\"valueY\", previousDataItem.valueY, 0); // instantly move it to previous\r\n dataItem.setWorkingValue(\"valueY\", value); // animate to new value\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (this.baseAxis == xAxis) {\r\n if (yAxis instanceof ValueAxis) {\r\n if (xAxis instanceof DateAxis) {\r\n dataItem.setWorkingLocation(\"dateX\", dataItem.locations.dateX);\r\n }\r\n if (xAxis instanceof CategoryAxis) {\r\n dataItem.setWorkingLocation(\"categoryX\", dataItem.locations.categoryX);\r\n }\r\n }\r\n }\r\n if (this.baseAxis == yAxis) {\r\n if (xAxis instanceof ValueAxis) {\r\n if (yAxis instanceof DateAxis) {\r\n dataItem.setWorkingLocation(\"dateY\", dataItem.locations.dateY);\r\n }\r\n if (yAxis instanceof CategoryAxis) {\r\n dataItem.setWorkingLocation(\"categoryY\", dataItem.locations.categoryY);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Updates corresponding legend data item with current values.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n LineSeries.prototype.updateLegendValue = function (dataItem, notRange) {\r\n _super.prototype.updateLegendValue.call(this, dataItem, notRange);\r\n //This is hack to save some methos, used to set tooltip color source only\r\n if (dataItem && dataItem.segment) {\r\n this.tooltipColorSource = dataItem.segment;\r\n }\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n LineSeries.prototype.validate = function () {\r\n var _this = this;\r\n _super.prototype.validate.call(this);\r\n if (this.xAxis && this.yAxis) {\r\n this._segmentsIterator.reset();\r\n this.openSegmentWrapper(this._adjustedStartIndex);\r\n $iter.each(this.axisRanges.iterator(), function (range) {\r\n _this.openSegmentWrapper(_this._adjustedStartIndex, range);\r\n });\r\n $iter.each(this._segmentsIterator.iterator(), function (segment) {\r\n segment.__disabled = true;\r\n });\r\n }\r\n };\r\n /**\r\n * [sliceData description]\r\n *\r\n * @todo Description\r\n */\r\n LineSeries.prototype.sliceData = function () {\r\n var startIndex = this.startIndex;\r\n var endIndex = this.endIndex;\r\n // we need extra one item to both sides with values for line series, otherwise the line will not continue out of bounds of the chart while scrolling\r\n // find first to the left\r\n // TODO use iterator instead\r\n for (var i = this.startIndex - 1; i >= 0; i--) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n if (dataItem && dataItem.hasValue(this._xValueFields) && dataItem.hasValue(this._yValueFields)) {\r\n startIndex = i;\r\n break;\r\n }\r\n }\r\n this._adjustedStartIndex = this.findAdjustedIndex(startIndex, [\"stroke\", \"strokeWidth\", \"strokeDasharray\", \"strokeOpacity\", \"fill\", \"fillOpacity\", \"opacity\"]);\r\n // find first to the right\r\n // TODO use iterator instead\r\n for (var i = this.endIndex, len = this.dataItems.length; i < len; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n if (dataItem && dataItem.hasValue(this._xValueFields) && dataItem.hasValue(this._yValueFields)) {\r\n endIndex = i + 1;\r\n break;\r\n }\r\n }\r\n this._workingStartIndex = startIndex;\r\n this._workingEndIndex = endIndex;\r\n };\r\n /**\r\n * @ignore\r\n */\r\n LineSeries.prototype.findAdjustedIndex = function (adjustedIndex, properties) {\r\n var _this = this;\r\n var propertyFields = this.propertyFields;\r\n var startIndex = adjustedIndex;\r\n $array.each(properties, function (property) {\r\n if ($type.hasValue(propertyFields[property])) {\r\n for (var i = startIndex; i >= 0; i--) {\r\n var dataItem = _this.dataItems.getIndex(i);\r\n if (dataItem) {\r\n if ($type.hasValue(dataItem.properties[property])) {\r\n if (adjustedIndex > i) {\r\n adjustedIndex = i;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n });\r\n return adjustedIndex;\r\n };\r\n /**\r\n * Wraps openSegment call with iterative solution to prevent stack overflow\r\n *\r\n * @param openIndex Index\r\n * @param axisRange Range\r\n */\r\n LineSeries.prototype.openSegmentWrapper = function (openIndex, axisRange) {\r\n var params = {\r\n \"index\": openIndex,\r\n \"axisRange\": axisRange\r\n };\r\n do {\r\n params = this.openSegment(params.index, params.axisRange);\r\n } while (params);\r\n };\r\n LineSeries.prototype.getSegment = function () {\r\n var segment = this._segmentsIterator.getFirst();\r\n if (segment.isDisposed()) {\r\n this.segments.removeValue(segment);\r\n return this.getSegment();\r\n }\r\n return segment;\r\n };\r\n /**\r\n * [openSegment description]\r\n *\r\n * @todo Description\r\n * @param openIndex [description]\r\n * @param axisRange [description]\r\n */\r\n LineSeries.prototype.openSegment = function (openIndex, axisRange) {\r\n var addToClose = false;\r\n var points = [];\r\n openIndex = Math.min(openIndex, this.dataItems.length);\r\n var endIndex = Math.min(this._workingEndIndex, this.dataItems.length);\r\n this._workingEndIndex = Math.min(this._workingEndIndex, this.dataItems.length);\r\n var closeIndex;\r\n var propertiesChanged = false;\r\n var segment = this.getSegment();\r\n segment.__disabled = false;\r\n if (axisRange) {\r\n segment.parent = axisRange.contents;\r\n $object.copyProperties(axisRange.contents, segment, visualProperties);\r\n }\r\n else {\r\n $object.copyProperties(this, segment, visualProperties);\r\n segment.filters.clear();\r\n segment.parent = this.segmentsContainer;\r\n }\r\n this.group.node.removeAttribute(\"fill\");\r\n var connect = this.connect;\r\n var valuesFound = false; // some flag to avoid multiple closes if no values found\r\n for (var i = openIndex; i < endIndex; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n dataItem.segment = segment;\r\n if (dataItem.hasProperties) {\r\n // if this is first item of segment\r\n if (i == openIndex) {\r\n this.updateSegmentProperties(dataItem.properties, segment);\r\n }\r\n else {\r\n // this time we only need to know if properties changed, so we don't pass segment\r\n propertiesChanged = this.updateSegmentProperties(dataItem.properties, segment, true);\r\n }\r\n }\r\n if (dataItem.hasValue(this._xValueFields) && dataItem.hasValue(this._yValueFields)) {\r\n this.addPoints(points, dataItem, this.xField, this.yField);\r\n valuesFound = true;\r\n }\r\n else {\r\n // if no values in first data item, go to next\r\n if (i == openIndex) {\r\n continue;\r\n }\r\n else {\r\n // stop cycle\r\n if (!connect && valuesFound) {\r\n closeIndex = i;\r\n break;\r\n }\r\n }\r\n }\r\n closeIndex = i;\r\n if (this.baseAxis instanceof DateAxis) {\r\n var next = this.dataItems.getIndex(i + 1);\r\n if (next && this.baseAxis.makeGap(next, dataItem)) {\r\n addToClose = true;\r\n break;\r\n }\r\n }\r\n if (propertiesChanged) {\r\n break;\r\n }\r\n }\r\n return this.closeSegment(segment, points, openIndex, closeIndex, axisRange, addToClose);\r\n };\r\n /**\r\n * [addPoints description]\r\n *\r\n * @todo Description\r\n * @param points [description]\r\n * @param dataItem [description]\r\n * @param xField [description]\r\n * @param yField [description]\r\n * @param backwards [description]\r\n */\r\n LineSeries.prototype.addPoints = function (points, dataItem, xField, yField, backwards) {\r\n var point = this.getPoint(dataItem, xField, yField, dataItem.workingLocations[xField], dataItem.workingLocations[yField]);\r\n if (!backwards) {\r\n dataItem.point = point;\r\n }\r\n points.push(point);\r\n };\r\n /**\r\n * [closeSegment description]\r\n *\r\n * @todo Description\r\n * @param segment [description]\r\n * @param points [description]\r\n * @param openIndex [description]\r\n * @param closeIndex [description]\r\n * @param axisRange [description]\r\n */\r\n LineSeries.prototype.closeSegment = function (segment, points, openIndex, closeIndex, axisRange, add) {\r\n var closePoints = [];\r\n if (this.dataFields[this._xOpenField] ||\r\n this.dataFields[this._yOpenField] ||\r\n this.stacked) {\r\n for (var i = closeIndex; i >= openIndex; i--) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n if (dataItem.hasValue(this._xValueFields) && dataItem.hasValue(this._yValueFields)) { // not sure, this means that open point will only be added if value is also set for this point, but maybe it's ok.\r\n this.addPoints(closePoints, dataItem, this.xOpenField, this.yOpenField, true);\r\n }\r\n }\r\n }\r\n else {\r\n var baseAxis = this.baseAxis;\r\n var count = points.length;\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (count > 0) {\r\n if (baseAxis == xAxis) {\r\n closePoints.push({ x: points[count - 1].x, y: yAxis.basePoint.y }); // last x\r\n closePoints.push({ x: points[0].x, y: yAxis.basePoint.y }); // first x\r\n }\r\n else {\r\n closePoints.push({ x: xAxis.basePoint.x, y: points[count - 1].y }); // last y\r\n closePoints.push({ x: xAxis.basePoint.x, y: points[0].y }); // first y\r\n }\r\n }\r\n }\r\n this.drawSegment(segment, points, closePoints);\r\n if (add) {\r\n closeIndex++;\r\n }\r\n if (closeIndex < this._workingEndIndex - 1) {\r\n return { \"index\": closeIndex, \"axisRange\": axisRange };\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Draws the line segment.\r\n *\r\n * @param segment Segment\r\n * @param points Segment points\r\n * @param closePoints Segment close points\r\n */\r\n LineSeries.prototype.drawSegment = function (segment, points, closePoints) {\r\n segment.drawSegment(points, closePoints, this.tensionX, this.tensionY);\r\n };\r\n /**\r\n * Segement will get its colors from `this.dataItem`, as thats how\r\n * `getPropertyValue()` method works.\r\n *\r\n * We pass `lineSeriesDataItem.properties` as item here each time when a flag\r\n * `hasProperties` is set to `true` on data item (this means it can contain\r\n * some properties set).\r\n *\r\n * @param itemProperties Item properties\r\n * @param segment Segment\r\n * @return Properties changed?\r\n */\r\n LineSeries.prototype.updateSegmentProperties = function (itemProperties, segment, checkOnly) {\r\n var changed = false;\r\n $object.each(itemProperties, function (propertyName, value) {\r\n // some value must be defined\r\n if ($type.hasValue(value)) {\r\n var currentValue = segment[propertyName];\r\n var currentValueStr = void 0;\r\n // current value can be Color, number, anything. So we check if it has toString, otherwise just do String().\r\n // toString() will return hex if it's color. The only problem is that it will return lowercased hex and if we have uppercase in data, it will think that it changed\r\n if (currentValue) {\r\n if (currentValue.toString) {\r\n currentValueStr = currentValue.toString();\r\n }\r\n else {\r\n currentValueStr = currentValue; // not doing String(currentValue) as this will make all Objects the same\r\n }\r\n }\r\n var valueStr = void 0;\r\n if (value) {\r\n if (value.toString) {\r\n valueStr = value.toString();\r\n }\r\n else {\r\n valueStr = value; // not doing String(currentValue) as this will make all Objects the same\r\n }\r\n }\r\n if (currentValue == value || (currentValueStr != undefined && valueStr != undefined && currentValueStr == valueStr)) {\r\n // void\r\n }\r\n else {\r\n if (!checkOnly) {\r\n segment[propertyName] = value;\r\n }\r\n changed = true;\r\n }\r\n }\r\n });\r\n return changed;\r\n };\r\n Object.defineProperty(LineSeries.prototype, \"connect\", {\r\n /**\r\n * @return Connect?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"connect\");\r\n },\r\n /**\r\n * Connect the lines over empty data points?\r\n *\r\n * If set to `true` the line will connect two adjacent data points by a\r\n * straight line. Even if there are data points with missing values\r\n * in-between.\r\n *\r\n * If you set this to `false`, the line will break when there are missing\r\n * values.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/xy-chart/#Line_series_with_gaps} for more information about this feature\r\n * @default true\r\n * @param value Connect?\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"connect\", value)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LineSeries.prototype, \"tensionX\", {\r\n /**\r\n * @return Horizontal tension (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tensionX\");\r\n },\r\n /**\r\n * Horizontal tension setting of the line (0-1).\r\n *\r\n * Can be used to create smoothed lines. It works like this:\r\n *\r\n * Accepted values are in the range between 0 and 1. The biggest value (1)\r\n * will mean that the \"tension\" is very high, so the line is maximally\r\n * attracted to the points it connects, hence the straight line.\r\n *\r\n * Using smaller numbers will \"relax\" the tension, creating some curving.\r\n *\r\n * The smaller the tension setting, the more relaxed the line and the more\r\n * wide the curve.\r\n *\r\n * This setting is for horizontal tension, meaning the curve will bend in\r\n * such way that it never goes below or above connecting points. To enable\r\n * vertical bending as well, use `tensionY`.\r\n *\r\n * IMPORTANT: line smoothing works best when data items are placed at regular\r\n * intervals. For setups where data items are spaced erratically, enabling\r\n * smoothing might result in awkwardly looking lines.\r\n *\r\n * @default 1\r\n * @param value Horizontal tension (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tensionX\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LineSeries.prototype, \"tensionY\", {\r\n /**\r\n * @return Vertical tension (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tensionY\");\r\n },\r\n /**\r\n * Can be used to create smoothed lines. It works like this:\r\n *\r\n * Accepted values are in the range between 0 and 1. The biggest value (1)\r\n * will mean that the \"tension\" is very high, so the line is maximally\r\n * attracted to the points it connects, hence the straight line.\r\n *\r\n * Using smaller numbers will \"relax\" the tension, creating some curving.\r\n *\r\n * The smaller the tension setting, the more relaxed the line and the more\r\n * wide the curve.\r\n *\r\n * This setting is for vertical tension, meaning the curve might bend in\r\n * such way that it will go below or above connected points.\r\n *\r\n * Combine this setting with `tensionX` to create beautifully looking\r\n * smoothed line series.\r\n *\r\n * @default 1\r\n * @param value Vertical tension (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tensionY\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates elements in related legend container, that mimics the look of this\r\n * Series.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Legend item container\r\n */\r\n LineSeries.prototype.createLegendMarker = function (marker) {\r\n var _this = this;\r\n var w = marker.pixelWidth;\r\n var h = marker.pixelHeight;\r\n marker.disposeChildren();\r\n var line = marker.createChild(Line);\r\n line.shouldClone = false;\r\n //line.copyFrom(this); coppies events which is not good\r\n $object.copyProperties(this, line, visualProperties);\r\n line.x2 = w;\r\n line.y = h / 2;\r\n line.y2 = 0.00001;\r\n line.visible = true;\r\n if (this.fillOpacity > 0) {\r\n var fill = marker.createChild(Rectangle);\r\n //fill.copyFrom(this); coppies events which is not good\r\n $object.copyProperties(this, fill, visualProperties);\r\n fill.width = w;\r\n fill.height = h;\r\n fill.y = 0;\r\n fill.strokeOpacity = 0;\r\n fill.visible = true;\r\n line.y = 0;\r\n }\r\n var legendDataItem = marker.dataItem;\r\n legendDataItem.color = this.stroke;\r\n legendDataItem.colorOrig = this.fill;\r\n $iter.eachContinue(this.bullets.iterator(), function (bullet) {\r\n if ((bullet instanceof Bullet) && !bullet.copyToLegendMarker) {\r\n return false;\r\n }\r\n var hasLabels = false;\r\n if (bullet instanceof Container) {\r\n // do not copy bullets with labels\r\n $iter.each(bullet.children.iterator(), function (child) {\r\n if (child instanceof Label) {\r\n hasLabels = true;\r\n return true;\r\n }\r\n });\r\n }\r\n if (!hasLabels) {\r\n var clone = bullet.clone();\r\n clone.parent = marker;\r\n clone.isMeasured = true;\r\n clone.tooltipText = undefined;\r\n clone.x = w / 2;\r\n if (_this.fillOpacity > 0) {\r\n clone.y = 0;\r\n }\r\n else {\r\n clone.y = h / 2;\r\n }\r\n clone.visible = true;\r\n // otherwise will not transit to color after hiding\r\n if (!$type.hasValue(clone.fill)) {\r\n clone.fill = _this.fill;\r\n }\r\n if (!$type.hasValue(clone.stroke)) {\r\n clone.stroke = _this.stroke;\r\n }\r\n return false;\r\n }\r\n });\r\n };\r\n /**\r\n * @ignore\r\n */\r\n LineSeries.prototype.disposeData = function () {\r\n _super.prototype.disposeData.call(this);\r\n this.segments.clear();\r\n };\r\n Object.defineProperty(LineSeries.prototype, \"autoGapCount\", {\r\n /**\r\n * @return Gap count\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"autoGapCount\");\r\n },\r\n /**\r\n * If `connect = false` and distance between two data points is bigger\r\n * than `baseInterval * autoGapCount`, a line will break automatically.\r\n *\r\n * @since 4.2.4\r\n * @param value Gap count\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"autoGapCount\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return LineSeries;\r\n}(XYSeries));\r\nexport { LineSeries };\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[\"LineSeries\"] = LineSeries;\r\nregistry.registeredClasses[\"LineSeriesDataItem\"] = LineSeriesDataItem;\r\n//# sourceMappingURL=LineSeries.js.map","/**\r\n * Radar series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { LineSeries, LineSeriesDataItem } from \"./LineSeries\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n//import { AxisRendererCircular } from \"../axes/AxisRendererCircular\";\r\n//import { Sprite } from \"../../core/Sprite\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[RadarSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar RadarSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(RadarSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RadarSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"RadarSeriesDataItem\";\r\n _this.setLocation(\"dateX\", 0, 0);\r\n _this.setLocation(\"dateY\", 0, 0);\r\n _this.setLocation(\"categoryX\", 0, 0);\r\n _this.setLocation(\"categoryY\", 0, 0);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return RadarSeriesDataItem;\r\n}(LineSeriesDataItem));\r\nexport { RadarSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a radar graph.\r\n *\r\n * @see {@link IRadarSeriesEvents} for a list of available Events\r\n * @see {@link IRadarSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar RadarSeries = /** @class */ (function (_super) {\r\n __extends(RadarSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RadarSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"RadarSeries\";\r\n _this.connectEnds = true;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n RadarSeries.prototype.validate = function () {\r\n // so that radius would be updated\r\n if (this.chart.invalid) {\r\n this.chart.validate();\r\n }\r\n _super.prototype.validate.call(this);\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n RadarSeries.prototype.createDataItem = function () {\r\n return new RadarSeriesDataItem();\r\n };\r\n /**\r\n * Returns an [[IPoint]] coordinates of the specific Serie's data point.\r\n *\r\n * @param dataItem Data item\r\n * @param xKey Name of X data field\r\n * @param yKey Name of Y data field\r\n * @param locationX X location\r\n * @param locationY Y location\r\n * @param stackKeyX ?\r\n * @param stackKeyY ?\r\n * @returns Coordinates\r\n */\r\n RadarSeries.prototype.getPoint = function (dataItem, xKey, yKey, locationX, locationY, stackKeyX, stackKeyY) {\r\n if (!stackKeyX) {\r\n stackKeyX = \"valueX\";\r\n }\r\n if (!stackKeyY) {\r\n stackKeyY = \"valueY\";\r\n }\r\n var x = this.yAxis.getX(dataItem, yKey, locationY, stackKeyY);\r\n var y = this.yAxis.getY(dataItem, yKey, locationY, stackKeyY);\r\n var radius = $math.getDistance({ x: x, y: y });\r\n // hack to be able to determine angle later\r\n if (radius == 0) {\r\n radius = 0.00001;\r\n }\r\n var angle = this.xAxis.getAngle(dataItem, xKey, locationX, stackKeyX);\r\n var startAngle = this.chart.startAngle;\r\n var endAngle = this.chart.endAngle;\r\n //\t\tangle = $math.fitToRange(angle, startAngle, endAngle);\r\n if (angle < startAngle || angle > endAngle) {\r\n return undefined;\r\n }\r\n else {\r\n return { x: radius * $math.cos(angle), y: radius * $math.sin(angle) };\r\n }\r\n };\r\n /**\r\n * [addPoints description]\r\n *\r\n * @todo Description\r\n * @param points [description]\r\n * @param dataItem [description]\r\n * @param xField [description]\r\n * @param yField [description]\r\n * @param backwards [description]\r\n */\r\n RadarSeries.prototype.addPoints = function (points, dataItem, xField, yField, backwards) {\r\n var point = this.getPoint(dataItem, xField, yField, dataItem.locations[xField], dataItem.locations[yField]);\r\n if (point) {\r\n points.push(point);\r\n }\r\n };\r\n /**\r\n * Returns an SVG path to be used as a mask for the series.\r\n *\r\n * @return SVG path\r\n */\r\n RadarSeries.prototype.getMaskPath = function () {\r\n var renderer = this.yAxis.renderer;\r\n return $path.arc(renderer.startAngle, renderer.endAngle - renderer.startAngle, renderer.pixelRadius, renderer.pixelInnerRadius);\r\n };\r\n /**\r\n * [drawSegment description]\r\n *\r\n * @todo Description\r\n * @param segment [description]\r\n * @param points [description]\r\n * @param closePoints [description]\r\n */\r\n RadarSeries.prototype.drawSegment = function (segment, points, closePoints) {\r\n var axis = this.yAxis;\r\n var renderer = axis.renderer;\r\n if (this.connectEnds && Math.abs(renderer.endAngle - renderer.startAngle) == 360) {\r\n // adds one point to the beginning of closePoints array, if needed\r\n if (this.dataFields[this._xOpenField] ||\r\n this.dataFields[this._yOpenField] ||\r\n this.stacked) {\r\n points.push(points[0]);\r\n if (closePoints.length > 0) {\r\n closePoints.unshift(closePoints[closePoints.length - 1]);\r\n }\r\n }\r\n }\r\n _super.prototype.drawSegment.call(this, segment, points, closePoints);\r\n };\r\n Object.defineProperty(RadarSeries.prototype, \"connectEnds\", {\r\n /**\r\n * @return Connect?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"connectEnds\");\r\n },\r\n /**\r\n * Should the last and and first data points be connected, forming a complete\r\n * closed circle?\r\n *\r\n * @default true\r\n * @param value Connect?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"connectEnds\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RadarSeries.prototype.positionBulletReal = function (bullet, positionX, positionY) {\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (positionX < xAxis.start || positionX > xAxis.end || positionY < yAxis.start || positionY > yAxis.end) {\r\n bullet.visible = false;\r\n }\r\n bullet.moveTo(this.xAxis.renderer.positionToPoint(positionX, positionY));\r\n };\r\n RadarSeries.prototype.setXAxis = function (axis) {\r\n _super.prototype.setXAxis.call(this, axis);\r\n this.updateRendererRefs();\r\n };\r\n RadarSeries.prototype.setYAxis = function (axis) {\r\n _super.prototype.setYAxis.call(this, axis);\r\n this.updateRendererRefs();\r\n };\r\n RadarSeries.prototype.updateRendererRefs = function () {\r\n var rendererX = this.xAxis.renderer;\r\n var rendererY = this.yAxis.renderer;\r\n rendererX.axisRendererY = rendererY;\r\n };\r\n return RadarSeries;\r\n}(LineSeries));\r\nexport { RadarSeries };\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[\"RadarSeries\"] = RadarSeries;\r\nregistry.registeredClasses[\"RadarSeriesDataItem\"] = RadarSeriesDataItem;\r\n//# sourceMappingURL=RadarSeries.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisFill } from \"./AxisFill\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Provides fill element functionality for circular Axes.\r\n *\r\n * @see {@link IAxisFillCircularEvents} for a list of available events\r\n * @see {@link IAxisFillCircularAdapters} for a list of available Adapters\r\n * @todo Needs description\r\n */\r\nvar AxisFillCircular = /** @class */ (function (_super) {\r\n __extends(AxisFillCircular, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Axis\r\n */\r\n function AxisFillCircular(axis) {\r\n var _this = _super.call(this, axis) || this;\r\n _this.className = \"AxisFillCircular\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.radius = percent(100);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the fill element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisFillCircular.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n if (this.__disabled || this.disabled) {\r\n return;\r\n }\r\n if (this.axis) {\r\n var renderer = this.axis.renderer;\r\n this.fillPath = renderer.getPositionRangePath(this.startPosition, this.endPosition, this.radius, $type.hasValue(this.innerRadius) ? this.innerRadius : renderer.innerRadius, this.cornerRadius);\r\n this.path = this.fillPath;\r\n }\r\n };\r\n Object.defineProperty(AxisFillCircular.prototype, \"innerRadius\", {\r\n /**\r\n * @return Inner radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Inner radius of the fill. Relative ([[Percent]]) or absolute (pixels).\r\n *\r\n * @param value Inner radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisFillCircular.prototype, \"radius\", {\r\n /**\r\n * @return Outer radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Outer radius of the fill. Relative ([[Percent]]) or absolute (pixels).\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisFillCircular.prototype, \"cornerRadius\", {\r\n /**\r\n * @return Corner radius (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cornerRadius\");\r\n },\r\n /**\r\n * Corner radius for the fill. In pixels.\r\n *\r\n * @param value Corner radius (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"cornerRadius\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return AxisFillCircular;\r\n}(AxisFill));\r\nexport { AxisFillCircular };\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[\"AxisFillCircular\"] = AxisFillCircular;\r\n//# sourceMappingURL=AxisFillCircular.js.map","/**\r\n * A module defining functionality for circular axis grid elements.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Grid } from \"./Grid\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a circular grid element for circular-type axis.\r\n *\r\n * @see {@link IGridCircularEvents} for a list of available events\r\n * @see {@link IGridCircularAdapters} for a list of available Adapters\r\n * @todo Review: container is better, as we'll be able to attach something to the GridCircular, also with 3d charts we might need some additional elements\r\n */\r\nvar GridCircular = /** @class */ (function (_super) {\r\n __extends(GridCircular, _super);\r\n /**\r\n * Constructor\r\n */\r\n function GridCircular() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"GridCircular\";\r\n _this.pixelPerfect = false;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(GridCircular.prototype, \"innerRadius\", {\r\n /**\r\n * @return Inner radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Inner radius of the circular grid. (absolute or relative)\r\n *\r\n * @param value Inner radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GridCircular.prototype, \"radius\", {\r\n /**\r\n * @return Outer radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Outer radius of the circular grid. (absolute or relative)\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return GridCircular;\r\n}(Grid));\r\nexport { GridCircular };\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[\"GridCircular\"] = GridCircular;\r\n//# sourceMappingURL=GridCircular.js.map","/**\r\n * Axis Label module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisLabel } from \"./AxisLabel\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport { Percent } from \"../../core/utils/Percent\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Use to create labels on circular axis.\r\n *\r\n * @see {@link IAxisLabelCircularEvents} for a list of available events\r\n * @see {@link IAxisLabelCircularAdapters} for a list of available Adapters\r\n */\r\nvar AxisLabelCircular = /** @class */ (function (_super) {\r\n __extends(AxisLabelCircular, _super);\r\n /**\r\n * Constructor\r\n */\r\n function AxisLabelCircular() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n *\r\n * @ignore\r\n */\r\n _this.fdx = 0;\r\n /**\r\n *\r\n * @ignore\r\n */\r\n _this.fdy = 0;\r\n _this.className = \"AxisLabelCircular\";\r\n _this.padding(0, 0, 0, 0);\r\n _this.location = 0.5;\r\n _this.locationOnPath = 0.5;\r\n _this.radius = 0;\r\n _this.isMeasured = false;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(AxisLabelCircular.prototype, \"relativeRotation\", {\r\n /**\r\n * @return Rotation angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"relativeRotation\");\r\n },\r\n /**\r\n * Relative rotation of the label.\r\n *\r\n * It is an angle to circle. In case 90, labels will be positioned like rays\r\n * of light, if 0 - positioned along the circle.\r\n *\r\n * @param value Rotation angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"relativeRotation\", value, true);\r\n if (!$type.hasValue(value)) {\r\n this.rotation = undefined;\r\n var dataItem = this.dataItem;\r\n if (dataItem && dataItem.component) {\r\n dataItem.component.invalidateDataItems();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisLabelCircular.prototype, \"radius\", {\r\n /**\r\n * @return Distance (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Distance from axis circle to label in pixels or percent.\r\n *\r\n * @param value Distance (px or percent)\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisLabelCircular.prototype, \"bent\", {\r\n /**\r\n * @return Bent?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"bent\");\r\n },\r\n /**\r\n * Specifies if label should be bent along the circle.\r\n *\r\n * IMPORTANT: Use this with caution, since it is quite CPU-greedy.\r\n *\r\n * @since 4.1.2\r\n * @default false\r\n * @param value Bent?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"bent\", value, true);\r\n this.setPropertyValue(\"wrap\", false);\r\n this.setPropertyValue(\"horizontalCenter\", \"none\");\r\n this.setPropertyValue(\"verticalCenter\", \"none\");\r\n if (value) {\r\n this.setPropertyValue(\"dx\", 0);\r\n this.setPropertyValue(\"dy\", 0);\r\n this.setPropertyValue(\"x\", 0);\r\n this.setPropertyValue(\"y\", 0);\r\n this.setPropertyValue(\"rotation\", 0);\r\n //this.setPropertyValue(\"relativeRotation\", undefined);\r\n this.fdx = 0;\r\n this.fdy = 0;\r\n this.textAlign = \"middle\";\r\n }\r\n else {\r\n if (this.textPathElement) {\r\n this.textPathElement.dispose();\r\n this.textPathElement = undefined;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns label radius in pixels.\r\n *\r\n * @param axisRadius Radius\r\n * @return Pixel radius\r\n */\r\n AxisLabelCircular.prototype.pixelRadius = function (axisRadius) {\r\n var sign = 1;\r\n if (this.inside) {\r\n sign = -1;\r\n }\r\n return $utils.relativeToValue(this.radius, axisRadius) * sign;\r\n };\r\n /**\r\n * Returns label horizontal radius in pixels.\r\n *\r\n * @param axisRadius Radius\r\n * @param axisRadiusY Vertical radius\r\n * @return Radius\r\n */\r\n AxisLabelCircular.prototype.pixelRadiusY = function (axisRadius, axisRadiusY) {\r\n var sign = 1;\r\n if (this.inside) {\r\n sign = -1;\r\n }\r\n var radius = this.radius;\r\n if ($type.isNumber(radius)) {\r\n radius *= axisRadiusY / axisRadius;\r\n return $utils.relativeToValue(radius, axisRadius) * sign;\r\n }\r\n else {\r\n return $utils.relativeToValue(radius, axisRadiusY) * sign;\r\n }\r\n };\r\n /**\r\n * [fixPosition description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param point Label affixation point\r\n * @param axisRadius Distance from point (px)\r\n */\r\n AxisLabelCircular.prototype.fixPosition = function (angle, axisRadius, axisRadiusY, dx, dy) {\r\n if (!$type.isNumber(axisRadiusY)) {\r\n axisRadiusY = axisRadius;\r\n }\r\n if (!$type.isNumber(dx)) {\r\n dx = 0;\r\n }\r\n if (!$type.isNumber(dy)) {\r\n dy = 0;\r\n }\r\n var point = { x: axisRadius * $math.cos(angle), y: axisRadiusY * $math.sin(angle) };\r\n if (this.invalid) {\r\n this.validate(); //@todo\" check if we need this\r\n }\r\n var isNegative = false;\r\n var realRadius = this.radius;\r\n if (realRadius instanceof Percent && realRadius.value < 0) {\r\n isNegative = true;\r\n }\r\n else if (realRadius < 0) {\r\n isNegative = true;\r\n }\r\n var relativeRotation = this.relativeRotation;\r\n var labelRadius = this.pixelRadius(axisRadius);\r\n if (this.bent) {\r\n var point_1 = { x: (axisRadius + labelRadius) * $math.cos(angle + 180), y: (axisRadiusY + labelRadius * axisRadiusY / axisRadius) * $math.sin(angle + 180) };\r\n this.path = $path.moveTo(point_1) + $path.arcTo(angle + 180, 360, axisRadius + labelRadius, axisRadiusY + labelRadius * axisRadiusY / axisRadius);\r\n if (this.textPathElement) {\r\n this.textPathElement.attr({ \"startOffset\": (this.locationOnPath * 100) + \"%\" });\r\n }\r\n return;\r\n }\r\n // WHEN ROTATED\r\n if ($type.isNumber(relativeRotation)) {\r\n this.horizontalCenter = \"none\";\r\n this.verticalCenter = \"none\";\r\n angle = $math.fitAngleToRange(angle, -180, 180);\r\n var pixelWidth = this.bbox.width;\r\n var pixelHeight = this.bbox.height;\r\n var pixelPaddingBottom = this.pixelPaddingBottom;\r\n var pixelPaddingTop = this.pixelPaddingTop;\r\n var pixelPaddingLeft = this.pixelPaddingLeft;\r\n var pixelPaddingRight = this.pixelPaddingRight;\r\n if (angle > 90 || angle < -90) {\r\n if (relativeRotation == -90) {\r\n relativeRotation = 90;\r\n pixelWidth = 0;\r\n }\r\n }\r\n else {\r\n if (relativeRotation == -90) {\r\n pixelHeight = -pixelHeight;\r\n }\r\n if (relativeRotation == 90) {\r\n relativeRotation = -90;\r\n pixelWidth = -pixelPaddingLeft - pixelPaddingRight;\r\n pixelHeight = -pixelHeight - pixelPaddingTop - pixelPaddingBottom;\r\n }\r\n }\r\n this.rotation = relativeRotation + angle + 90;\r\n var dH = $math.sin(relativeRotation) / 2;\r\n var dW = $math.cos(relativeRotation) / 2;\r\n var rotation = this.rotation;\r\n this.dx = pixelHeight * dH * $math.sin(rotation) - pixelWidth * dW * $math.cos(rotation);\r\n this.dy = -pixelHeight * dH * $math.cos(rotation) - pixelWidth * dW * $math.sin(rotation);\r\n if (!this.inside) {\r\n labelRadius += (pixelHeight + pixelPaddingBottom + pixelPaddingTop) * $math.cos(relativeRotation) + (pixelWidth + pixelPaddingLeft + pixelPaddingRight) * $math.sin(relativeRotation);\r\n }\r\n else {\r\n if (angle > 90 || angle < -90) {\r\n labelRadius -= (pixelPaddingBottom + pixelPaddingTop) * $math.cos(relativeRotation) + (pixelPaddingLeft + pixelPaddingRight) * $math.sin(relativeRotation);\r\n }\r\n else {\r\n labelRadius += (pixelPaddingBottom + this.bbox.height + pixelPaddingTop) * $math.cos(relativeRotation) + (pixelPaddingLeft + pixelPaddingRight + this.bbox.width) * $math.sin(relativeRotation);\r\n }\r\n }\r\n point.x += $math.cos(angle) * labelRadius;\r\n point.y += $math.sin(angle) * labelRadius * axisRadiusY / axisRadius;\r\n }\r\n else {\r\n // END OF ROTATED\r\n this.horizontalCenter = \"middle\";\r\n this.verticalCenter = \"middle\";\r\n if (isNegative) {\r\n this.dx = 0;\r\n this.dy = 0;\r\n point.x = (axisRadius + labelRadius) * $math.cos(angle);\r\n point.y = (axisRadiusY + labelRadius * axisRadiusY / axisRadius) * $math.sin(angle);\r\n }\r\n else {\r\n // we don't use valign for labels because then they would jump while animating. instead we modify dy depending on a y position\r\n // this math makes dy to be 1 at the top of the circle, 0.5 at the middle and 1 at the bottom\r\n // @todo with this math doesn't work well with inside = true\r\n this.dy = this._measuredHeight / 2 * $math.sin(angle); //(1 - (point.y + axisRadiusY) / (2 * axisRadiusY));\r\n // simmilar with dx\r\n this.dx = this._measuredWidth / 2 * $math.cos(angle); //(1 - (point.x + axisRadius) / (2 * axisRadius));\r\n point.x += $math.cos(angle) * labelRadius;\r\n point.y += $math.sin(angle) * labelRadius * axisRadiusY / axisRadius;\r\n }\r\n }\r\n point.x += dx;\r\n point.y += dy;\r\n this.fdx = this.dx;\r\n this.fdy = this.dy;\r\n this.moveTo(point);\r\n };\r\n return AxisLabelCircular;\r\n}(AxisLabel));\r\nexport { AxisLabelCircular };\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[\"AxisLabelCircular\"] = AxisLabelCircular;\r\n//# sourceMappingURL=AxisLabelCircular.js.map","/**\r\n * Module, defining Axis Renderer for circular axes.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisRenderer } from \"./AxisRenderer\";\r\nimport { AxisFillCircular } from \"./AxisFillCircular\";\r\nimport { GridCircular } from \"./GridCircular\";\r\nimport { AxisLabelCircular } from \"./AxisLabelCircular\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { percent, Percent } from \"../../core/utils/Percent\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { AxisBullet } from \"./AxisBullet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A renderer for circular axis.\r\n */\r\nvar AxisRendererCircular = /** @class */ (function (_super) {\r\n __extends(AxisRendererCircular, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\r\n function AxisRendererCircular() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * @ignore\r\n */\r\n _this.pixelRadiusReal = 0;\r\n // axis.layout = \"none\"; // does not trigger redraw when size changes\r\n _this.layout = \"none\";\r\n _this.className = \"AxisRendererCircular\";\r\n _this.isMeasured = false;\r\n _this.startAngle = -90;\r\n _this.endAngle = 270;\r\n _this.useChartAngles = true;\r\n _this.radius = percent(100);\r\n _this.isMeasured = false;\r\n _this.grid.template.location = 0;\r\n _this.labels.template.location = 0;\r\n _this.labels.template.radius = 15;\r\n _this.ticks.template.location = 0;\r\n _this.ticks.template.pixelPerfect = false;\r\n _this.tooltipLocation = 0;\r\n _this.line.strokeOpacity = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n AxisRendererCircular.prototype.setAxis = function (axis) {\r\n var _this = this;\r\n _super.prototype.setAxis.call(this, axis);\r\n axis.isMeasured = false;\r\n // modify x and y so that tooltip would always be on circle\r\n var tooltip = axis.tooltip;\r\n tooltip.adapter.add(\"dx\", function (x, target) {\r\n var point = $utils.svgPointToSprite({ x: target.pixelX, y: target.pixelY }, _this);\r\n return _this.pixelRadius * Math.cos(Math.atan2(point.y, point.x)) - point.x;\r\n });\r\n tooltip.adapter.add(\"dy\", function (y, target) {\r\n var point = $utils.svgPointToSprite({ x: target.pixelX, y: target.pixelY }, _this);\r\n return _this.pixelRadius * Math.sin(Math.atan2(point.y, point.x)) - point.y;\r\n });\r\n };\r\n /**\r\n * Validates Axis renderer.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererCircular.prototype.validate = function () {\r\n // so that radius would be updated\r\n if (this.chart && this.chart.invalid) {\r\n this.chart.validate();\r\n }\r\n _super.prototype.validate.call(this);\r\n };\r\n Object.defineProperty(AxisRendererCircular.prototype, \"axisLength\", {\r\n /**\r\n * Returns actual length of the Axis, in pixels.\r\n *\r\n * @return Length (px)\r\n */\r\n get: function () {\r\n return 2 * Math.PI * this.pixelRadius;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererCircular.prototype, \"radius\", {\r\n /**\r\n * @return Outer radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Outer radius of the axis.\r\n *\r\n * Can be absolute (px) or relative ([[Percent]]).\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n if (this.setPercentProperty(\"radius\", value, false, false, 10, false)) {\r\n if (this.axis) {\r\n this.axis.invalidate();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererCircular.prototype, \"pixelRadius\", {\r\n /**\r\n * Outer radius in pixels.\r\n *\r\n * @return Outer radius (px)\r\n */\r\n get: function () {\r\n return $utils.relativeRadiusToValue(this.radius, this.pixelRadiusReal) || 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererCircular.prototype, \"innerRadius\", {\r\n /**\r\n * @return Inner radius\r\n */\r\n get: function () {\r\n var chart = this.chart;\r\n var innerRadius = this.getPropertyValue(\"innerRadius\");\r\n if (chart) {\r\n if (!$type.hasValue(innerRadius)) {\r\n innerRadius = chart.innerRadius;\r\n if (innerRadius instanceof Percent && chart) {\r\n innerRadius = percent(innerRadius.value * chart.innerRadiusModifyer * 100);\r\n }\r\n }\r\n else {\r\n if (innerRadius instanceof Percent && chart) {\r\n var mr = chart.mr;\r\n var value = innerRadius.value;\r\n value = Math.max(mr * value, mr - Math.min(chart.plotContainer.innerHeight, chart.plotContainer.innerWidth)) / mr;\r\n innerRadius = percent(value * 100);\r\n }\r\n }\r\n return innerRadius;\r\n }\r\n },\r\n /**\r\n * Inner radius of the axis.\r\n *\r\n * Can be absolute (px) or relative ([[Percent]]).\r\n *\r\n * @param value Inner radius\r\n */\r\n set: function (value) {\r\n if (this.setPercentProperty(\"innerRadius\", value, false, false, 10, false)) {\r\n if (this.axis) {\r\n this.axis.invalidate();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererCircular.prototype, \"useChartAngles\", {\r\n /**\r\n * @return Use chart angles\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"useChartAngles\");\r\n },\r\n /**\r\n * Specifies if axis should use its own `startAngle` and `endAngle` or\r\n * inherit them from relative properties from chart.\r\n *\r\n * @default false\r\n * @param value Use chart's angles\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"useChartAngles\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererCircular.prototype, \"pixelInnerRadius\", {\r\n /**\r\n * Inner radius in pixels.\r\n *\r\n * @return Inner radius (px)\r\n */\r\n get: function () {\r\n return $utils.relativeRadiusToValue(this.innerRadius, this.pixelRadiusReal) || 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts relative position on axis to point coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @param position2 Position (0-1) Position on the second axis\r\n * @return Point\r\n */\r\n AxisRendererCircular.prototype.positionToPoint = function (position, position2) {\r\n if (!$type.isNumber(position2)) {\r\n position2 = 1;\r\n }\r\n var coordinate = this.positionToCoordinate(position);\r\n var angle = this.startAngle + (this.endAngle - this.startAngle) * coordinate / this.axisLength;\r\n var radius = this.pixelRadius;\r\n var innerRadius = this.pixelInnerRadius;\r\n if (this.axisRendererY) {\r\n var realRadius = $math.fitToRange(this.axisRendererY.positionToCoordinate(position2), 0, Infinity);\r\n var point = { x: realRadius * $math.cos(angle), y: realRadius * $math.sin(angle) };\r\n return point;\r\n }\r\n return { x: $math.cos(angle) * innerRadius + (radius - innerRadius) * $math.cos(angle) * position2, y: $math.sin(angle) * innerRadius + (radius - innerRadius) * $math.sin(angle) * position2 };\r\n };\r\n /**\r\n * Converts relative position (0-1) on axis to angle in degrees (0-360).\r\n *\r\n * @param position Position (0-1)\r\n * @return Angle (0-360)\r\n */\r\n AxisRendererCircular.prototype.positionToAngle = function (position) {\r\n var axis = this.axis;\r\n var arc = (this.endAngle - this.startAngle) / (axis.end - axis.start);\r\n var angle;\r\n if (axis.renderer.inversed) {\r\n angle = this.startAngle + (axis.end - position) * arc;\r\n }\r\n else {\r\n angle = this.startAngle + (position - axis.start) * arc;\r\n }\r\n return $math.round(angle, 3);\r\n };\r\n /**\r\n * Converts angle on axis to relative position(0-1).\r\n *\r\n * @param angle Angle in degrees\r\n * @return Position (0-1)\r\n */\r\n AxisRendererCircular.prototype.angleToPosition = function (angle) {\r\n var axis = this.axis;\r\n var arc = (this.endAngle - this.startAngle) / (axis.end - axis.start);\r\n var position;\r\n if (axis.renderer.inversed) {\r\n position = axis.end - (angle - this.startAngle) / arc;\r\n }\r\n else {\r\n position = (angle - this.startAngle) / arc + axis.start;\r\n }\r\n return $math.round(position, 5);\r\n };\r\n /**\r\n * Updates and positions the axis line element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererCircular.prototype.updateAxisLine = function () {\r\n var radius = this.pixelRadius;\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n var arc = endAngle - startAngle;\r\n this.line.path = $path.moveTo({ x: radius * $math.cos(startAngle), y: radius * $math.sin(startAngle) }) + $path.arcTo(startAngle, arc, radius, radius);\r\n };\r\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererCircular.prototype.updateGridElement = function (grid, position, endPosition) {\r\n position = position + (endPosition - position) * grid.location;\r\n var point = this.positionToPoint(position);\r\n if ($type.isNumber(point.x) && $type.isNumber(point.y) && grid.element) {\r\n var angle = $math.DEGREES * Math.atan2(point.y, point.x);\r\n var radius = $utils.relativeRadiusToValue($type.hasValue(grid.radius) ? grid.radius : percent(100), this.pixelRadius);\r\n var gridInnerRadius = $utils.relativeRadiusToValue(grid.innerRadius, this.pixelRadius);\r\n grid.zIndex = 0;\r\n var innerRadius = $utils.relativeRadiusToValue($type.isNumber(gridInnerRadius) ? gridInnerRadius : this.innerRadius, this.pixelRadiusReal, true);\r\n grid.path = $path.moveTo({ x: innerRadius * $math.cos(angle), y: innerRadius * $math.sin(angle) }) + $path.lineTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) });\r\n }\r\n this.toggleVisibility(grid, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions a tick element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param tick Tick element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererCircular.prototype.updateTickElement = function (tick, position, endPosition) {\r\n position = position + (endPosition - position) * tick.location;\r\n var point = this.positionToPoint(position);\r\n if (tick.element) {\r\n var radius = this.pixelRadius;\r\n var angle = $math.DEGREES * Math.atan2(point.y, point.x);\r\n var tickLength = tick.length;\r\n if (tick.inside) {\r\n tickLength = -tickLength;\r\n }\r\n tick.zIndex = 1;\r\n tick.path = $path.moveTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) }) + $path.lineTo({ x: (radius + tickLength) * $math.cos(angle), y: (radius + tickLength) * $math.sin(angle) });\r\n }\r\n this.toggleVisibility(tick, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions axis bullet.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet AxisBullet element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererCircular.prototype.updateBullet = function (bullet, position, endPosition) {\r\n var location = 0.5;\r\n if (bullet instanceof AxisBullet) {\r\n location = bullet.location;\r\n }\r\n position = position + (endPosition - position) * location;\r\n var point = this.positionToPoint(position);\r\n var radius = this.pixelRadius;\r\n var angle = $math.DEGREES * Math.atan2(point.y, point.x);\r\n point = { x: radius * $math.cos(angle), y: radius * $math.sin(angle) };\r\n this.positionItem(bullet, point);\r\n this.toggleVisibility(bullet, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions a label element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param label Label element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\r\n AxisRendererCircular.prototype.updateLabelElement = function (label, position, endPosition, location) {\r\n if (!$type.hasValue(location)) {\r\n location = label.location;\r\n }\r\n position = position + (endPosition - position) * location;\r\n label.fixPosition(this.positionToAngle(position), this.pixelRadius);\r\n label.zIndex = 2;\r\n this.toggleVisibility(label, position, this.minLabelPosition, this.maxLabelPosition);\r\n };\r\n /**\r\n * Checks if point is within bounds of a container.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point Point coordinates\r\n * @return Fits?\r\n */\r\n AxisRendererCircular.prototype.fitsToBounds = function (point) {\r\n return true;\r\n };\r\n Object.defineProperty(AxisRendererCircular.prototype, \"startAngle\", {\r\n /**\r\n * @return Start angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startAngle\");\r\n },\r\n /**\r\n * Start angle of the axis in degrees (0-360).\r\n *\r\n * @param value Start angle\r\n */\r\n set: function (value) {\r\n // do not normalize angel here!\r\n if (this.setPropertyValue(\"startAngle\", value)) {\r\n this.invalidateAxisItems();\r\n if (this.axis) {\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererCircular.prototype, \"endAngle\", {\r\n /**\r\n * @return End angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endAngle\");\r\n },\r\n /**\r\n * End angle of the axis in degrees (0-360).\r\n *\r\n * @param value End angle\r\n */\r\n set: function (value) {\r\n // do not normalize angel here!\r\n if (this.setPropertyValue(\"endAngle\", value)) {\r\n this.invalidateAxisItems();\r\n if (this.axis) {\r\n this.axis.invalidateSeries();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition Starting position\r\n * @param endPosition End position\r\n * @return SVG path\r\n */\r\n AxisRendererCircular.prototype.getPositionRangePath = function (startPosition, endPosition, radius, innerRadius, cornerRadius) {\r\n var path = \"\";\r\n if ($type.isNumber(startPosition) && $type.isNumber(endPosition)) {\r\n if (!$type.hasValue(radius)) {\r\n radius = this.radius;\r\n }\r\n startPosition = $math.max(startPosition, this.axis.start);\r\n endPosition = $math.min(endPosition, this.axis.end);\r\n if (endPosition < startPosition) {\r\n endPosition = startPosition;\r\n }\r\n var pixelRadius = $utils.relativeRadiusToValue(radius, this.pixelRadius);\r\n var pixelInnerRadius = $utils.relativeRadiusToValue(innerRadius, this.pixelRadius, true);\r\n var startAngle = this.positionToAngle(startPosition);\r\n var endAngle = this.positionToAngle(endPosition);\r\n var arc = endAngle - startAngle;\r\n path = $path.arc(startAngle, arc, pixelRadius, pixelInnerRadius, pixelRadius, cornerRadius);\r\n }\r\n return path;\r\n };\r\n /**\r\n * Returns a new grid element, suitable for this Axis Renderer type.\r\n *\r\n * @return Grid element\r\n */\r\n AxisRendererCircular.prototype.createGrid = function () {\r\n return new GridCircular();\r\n };\r\n /**\r\n * Returns a new fill element, suitable for this Axis Renderer type.\r\n *\r\n * @return Fill element\r\n */\r\n AxisRendererCircular.prototype.createFill = function (axis) {\r\n return new AxisFillCircular(axis);\r\n };\r\n /**\r\n * Returns a new label element, suitable for this Axis Renderer type.\r\n *\r\n * @return Label element\r\n */\r\n AxisRendererCircular.prototype.createLabel = function () {\r\n return new AxisLabelCircular();\r\n };\r\n /**\r\n * Converts a point at specific coordinates to a relative position (0-1)\r\n * on the axis.\r\n *\r\n * @param point Point\r\n * @return Position (0-1)\r\n */\r\n AxisRendererCircular.prototype.pointToPosition = function (point) {\r\n var angle = $math.fitAngleToRange($math.getAngle(point), this.startAngle, this.endAngle);\r\n return this.coordinateToPosition((angle - this.startAngle) / 360 * this.axisLength);\r\n };\r\n return AxisRendererCircular;\r\n}(AxisRenderer));\r\nexport { AxisRendererCircular };\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[\"AxisRendererCircular\"] = AxisRendererCircular;\r\n//# sourceMappingURL=AxisRendererCircular.js.map","/**\r\n * Module, defining Axis Renderer for radial axes.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisRendererY } from \"./AxisRendererY\";\r\nimport { CategoryAxis } from \"./CategoryAxis\";\r\nimport { WavedCircle } from \"../../core/elements/WavedCircle\";\r\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\r\nimport { Percent, percent } from \"../../core/utils/Percent\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { AxisBullet } from \"./AxisBullet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A renderer for radial axis.\r\n */\r\nvar AxisRendererRadial = /** @class */ (function (_super) {\r\n __extends(AxisRendererRadial, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\r\n function AxisRendererRadial() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * A related chart.\r\n */\r\n _this._chart = new MutableValueDisposer();\r\n /**\r\n * @ignore\r\n */\r\n _this.pixelRadiusReal = 0;\r\n _this.className = \"AxisRendererRadial\";\r\n _this.isMeasured = false;\r\n _this.startAngle = -90;\r\n _this.endAngle = 270;\r\n _this.minGridDistance = 30;\r\n _this.gridType = \"circles\";\r\n _this.axisAngle = -90;\r\n _this.isMeasured = false;\r\n _this.layout = \"none\";\r\n _this.radius = percent(100);\r\n _this.line.strokeOpacity = 0;\r\n _this.labels.template.horizontalCenter = \"middle\";\r\n _this._disposers.push(_this._chart);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Validates Axis renderer.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererRadial.prototype.validate = function () {\r\n // so that radius would be updated\r\n if (this.chart && this.chart.invalid) {\r\n this.chart.validate();\r\n }\r\n _super.prototype.validate.call(this);\r\n };\r\n Object.defineProperty(AxisRendererRadial.prototype, \"axisLength\", {\r\n /**\r\n * Returns actual length of the Axis, in pixels.\r\n *\r\n * @return Length (px)\r\n */\r\n get: function () {\r\n return this.pixelRadius - this.pixelInnerRadius;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererRadial.prototype, \"radius\", {\r\n /**\r\n * @return Outer radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Outer radius of the axis.\r\n *\r\n * Can be absolute (px) or relative ([[Percent]]).\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, false, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererRadial.prototype, \"pixelRadius\", {\r\n /**\r\n * Outer radius in pixels.\r\n *\r\n * @return Outer radius (px)\r\n */\r\n get: function () {\r\n return $utils.relativeRadiusToValue(this.radius, this.pixelRadiusReal) || 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererRadial.prototype, \"innerRadius\", {\r\n /**\r\n * @return Inner radius\r\n */\r\n get: function () {\r\n var chart = this.chart;\r\n var innerRadius = this.getPropertyValue(\"innerRadius\");\r\n if (chart) {\r\n if (!$type.hasValue(innerRadius)) {\r\n innerRadius = chart.innerRadius;\r\n if (innerRadius instanceof Percent && chart) {\r\n innerRadius = percent(innerRadius.value * chart.innerRadiusModifyer * 100);\r\n }\r\n }\r\n else {\r\n if (innerRadius instanceof Percent && chart) {\r\n var mr = chart.mr;\r\n var value = innerRadius.value;\r\n value = Math.max(mr * value, mr - Math.min(chart.plotContainer.innerHeight, chart.plotContainer.innerWidth)) / mr;\r\n innerRadius = percent(value * 100);\r\n }\r\n }\r\n }\r\n return innerRadius;\r\n },\r\n /**\r\n * Inner radius of the axis.\r\n *\r\n * Can be absolute (px) or relative ([[Percent]]).\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, false, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererRadial.prototype, \"pixelInnerRadius\", {\r\n /**\r\n * Inner radius in pixels.\r\n *\r\n * @return Inner radius (px)\r\n */\r\n get: function () {\r\n return $utils.relativeRadiusToValue(this.innerRadius, this.pixelRadiusReal) || 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts relative position on axis to point coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @param position2 Position (0-1) Position on the second axis\r\n * @return Point\r\n */\r\n AxisRendererRadial.prototype.positionToPoint = function (position, position2) {\r\n var radius = $math.fitToRange(this.positionToCoordinate(position), 0, Infinity);\r\n return { x: radius * $math.cos(this.axisAngle), y: radius * $math.sin(this.axisAngle) };\r\n };\r\n /**\r\n * Updates and positions the axis line element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererRadial.prototype.updateAxisLine = function () {\r\n this.line.path = $path.moveTo({ x: this.pixelInnerRadius * $math.cos(this.axisAngle), y: this.pixelInnerRadius * $math.sin(this.axisAngle) }) + $path.lineTo({ x: this.pixelRadius * $math.cos(this.axisAngle), y: this.pixelRadius * $math.sin(this.axisAngle) });\r\n var title = this.axis.title;\r\n title.valign = \"none\";\r\n title.horizontalCenter = \"middle\";\r\n title.verticalCenter = \"bottom\";\r\n title.y = -this.axisLength / 2;\r\n var rotation = 90;\r\n if (this.opposite) {\r\n if (!this.inside) {\r\n rotation = -90;\r\n }\r\n }\r\n else {\r\n if (this.inside) {\r\n rotation = -90;\r\n }\r\n }\r\n title.rotation = rotation;\r\n };\r\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererRadial.prototype.updateGridElement = function (grid, position, endPosition) {\r\n position = position + (endPosition - position) * grid.location;\r\n var point = this.positionToPoint(position);\r\n var path;\r\n var radius = $math.getDistance(point);\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n if ($type.isNumber(radius) && grid.element) {\r\n var chart = this.chart;\r\n var xAxis = chart.xAxes.getIndex(0);\r\n var count = 0;\r\n var series = chart.series.getIndex(0);\r\n if (series) {\r\n count = series.dataItems.length;\r\n }\r\n // polygons are only possible if x axis is present\r\n // @todo: review this\r\n if (this.gridType == \"polygons\" && count > 0 && series && xAxis && xAxis instanceof CategoryAxis) {\r\n var gridLocation = xAxis.renderer.grid.template.location;\r\n var angle = xAxis.getAngle(series.dataItems.getIndex(0), \"categoryX\", gridLocation);\r\n path = $path.moveTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) });\r\n for (var i = 1; i < count; i++) {\r\n angle = xAxis.getAngle(series.dataItems.getIndex(i), \"categoryX\", gridLocation);\r\n path += $path.lineTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) });\r\n }\r\n angle = xAxis.getAngle(series.dataItems.getIndex(count - 1), \"categoryX\", xAxis.renderer.cellEndLocation);\r\n path += $path.lineTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) });\r\n }\r\n else {\r\n path = $path.moveTo({ x: radius * $math.cos(startAngle), y: radius * $math.sin(startAngle) }) + $path.arcTo(startAngle, endAngle - startAngle, radius, radius);\r\n }\r\n grid.path = path;\r\n }\r\n this.toggleVisibility(grid, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions a label element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param label Label element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\r\n AxisRendererRadial.prototype.updateLabelElement = function (label, position, endPosition, location) {\r\n if (!$type.hasValue(location)) {\r\n location = label.location;\r\n }\r\n position = position + (endPosition - position) * location;\r\n var point = this.positionToPoint(position);\r\n this.positionItem(label, point);\r\n this.toggleVisibility(label, position, this.minLabelPosition, this.maxLabelPosition);\r\n };\r\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererRadial.prototype.updateBaseGridElement = function () {\r\n // @todo? zero grid for radar chart, is it needed?\r\n };\r\n /**\r\n * Checks if point is within bounds of a container.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point Point coordinates\r\n * @return Fits?\r\n */\r\n AxisRendererRadial.prototype.fitsToBounds = function (point) {\r\n return true;\r\n };\r\n Object.defineProperty(AxisRendererRadial.prototype, \"startAngle\", {\r\n /**\r\n * @return Start angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startAngle\");\r\n },\r\n /**\r\n * Start angle of the axis in degrees. (0-360)\r\n *\r\n * @param value Start angle\r\n */\r\n set: function (value) {\r\n // do not normalize angle here!\r\n if (this.setPropertyValue(\"startAngle\", value)) {\r\n this.invalidateAxisItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererRadial.prototype, \"endAngle\", {\r\n /**\r\n * @return End angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endAngle\");\r\n },\r\n /**\r\n * End angle of the axis in degrees. (0-360)\r\n *\r\n * @param value End angle\r\n */\r\n set: function (value) {\r\n // do not normalize angel here!\r\n if (this.setPropertyValue(\"endAngle\", value)) {\r\n this.invalidateAxisItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererRadial.prototype, \"axisAngle\", {\r\n /**\r\n * @return Axis angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"axisAngle\");\r\n //return $math.fitToRange(this.getPropertyValue(\"axisAngle\"), this.startAngle, this.endAngle); // no good, as less flexible\r\n },\r\n /**\r\n * Angle of the radial axis in degrees. (0-360)\r\n *\r\n * @param value Axis angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"axisAngle\", $math.normalizeAngle(value));\r\n this.invalidateAxisItems();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxisRendererRadial.prototype, \"gridType\", {\r\n /**\r\n * Grid type\r\n */\r\n get: function () {\r\n var axis = this.chart.xAxes.getIndex(0);\r\n if (axis instanceof CategoryAxis) {\r\n return this.getPropertyValue(\"gridType\");\r\n }\r\n else {\r\n return \"circles\";\r\n }\r\n },\r\n // polygons grid type is only possible under these conditions: xAxis is available and it is CategoryAxis, also at least one series should be added to a chart\r\n /**\r\n * Grid type for radial axis.\r\n *\r\n * A grid on radia axis can either be perfect circles (\"circles\"), or\r\n * straight lines (\"polygons\").\r\n *\r\n * @default \"circles\"\r\n * @param value Grid type\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"gridType\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition Starting position\r\n * @param endPosition End position\r\n * @return SVG path\r\n */\r\n AxisRendererRadial.prototype.getPositionRangePath = function (startPosition, endPosition) {\r\n var pixelInnerRadius = this.pixelInnerRadius;\r\n var pixelRadius = this.axisLength + pixelInnerRadius;\r\n var innerRadius = $math.fitToRange(this.positionToCoordinate(startPosition), pixelInnerRadius, pixelRadius);\r\n var radius = $math.fitToRange(this.positionToCoordinate(endPosition), pixelInnerRadius, pixelRadius);\r\n //let angleCount: number = this.angleCount;\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n var arc = endAngle - startAngle;\r\n var path;\r\n var chart = this.chart;\r\n var xAxis = chart.xAxes.getIndex(0);\r\n var series = chart.series.getIndex(0);\r\n var count = 0;\r\n if (series) {\r\n count = series.dataItems.length;\r\n }\r\n // polygons are only possible if x axis is present\r\n // @todo: review this\r\n if (this.gridType == \"polygons\" && count > 0 && series && xAxis && xAxis instanceof CategoryAxis) {\r\n var gridLocation = xAxis.renderer.grid.template.location;\r\n var angle = xAxis.getAngle(series.dataItems.getIndex(0), \"categoryX\", gridLocation);\r\n path = $path.moveTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) });\r\n for (var i = 1; i < count; i++) {\r\n angle = xAxis.getAngle(series.dataItems.getIndex(i), \"categoryX\", gridLocation);\r\n path += $path.lineTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) });\r\n }\r\n angle = xAxis.getAngle(series.dataItems.getIndex(count - 1), \"categoryX\", xAxis.renderer.cellEndLocation);\r\n path += $path.lineTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) });\r\n path += $path.moveTo({ x: innerRadius * $math.cos(angle), y: innerRadius * $math.sin(angle) });\r\n for (var i = count - 1; i >= 0; i--) {\r\n angle = xAxis.getAngle(series.dataItems.getIndex(i), \"categoryX\", gridLocation);\r\n path += $path.lineTo({ x: innerRadius * $math.cos(angle), y: innerRadius * $math.sin(angle) });\r\n }\r\n }\r\n else {\r\n path = $path.arc(startAngle, arc, radius, innerRadius);\r\n }\r\n return path;\r\n };\r\n /**\r\n * Updates and positions an axis break element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Break element\r\n */\r\n AxisRendererRadial.prototype.updateBreakElement = function (axisBreak) {\r\n // @todo: someday we might need axis break when gridType is polygons\r\n var startLine = axisBreak.startLine;\r\n var endLine = axisBreak.endLine;\r\n var fillShape = axisBreak.fillShape;\r\n var startPoint = axisBreak.startPoint;\r\n var endPoint = axisBreak.endPoint;\r\n startLine.radius = Math.abs(startPoint.y);\r\n endLine.radius = Math.abs(endPoint.y);\r\n fillShape.radius = Math.abs(endPoint.y);\r\n fillShape.innerRadius = Math.abs(startPoint.y);\r\n };\r\n /**\r\n * Creates visual elements for and axis break.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Axis break\r\n */\r\n AxisRendererRadial.prototype.createBreakSprites = function (axisBreak) {\r\n axisBreak.startLine = new WavedCircle();\r\n axisBreak.endLine = new WavedCircle();\r\n axisBreak.fillShape = new WavedCircle();\r\n };\r\n /**\r\n * Updates some of the Axis tooltip's visual properties, related to\r\n * rendering of the Axis.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererRadial.prototype.updateTooltip = function () {\r\n var axis = this.axis;\r\n if (axis) {\r\n var bigNum = 4000;\r\n var bbx = -4000;\r\n var bby = -4000;\r\n var bbw = bigNum * 2;\r\n var bbh = bigNum * 2;\r\n var axisAngle = this.axisAngle;\r\n if (axisAngle < 0) {\r\n axisAngle += 360;\r\n }\r\n var tooltipOrientation = \"vertical\";\r\n if ((axisAngle > 45 && axisAngle < 135) || (axisAngle > 225 && axisAngle < 315)) {\r\n tooltipOrientation = \"horizontal\";\r\n }\r\n this.axis.updateTooltip(tooltipOrientation, { x: bbx, y: bby, width: bbw, height: bbh });\r\n }\r\n };\r\n /**\r\n * Updates and positions a tick element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param tick Tick element\r\n * @param position Position\r\n */\r\n AxisRendererRadial.prototype.updateTickElement = function (tick, position, endPosition) {\r\n position = position + (endPosition - position) * tick.location;\r\n var point = this.positionToPoint(position);\r\n if (tick.element) {\r\n var angle = $math.normalizeAngle(this.axisAngle + 90);\r\n if (angle / 90 != Math.round(angle / 90)) {\r\n tick.pixelPerfect = false;\r\n }\r\n else {\r\n tick.pixelPerfect = true;\r\n }\r\n var tickLength = -tick.length;\r\n if (tick.inside) {\r\n tickLength *= -1;\r\n }\r\n tick.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: tickLength * $math.cos(angle), y: tickLength * $math.sin(angle) });\r\n }\r\n this.positionItem(tick, point);\r\n this.toggleVisibility(tick, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions axis bullet.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet AxisBullet element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererRadial.prototype.updateBullet = function (bullet, position, endPosition) {\r\n var location = 0.5;\r\n if (bullet instanceof AxisBullet) {\r\n location = bullet.location;\r\n }\r\n position = position + (endPosition - position) * location;\r\n var point = this.positionToPoint(position);\r\n this.positionItem(bullet, point);\r\n this.toggleVisibility(bullet, position, 0, 1);\r\n };\r\n /**\r\n * Converts a position on the axis to a coordinate in pixels.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position (0-1)\r\n * @return Coordinate (px)\r\n */\r\n AxisRendererRadial.prototype.positionToCoordinate = function (position) {\r\n var coordinate;\r\n var axis = this.axis;\r\n var axisFullLength = axis.axisFullLength;\r\n var innerRadius = this.pixelInnerRadius;\r\n if (axis.renderer.inversed) {\r\n coordinate = (axis.end - position) * axisFullLength + innerRadius;\r\n }\r\n else {\r\n coordinate = (position - axis.start) * axisFullLength + innerRadius;\r\n }\r\n return $math.round(coordinate, 1);\r\n };\r\n /**\r\n * Converts a point at specific coordinates to a relative position (0-1)\r\n * on the axis.\r\n *\r\n * @param point Point\r\n * @return Position (0-1)\r\n */\r\n AxisRendererRadial.prototype.pointToPosition = function (point) {\r\n var coordinate = ($math.getDistance(point) - this.pixelInnerRadius);\r\n return this.coordinateToPosition(coordinate);\r\n };\r\n Object.defineProperty(AxisRendererRadial.prototype, \"chart\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Chart\r\n */\r\n get: function () {\r\n return this._chart.get();\r\n },\r\n /**\r\n * A chart, associated with the Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Chart\r\n */\r\n set: function (value) {\r\n this._chart.set(value, null);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return AxisRendererRadial;\r\n}(AxisRendererY));\r\nexport { AxisRendererRadial };\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[\"AxisRendererRadial\"] = AxisRendererRadial;\r\n//# sourceMappingURL=AxisRendererRadial.js.map","/**\r\n * Radar chart module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { XYChart, XYChartDataItem } from \"./XYChart\";\r\nimport { percent, Percent } from \"../../core/utils/Percent\";\r\nimport { RadarSeries } from \"../series/RadarSeries\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { Circle } from \"../../core/elements/Circle\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { AxisRendererCircular } from \"../axes/AxisRendererCircular\";\r\nimport { AxisRendererRadial } from \"../axes/AxisRendererRadial\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[RadarChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar RadarChartDataItem = /** @class */ (function (_super) {\r\n __extends(RadarChartDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RadarChartDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"RadarChartDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return RadarChartDataItem;\r\n}(XYChartDataItem));\r\nexport { RadarChartDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a Radar chart.\r\n *\r\n * @see {@link IRadarChartEvents} for a list of available Events\r\n * @see {@link IRadarChartAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/radar-chart/} for documentation\r\n * @important\r\n */\r\nvar RadarChart = /** @class */ (function (_super) {\r\n __extends(RadarChart, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RadarChart() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Defines X axis renderer type.\r\n */\r\n _this._axisRendererX = AxisRendererCircular;\r\n /**\r\n * Defines Y axis renderer type.\r\n */\r\n _this._axisRendererY = AxisRendererRadial;\r\n /**\r\n * used by cursor. We adjust innerradius if start and end angle are close to each other\r\n * @ignore Exclude from docs\r\n */\r\n _this.innerRadiusModifyer = 1;\r\n /**\r\n * @ignore\r\n */\r\n _this.mr = 1;\r\n _this.className = \"RadarChart\";\r\n _this.startAngle = -90;\r\n _this.endAngle = 270;\r\n _this.radius = percent(80);\r\n _this.innerRadius = 0;\r\n var radarContainer = _this.plotContainer.createChild(Container);\r\n radarContainer.shouldClone = false;\r\n radarContainer.layout = \"absolute\";\r\n radarContainer.align = \"center\";\r\n radarContainer.valign = \"middle\";\r\n _this.seriesContainer.parent = radarContainer;\r\n _this.radarContainer = radarContainer;\r\n _this.bulletsContainer.parent = radarContainer;\r\n _this.axisBulletsContainer = radarContainer;\r\n _this._cursorContainer = radarContainer;\r\n _this.chartContainer.events.on(\"maxsizechanged\", _this.invalidate, _this, false); // need this for the chart to change radius if legend is removed/disabled\r\n _this._bulletMask = radarContainer.createChild(Circle);\r\n _this._bulletMask.shouldClone = false;\r\n _this._bulletMask.element = _this.paper.add(\"path\");\r\n _this._bulletMask.opacity = 0;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n RadarChart.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Radar chart\");\r\n }\r\n };\r\n /**\r\n * Decorates Axis with required properties for this chart.\r\n *\r\n * @param axis Axis\r\n */\r\n RadarChart.prototype.processAxis = function (axis) {\r\n _super.prototype.processAxis.call(this, axis);\r\n var renderer = axis.renderer;\r\n renderer.gridContainer.parent = renderer;\r\n renderer.breakContainer.parent = renderer;\r\n axis.parent = this.radarContainer;\r\n renderer.toBack();\r\n };\r\n /**\r\n * Updates all X axes after range change event.\r\n */\r\n RadarChart.prototype.handleXAxisRangeChange = function () {\r\n _super.prototype.handleXAxisRangeChange.call(this);\r\n $iter.each(this.yAxes.iterator(), function (axis) {\r\n axis.invalidate();\r\n });\r\n };\r\n /**\r\n * Updates all Y axes after range change event.\r\n */\r\n RadarChart.prototype.handleYAxisRangeChange = function () {\r\n _super.prototype.handleYAxisRangeChange.call(this);\r\n $iter.each(this.xAxes.iterator(), function (axis) {\r\n axis.invalidate();\r\n });\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n RadarChart.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Set up cursor\r\n if ($type.hasValue(config.cursor) && !$type.hasValue(config.cursor.type)) {\r\n config.cursor.type = \"RadarCursor\";\r\n }\r\n // Set up series\r\n if ($type.hasValue(config.series) && $type.isArray(config.series)) {\r\n for (var i = 0, len = config.series.length; i < len; i++) {\r\n config.series[i].type = config.series[i].type || \"RadarSeries\";\r\n }\r\n }\r\n // Set up axes\r\n /*if ($type.hasValue(config.xAxes) && $type.isArray(config.xAxes)) {\r\n for (let i = 0, len = config.xAxes.length; i < len; i++) {\r\n config.xAxes[i].type = config.xAxes[i].type || \"AxisRendererCircular\";\r\n }\r\n }\r\n if ($type.hasValue(config.yAxes) && $type.isArray(config.yAxes)) {\r\n for (let i = 0, len = config.yAxes.length; i < len; i++) {\r\n config.yAxes[i].type = config.yAxes[i].type || \"AxisRendererRadial\";\r\n }\r\n }*/\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n /**\r\n * Does calculations before drawing the chart.\r\n */\r\n RadarChart.prototype.beforeDraw = function () {\r\n _super.prototype.beforeDraw.call(this);\r\n var plotContainer = this.plotContainer;\r\n var rect = $math.getArcRect(this.startAngle, this.endAngle, 1);\r\n var innerRect = { x: 0, y: 0, width: 0, height: 0 };\r\n var wr = plotContainer.innerWidth / rect.width;\r\n var hr = plotContainer.innerHeight / rect.height;\r\n var innerRadius = this.innerRadius;\r\n if (innerRadius instanceof Percent) {\r\n var value = innerRadius.value;\r\n var mr = Math.min(wr, hr);\r\n this.mr = mr;\r\n value = Math.max(mr * value, mr - Math.min(plotContainer.innerHeight, plotContainer.innerWidth)) / mr;\r\n innerRect = $math.getArcRect(this.startAngle, this.endAngle, value);\r\n this.innerRadiusModifyer = value / innerRadius.value;\r\n innerRadius = percent(value * 100);\r\n }\r\n // @todo handle this when innerRadius set in pixels (do it for pie also)\r\n rect = $math.getCommonRectangle([rect, innerRect]);\r\n var maxRadius = Math.min(plotContainer.innerWidth / rect.width, plotContainer.innerHeight / rect.height);\r\n var diameter = $utils.relativeRadiusToValue(this.radius, maxRadius) * 2 || 0;\r\n var radius = diameter / 2;\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n this._pixelInnerRadius = $utils.relativeRadiusToValue(innerRadius, radius);\r\n this._bulletMask.path = $path.arc(startAngle, endAngle - startAngle, radius, this._pixelInnerRadius);\r\n $iter.each(this.xAxes.iterator(), function (axis) {\r\n if (axis.renderer.useChartAngles) {\r\n axis.renderer.startAngle = startAngle;\r\n axis.renderer.endAngle = endAngle;\r\n }\r\n axis.width = diameter;\r\n axis.height = diameter;\r\n //axis.renderer.width = diameter;\r\n //axis.renderer.height = diameter;\r\n axis.renderer.pixelRadiusReal = radius;\r\n //axis.renderer.innerRadius = innerRadius;\r\n });\r\n $iter.each(this.yAxes.iterator(), function (axis) {\r\n axis.renderer.startAngle = startAngle;\r\n axis.renderer.endAngle = endAngle;\r\n axis.width = diameter;\r\n axis.height = diameter;\r\n //axis.renderer.width = diameter;\r\n //axis.renderer.height = diameter;\r\n axis.renderer.pixelRadiusReal = radius;\r\n //axis.renderer.innerRadius = innerRadius;\r\n });\r\n var cursor = this.cursor;\r\n if (cursor) {\r\n cursor.width = diameter;\r\n cursor.height = diameter;\r\n cursor.startAngle = startAngle;\r\n cursor.endAngle = endAngle;\r\n }\r\n this.radarContainer.definedBBox = { x: radius * rect.x, y: radius * rect.y, width: radius * rect.width, height: radius * rect.height };\r\n this.radarContainer.validatePosition();\r\n };\r\n /**\r\n * Creates and returns a new Series, suitable for RadarChart.\r\n *\r\n * @return New Series\r\n */\r\n RadarChart.prototype.createSeries = function () {\r\n return new RadarSeries();\r\n };\r\n Object.defineProperty(RadarChart.prototype, \"startAngle\", {\r\n /**\r\n * @return Start angle (degrees)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startAngle\");\r\n },\r\n /**\r\n * Starting angle of the Radar face. (degrees)\r\n *\r\n * Normally, a circular radar face begins (the radial axis is drawn) at the\r\n * top center. (at -90 degrees)\r\n *\r\n * You can use `startAngle` to change this setting.\r\n *\r\n * E.g. setting this to 0 will make the radial axis start horizontally to\r\n * the right, as opposed to vertical.\r\n *\r\n * For a perfect circle the absolute sum of `startAngle` and `endAngle`\r\n * needs to be 360.\r\n *\r\n * However, it's **not** necessary to do so. You can set those to lesser\r\n * numbers, to create semi-circles.\r\n *\r\n * E.g. `startAngle = -90` with `endAngle = 0` will create a radar face that\r\n * looks like a quarter of a circle.\r\n *\r\n * @default -90\r\n * @param value Start angle (degrees)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarChart.prototype, \"endAngle\", {\r\n /**\r\n * @return End angle (degrees)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endAngle\");\r\n },\r\n /**\r\n * Starting angle of the Radar face. (degrees)\r\n *\r\n * Normally, a circular radar face ends (the radial axis is drawn) exactly\r\n * where it has started, forming a full 360 circle. (at 270 degrees)\r\n *\r\n * You can use `endAngle` to end the circle somewhere else.\r\n *\r\n * E.g. setting this to 180 will make the radar face end at horizontal line\r\n * to the left off the center.\r\n *\r\n * For a perfect circle the absolute sum of `startAngle` and `endAngle`\r\n * needs to be 360.\r\n *\r\n * However, it's **not** necessary to do so. You can set those to lesser\r\n * numbers, to create semi-circles.\r\n *\r\n * E.g. `startAngle = -90` with `endAngle = 0` will create a radar face that\r\n * looks like a quarter of a circle.\r\n *\r\n * @default -90\r\n * @param value End angle (degrees)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarChart.prototype, \"radius\", {\r\n /**\r\n * @return Outer radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Outer radius of the Radar face.\r\n *\r\n * This can either be in absolute pixel value, or relative [[Percent]].\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarChart.prototype, \"pixelInnerRadius\", {\r\n /**\r\n * @return Inner radius in pixels\r\n */\r\n get: function () {\r\n return this._pixelInnerRadius;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarChart.prototype, \"innerRadius\", {\r\n /**\r\n * @return Inner radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Inner radius of the radar face.\r\n *\r\n * This can either be in absolute pixel value, or relative [[Percent]].\r\n *\r\n * If set in Percent, it will be relative to `radius`. (outer radius)\r\n *\r\n * @param value Inner radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Triggers (re)rendering of the horizontal (X) axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axis Axis\r\n */\r\n RadarChart.prototype.updateXAxis = function (renderer) {\r\n //do not call super!\r\n if (renderer) {\r\n renderer.processRenderer();\r\n }\r\n };\r\n /**\r\n * Triggers (re)rendering of the vertical (Y) axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axis Axis\r\n */\r\n RadarChart.prototype.updateYAxis = function (renderer) {\r\n // do not call super!\r\n if (renderer) {\r\n renderer.processRenderer();\r\n }\r\n };\r\n return RadarChart;\r\n}(XYChart));\r\nexport { RadarChart };\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[\"RadarChart\"] = RadarChart;\r\n//# sourceMappingURL=RadarChart.js.map","/**\r\n * Functionality for drawing simple ClockHands\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { Circle } from \"../../core/elements/Circle\";\r\nimport { Trapezoid } from \"../../core/elements/Trapezoid\";\r\nimport { MutableValueDisposer, MultiDisposer } from \"../../core/utils/Disposer\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * ClockHand class is capable of drawing a simple pointy shape with optionally\r\n * rounderd corners and an icon.\r\n *\r\n * @see {@link IClockHandEvents} for a list of available events\r\n * @see {@link IClockHandAdapters} for a list of available Adapters\r\n * @todo Improve\r\n * @important\r\n */\r\nvar ClockHand = /** @class */ (function (_super) {\r\n __extends(ClockHand, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ClockHand() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * An Axis hand is related to.\r\n */\r\n _this._axis = new MutableValueDisposer();\r\n _this.className = \"ClockHand\";\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.fill = interfaceColors.getFor(\"alternativeBackground\");\r\n _this.stroke = _this.fill;\r\n var pin = new Circle();\r\n pin.radius = 5;\r\n _this.pin = pin;\r\n _this.isMeasured = false;\r\n _this.startWidth = 5;\r\n _this.endWidth = 1;\r\n _this.width = percent(100);\r\n _this.height = percent(100);\r\n _this.radius = percent(100);\r\n _this.innerRadius = percent(0);\r\n var hand = new Trapezoid();\r\n _this.hand = hand;\r\n _this._disposers.push(_this._axis);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Re(validates) the clock hand, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ClockHand.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n var hand = this.hand;\r\n hand.width = this.pixelWidth;\r\n var h = Math.max(this.startWidth, this.endWidth);\r\n hand.height = h;\r\n hand.leftSide = percent(this.startWidth / h * 100);\r\n hand.rightSide = percent(this.endWidth / h * 100);\r\n if (this.axis) {\r\n var renderer = this.axis.renderer;\r\n var x0 = $utils.relativeRadiusToValue(this.innerRadius, renderer.pixelRadius);\r\n var x1 = $utils.relativeRadiusToValue(this.radius, renderer.pixelRadius);\r\n hand.x = x0;\r\n hand.y = -h / 2;\r\n hand.width = x1 - x0;\r\n }\r\n };\r\n Object.defineProperty(ClockHand.prototype, \"pin\", {\r\n /**\r\n * @return Pin element\r\n */\r\n get: function () {\r\n return this._pin;\r\n },\r\n /**\r\n * A circle element used as hand's base. (pin)\r\n *\r\n * @param pin Pin element\r\n */\r\n set: function (pin) {\r\n if (this._pin) {\r\n this.removeDispose(this._pin);\r\n }\r\n if (pin) {\r\n this._pin = pin;\r\n pin.parent = this;\r\n this._disposers.push(pin);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClockHand.prototype, \"hand\", {\r\n /**\r\n * @return Hand element\r\n */\r\n get: function () {\r\n return this._hand;\r\n },\r\n /**\r\n * A trapezoid shape used for hand itself.\r\n *\r\n * The shape of the trapezoid is controlled by ClockHand's `startWidth` and\r\n * `endWidth` properties.\r\n *\r\n * Set `endWidth` to 1 (px) to make it pointy.\r\n *\r\n * @param hand Hand element\r\n */\r\n set: function (hand) {\r\n if (this._hand) {\r\n this.removeDispose(this._hand);\r\n }\r\n if (hand) {\r\n this._hand = hand;\r\n hand.parent = this;\r\n this._disposers.push(hand);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClockHand.prototype, \"radius\", {\r\n /**\r\n * @return Radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Radius of the hand's outer end. (tip)\r\n *\r\n * Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(0)\r\n * @param value Radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClockHand.prototype, \"innerRadius\", {\r\n /**\r\n * @return Radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Radius of the hand's inner end. (base)\r\n *\r\n * Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(0)\r\n * @param value Radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClockHand.prototype, \"startWidth\", {\r\n /**\r\n * @return Width (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startWidth\");\r\n },\r\n /**\r\n * Width, in pixels, of the clock hand's inner end. (base)\r\n *\r\n * @default 5\r\n * @param value Width (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startWidth\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClockHand.prototype, \"endWidth\", {\r\n /**\r\n * @return Width (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endWidth\");\r\n },\r\n /**\r\n * Width, in pixels, of the clock hand's outer end. (tip)\r\n *\r\n * @default 1\r\n * @param value Width (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endWidth\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClockHand.prototype, \"rotationDirection\", {\r\n /**\r\n * @return rotationDirection\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"rotationDirection\");\r\n },\r\n /**\r\n * Rotation direction\r\n *\r\n * @default any\r\n * @param value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"rotationDirection\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Moves clock hand to particular value.\r\n *\r\n * If `duration` is set to a number in milliseconds, the hand will move\r\n * to the new position gracefully, rather than jumping rigth to it.\r\n *\r\n * Alternatively, you can also set `value` directly.\r\n *\r\n * @param value New value\r\n * @param duration Animation duration (ms)\r\n * @param easing Animation easing function\r\n */\r\n ClockHand.prototype.showValue = function (value, duration, easing) {\r\n this._value = value;\r\n if (value != undefined) {\r\n if (!$type.isNumber(duration)) {\r\n duration = 0;\r\n }\r\n if (this.axis) {\r\n var renderer = this.axis.renderer;\r\n var newAngle = renderer.positionToAngle(this.axis.anyToPosition(value));\r\n var currentAngle = this.rotation;\r\n if (this.rotationDirection == \"clockWise\") {\r\n if (newAngle < currentAngle) {\r\n this.rotation = currentAngle - 360;\r\n }\r\n }\r\n if (this.rotationDirection == \"counterClockWise\") {\r\n if (newAngle > currentAngle) {\r\n this.rotation = currentAngle + 360;\r\n }\r\n }\r\n this.animate({ property: \"rotation\", to: newAngle }, duration, easing);\r\n }\r\n }\r\n };\r\n Object.defineProperty(ClockHand.prototype, \"currentPosition\", {\r\n /**\r\n * Returns hand's relative position on axis\r\n */\r\n get: function () {\r\n if (this.axis) {\r\n var renderer = this.axis.renderer;\r\n return renderer.angleToPosition(this.rotation);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClockHand.prototype, \"value\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this._value;\r\n },\r\n /**\r\n * A current value clock hand is pointing to.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.showValue(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClockHand.prototype, \"axis\", {\r\n /**\r\n * @return Axis\r\n */\r\n get: function () {\r\n return this._axis.get();\r\n },\r\n /**\r\n * An Axis clock hand is associated with.\r\n *\r\n * Hand's `value` relates to values on the Axis.\r\n *\r\n * @param axis Axis\r\n */\r\n set: function (axis) {\r\n if (this.axis != axis) {\r\n this._axis.set(axis, new MultiDisposer([\r\n axis.events.on(\"datavalidated\", this.updateValue, this, false),\r\n axis.events.on(\"datarangechanged\", this.updateValue, this, false),\r\n axis.events.on(\"dataitemsvalidated\", this.updateValue, this, false),\r\n axis.events.on(\"propertychanged\", this.invalidate, this, false)\r\n ]));\r\n }\r\n if (axis) {\r\n var chart = axis.chart;\r\n if (chart) {\r\n this.rotation = chart.startAngle;\r\n }\r\n }\r\n this.parent = axis.renderer;\r\n this.zIndex = 5;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Triggers `value` accessor, so that Hand animates to new position, in case\r\n * value has changed.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ClockHand.prototype.updateValue = function () {\r\n this.value = this.value;\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n ClockHand.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Connect clock hands with axes\r\n if ($type.hasValue(config.axis) && $type.isString(config.axis) && this.map.hasKey(config.axis)) {\r\n config.axis = this.map.getKey(config.axis);\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n return ClockHand;\r\n}(Container));\r\nexport { ClockHand };\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[\"ClockHand\"] = ClockHand;\r\n//# sourceMappingURL=ClockHand.js.map","/**\r\n * Module for building Gauge charts.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { RadarChart, RadarChartDataItem } from \"./RadarChart\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { ClockHand } from \"../elements/ClockHand\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[GaugeChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar GaugeChartDataItem = /** @class */ (function (_super) {\r\n __extends(GaugeChartDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function GaugeChartDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"GaugeChartDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return GaugeChartDataItem;\r\n}(RadarChartDataItem));\r\nexport { GaugeChartDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a Gauge chart.\r\n *\r\n * @see {@link IGaugeChartEvents} for a list of available Events\r\n * @see {@link IGaugeChartAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/gauge-chart/} for documentation\r\n * @important\r\n */\r\nvar GaugeChart = /** @class */ (function (_super) {\r\n __extends(GaugeChart, _super);\r\n /**\r\n * Constructor\r\n */\r\n function GaugeChart() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"GaugeChart\";\r\n _this.startAngle = 180;\r\n _this.endAngle = 360;\r\n _this.hands = new ListTemplate(new ClockHand());\r\n _this.hands.events.on(\"inserted\", _this.processHand, _this, false);\r\n _this._disposers.push(new ListDisposer(_this.hands));\r\n _this._disposers.push(_this.hands.template);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n GaugeChart.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Gauge chart\");\r\n }\r\n };\r\n /**\r\n * Decorates a [[ClockHand]] when it is added to the chart.\r\n *\r\n * @param event Event\r\n */\r\n GaugeChart.prototype.processHand = function (event) {\r\n var hand = event.newValue;\r\n if (!hand.axis) {\r\n hand.axis = this.xAxes.getIndex(0);\r\n }\r\n };\r\n /**\r\n * This function is used to sort element's JSON config properties, so that\r\n * some properties that absolutely need to be processed last, can be put at\r\n * the end.\r\n *\r\n * @ignore Exclude from docs\r\n * @param a Element 1\r\n * @param b Element 2\r\n * @return Sorting number\r\n */\r\n GaugeChart.prototype.configOrder = function (a, b) {\r\n if (a == b) {\r\n return 0;\r\n }\r\n // Must come last\r\n else if (a == \"hands\") {\r\n return 1;\r\n }\r\n else if (b == \"hands\") {\r\n return -1;\r\n }\r\n else {\r\n return _super.prototype.configOrder.call(this, a, b);\r\n }\r\n };\r\n return GaugeChart;\r\n}(RadarChart));\r\nexport { GaugeChart };\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[\"GaugeChart\"] = GaugeChart;\r\n//# sourceMappingURL=GaugeChart.js.map","/**\r\n * Defines Percent Chart Series.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Series, SeriesDataItem } from \"./Series\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { Label } from \"../../core/elements/Label\";\r\nimport { Color } from \"../../core/utils/Color\";\r\nimport { Tick } from \"../elements/Tick\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { ColorSet } from \"../../core/utils/ColorSet\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $ease from \"../../core/utils/Ease\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { Disposer } from \"../../core/utils/Disposer\";\r\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n//@todo: sequenced?\r\n/**\r\n * Defines a [[DataItem]] for [[PercentSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar PercentSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(PercentSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PercentSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PercentSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Adds an `id` attribute the the slice element and returns its id.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PercentSeriesDataItem.prototype.uidAttr = function () {\r\n return this.slice.uidAttr();\r\n };\r\n /**\r\n * Hide the data item (and corresponding visual elements).\r\n *\r\n * @param duration Duration (ms)\r\n * @param delay Delay hiding (ms)\r\n * @param toValue Target value for animation\r\n * @param fields Fields to animate while hiding\r\n */\r\n PercentSeriesDataItem.prototype.hide = function (duration, delay, toValue, fields) {\r\n if (!fields) {\r\n fields = [\"value\"];\r\n }\r\n return _super.prototype.hide.call(this, duration, delay, 0, fields);\r\n };\r\n /**\r\n * Sets visibility of the Data Item.\r\n *\r\n * @param value Data Item\r\n */\r\n PercentSeriesDataItem.prototype.setVisibility = function (value, noChangeValues) {\r\n if (!noChangeValues) {\r\n if (value) {\r\n this.setWorkingValue(\"value\", this.values[\"value\"].value, 0, 0);\r\n }\r\n else {\r\n this.setWorkingValue(\"value\", 0, 0, 0);\r\n }\r\n }\r\n _super.prototype.setVisibility.call(this, value, noChangeValues);\r\n };\r\n /**\r\n * Show hidden data item (and corresponding visual elements).\r\n *\r\n * @param duration Duration (ms)\r\n * @param delay Delay hiding (ms)\r\n * @param fields Fields to animate while hiding\r\n */\r\n PercentSeriesDataItem.prototype.show = function (duration, delay, fields) {\r\n if (!fields) {\r\n fields = [\"value\"];\r\n }\r\n return _super.prototype.show.call(this, duration, delay, fields);\r\n };\r\n Object.defineProperty(PercentSeriesDataItem.prototype, \"category\", {\r\n /**\r\n * @return Category\r\n */\r\n get: function () {\r\n return this.properties.category;\r\n },\r\n /**\r\n * Category.\r\n *\r\n * @param value Category\r\n */\r\n set: function (value) {\r\n this.setProperty(\"category\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a marker used in the legend for this slice.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Marker container\r\n */\r\n PercentSeriesDataItem.prototype.createLegendMarker = function (marker) {\r\n this.component.createLegendMarker(marker, this);\r\n };\r\n Object.defineProperty(PercentSeriesDataItem.prototype, \"legendDataItem\", {\r\n /**\r\n * @return Legend data item\r\n */\r\n get: function () {\r\n return this._legendDataItem;\r\n },\r\n /**\r\n * A legend's data item, that corresponds to this data item.\r\n *\r\n * @param value Legend data item\r\n */\r\n set: function (value) {\r\n this._legendDataItem = value;\r\n if (value.label) {\r\n value.label.dataItem = this;\r\n }\r\n if (value.valueLabel) {\r\n value.valueLabel.dataItem = this;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PercentSeriesDataItem.prototype, \"tick\", {\r\n /**\r\n * A Tick element, related to this data item. (slice)\r\n *\r\n * @readonly\r\n * @return Tick element\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._tick) {\r\n var tick_1 = this.component.ticks.create();\r\n this._tick = tick_1;\r\n this.addSprite(tick_1);\r\n this._disposers.push(tick_1);\r\n tick_1.parent = this.component.ticksContainer;\r\n this._disposers.push(new Disposer(function () {\r\n if (_this.component) {\r\n _this.component.ticks.removeValue(tick_1);\r\n }\r\n }));\r\n tick_1.visible = this.visible;\r\n }\r\n return this._tick;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PercentSeriesDataItem.prototype, \"label\", {\r\n /**\r\n * A Label element, related to this data item. (slice)\r\n *\r\n * @readonly\r\n * @return Label element\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._label) {\r\n var label_1 = this.component.labels.create();\r\n this.addSprite(label_1);\r\n this._label = label_1;\r\n this._disposers.push(label_1);\r\n label_1.parent = this.component.labelsContainer;\r\n this._disposers.push(new Disposer(function () {\r\n if (_this.component) {\r\n _this.component.labels.removeValue(label_1);\r\n }\r\n }));\r\n label_1.visible = this.visible;\r\n }\r\n return this._label;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PercentSeriesDataItem.prototype, \"slice\", {\r\n /**\r\n * An element, related to this data item. (slice)\r\n *\r\n * @readonly\r\n * @return Slice element\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._slice) {\r\n var component_1 = this.component;\r\n var slice_1 = component_1.slices.create();\r\n this.addSprite(slice_1);\r\n this._slice = slice_1;\r\n this._disposers.push(slice_1);\r\n slice_1.parent = component_1.slicesContainer;\r\n this._disposers.push(new Disposer(function () {\r\n component_1.slices.removeValue(slice_1);\r\n }));\r\n slice_1.visible = this.visible;\r\n // Apply accessibility\r\n if (component_1.itemsFocusable()) {\r\n this.component.role = \"menu\";\r\n slice_1.role = \"menuitem\";\r\n slice_1.focusable = true;\r\n }\r\n else {\r\n this.component.role = \"list\";\r\n slice_1.role = \"listitem\";\r\n slice_1.focusable = false;\r\n }\r\n // Apply screen reader label\r\n if (slice_1.focusable) {\r\n slice_1.events.on(\"focus\", function (ev) {\r\n slice_1.readerTitle = component_1.populateString(component_1.itemReaderText, _this);\r\n }, undefined, false);\r\n slice_1.events.on(\"blur\", function (ev) {\r\n slice_1.readerTitle = \"\";\r\n }, undefined, false);\r\n }\r\n if (slice_1.hoverable) {\r\n slice_1.events.on(\"over\", function (ev) {\r\n slice_1.readerTitle = component_1.populateString(component_1.itemReaderText, _this);\r\n }, undefined, false);\r\n slice_1.events.on(\"out\", function (ev) {\r\n slice_1.readerTitle = \"\";\r\n }, undefined, false);\r\n }\r\n }\r\n return this._slice;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PercentSeriesDataItem.prototype, \"hiddenInLegend\", {\r\n /**\r\n * @return Disabled in legend?\r\n */\r\n get: function () {\r\n return this.properties.hiddenInLegend;\r\n },\r\n /**\r\n * Should dataItem (slice) be hidden in legend?\r\n *\r\n * @param value Visible in legend?\r\n */\r\n set: function (value) {\r\n this.setProperty(\"hiddenInLegend\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PercentSeriesDataItem;\r\n}(SeriesDataItem));\r\nexport { PercentSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[PercentSeries]] which is a base class for [[PieSeries]],\r\n * [[FunnelSeries]], and [[PyramidSeries]].\r\n *\r\n * @see {@link IPercentSeriesEvents} for a list of available Events\r\n * @see {@link IPercentSeriesAdapters} for a list of available Adapters\r\n */\r\nvar PercentSeries = /** @class */ (function (_super) {\r\n __extends(PercentSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PercentSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PercentSeries\";\r\n _this._addAllDataItems = false;\r\n _this.colors = new ColorSet();\r\n _this.colors.step = 1;\r\n _this.isMeasured = true;\r\n _this.calculatePercent = true;\r\n var slicesContainer = _this.createChild(Container);\r\n slicesContainer.shouldClone = false;\r\n slicesContainer.isMeasured = false;\r\n _this.slicesContainer = slicesContainer;\r\n var ticksContainer = _this.createChild(Container);\r\n ticksContainer.shouldClone = false;\r\n ticksContainer.isMeasured = false;\r\n ticksContainer.layout = \"none\";\r\n _this.ticksContainer = ticksContainer;\r\n var labelsContainer = _this.createChild(Container);\r\n labelsContainer.shouldClone = false;\r\n labelsContainer.isMeasured = false;\r\n labelsContainer.layout = \"none\";\r\n _this.labelsContainer = labelsContainer;\r\n _this.alignLabels = false;\r\n _this.bulletsContainer.toFront();\r\n // Make all slices focusable\r\n _this.skipFocusThreshold = 50;\r\n var defaultState = _this.defaultState;\r\n defaultState.transitionEasing = $ease.sinOut;\r\n // Accessibility\r\n _this.itemReaderText = \"{category}: {value.percent.formatNumber('#.#')}%\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Creates a slice element.\r\n *\r\n * @return Slice\r\n */\r\n PercentSeries.prototype.createSlice = function () {\r\n return new Sprite();\r\n };\r\n /**\r\n * Creates a tick element.\r\n *\r\n * @return Tick\r\n */\r\n PercentSeries.prototype.createTick = function () {\r\n return new Tick();\r\n };\r\n /**\r\n * Sreates label element.\r\n *\r\n * @return label\r\n */\r\n PercentSeries.prototype.createLabel = function () {\r\n return new Label();\r\n };\r\n Object.defineProperty(PercentSeries.prototype, \"slices\", {\r\n /**\r\n * A list of slice elements for the series.\r\n *\r\n * Use its `template` to configure look and behavior of the slices. E.g.:\r\n *\r\n * ```TypeScript\r\n * series.slices.template.stroke = am4core.color(\"#fff\");\r\n * series.slices.template.strokeWidth = 2;\r\n * ```\r\n * ```JavaScript\r\n * series.slices.template.stroke = am4core.color(\"#fff\");\r\n * series.slices.template.strokeWidth = 2;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * // ...\r\n * \"slices\": {\r\n * \"stroke\": \"#fff\",\r\n * \"strokeWidth\": 2\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/list-templates/} for more information about list templates\r\n * @return Slices\r\n */\r\n get: function () {\r\n if (!this._slices) {\r\n var slice = this.createSlice();\r\n slice.applyOnClones = true;\r\n this._disposers.push(slice);\r\n this.initSlice(slice);\r\n this._slices = new ListTemplate(slice);\r\n this._disposers.push(new ListDisposer(this._slices));\r\n }\r\n return this._slices;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PercentSeries.prototype, \"ticks\", {\r\n /**\r\n * A list of tick elements for the series. Ticks connect slice to its label.\r\n *\r\n * Use its `template` to configure look and behavior of the ticks. E.g.:\r\n *\r\n * ```TypeScript\r\n * series.ticks.template.strokeWidth = 2;\r\n * ```\r\n * ```JavaScript\r\n * series.ticks.template.strokeWidth = 2;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * // ...\r\n * \"ticks\": {\r\n * \"strokeWidth\": 2\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/list-templates/} for more information about list templates\r\n * @return Ticks\r\n */\r\n get: function () {\r\n if (!this._ticks) {\r\n var tick = this.createTick();\r\n tick.applyOnClones = true;\r\n this._disposers.push(tick);\r\n this.initTick(tick);\r\n this._ticks = new ListTemplate(tick);\r\n this._disposers.push(new ListDisposer(this._ticks));\r\n }\r\n return this._ticks;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PercentSeries.prototype, \"labels\", {\r\n /**\r\n * A list of slice label elements for the series.\r\n *\r\n * Use its `template` to configure look and behavior of the labels. E.g.:\r\n *\r\n * ```TypeScript\r\n * series.labels.template.fill = am4core.color(\"#c00\");\r\n * series.labels.template.fontSize = 20;\r\n * ```\r\n * ```JavaScript\r\n * series.labels.template.fill = am4core.color(\"#c00\");\r\n * series.labels.template.fontSize = 20;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * // ...\r\n * \"labels\": {\r\n * \"stroke\": \"#c00\",\r\n * \"fontSize\": 20\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/list-templates/} for more information about list templates\r\n * @return Labels\r\n */\r\n get: function () {\r\n if (!this._labels) {\r\n var label = this.createLabel();\r\n label.applyOnClones = true;\r\n this._disposers.push(label);\r\n this.initLabel(label);\r\n this._labels = new ListTemplate(label);\r\n this._disposers.push(new ListDisposer(this._labels));\r\n }\r\n return this._labels;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n PercentSeries.prototype.createDataItem = function () {\r\n return new PercentSeriesDataItem();\r\n };\r\n /**\r\n * Creates and returns a new slice element.\r\n *\r\n * @param sliceType Type of the slice element\r\n * @return Slice\r\n */\r\n PercentSeries.prototype.initSlice = function (slice) {\r\n };\r\n PercentSeries.prototype.initLabel = function (label) {\r\n label.text = \"{category}: {value.percent.formatNumber('#.0')}%\";\r\n label.isMeasured = false;\r\n label.padding(5, 5, 5, 5);\r\n };\r\n PercentSeries.prototype.initTick = function (label) {\r\n };\r\n /**\r\n * Validates (processes) data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PercentSeries.prototype.validateDataItems = function () {\r\n this.colors.reset();\r\n if (this.patterns) {\r\n this.patterns.reset();\r\n }\r\n _super.prototype.validateDataItems.call(this);\r\n };\r\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n PercentSeries.prototype.validateDataElement = function (dataItem) {\r\n var slice = dataItem.slice;\r\n if (slice) {\r\n if (slice.fill == undefined) {\r\n if (this.patterns) {\r\n if (!$type.hasValue(slice.stroke)) {\r\n slice.stroke = this.colors.next();\r\n }\r\n slice.fill = this.patterns.next();\r\n if ($type.hasValue(slice.fillOpacity)) {\r\n slice.fill.backgroundOpacity = slice.fillOpacity;\r\n }\r\n if (slice.stroke instanceof Color) {\r\n slice.fill.stroke = slice.stroke;\r\n slice.fill.fill = slice.stroke;\r\n }\r\n }\r\n else {\r\n slice.fill = this.colors.next();\r\n }\r\n }\r\n else {\r\n this.colors.currentStep += this.colors.step;\r\n }\r\n if (slice.stroke == undefined) {\r\n slice.stroke = slice.fill;\r\n }\r\n }\r\n // do this at the end, otherwise bullets won't be positioned properly\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n if (slice) {\r\n dataItem.bullets.each(function (key, bullet) {\r\n if (bullet.fill == undefined) {\r\n bullet.fill = slice.fill;\r\n }\r\n if (bullet.stroke == undefined) {\r\n bullet.stroke = slice.stroke;\r\n }\r\n });\r\n }\r\n this.updateLegendValue(dataItem);\r\n };\r\n /**\r\n * Validates (processes) data.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PercentSeries.prototype.validateData = function () {\r\n _super.prototype.validateData.call(this);\r\n if (this.chart) {\r\n this.chart.feedLegend();\r\n }\r\n };\r\n /**\r\n * Arranges slice labels according to position settings.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItems Data items\r\n */\r\n PercentSeries.prototype.arrangeLabels = function (dataItems) {\r\n for (var i = 0, len = dataItems.length; i < len; i++) {\r\n var dataItem = dataItems[i];\r\n var label = dataItem.label;\r\n if (label) {\r\n if (label.invalid) {\r\n label.validate();\r\n }\r\n var lh = label.measuredHeight;\r\n if (!label.visible) {\r\n lh = 0;\r\n }\r\n if (label.pixelY - lh / 2 < -this.maxHeight / 2) {\r\n label.y = -this.maxHeight / 2 + lh / 2;\r\n }\r\n var nextLabel = this.getNextLabel(i + 1, dataItems);\r\n var bottom = label.pixelY + lh;\r\n if (nextLabel) {\r\n if (nextLabel.y < bottom) {\r\n nextLabel.y = bottom;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n PercentSeries.prototype.arrangeLabels2 = function (dataItems) {\r\n var previousTop = this.maxHeight / 2;\r\n for (var i = dataItems.length - 1; i >= 0; i--) {\r\n var dataItem = dataItems[i];\r\n var label = dataItem.label;\r\n if (label) {\r\n if (label.invalid) {\r\n label.validate();\r\n }\r\n var lh = label.measuredHeight;\r\n if (!label.visible) {\r\n lh = 0;\r\n }\r\n if (i == dataItems.length - 1) {\r\n previousTop += lh / 2;\r\n }\r\n if (label.pixelY + lh > previousTop) {\r\n label.y = previousTop - lh;\r\n previousTop = label.y;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the next label according to `index`.\r\n *\r\n * @param index Current index\r\n * @param dataItems Data items\r\n * @return Label element\r\n */\r\n PercentSeries.prototype.getNextLabel = function (index, dataItems) {\r\n if (dataItems.length >= index) {\r\n var nextDataItem = dataItems[index];\r\n if (nextDataItem) {\r\n if (nextDataItem.label) {\r\n if (nextDataItem.visible) {\r\n return nextDataItem.label;\r\n }\r\n else {\r\n return this.getNextLabel(index + 1, dataItems);\r\n }\r\n }\r\n else {\r\n return this.getNextLabel(index + 1, dataItems);\r\n }\r\n }\r\n }\r\n };\r\n Object.defineProperty(PercentSeries.prototype, \"colors\", {\r\n /**\r\n * @return Color set\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"colors\");\r\n },\r\n /**\r\n * A color set to be used for slices.\r\n *\r\n * For each new subsequent slice, the chart will assign the next color in\r\n * this set.\r\n *\r\n * @param value Color set\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"colors\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PercentSeries.prototype, \"patterns\", {\r\n /**\r\n * @return Pattern set\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"patterns\");\r\n },\r\n /**\r\n * A [[PatternSet]] to use when creating patterned fills for slices.\r\n *\r\n * @since 4.7.5\r\n * @param value Pattern set\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"patterns\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Binds related legend data item's visual settings to this series' visual\r\n * settings.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Container\r\n * @param dataItem Data item\r\n */\r\n PercentSeries.prototype.createLegendMarker = function (marker, dataItem) {\r\n $iter.each(marker.children.iterator(), function (child) {\r\n var slice = dataItem.slice;\r\n child.defaultState.properties.fill = slice.fill;\r\n child.defaultState.properties.stroke = slice.stroke;\r\n child.defaultState.properties.fillOpacity = slice.fillOpacity;\r\n child.defaultState.properties.strokeOpacity = slice.strokeOpacity;\r\n child.fill = slice.fill;\r\n child.stroke = slice.stroke;\r\n child.fillOpacity = slice.fillOpacity;\r\n child.strokeOpacity = slice.strokeOpacity;\r\n if (child.fill == undefined) {\r\n child.__disabled = true;\r\n }\r\n var legendDataItem = marker.dataItem;\r\n legendDataItem.color = slice.fill;\r\n legendDataItem.colorOrig = slice.fill;\r\n child.addDisposer(slice.events.on(\"propertychanged\", function (ev) {\r\n if (ev.property == \"fill\") {\r\n child.__disabled = false;\r\n if (!child.isActive) {\r\n child.fill = slice.fill;\r\n }\r\n child.defaultState.properties.fill = slice.fill;\r\n legendDataItem.color = slice.fill;\r\n legendDataItem.colorOrig = slice.fill;\r\n }\r\n if (ev.property == \"stroke\") {\r\n if (!child.isActive) {\r\n child.stroke = slice.stroke;\r\n }\r\n child.defaultState.properties.stroke = slice.stroke;\r\n }\r\n }, undefined, false));\r\n });\r\n };\r\n /**\r\n * Repositions bullets when slice's size changes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n PercentSeries.prototype.handleSliceScale = function (event) {\r\n var _this = this;\r\n var slice = event.target;\r\n var dataItem = slice.dataItem;\r\n $iter.each(dataItem.bullets.iterator(), function (a) {\r\n var value = a[1];\r\n _this.positionBullet(value);\r\n });\r\n };\r\n /**\r\n * Repositions bullet and labels when slice moves.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n PercentSeries.prototype.handleSliceMove = function (event) {\r\n };\r\n /**\r\n * Copies all properties from another instance of [[PercentSeries]].\r\n *\r\n * @param source Source series\r\n */\r\n PercentSeries.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.slices.template.copyFrom(source.slices.template);\r\n this.labels.template.copyFrom(source.labels.template);\r\n this.ticks.template.copyFrom(source.ticks.template);\r\n this.colors = source.colors.clone();\r\n };\r\n Object.defineProperty(PercentSeries.prototype, \"alignLabels\", {\r\n /**\r\n * @return Align labels?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"alignLabels\");\r\n },\r\n /**\r\n * Align labels into nice vertical columns?\r\n *\r\n * This will ensure that labels never overlap with each other.\r\n *\r\n * Arranging labels into columns makes them more readble, and better user\r\n * experience.\r\n *\r\n * If set to `false` labels will be positioned at `label.radius` distance,\r\n * and may, in some cases, overlap.\r\n *\r\n * @default true\r\n * @param value Align labels?\r\n */\r\n set: function (value) {\r\n this.setAlignLabels(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n PercentSeries.prototype.setAlignLabels = function (value) {\r\n this.setPropertyValue(\"alignLabels\", value, true);\r\n };\r\n Object.defineProperty(PercentSeries.prototype, \"ignoreZeroValues\", {\r\n /**\r\n * @return Ignore zero values\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"ignoreZeroValues\");\r\n },\r\n /**\r\n * If set to `true` the chart will not show slices with zero values.\r\n *\r\n * @default false\r\n * @since 4.7.9\r\n * @param value Ignore zero values\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"ignoreZeroValues\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates corresponding legend data item with current values.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n PercentSeries.prototype.updateLegendValue = function (dataItem) {\r\n if (dataItem) {\r\n var legendDataItem = dataItem.legendDataItem;\r\n var legendSettings = dataItem.legendSettings;\r\n if (legendDataItem && legendSettings) {\r\n if (legendSettings) {\r\n if (legendSettings.labelText) {\r\n legendDataItem.label.text = legendSettings.labelText;\r\n }\r\n if (legendSettings.itemLabelText) {\r\n legendDataItem.label.text = legendSettings.itemLabelText;\r\n }\r\n if (legendSettings.valueText) {\r\n legendDataItem.valueLabel.text = legendSettings.valueText;\r\n }\r\n if (legendSettings.itemValueText) {\r\n legendDataItem.valueLabel.text = legendSettings.itemValueText;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n return PercentSeries;\r\n}(Series));\r\nexport { PercentSeries };\r\n/**\r\n * bboxter 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[\"PercentSeries\"] = PercentSeries;\r\nregistry.registeredClasses[\"PercentSeriesDataItem\"] = PercentSeriesDataItem;\r\n/**\r\n * Add default responsive rules\r\n */\r\n/**\r\n * Disable labels and ticks.\r\n */\r\ndefaultRules.push({\r\n relevant: ResponsiveBreakpoints.maybeXS,\r\n state: function (target, stateId) {\r\n if (target instanceof PercentSeries) {\r\n var state = target.states.create(stateId);\r\n var labelState = target.labels.template.states.create(stateId);\r\n labelState.properties.disabled = true;\r\n var tickState = target.ticks.template.states.create(stateId);\r\n tickState.properties.disabled = true;\r\n return state;\r\n }\r\n return null;\r\n }\r\n});\r\n//# sourceMappingURL=PercentSeries.js.map","/**\r\n * Percent chart module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { SerialChart, SerialChartDataItem } from \"./SerialChart\";\r\nimport { PercentSeries } from \"../series/PercentSeries\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[PercentChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar PercentChartDataItem = /** @class */ (function (_super) {\r\n __extends(PercentChartDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PercentChartDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PercentChartDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return PercentChartDataItem;\r\n}(SerialChartDataItem));\r\nexport { PercentChartDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This is a base class for \"percent-based\" chart types like Pie and Funnel.\r\n *\r\n * @see {@link IPercentChartEvents} for a list of available Events\r\n * @see {@link IPercentChartAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/pie-chart/} for Pie chart documentation\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/sliced-chart/} for Sliced chart documentation\r\n */\r\nvar PercentChart = /** @class */ (function (_super) {\r\n __extends(PercentChart, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PercentChart() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"PercentChart\";\r\n _this.align = \"none\";\r\n _this.valign = \"none\";\r\n // so that the chart is always drawn, even the legend wants all the space\r\n _this.chartContainer.minHeight = 50;\r\n _this.chartContainer.minWidth = 50;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * (Re)validates chart data.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PercentChart.prototype.validateData = function () {\r\n _super.prototype.validateData.call(this);\r\n this.feedLegend();\r\n };\r\n /**\r\n * Setups the legend to use the chart's data.\r\n * @ignore\r\n */\r\n PercentChart.prototype.feedLegend = function () {\r\n var legend = this.legend;\r\n if (legend) {\r\n var legendData_1 = [];\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (!series.hiddenInLegend) {\r\n $iter.each(series.dataItems.iterator(), function (dataItem) {\r\n if (!dataItem.hiddenInLegend) {\r\n legendData_1.push(dataItem);\r\n if (!dataItem.legendSettings) {\r\n dataItem.legendSettings = series.legendSettings;\r\n }\r\n }\r\n });\r\n }\r\n });\r\n legend.data = legendData_1;\r\n legend.dataFields.name = \"category\";\r\n }\r\n };\r\n /**\r\n * Creates a new [[PercentSeries]].\r\n *\r\n * @return New series\r\n */\r\n PercentChart.prototype.createSeries = function () {\r\n return new PercentSeries();\r\n };\r\n /**\r\n * @ignore\r\n */\r\n PercentChart.prototype.setLegend = function (legend) {\r\n _super.prototype.setLegend.call(this, legend);\r\n if (legend) {\r\n legend.labels.template.text = \"{category}\";\r\n legend.valueLabels.template.text = \"{value.percent.formatNumber('#.0')}%\";\r\n legend.itemContainers.template.events.on(\"over\", function (event) {\r\n var percentSeriesDataItem = event.target.dataItem.dataContext;\r\n if (percentSeriesDataItem.visible && !percentSeriesDataItem.isHiding) {\r\n var slice = percentSeriesDataItem.slice;\r\n slice.dispatchImmediately(\"over\");\r\n slice.isHover = true;\r\n slice.interactions.isRealHover = true;\r\n }\r\n });\r\n legend.itemContainers.template.events.on(\"out\", function (event) {\r\n var percentSeriesDataItem = event.target.dataItem.dataContext;\r\n var slice = percentSeriesDataItem.slice;\r\n slice.dispatchImmediately(\"out\");\r\n slice.isHover = false;\r\n });\r\n }\r\n };\r\n return PercentChart;\r\n}(SerialChart));\r\nexport { PercentChart };\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 * @hidden\r\n */\r\nregistry.registeredClasses[\"PercentChart\"] = PercentChart;\r\nregistry.registeredClasses[\"PercentChartDataItem\"] = PercentChartDataItem;\r\n//# sourceMappingURL=PercentChart.js.map","/**\r\n * Pie tick module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Tick } from \"../elements/Tick\";\r\nimport { MutableValueDisposer, MultiDisposer } from \"../../core/utils/Disposer\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws an tick line for a pie slice connecting it to a related label.\r\n *\r\n * @see {@link IPieTickEvents} for a list of available events\r\n * @see {@link IPieTickAdapters} for a list of available Adapters\r\n */\r\nvar PieTick = /** @class */ (function (_super) {\r\n __extends(PieTick, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieTick() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * A label element this tick is attached to.\r\n */\r\n _this._label = new MutableValueDisposer();\r\n /**\r\n * A slice element this tick is attached to.\r\n */\r\n _this._slice = new MutableValueDisposer();\r\n _this.className = \"PieTick\";\r\n _this.element = _this.paper.add(\"polyline\");\r\n _this._disposers.push(_this._label);\r\n _this._disposers.push(_this._slice);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the tick element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PieTick.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var slice = this.slice;\r\n var label = this.label;\r\n var series = slice.dataItem.component;\r\n if (slice && slice.radius > 0 && label && label.text) {\r\n var x0 = slice.dx + slice.slice.dx + slice.pixelX + slice.ix * slice.radius * slice.scale;\r\n var y0 = slice.dy + slice.slice.dy + slice.pixelY + slice.iy * slice.radiusY * slice.scale;\r\n var x1 = void 0;\r\n var y1 = void 0;\r\n var x2 = void 0;\r\n var y2 = void 0;\r\n if (series.alignLabels) {\r\n x1 = label.pixelX - this.length;\r\n y1 = label.pixelY;\r\n x2 = label.pixelX;\r\n y2 = y1;\r\n if (label.horizontalCenter == \"right\") {\r\n x1 += 2 * this.length;\r\n x2 = x1 - this.length;\r\n }\r\n }\r\n else {\r\n var r = label.pixelRadius(slice.radius);\r\n x1 = x0 + r * slice.ix;\r\n y1 = y0 + r * slice.iy;\r\n x2 = x1;\r\n y2 = y1;\r\n }\r\n this.element.attr({ \"points\": [x0, y0, x1, y1, x2, y2] });\r\n }\r\n };\r\n Object.defineProperty(PieTick.prototype, \"slice\", {\r\n /**\r\n * @return Slice\r\n */\r\n get: function () {\r\n return this._slice.get();\r\n },\r\n /**\r\n * Slice element tick is attached to.\r\n *\r\n * @param slice Slice\r\n */\r\n set: function (slice) {\r\n this._slice.set(slice, new MultiDisposer([\r\n slice.events.on(\"transformed\", this.invalidate, this),\r\n slice.events.on(\"validated\", this.invalidate, this)\r\n ]));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieTick.prototype, \"label\", {\r\n /**\r\n * @return Label\r\n */\r\n get: function () {\r\n return this._label.get();\r\n },\r\n /**\r\n * Label element tick is attached to.\r\n *\r\n * @param label Label\r\n */\r\n set: function (label) {\r\n this._label.set(label, label.events.on(\"transformed\", this.invalidate, this, false));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PieTick;\r\n}(Tick));\r\nexport { PieTick };\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[\"PieTick\"] = PieTick;\r\n//# sourceMappingURL=PieTick.js.map","/**\r\n * Defines Pie Chart Series.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { PercentSeries, PercentSeriesDataItem } from \"./PercentSeries\";\r\nimport { Slice } from \"../../core/elements/Slice\";\r\n//import { Slice3D } from \"../../core/elements/3D/Slice3D\";\r\nimport { AxisLabelCircular } from \"../axes/AxisLabelCircular\";\r\nimport { PieTick } from \"../elements/PieTick\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { Percent, percent } from \"../../core/utils/Percent\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n//@todo: sequenced?\r\n/**\r\n * Defines a [[DataItem]] for [[PieSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar PieSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(PieSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PieSeriesDataItem\";\r\n _this.values.radiusValue = {};\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(PieSeriesDataItem.prototype, \"radiusValue\", {\r\n /**\r\n * @return Radius\r\n */\r\n get: function () {\r\n return this.values.radiusValue.value;\r\n },\r\n /**\r\n * Slice's radius, if other than default.\r\n *\r\n * @param value Radius\r\n */\r\n set: function (value) {\r\n this.setValue(\"radiusValue\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Hide the data item (and corresponding visual elements).\r\n *\r\n * @param duration Duration (ms)\r\n * @param delay Delay hiding (ms)\r\n * @param toValue Target value for animation\r\n * @param fields Fields to animate while hiding\r\n */\r\n PieSeriesDataItem.prototype.hide = function (duration, delay, toValue, fields) {\r\n return _super.prototype.hide.call(this, duration, delay, 0, [\"value\", \"radiusValue\"]);\r\n };\r\n /**\r\n * Show hidden data item (and corresponding visual elements).\r\n *\r\n * @param duration Duration (ms)\r\n * @param delay Delay hiding (ms)\r\n * @param fields Fields to animate while hiding\r\n */\r\n PieSeriesDataItem.prototype.show = function (duration, delay, fields) {\r\n return _super.prototype.show.call(this, duration, delay, [\"value\", \"radiusValue\"]);\r\n };\r\n return PieSeriesDataItem;\r\n}(PercentSeriesDataItem));\r\nexport { PieSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a slice series on a Pie chart.\r\n *\r\n * @see {@link IPieSeriesEvents} for a list of available Events\r\n * @see {@link IPieSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar PieSeries = /** @class */ (function (_super) {\r\n __extends(PieSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PieSeries\";\r\n _this.alignLabels = true;\r\n //this.startAngle = -90;\r\n //this.endAngle = 270;\r\n _this.layout = \"none\";\r\n _this.labels.template.radius = percent(5);\r\n _this.addDisposer(_this.labels.template.events.on(\"enabled\", _this.invalidate, _this, false));\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * creates slice\r\n */\r\n PieSeries.prototype.createSlice = function () {\r\n return new Slice();\r\n };\r\n /**\r\n * creates tick\r\n */\r\n PieSeries.prototype.createTick = function () {\r\n return new PieTick();\r\n };\r\n /**\r\n * creates label\r\n */\r\n PieSeries.prototype.createLabel = function () {\r\n return new AxisLabelCircular();\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n PieSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Pie Slice Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n PieSeries.prototype.createDataItem = function () {\r\n return new PieSeriesDataItem();\r\n };\r\n /**\r\n * Inits slice.\r\n *\r\n * @param slice to init\r\n */\r\n PieSeries.prototype.initSlice = function (slice) {\r\n slice.isMeasured = false;\r\n slice.defaultState.properties.scale = 1;\r\n slice.observe(\"scale\", this.handleSliceScale, this);\r\n slice.observe([\"dx\", \"dy\", \"x\", \"y\", \"shiftRadius\"], this.handleSliceMove, this);\r\n slice.tooltipText = \"{category}: {value.percent.formatNumber('#.#')}% ({value.value})\";\r\n var hoverState = slice.states.create(\"hover\");\r\n hoverState.properties.scale = 1.05;\r\n var defaultState = slice.defaultState;\r\n defaultState.properties.shiftRadius = 0;\r\n slice.togglable = true;\r\n slice.events.on(\"toggled\", function (event) {\r\n event.target.hideTooltip();\r\n });\r\n var activeState = slice.states.create(\"active\");\r\n activeState.properties.shiftRadius = 0.10;\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PieSeries.prototype.validate = function () {\r\n this._leftItems = [];\r\n this._rightItems = [];\r\n this._currentStartAngle = this.startAngle;\r\n this._arcRect = $math.getArcRect(this.startAngle, this.endAngle);\r\n this._maxRadiusPercent = 0;\r\n for (var i = this.startIndex; i < this.endIndex; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n var radiusValuePercent = dataItem.values.radiusValue.percent;\r\n if (radiusValuePercent > this._maxRadiusPercent) {\r\n this._maxRadiusPercent = radiusValuePercent;\r\n }\r\n }\r\n _super.prototype.validate.call(this);\r\n if (this.alignLabels) {\r\n if (this.startAngle > this.endAngle) {\r\n this._rightItems.reverse();\r\n }\r\n else {\r\n this._leftItems.reverse();\r\n }\r\n this._rightItems.sort(function (a, b) {\r\n var aAngle = (a.slice.middleAngle + 360) % 360;\r\n var bAngle = (b.slice.middleAngle + 360) % 360;\r\n if (aAngle > 270) {\r\n aAngle -= 360;\r\n }\r\n if (bAngle > 270) {\r\n bAngle -= 360;\r\n }\r\n if (aAngle < bAngle) {\r\n return -1;\r\n }\r\n else if (aAngle > bAngle) {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n });\r\n this._leftItems.sort(function (a, b) {\r\n var aAngle = (a.slice.middleAngle + 360) % 360;\r\n var bAngle = (b.slice.middleAngle + 360) % 360;\r\n if (aAngle < bAngle) {\r\n return 1;\r\n }\r\n else if (aAngle > bAngle) {\r\n return -1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n });\r\n this.arrangeLabels(this._rightItems);\r\n this.arrangeLabels2(this._rightItems);\r\n this.arrangeLabels(this._leftItems);\r\n this.arrangeLabels2(this._leftItems);\r\n }\r\n };\r\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n PieSeries.prototype.validateDataElement = function (dataItem) {\r\n if (this.pixelRadius > 0) {\r\n if (this.ignoreZeroValues && dataItem.value == 0) {\r\n dataItem.__disabled = true;\r\n }\r\n else {\r\n dataItem.__disabled = false;\r\n }\r\n // SLICE\r\n var slice = dataItem.slice;\r\n slice.radius = this.pixelRadius;\r\n if ($type.isNumber(dataItem.radiusValue)) {\r\n slice.radius = this.pixelInnerRadius + (this.pixelRadius - this.pixelInnerRadius) * dataItem.values.radiusValue.percent / this._maxRadiusPercent;\r\n }\r\n if (!(slice.innerRadius instanceof Percent)) {\r\n slice.innerRadius = this.pixelInnerRadius;\r\n }\r\n slice.startAngle = this._currentStartAngle;\r\n slice.arc = Math.abs(dataItem.values.value.percent) * (this.endAngle - this.startAngle) / 100;\r\n // LABEL\r\n if (!this.labels.template.disabled) {\r\n var label = dataItem.label;\r\n var tick = dataItem.tick;\r\n tick.slice = slice;\r\n tick.label = label;\r\n var normalizedMiddleAngle = (slice.middleAngle + 360) % 360; // force angle to be 0 - 360;\r\n var point = void 0;\r\n if (this.alignLabels) {\r\n var labelRadius = label.pixelRadius(slice.radius);\r\n var x = tick.length + labelRadius;\r\n label.dx = 0;\r\n label.dy = 0;\r\n label.verticalCenter = \"middle\";\r\n var arcRect = this._arcRect;\r\n // right half\r\n if (normalizedMiddleAngle > 270 || normalizedMiddleAngle <= 90) {\r\n x += (arcRect.width + arcRect.x) * this.pixelRadius;\r\n label.horizontalCenter = \"left\";\r\n this._rightItems.push(dataItem);\r\n }\r\n // left half\r\n else {\r\n x -= arcRect.x * this.pixelRadius;\r\n label.horizontalCenter = \"right\";\r\n this._leftItems.push(dataItem);\r\n x *= -1;\r\n }\r\n var distance = slice.radius + tick.length + labelRadius;\r\n point = { x: x, y: slice.iy * distance };\r\n label.moveTo(point);\r\n }\r\n else {\r\n var depth = slice[\"depth\"];\r\n if (!$type.isNumber(depth)) {\r\n depth = 0;\r\n }\r\n label.fixPosition(slice.middleAngle, slice.radius, slice.radiusY, 0, -depth);\r\n }\r\n }\r\n this._currentStartAngle += slice.arc;\r\n // do this at the end, otherwise bullets won't be positioned properly\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n }\r\n };\r\n Object.defineProperty(PieSeries.prototype, \"radius\", {\r\n /**\r\n * @return Radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Outer radius for the series' slices in pixels or [[Percent]].\r\n *\r\n * @param value Radius\r\n */\r\n set: function (value) {\r\n if (this.setPercentProperty(\"radius\", value, true, false, 10, false)) {\r\n this.invalidateDataItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieSeries.prototype, \"pixelRadius\", {\r\n /**\r\n * @return Radius\r\n * @ignore\r\n */\r\n get: function () {\r\n return this._pixelRadius;\r\n },\r\n /**\r\n * @ignore\r\n */\r\n set: function (value) {\r\n if (this._pixelRadius != value) {\r\n this._pixelRadius = value;\r\n this.invalidateDataItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieSeries.prototype, \"pixelInnerRadius\", {\r\n /**\r\n * @return Pixel inner radius\r\n * @ignore\r\n */\r\n get: function () {\r\n return this._pixelInnerRadius;\r\n },\r\n /**\r\n * @ignore\r\n */\r\n set: function (value) {\r\n if (this._pixelInnerRadius != value) {\r\n this._pixelInnerRadius = value;\r\n this.invalidateDataItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieSeries.prototype, \"innerRadius\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Inner radius for the series' slices in pixels.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Redo so that users can set it\r\n * @param value Radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieSeries.prototype, \"startAngle\", {\r\n /**\r\n * @return Angle\r\n */\r\n get: function () {\r\n var startAngle = this.getPropertyValue(\"startAngle\");\r\n if ($type.isNumber(startAngle)) {\r\n return startAngle;\r\n }\r\n else {\r\n return this._startAngleInternal;\r\n }\r\n },\r\n /**\r\n * Start angle for the series' slices in degrees. (0-360)\r\n *\r\n * @param value Angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startAngle\", $math.normalizeAngle(value), true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieSeries.prototype, \"endAngle\", {\r\n /**\r\n * @return Angle\r\n */\r\n get: function () {\r\n var endAngle = this.getPropertyValue(\"endAngle\");\r\n if ($type.isNumber(endAngle)) {\r\n return endAngle;\r\n }\r\n else {\r\n return this._endAngleInternal;\r\n }\r\n },\r\n /**\r\n * End angle for the series' slices in degrees. (0-360)\r\n *\r\n * @param value Angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Positions series bullet.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet Bullet\r\n */\r\n PieSeries.prototype.positionBullet = function (bullet) {\r\n _super.prototype.positionBullet.call(this, bullet);\r\n var dataItem = bullet.dataItem;\r\n var slice = dataItem.slice;\r\n var locationX = bullet.locationX;\r\n if (!$type.isNumber(locationX)) {\r\n locationX = 0.5;\r\n }\r\n var locationY = bullet.locationY;\r\n if (!$type.isNumber(locationY)) {\r\n locationY = 1;\r\n }\r\n var angle = slice.startAngle + slice.arc * locationX;\r\n bullet.x = locationY * slice.radius * $math.cos(angle);\r\n bullet.y = locationY * slice.radiusY * $math.sin(angle);\r\n };\r\n /**\r\n * Repositions bullet and labels when slice moves.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n PieSeries.prototype.handleSliceMove = function (event) {\r\n if (!this.alignLabels) {\r\n var slice = event.target;\r\n var dataItem = slice.dataItem;\r\n // moving textelement, as label dx and dy are already employed for aligning\r\n //@labeltodo\r\n if (dataItem) {\r\n var label = dataItem.label;\r\n if (label) {\r\n label.dx = label.fdx + slice.dx + slice.pixelX;\r\n label.dy = label.fdy + slice.dy + slice.pixelY;\r\n }\r\n }\r\n }\r\n };\r\n Object.defineProperty(PieSeries.prototype, \"bbox\", {\r\n /**\r\n * Returns bounding box (square) for this element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n get: function () {\r\n if (this.definedBBox) {\r\n return this.definedBBox;\r\n }\r\n var chart = this.chart;\r\n if (chart) {\r\n return $math.getArcRect(chart.startAngle, chart.endAngle, this.pixelRadius);\r\n }\r\n return $math.getArcRect(this.startAngle, this.endAngle, this.pixelRadius);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PieSeries;\r\n}(PercentSeries));\r\nexport { PieSeries };\r\n/**\r\n * bboxter 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[\"PieSeries\"] = PieSeries;\r\nregistry.registeredClasses[\"PieSeriesDataItem\"] = PieSeriesDataItem;\r\n//# sourceMappingURL=PieSeries.js.map","/**\r\n * Pie chart module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { PercentChart, PercentChartDataItem } from \"./PercentChart\";\r\nimport { percent, Percent } from \"../../core/utils/Percent\";\r\nimport { PieSeries } from \"../series/PieSeries\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[PieChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar PieChartDataItem = /** @class */ (function (_super) {\r\n __extends(PieChartDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieChartDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PieChartDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return PieChartDataItem;\r\n}(PercentChartDataItem));\r\nexport { PieChartDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a Pie chart.\r\n *\r\n * ```TypeScript\r\n * // Includes\r\n * import * as am4core from \"@amcharts/amcharts4/core\";\r\n * import * as am4charts from \"@amcharts/amcharts4/charts\";\r\n *\r\n * // Create chart\r\n * let chart = am4core.create(\"chartdiv\", am4charts.PieChart);\r\n *\r\n * // Set data\r\n * chart.data = [{\r\n * \t\"country\": \"Lithuania\",\r\n * \t\"litres\": 501.9\r\n * }, {\r\n * \t\"country\": \"Czechia\",\r\n * \t\"litres\": 301.9\r\n * }, {\r\n * \t\"country\": \"Ireland\",\r\n * \t\"litres\": 201.1\r\n * }];\r\n *\r\n * // Create series\r\n * let series = chart.series.push(new am4charts.PieSeries());\r\n * series.dataFields.value = \"litres\";\r\n * series.dataFields.category = \"country\";\r\n * ```\r\n * ```JavaScript\r\n * // Create chart\r\n * var chart = am4core.create(\"chartdiv\", am4charts.PieChart);\r\n *\r\n * // The following would work as well:\r\n * // var chart = am4core.create(\"chartdiv\", \"PieChart\");\r\n *\r\n * // Set data\r\n * chart.data = [{\r\n * \t\"country\": \"Lithuania\",\r\n * \t\"litres\": 501.9\r\n * }, {\r\n * \t\"country\": \"Czechia\",\r\n * \t\"litres\": 301.9\r\n * }, {\r\n * \t\"country\": \"Ireland\",\r\n * \t\"litres\": 201.1\r\n * }];\r\n *\r\n * // Create series\r\n * var series = chart.series.push(new am4charts.PieSeries());\r\n * series.dataFields.value = \"litres\";\r\n * series.dataFields.category = \"country\";\r\n * ```\r\n * ```JSON\r\n * var chart = am4core.createFromConfig({\r\n *\r\n * \t// Series\r\n * \t\"series\": [{\r\n * \t\t\"type\": \"PieSeries\",\r\n * \t\t\"dataFields\": {\r\n * \t\t\t\"value\": \"litres\",\r\n * \t\t\t\"category\": \"country\"\r\n * \t\t}\r\n * \t}],\r\n *\r\n * \t// Data\r\n * \t\"data\": [{\r\n * \t\t\"country\": \"Lithuania\",\r\n * \t\t\"litres\": 501.9\r\n * \t}, {\r\n * \t\t\"country\": \"Czechia\",\r\n * \t\t\"litres\": 301.9\r\n * \t}, {\r\n * \t\t\"country\": \"Ireland\",\r\n * \t\t\"litres\": 201.1\r\n * \t}]\r\n *\r\n * }, \"chartdiv\", \"PieChart\");\r\n * ```\r\n *\r\n * @see {@link IPieChartEvents} for a list of available Events\r\n * @see {@link IPieChartAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/pie-chart/} for documentation\r\n * @important\r\n */\r\nvar PieChart = /** @class */ (function (_super) {\r\n __extends(PieChart, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieChart() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"PieChart\";\r\n // Set defaults\r\n _this.innerRadius = 0;\r\n _this.radius = percent(80);\r\n _this.align = \"none\";\r\n _this.valign = \"none\";\r\n _this.startAngle = -90;\r\n _this.endAngle = 270;\r\n var seriesContainer = _this.seriesContainer;\r\n seriesContainer.isMeasured = true;\r\n seriesContainer.valign = \"middle\";\r\n seriesContainer.align = \"center\";\r\n seriesContainer.layout = \"absolute\";\r\n seriesContainer.width = undefined;\r\n seriesContainer.height = undefined;\r\n // so that the pie is always drawn, even the legend wants all the space\r\n _this.chartContainer.minHeight = 50;\r\n _this.chartContainer.minWidth = 50;\r\n _this.chartContainer.events.on(\"maxsizechanged\", _this.updateRadius, _this, false); // need this for the chart to change radius if legend is removed/disabled\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n PieChart.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Pie chart\");\r\n }\r\n };\r\n /**\r\n * (Re)validates the chart, causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PieChart.prototype.validateLayout = function () {\r\n _super.prototype.validateLayout.call(this);\r\n this.updateRadius();\r\n };\r\n /**\r\n * Decorates a new [[Series]] object with required parameters when it is\r\n * added to the chart.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n PieChart.prototype.handleSeriesAdded = function (event) {\r\n _super.prototype.handleSeriesAdded.call(this, event);\r\n this._chartPixelRadius = undefined;\r\n this.updateSeriesAngles();\r\n };\r\n PieChart.prototype.updateSeriesAngles = function () {\r\n var _this = this;\r\n this.series.each(function (series) {\r\n series._startAngleInternal = _this.startAngle;\r\n series._endAngleInternal = _this.endAngle;\r\n //series.defaultState.properties.startAngle = this.startAngle;\r\n //series.defaultState.properties.endAngle = this.endAngle;\r\n });\r\n };\r\n /**\r\n * Recalculates pie's radius, based on a number of criteria.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PieChart.prototype.updateRadius = function () {\r\n var chartCont = this.chartContainer;\r\n var rect = $math.getArcRect(this.startAngle, this.endAngle, 1);\r\n var innerRect = { x: 0, y: 0, width: 0, height: 0 };\r\n var innerRadius = this.innerRadius;\r\n if (innerRadius instanceof Percent) {\r\n innerRect = $math.getArcRect(this.startAngle, this.endAngle, innerRadius.value);\r\n }\r\n // @todo handle this when innerRadius set in pixels (do it for radar also)\r\n rect = $math.getCommonRectangle([rect, innerRect]);\r\n var maxRadius = Math.min(chartCont.innerWidth / rect.width, chartCont.innerHeight / rect.height);\r\n if (!$type.isNumber(maxRadius)) {\r\n maxRadius = 0;\r\n }\r\n var chartRadius = $utils.relativeRadiusToValue(this.radius, maxRadius);\r\n var chartPixelInnerRadius = $utils.relativeRadiusToValue(this.innerRadius, maxRadius);\r\n var seriesRadius = (chartRadius - chartPixelInnerRadius) / this.series.length;\r\n if (chartRadius != this._chartPixelRadius || chartPixelInnerRadius != this._chartPixelInnerRadius) {\r\n this._chartPixelRadius = chartRadius;\r\n this._chartPixelInnerRadius = chartPixelInnerRadius;\r\n //@todo: make it possible to set series radius in percent\r\n $iter.each($iter.indexed(this.series.iterator()), function (a) {\r\n var i = a[0];\r\n var series = a[1];\r\n var radius = chartPixelInnerRadius + $utils.relativeRadiusToValue(series.radius, chartRadius - chartPixelInnerRadius);\r\n var innerRadius = chartPixelInnerRadius + $utils.relativeRadiusToValue(series.innerRadius, chartRadius - chartPixelInnerRadius);\r\n if (!$type.isNumber(radius)) {\r\n radius = chartPixelInnerRadius + seriesRadius * (i + 1);\r\n }\r\n if (!$type.isNumber(innerRadius)) {\r\n innerRadius = chartPixelInnerRadius + seriesRadius * i;\r\n }\r\n series.pixelRadius = radius;\r\n series.pixelInnerRadius = innerRadius;\r\n });\r\n this.seriesContainer.definedBBox = { x: chartRadius * rect.x, y: chartRadius * rect.y, width: chartRadius * rect.width, height: chartRadius * rect.height };\r\n this.seriesContainer.invalidateLayout();\r\n this.bulletsContainer.x = this.seriesContainer.x;\r\n this.bulletsContainer.y = this.seriesContainer.y;\r\n }\r\n };\r\n Object.defineProperty(PieChart.prototype, \"radius\", {\r\n /**\r\n * @return Radius (px or relative)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Sets radius of the pie chart.\r\n *\r\n * Setting to a number will mean a fixed pixel radius.\r\n *\r\n * Setting to an instance of [[Percent]] will mean a relative radius to\r\n * available space.\r\n *\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * // Set pie chart to be at 50% of the available space\r\n * pieChart.radius = am4core.percent.percent(50);\r\n * ```\r\n * ```JavaScript\r\n * // Set pie chart to be at 50% of the available space\r\n * pieChart.radius = am4core.percent.percent(50);\r\n * ```\r\n * ```JSON\r\n * {\r\n * // Set pie chart to be at 50% of the available space\r\n * \"radius\": \"50%\"\r\n * }\r\n * ```\r\n *\r\n * @default 80%\r\n * @param value Radius (px or relative)\r\n */\r\n set: function (value) {\r\n if (this.setPercentProperty(\"radius\", value, true, false, 10, false)) {\r\n this.invalidateLayout();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieChart.prototype, \"innerRadius\", {\r\n /**\r\n * @return Relative inner radius (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Sets relative inner radius (to create a donut chart).\r\n *\r\n * Setting to a number will mean a fixed pixel radius.\r\n *\r\n * Setting to an instance of [[Percent]] will mean a relative radius to\r\n * available space.\r\n *\r\n * NOTE: it's not related to `radius`.\r\n *\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * // Set pie chart to be at 50% of the available space\r\n * pieChart.innerRadius = am4core.percent.percent(50);\r\n * ```\r\n * ```JavaScript\r\n * // Set pie chart to be at 50% of the available space\r\n * pieChart.innerRadius = am4core.percent.percent(50);\r\n * ```\r\n * ```JSON\r\n * {\r\n * // Set pie chart to be at 50% of the available space\r\n * \"innerRadius\": \"50%\"\r\n * }\r\n * ```\r\n *\r\n * @default 0\r\n * @param value Relative inner radius (0-1)\r\n * @todo Setting things like `innerRadius` modifies `slice.radius` and it then looks like it is not the same value as in default state\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a new [[PieSeries]].\r\n *\r\n * @return New series\r\n */\r\n PieChart.prototype.createSeries = function () {\r\n return new PieSeries();\r\n };\r\n Object.defineProperty(PieChart.prototype, \"startAngle\", {\r\n /**\r\n * @return Start angle (degrees)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startAngle\");\r\n },\r\n /**\r\n * Starting angle of the Pie circle. (degrees)\r\n *\r\n * Normally, a pie chart begins (the left side of the first slice is drawn)\r\n * at the top center. (at -90 degrees)\r\n *\r\n * You can use `startAngle` to change this setting.\r\n *\r\n * E.g. setting this to 0 will make the first slice be drawn to the right.\r\n *\r\n * For a perfect circle the absolute sum of `startAngle` and `endAngle`\r\n * needs to be 360.\r\n *\r\n * However, it's **not** necessary to do so. You can set to those lesser\r\n * numbers, to create semi-circles.\r\n *\r\n * E.g. `startAngle = -90` with `endAngle = 0` will create a Pie chart that\r\n * looks like a quarter of a circle.\r\n *\r\n * NOTE: This setting is not supported in a 3D pie chart.\r\n *\r\n * @default -90\r\n * @param value Start angle (degrees)\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"startAngle\", value)) {\r\n this.updateRadius();\r\n this.updateSeriesAngles();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieChart.prototype, \"endAngle\", {\r\n /**\r\n * @return End angle (degrees)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endAngle\");\r\n },\r\n /**\r\n * End angle of the Pie circle. (degrees)\r\n *\r\n * Normally, a pie chart ends (the right side of the last slice is drawn)\r\n * at the top center. (at 270 degrees)\r\n *\r\n * You can use `endAngle` to change this setting.\r\n *\r\n * For a perfect circle the absolute sum of `startAngle` and `endAngle`\r\n * needs to be 360.\r\n *\r\n * However, it's **not** necessary to do so. You can set to those lesser\r\n * numbers, to create semi-circles.\r\n *\r\n * E.g. `startAngle = -90` with `endAngle = 0` will create a Pie chart that\r\n * looks like a quarter of a circle.\r\n *\r\n * NOTE: This setting is not supported in a 3D pie chart.\r\n *\r\n * @default 270\r\n * @param value End angle (degrees)\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"endAngle\", value)) {\r\n this.updateRadius();\r\n this.updateSeriesAngles();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PieChart;\r\n}(PercentChart));\r\nexport { PieChart };\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[\"PieChart\"] = PieChart;\r\nregistry.registeredClasses[\"PieChartDataItem\"] = PieChartDataItem;\r\n//# sourceMappingURL=PieChart.js.map","/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport { PieSeries, PieSeriesDataItem } from \"../series/PieSeries\";\r\nimport { Slice3D } from \"../../core/elements/3d/Slice3D\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[PieSeries3D]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar PieSeries3DDataItem = /** @class */ (function (_super) {\r\n __extends(PieSeries3DDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieSeries3DDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PieSeries3DDataItem\";\r\n _this.values.depthValue = {};\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(PieSeries3DDataItem.prototype, \"depthValue\", {\r\n /**\r\n * @return Depth\r\n */\r\n get: function () {\r\n return this.values[\"depthValue\"].value;\r\n },\r\n /**\r\n * Slice depth (height).\r\n *\r\n * @param value Depth\r\n */\r\n set: function (value) {\r\n this.setValue(\"depthValue\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PieSeries3DDataItem;\r\n}(PieSeriesDataItem));\r\nexport { PieSeries3DDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a slice series on a 3D pie chart.\r\n *\r\n * @see {@link IPieSeries3DEvents} for a list of available Events\r\n * @see {@link IPieSeries3DAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar PieSeries3D = /** @class */ (function (_super) {\r\n __extends(PieSeries3D, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieSeries3D() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PieSeries3D\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n PieSeries3D.prototype.createDataItem = function () {\r\n return new PieSeries3DDataItem();\r\n };\r\n /**\r\n * creates slice\r\n */\r\n PieSeries3D.prototype.createSlice = function () {\r\n return new Slice3D();\r\n };\r\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n PieSeries3D.prototype.validateDataElement = function (dataItem) {\r\n var slice = dataItem.slice;\r\n var depth = this.depth;\r\n if (!$type.isNumber(depth)) {\r\n depth = this.chart.depth;\r\n }\r\n var depthPercent = dataItem.values.depthValue.percent;\r\n if (!$type.isNumber(depthPercent)) {\r\n depthPercent = 100;\r\n }\r\n slice.depth = depthPercent * depth / 100;\r\n var angle = this.angle;\r\n if (!$type.isNumber(angle)) {\r\n angle = this.chart.angle;\r\n }\r\n slice.angle = angle;\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PieSeries3D.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n for (var i = this._workingStartIndex; i < this._workingEndIndex; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n var slice = dataItem.slice;\r\n var startAngle = slice.startAngle;\r\n // find quarter\r\n //q0 || q1\r\n if ((startAngle >= -90 && startAngle < 90)) {\r\n slice.toFront();\r\n }\r\n //q2 || q3\r\n else if ((startAngle >= 90)) {\r\n slice.toBack();\r\n }\r\n }\r\n };\r\n Object.defineProperty(PieSeries3D.prototype, \"depth\", {\r\n /**\r\n * @return Depth (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"depth\");\r\n },\r\n /**\r\n * Depth (height) of the pie slice in pixels.\r\n *\r\n * @param value Depth (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"depth\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieSeries3D.prototype, \"angle\", {\r\n /**\r\n * @return Angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"angle\");\r\n },\r\n /**\r\n * Angle of the view point of the 3D pie. (0-360)\r\n *\r\n * @param value Angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"angle\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Positions series bullet.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet Bullet\r\n */\r\n PieSeries3D.prototype.positionBullet = function (bullet) {\r\n _super.prototype.positionBullet.call(this, bullet);\r\n var dataItem = bullet.dataItem;\r\n var slice = dataItem.slice;\r\n bullet.y = bullet.pixelY - slice.depth;\r\n };\r\n return PieSeries3D;\r\n}(PieSeries));\r\nexport { PieSeries3D };\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[\"PieSeries3D\"] = PieSeries3D;\r\nregistry.registeredClasses[\"PieSeries3DDataItem\"] = PieSeries3DDataItem;\r\n//# sourceMappingURL=PieSeries3D.js.map","/**\r\n * 3D Pie chart module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * Imports\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { PieChart, PieChartDataItem } from \"./PieChart\";\r\nimport { PieSeries3D } from \"../series/PieSeries3D\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[PieChart3D]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar PieChart3DDataItem = /** @class */ (function (_super) {\r\n __extends(PieChart3DDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieChart3DDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PieChart3DDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return PieChart3DDataItem;\r\n}(PieChartDataItem));\r\nexport { PieChart3DDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a 3D Pie chart.\r\n *\r\n * * ```TypeScript\r\n * // Includes\r\n * import * as am4core from \"@amcharts/amcharts4/core\";\r\n * import * as am4charts from \"@amcharts/amcharts4/charts\";\r\n *\r\n * // Create chart\r\n * let chart = am4core.create(\"chartdiv\", am4charts.Pie3DChart);\r\n *\r\n * // Set data\r\n * chart.data = [{\r\n * \t\"country\": \"Lithuania\",\r\n * \t\"litres\": 501.9\r\n * }, {\r\n * \t\"country\": \"Czechia\",\r\n * \t\"litres\": 301.9\r\n * }, {\r\n * \t\"country\": \"Ireland\",\r\n * \t\"litres\": 201.1\r\n * }];\r\n *\r\n * // Create series\r\n * let series = chart.series.push(new am4charts.Pie3DSeries());\r\n * series.dataFields.value = \"litres\";\r\n * series.dataFields.category = \"country\";\r\n * ```\r\n * ```JavaScript\r\n * // Create chart\r\n * var chart = am4core.create(\"chartdiv\", am4charts.Pie3DChart);\r\n *\r\n * // The following would work as well:\r\n * // var chart = am4core.create(\"chartdiv\", \"Pie3DChart\");\r\n *\r\n * // Set data\r\n * chart.data = [{\r\n * \t\"country\": \"Lithuania\",\r\n * \t\"litres\": 501.9\r\n * }, {\r\n * \t\"country\": \"Czechia\",\r\n * \t\"litres\": 301.9\r\n * }, {\r\n * \t\"country\": \"Ireland\",\r\n * \t\"litres\": 201.1\r\n * }];\r\n *\r\n * // Create series\r\n * var series = chart.series.push(new am4charts.Pie3DSeries());\r\n * series.dataFields.value = \"litres\";\r\n * series.dataFields.category = \"country\";\r\n * ```\r\n * ```JSON\r\n * var chart = am4core.createFromConfig({\r\n *\r\n * \t// Series\r\n * \t\"series\": [{\r\n * \t\t\"type\": \"Pie3DSeries\",\r\n * \t\t\"dataFields\": {\r\n * \t\t\t\"value\": \"litres\",\r\n * \t\t\t\"category\": \"country\"\r\n * \t\t}\r\n * \t}],\r\n *\r\n * \t// Data\r\n * \t\"data\": [{\r\n * \t\t\"country\": \"Lithuania\",\r\n * \t\t\"litres\": 501.9\r\n * \t}, {\r\n * \t\t\"country\": \"Czechia\",\r\n * \t\t\"litres\": 301.9\r\n * \t}, {\r\n * \t\t\"country\": \"Ireland\",\r\n * \t\t\"litres\": 201.1\r\n * \t}]\r\n *\r\n * }, \"chartdiv\", \"Pie3DChart\");\r\n * ```\r\n *\r\n * @see {@link IPieChart3DEvents} for a list of available Events\r\n * @see {@link IPieChart3DAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/pie-chart/} for documentation\r\n * @important\r\n */\r\nvar PieChart3D = /** @class */ (function (_super) {\r\n __extends(PieChart3D, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PieChart3D() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"PieChart3D\";\r\n _this.depth = 20;\r\n _this.angle = 10;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(PieChart3D.prototype, \"depth\", {\r\n /**\r\n * @return Depth (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"depth\");\r\n },\r\n /**\r\n * Depth of the 3D pie in pixels.\r\n *\r\n * This will determine \"height\" of the pie.\r\n *\r\n * @default 20\r\n * @param value Depth (px)\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"depth\", value)) {\r\n this.invalidateDataUsers();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PieChart3D.prototype, \"angle\", {\r\n /**\r\n * @return Angle (degrees)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"angle\");\r\n },\r\n /**\r\n * An angle of a \"point of view\" in degrees. Possible range 0 - 90.\r\n *\r\n * @default 10\r\n * @param value Angle (degrees)\r\n */\r\n set: function (value) {\r\n value = $math.fitToRange(value, 0, 90);\r\n if (this.setPropertyValue(\"angle\", value)) {\r\n this.invalidateDataUsers();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates and returns a new Series.\r\n *\r\n * @return New series\r\n */\r\n PieChart3D.prototype.createSeries = function () {\r\n return new PieSeries3D();\r\n };\r\n return PieChart3D;\r\n}(PieChart));\r\nexport { PieChart3D };\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[\"PieChart3D\"] = PieChart3D;\r\n//# sourceMappingURL=PieChart3D.js.map","/**\r\n * Sliced chart module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { PercentChart, PercentChartDataItem } from \"./PercentChart\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[SlicedChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar SlicedChartDataItem = /** @class */ (function (_super) {\r\n __extends(SlicedChartDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SlicedChartDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"SlicedChartDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return SlicedChartDataItem;\r\n}(PercentChartDataItem));\r\nexport { SlicedChartDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a Sliced chart.\r\n *\r\n * @see {@link ISlicedChartEvents} for a list of available Events\r\n * @see {@link ISlicedChartAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/sliced-chart/} for documentation\r\n * @important\r\n */\r\nvar SlicedChart = /** @class */ (function (_super) {\r\n __extends(SlicedChart, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SlicedChart() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"SlicedChart\";\r\n _this.seriesContainer.layout = \"horizontal\";\r\n _this.padding(15, 15, 15, 15);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n SlicedChart.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Sliced chart\");\r\n }\r\n };\r\n /**\r\n * (Re)validates the chart, causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n SlicedChart.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n };\r\n return SlicedChart;\r\n}(PercentChart));\r\nexport { SlicedChart };\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[\"SlicedChart\"] = SlicedChart;\r\nregistry.registeredClasses[\"SlicedChartDataItem\"] = SlicedChartDataItem;\r\n//# sourceMappingURL=SlicedChart.js.map","/**\r\n * FlowDiagramNode module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { visualProperties } from \"../../core/Sprite\";\r\nimport { List } from \"../../core/utils/List\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $string from \"../../core/utils/String\";\r\nimport * as $order from \"../../core/utils/Order\";\r\nimport * as $number from \"../../core/utils/Number\";\r\nimport { RoundedRectangle } from \"../../core/elements/RoundedRectangle\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport { LegendSettings } from \"../Legend\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a node in a Flow Diagram.\r\n *\r\n * A Flow node is a block with a value, which represents its size on the\r\n * diagram.\r\n *\r\n * Nodes are connected via [[FlowLink]] elements.\r\n *\r\n * @see {@link IFlowDiagramNodeEvents} for a list of available events\r\n * @see {@link IFlowDiagramNodeAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar FlowDiagramNode = /** @class */ (function (_super) {\r\n __extends(FlowDiagramNode, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FlowDiagramNode() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Settings for the appearance of the related legend items.\r\n */\r\n _this.legendSettings = new LegendSettings();\r\n _this.className = \"FlowDiagramNode\";\r\n _this.isMeasured = false;\r\n // TODO can this be removed ?\r\n new InterfaceColorSet();\r\n _this.draggable = true;\r\n _this.inert = true;\r\n _this.setStateOnChildren = true;\r\n _this.events.on(\"positionchanged\", _this.invalidateLinks, _this, false);\r\n _this.events.on(\"sizechanged\", _this.invalidateLinks, _this, false);\r\n return _this;\r\n //this.events.on(\"hit\", this.handleHit, this, false);\r\n }\r\n /**\r\n * @ignore\r\n */\r\n FlowDiagramNode.prototype.handleHit = function (event) {\r\n if (this.isHidden || this.isHiding) {\r\n this.show();\r\n }\r\n else {\r\n this.hide();\r\n }\r\n };\r\n /**\r\n * Shows hidden node.\r\n *\r\n * @param duration Duration of reveal animation (ms)\r\n * @return Animation\r\n */\r\n FlowDiagramNode.prototype.show = function (duration) {\r\n var animation = _super.prototype.show.call(this, duration);\r\n this.outgoingDataItems.each(function (dataItem) {\r\n if (!dataItem.toNode || (dataItem.toNode && !dataItem.toNode.isHidden)) {\r\n dataItem.setWorkingValue(\"value\", dataItem.getValue(\"value\"), duration);\r\n }\r\n });\r\n this.incomingDataItems.each(function (dataItem) {\r\n if (!dataItem.fromNode || (dataItem.fromNode && !dataItem.fromNode.isHidden)) {\r\n dataItem.setWorkingValue(\"value\", dataItem.getValue(\"value\"), duration);\r\n }\r\n });\r\n return animation;\r\n };\r\n /**\r\n * Hides node.\r\n *\r\n * @param duration Duration of hiding animation (ms)\r\n * @return Animation\r\n */\r\n FlowDiagramNode.prototype.hide = function (duration) {\r\n var animation = _super.prototype.hide.call(this, duration);\r\n this.outgoingDataItems.each(function (dataItem) {\r\n dataItem.setWorkingValue(\"value\", 0, duration);\r\n });\r\n this.incomingDataItems.each(function (dataItem) {\r\n dataItem.setWorkingValue(\"value\", 0, duration);\r\n });\r\n return animation;\r\n };\r\n /**\r\n * Marks node as invalid, for redrawal in the next update cycle.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n FlowDiagramNode.prototype.validate = function () {\r\n if (!this.isDisposed()) {\r\n _super.prototype.validate.call(this);\r\n this.invalidateLinks();\r\n }\r\n };\r\n /**\r\n * Invalidates all links, attached to this node.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n FlowDiagramNode.prototype.invalidateLinks = function () {\r\n var _this = this;\r\n this.outgoingDataItems.each(function (dataItem) {\r\n var link = dataItem.link;\r\n if (link.colorMode == \"fromNode\") {\r\n link.fill = link.dataItem.fromNode.color;\r\n }\r\n if (link.colorMode == \"gradient\") {\r\n link.fill = link.gradient;\r\n link.stroke = link.gradient;\r\n var stop_1 = link.gradient.stops.getIndex(0);\r\n if (stop_1) {\r\n stop_1.color = _this.color;\r\n link.gradient.validate();\r\n }\r\n }\r\n });\r\n this.incomingDataItems.each(function (dataItem) {\r\n var link = dataItem.link;\r\n if (link.colorMode == \"toNode\") {\r\n link.fill = link.dataItem.toNode.color;\r\n }\r\n if (link.colorMode == \"gradient\") {\r\n link.fill = link.gradient;\r\n link.stroke = link.gradient;\r\n var stop_2 = link.gradient.stops.getIndex(1);\r\n if (stop_2) {\r\n stop_2.color = _this.color;\r\n link.gradient.validate();\r\n }\r\n }\r\n });\r\n };\r\n Object.defineProperty(FlowDiagramNode.prototype, \"incomingDataItems\", {\r\n /**\r\n * List of incoming items (links).\r\n *\r\n * @readonly\r\n * @return Incoming items\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._incomingDataItems) {\r\n var incomingDataItems = new List();\r\n incomingDataItems.events.on(\"inserted\", function () {\r\n if (_this.chart.sortBy == \"name\") {\r\n _this._incomingSorted = $iter.sort(_this._incomingDataItems.iterator(), function (x, y) { return $string.order(x.fromName, y.fromName); });\r\n }\r\n else if (_this.chart.sortBy == \"value\") {\r\n _this._incomingSorted = $iter.sort(_this._incomingDataItems.iterator(), function (x, y) { return $order.reverse($number.order(x.value, y.value)); });\r\n }\r\n else {\r\n _this._incomingSorted = _this._incomingDataItems.iterator();\r\n }\r\n }, undefined, false);\r\n this._incomingDataItems = incomingDataItems;\r\n }\r\n return this._incomingDataItems;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramNode.prototype, \"outgoingDataItems\", {\r\n /**\r\n * List of outgoing items (links).\r\n *\r\n * @readonly\r\n * @return Outgoing items\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._outgoingDataItems) {\r\n var outgoingDataItems = new List();\r\n outgoingDataItems.events.on(\"inserted\", function () {\r\n if (_this.chart.sortBy == \"name\") {\r\n _this._outgoingSorted = $iter.sort(_this._outgoingDataItems.iterator(), function (x, y) { return $string.order(x.fromName, y.fromName); });\r\n }\r\n else if (_this.chart.sortBy == \"value\") {\r\n _this._outgoingSorted = $iter.sort(_this._outgoingDataItems.iterator(), function (x, y) { return $order.reverse($number.order(x.value, y.value)); });\r\n }\r\n else {\r\n _this._outgoingSorted = _this._outgoingDataItems.iterator();\r\n }\r\n }, undefined, false);\r\n this._outgoingDataItems = outgoingDataItems;\r\n }\r\n return this._outgoingDataItems;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramNode.prototype, \"name\", {\r\n /**\r\n * @return Name\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"name\");\r\n },\r\n /**\r\n * A name of the node.\r\n *\r\n * @param value Name\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"name\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramNode.prototype, \"total\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"total\");\r\n },\r\n /**\r\n * Sum of all incoming+outgoing link values\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"total\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramNode.prototype, \"totalIncoming\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"totalIncoming\");\r\n },\r\n /**\r\n * Sum of all incomming link values.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"totalIncoming\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramNode.prototype, \"totalOutgoing\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"totalOutgoing\");\r\n },\r\n /**\r\n * Sum of all outgoing link values.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"totalOutgoing\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramNode.prototype, \"color\", {\r\n /**\r\n * @return Color\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"color\");\r\n },\r\n /**\r\n * Node's color.\r\n *\r\n * @param value Color\r\n */\r\n set: function (value) {\r\n this.setColorProperty(\"color\", value);\r\n if (this._background) {\r\n this._background.fill = value;\r\n }\r\n this.fill = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates elements in related legend container, that mimics the look of this\r\n * Series.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Legend item container\r\n */\r\n FlowDiagramNode.prototype.createLegendMarker = function (marker) {\r\n var w = marker.pixelWidth;\r\n var h = marker.pixelHeight;\r\n marker.removeChildren();\r\n var column = marker.createChild(RoundedRectangle);\r\n column.shouldClone = false;\r\n $object.copyProperties(this, column, visualProperties);\r\n column.stroke = this.fill;\r\n column.copyFrom(this);\r\n column.padding(0, 0, 0, 0); // if columns will have padding (which is often), legend marker will be very narrow\r\n column.width = w;\r\n column.height = h;\r\n var legendDataItem = marker.dataItem;\r\n legendDataItem.color = column.fill;\r\n legendDataItem.colorOrig = column.fill;\r\n };\r\n Object.defineProperty(FlowDiagramNode.prototype, \"legendDataItem\", {\r\n /**\r\n * @return Data item\r\n */\r\n get: function () {\r\n return this._legendDataItem;\r\n },\r\n /**\r\n * Legend data item that corresponds to this series.\r\n *\r\n * @param value Data item\r\n */\r\n set: function (value) {\r\n this._legendDataItem = value;\r\n this._legendDataItem.itemContainer.deepInvalidate();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return FlowDiagramNode;\r\n}(Container));\r\nexport { FlowDiagramNode };\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[\"FlowDiagramNode\"] = FlowDiagramNode;\r\n//# sourceMappingURL=FlowDiagramNode.js.map","/**\r\n * FlowDiagramLink module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { LinearGradient } from \"../../core/rendering/fills/LinearGradient\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { Bullet } from \"../elements/Bullet\";\r\nimport { Color } from \"../../core/utils/Color\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { Polyline } from \"../../core/elements/Polyline\";\r\nimport { Line } from \"../../core/elements/Line\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This class creates a link (waved color-filled line) between two nodes in a\r\n * Flow Diagram.\r\n *\r\n * @see {@link IFlowDiagramLinkEvents} for a list of available events\r\n * @see {@link IFlowDiagramLinkAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar FlowDiagramLink = /** @class */ (function (_super) {\r\n __extends(FlowDiagramLink, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FlowDiagramLink() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"FlowDiagramLink\";\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.maskBullets = false;\r\n _this.colorMode = \"fromNode\";\r\n _this.layout = \"none\";\r\n _this.isMeasured = false;\r\n _this.startAngle = 0;\r\n _this.endAngle = 0;\r\n _this.strokeOpacity = 0;\r\n // this is very important, otherwise the container will be shifted\r\n _this.verticalCenter = \"none\";\r\n _this.horizontalCenter = \"none\";\r\n _this.tooltipText = \"{fromName}→{toName}:{value.value}\";\r\n _this.tooltipLocation = 0.5;\r\n _this.link = _this.createChild(Sprite);\r\n _this.link.shouldClone = false;\r\n _this.link.setElement(_this.paper.add(\"path\"));\r\n _this.link.isMeasured = false;\r\n _this.fillOpacity = 0.2;\r\n _this.fill = interfaceColors.getFor(\"alternativeBackground\");\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Positions bullets\r\n * @ignore\r\n */\r\n FlowDiagramLink.prototype.positionBullets = function () {\r\n var _this = this;\r\n $iter.each(this.bullets.iterator(), function (bullet) {\r\n bullet.parent = _this.bulletsContainer;\r\n bullet.maxWidth = _this.maxWidth;\r\n bullet.maxHeight = _this.maxHeight;\r\n _this.positionBullet(bullet);\r\n });\r\n };\r\n Object.defineProperty(FlowDiagramLink.prototype, \"bulletsContainer\", {\r\n /**\r\n * Bullets container\r\n */\r\n get: function () {\r\n if (!this._bulletsContainer) {\r\n var bulletsContainer = this.createChild(Container);\r\n bulletsContainer.shouldClone = false;\r\n bulletsContainer.layout = \"none\";\r\n this._bulletsContainer = bulletsContainer;\r\n }\r\n return this._bulletsContainer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramLink.prototype, \"bulletsMask\", {\r\n /**\r\n * Bullets mask sprite\r\n */\r\n get: function () {\r\n if (!this._bulletsMask) {\r\n var bulletsMask = this.createChild(Sprite);\r\n bulletsMask.shouldClone = false;\r\n bulletsMask.setElement(this.paper.add(\"path\"));\r\n bulletsMask.isMeasured = false;\r\n this._bulletsMask = bulletsMask;\r\n }\r\n return this._bulletsMask;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Positions bullets at relative bullet.locationX position on the link.\r\n * @ignore\r\n */\r\n FlowDiagramLink.prototype.positionBullet = function (bullet) {\r\n var location = bullet.locationX;\r\n if (!$type.isNumber(location)) {\r\n location = bullet.locationY;\r\n }\r\n if (!$type.isNumber(location)) {\r\n location = 0.5;\r\n }\r\n var point = this.middleLine.positionToPoint(location);\r\n bullet.moveTo(point);\r\n var rotationField = bullet.propertyFields.rotation;\r\n var angle;\r\n if (bullet.dataItem) {\r\n var dataContext = bullet.dataItem.dataContext;\r\n angle = dataContext[rotationField];\r\n }\r\n if (!$type.isNumber(angle)) {\r\n angle = point.angle;\r\n }\r\n bullet.rotation = angle;\r\n };\r\n Object.defineProperty(FlowDiagramLink.prototype, \"startAngle\", {\r\n /**\r\n * @return Start angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startAngle\");\r\n },\r\n /**\r\n * [startAngle description]\r\n *\r\n * @todo Description\r\n * @param value Start angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramLink.prototype, \"endAngle\", {\r\n /**\r\n * @return End angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endAngle\");\r\n },\r\n /**\r\n * [endAngle description]\r\n *\r\n * @todo Description\r\n * @param value End angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramLink.prototype, \"colorMode\", {\r\n /**\r\n * Fill mode\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"colorMode\");\r\n },\r\n /**\r\n * Should link be filled with a solid color, color of from node, color of toNode or gradient between node colors.\r\n * Some of the links, like ChordLink does not support gradiens well.\r\n *\r\n * @param value Fill mode\r\n */\r\n set: function (value) {\r\n if (value == \"gradient\") {\r\n var color = this.fill;\r\n this.gradient.stops.clear();\r\n if (color instanceof Color) {\r\n this.gradient.addColor(color);\r\n this.gradient.addColor(color);\r\n }\r\n this.fill = this.gradient;\r\n this.stroke = this.gradient;\r\n }\r\n this.setPropertyValue(\"colorMode\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramLink.prototype, \"maskBullets\", {\r\n /**\r\n * @return mask bullets value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maskBullets\");\r\n },\r\n /**\r\n * Should link bullets be masked or not\r\n *\r\n * @param value\r\n * @default false\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"maskBullets\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramLink.prototype, \"tooltipLocation\", {\r\n /**\r\n * Tooltip location value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tooltipLocation\");\r\n },\r\n /**\r\n * Relative location of a tooltip.\r\n * @default 0.5\r\n *\r\n * @param value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tooltipLocation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds color steps in the link gradient.\r\n *\r\n * @param value Fill option\r\n */\r\n FlowDiagramLink.prototype.setFill = function (value) {\r\n _super.prototype.setFill.call(this, value);\r\n var gradient = this._gradient;\r\n if (gradient && value instanceof Color) {\r\n gradient.stops.clear();\r\n gradient.addColor(value);\r\n gradient.addColor(value);\r\n }\r\n };\r\n /**\r\n * Updates bounding box based on element dimension settings.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n FlowDiagramLink.prototype.measureElement = function () {\r\n };\r\n Object.defineProperty(FlowDiagramLink.prototype, \"bullets\", {\r\n /**\r\n * List of bullets\r\n *\r\n * @return [description]\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._bullets) {\r\n this._bullets = new ListTemplate(new Bullet());\r\n this._disposers.push(new ListDisposer(this._bullets));\r\n this._disposers.push(this._bullets.template);\r\n this._bullets.events.on(\"inserted\", function (event) {\r\n event.newValue.events.on(\"propertychanged\", function (event) {\r\n if (event.property == \"locationX\" || event.property == \"locationY\") {\r\n _this.positionBullet(event.target);\r\n }\r\n }, undefined, false);\r\n }, undefined, false);\r\n }\r\n return this._bullets;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies properties from another [[FlowDiagramLink]].\r\n *\r\n * @param source Source link\r\n */\r\n FlowDiagramLink.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.bullets.copyFrom(source.bullets);\r\n var middleLine = this.middleLine;\r\n if (middleLine) {\r\n if (middleLine instanceof Line && source.middleLine instanceof Line) {\r\n middleLine.copyFrom(source.middleLine);\r\n }\r\n if (middleLine instanceof Polyline && source.middleLine instanceof Polyline) {\r\n middleLine.copyFrom(source.middleLine);\r\n }\r\n }\r\n this.link.copyFrom(source.link);\r\n };\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Tooltip X (px)\r\n */\r\n FlowDiagramLink.prototype.getTooltipX = function () {\r\n if (this.middleLine) {\r\n return this.middleLine.positionToPoint(this.tooltipLocation).x;\r\n }\r\n };\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Tooltip Y (px)\r\n */\r\n FlowDiagramLink.prototype.getTooltipY = function () {\r\n if (this.middleLine) {\r\n return this.middleLine.positionToPoint(this.tooltipLocation).y;\r\n }\r\n };\r\n Object.defineProperty(FlowDiagramLink.prototype, \"gradient\", {\r\n /**\r\n * A gradiend instance that is used to provided colored gradient fills for\r\n * the Flow link.\r\n */\r\n get: function () {\r\n if (!this._gradient) {\r\n this._gradient = new LinearGradient();\r\n }\r\n return this._gradient;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return FlowDiagramLink;\r\n}(Container));\r\nexport { FlowDiagramLink };\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[\"FlowDiagramLink\"] = FlowDiagramLink;\r\n//# sourceMappingURL=FlowDiagramLink.js.map","/**\r\n * FlowDiagram module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Chart, ChartDataItem } from \"../Chart\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { DictionaryTemplate, DictionaryDisposer } from \"../../core/utils/Dictionary\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { FlowDiagramNode } from \"../elements/FlowDiagramNode\";\r\nimport { FlowDiagramLink } from \"../elements/FlowDiagramLink\";\r\nimport { LinearGradientModifier } from \"../../core/rendering/fills/LinearGradientModifier\";\r\nimport { ColorSet } from \"../../core/utils/ColorSet\";\r\nimport { toColor, Color } from \"../../core/utils/Color\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $number from \"../../core/utils/Number\";\r\nimport * as $order from \"../../core/utils/Order\";\r\nimport { Disposer } from \"../../core/utils/Disposer\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n//@todo rearange notes after dragged\r\n/**\r\n * Defines a [[DataItem]] for [[FlowDiagram]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar FlowDiagramDataItem = /** @class */ (function (_super) {\r\n __extends(FlowDiagramDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FlowDiagramDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"FlowDiagramDataItem\";\r\n _this.values.value = {};\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(FlowDiagramDataItem.prototype, \"fromName\", {\r\n /**\r\n * @return name\r\n */\r\n get: function () {\r\n return this.properties.fromName;\r\n },\r\n /**\r\n * Source node's name.\r\n *\r\n * @param value Name\r\n */\r\n set: function (value) {\r\n this.setProperty(\"fromName\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramDataItem.prototype, \"toName\", {\r\n /**\r\n * @return name\r\n */\r\n get: function () {\r\n return this.properties.toName;\r\n },\r\n /**\r\n * Destination node's name.\r\n *\r\n * @param value Name\r\n */\r\n set: function (value) {\r\n this.setProperty(\"toName\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramDataItem.prototype, \"color\", {\r\n /**\r\n * @return color\r\n */\r\n get: function () {\r\n return this.properties.color;\r\n },\r\n /**\r\n * Node color\r\n *\r\n * @param value Name\r\n */\r\n set: function (value) {\r\n this.setProperty(\"color\", toColor(value));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramDataItem.prototype, \"value\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.value.value;\r\n },\r\n /**\r\n * Link's value.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"value\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagramDataItem.prototype, \"link\", {\r\n /**\r\n * A visual element, representing link between the source and target nodes.\r\n *\r\n * Link's actual thickness will be determined by `value` of this link and\r\n * `value` of the source node.\r\n *\r\n * @readonly\r\n * @return Link element\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._link) {\r\n var link_1 = this.component.links.create();\r\n this._link = link_1;\r\n this.addSprite(link_1);\r\n this._disposers.push(new Disposer(function () {\r\n if (_this.component) {\r\n _this.component.links.removeValue(link_1);\r\n }\r\n }));\r\n }\r\n return this._link;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return FlowDiagramDataItem;\r\n}(ChartDataItem));\r\nexport { FlowDiagramDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a Pie chart\r\n * @see {@link IFlowDiagramEvents} for a list of available Events\r\n * @see {@link IFlowDiagramAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar FlowDiagram = /** @class */ (function (_super) {\r\n __extends(FlowDiagram, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FlowDiagram() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * A Color Set to use when applying/generating colors for each subsequent\r\n * node.\r\n */\r\n _this.colors = new ColorSet();\r\n _this.className = \"FlowDiagram\";\r\n _this.nodePadding = 20;\r\n _this.sortBy = \"none\";\r\n _this.sequencedInterpolation = true;\r\n _this.colors.step = 2;\r\n _this.minNodeSize = 0.02;\r\n var linksContainer = _this.chartContainer.createChild(Container);\r\n linksContainer.shouldClone = false;\r\n linksContainer.layout = \"none\";\r\n linksContainer.isMeasured = false;\r\n _this.linksContainer = linksContainer;\r\n var nodesContainer = _this.chartContainer.createChild(Container);\r\n nodesContainer.shouldClone = false;\r\n nodesContainer.layout = \"none\";\r\n nodesContainer.isMeasured = false;\r\n _this.nodesContainer = nodesContainer;\r\n // this data item holds sums, averages, etc\r\n _this.dataItem = _this.createDataItem();\r\n _this.dataItem.component = _this;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n FlowDiagram.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.dataItem.dispose();\r\n };\r\n /**\r\n * (Re)validates chart's data, effectively causing the chart to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n FlowDiagram.prototype.validateData = function () {\r\n var _this = this;\r\n if (this._parseDataFrom == 0) {\r\n this.nodes.clear();\r\n }\r\n this.sortNodes();\r\n this.colors.reset();\r\n _super.prototype.validateData.call(this);\r\n var sum = 0;\r\n var count = 0;\r\n var low;\r\n var high;\r\n // build blocks\r\n $iter.each(this.dataItems.iterator(), function (dataItem) {\r\n var fromName = dataItem.fromName;\r\n if (fromName) {\r\n var node = _this.nodes.getKey(fromName);\r\n if (!node) {\r\n node = _this.nodes.create(fromName);\r\n node.name = fromName;\r\n node.chart = _this;\r\n node.dataItem = dataItem;\r\n }\r\n dataItem.fromNode = node;\r\n dataItem.fromNode.outgoingDataItems.push(dataItem);\r\n }\r\n var toName = dataItem.toName;\r\n if (toName) {\r\n var node = _this.nodes.getKey(toName);\r\n if (!node) {\r\n node = _this.nodes.create(toName);\r\n node.name = toName;\r\n node.chart = _this;\r\n node.dataItem = dataItem;\r\n }\r\n dataItem.toNode = node;\r\n dataItem.toNode.incomingDataItems.push(dataItem);\r\n }\r\n if (!dataItem.fromNode) {\r\n var strokeModifier = new LinearGradientModifier();\r\n strokeModifier.opacities = [0, 1];\r\n dataItem.link.strokeModifier = strokeModifier;\r\n }\r\n if (!dataItem.toNode) {\r\n var fillModifier = new LinearGradientModifier();\r\n fillModifier.opacities = [1, 0];\r\n dataItem.link.strokeModifier = fillModifier;\r\n }\r\n var value = dataItem.value;\r\n if ($type.isNumber(value)) {\r\n sum += value;\r\n count++;\r\n if (low > value || !$type.isNumber(low)) {\r\n low = value;\r\n }\r\n if (high < value || !$type.isNumber(high)) {\r\n high = value;\r\n }\r\n }\r\n });\r\n var key = \"value\";\r\n this.dataItem.setCalculatedValue(key, high, \"high\");\r\n this.dataItem.setCalculatedValue(key, low, \"low\");\r\n this.dataItem.setCalculatedValue(key, sum, \"sum\");\r\n this.dataItem.setCalculatedValue(key, sum / count, \"average\");\r\n this.dataItem.setCalculatedValue(key, count, \"count\");\r\n $iter.each(this.nodes.iterator(), function (strNode) {\r\n var node = strNode[1];\r\n if (node.fill instanceof Color) {\r\n node.color = node.fill;\r\n }\r\n if (node.color == undefined) {\r\n node.color = _this.colors.next();\r\n }\r\n if (node.dataItem.color != undefined) {\r\n node.color = node.dataItem.color;\r\n }\r\n if (!node.dataItem.visible) {\r\n node.hide(0);\r\n }\r\n _this.getNodeValue(node);\r\n });\r\n this.sortNodes();\r\n this.feedLegend();\r\n };\r\n /**\r\n * [handleDataItemWorkingValueChange description]\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n FlowDiagram.prototype.handleDataItemWorkingValueChange = function (dataItem, name) {\r\n this.invalidate();\r\n };\r\n /**\r\n * Sorts nodes by either their values or names, based on `sortBy` setting.\r\n */\r\n FlowDiagram.prototype.sortNodes = function () {\r\n if (this.sortBy == \"name\") {\r\n this._sorted = this.nodes.sortedIterator();\r\n }\r\n else if (this.sortBy == \"value\") {\r\n this._sorted = $iter.sort(this.nodes.iterator(), function (x, y) { return $order.reverse($number.order(x[1].total, y[1].total)); });\r\n }\r\n else {\r\n this._sorted = this.nodes.iterator();\r\n }\r\n };\r\n /**\r\n * Updates a cummulative value of the node.\r\n *\r\n * A node's value is determined by summing values of all of the incoming\r\n * links or all of the outgoing links, whichever results in bigger number.\r\n *\r\n * @param node Node value\r\n */\r\n FlowDiagram.prototype.getNodeValue = function (node) {\r\n // todo: totalIncomming totalOutgoing, total\r\n var incomingTotal = 0;\r\n var outgoingTotal = 0;\r\n $iter.each(node.incomingDataItems.iterator(), function (dataItem) {\r\n var value = dataItem.getWorkingValue(\"value\");\r\n if ($type.isNumber(value)) {\r\n incomingTotal += value;\r\n }\r\n });\r\n $iter.each(node.outgoingDataItems.iterator(), function (dataItem) {\r\n var value = dataItem.getWorkingValue(\"value\");\r\n if ($type.isNumber(value)) {\r\n outgoingTotal += value;\r\n }\r\n });\r\n node.total = incomingTotal + outgoingTotal;\r\n node.totalIncoming = incomingTotal;\r\n node.totalOutgoing = outgoingTotal;\r\n };\r\n ;\r\n /**\r\n * Changes the sort type of the nodes.\r\n *\r\n * This will actually reshuffle nodes using nice animation.\r\n */\r\n FlowDiagram.prototype.changeSorting = function () {\r\n this.sortNodes();\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n FlowDiagram.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Flow diagram\");\r\n }\r\n };\r\n /**\r\n * Creates and returns a new data item.\r\n *\r\n * @return Data item\r\n */\r\n FlowDiagram.prototype.createDataItem = function () {\r\n return new FlowDiagramDataItem();\r\n };\r\n Object.defineProperty(FlowDiagram.prototype, \"nodePadding\", {\r\n /**\r\n * @return Padding (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"nodePadding\");\r\n },\r\n /**\r\n * Padding for node square in pixels.\r\n *\r\n * Padding will add extra space around node's name label.\r\n *\r\n * @param value Padding (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"nodePadding\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagram.prototype, \"sortBy\", {\r\n /**\r\n * @returns Node sorting\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"sortBy\");\r\n },\r\n /**\r\n * Sort nodes by \"name\" or \"value\" or do not sort at all. If not sorted, nodes will appear in the same order as they are in the data.\r\n * @default \"none\"\r\n * @param value Node sorting\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"sortBy\", value);\r\n this.changeSorting();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagram.prototype, \"minNodeSize\", {\r\n /**\r\n * @returns min node size\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"minNodeSize\");\r\n },\r\n /**\r\n * Sometimes nodes can get very small if their value is little. With this setting you\r\n * can set min size of a node (this is relative value from the total size of all nodes)\r\n * @default 0.02\r\n * @param value Node sorting\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"minNodeSize\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlowDiagram.prototype, \"nodes\", {\r\n /**\r\n * A list of chart's nodes.\r\n *\r\n * @param {DictionaryTemplate}\r\n */\r\n get: function () {\r\n if (!this._nodes) {\r\n var template = this.createNode();\r\n template.events.on(\"hit\", function (event) {\r\n event.target.handleHit(event);\r\n });\r\n this._nodes = new DictionaryTemplate(template);\r\n this._disposers.push(new DictionaryDisposer(this._nodes));\r\n }\r\n return this._nodes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n FlowDiagram.prototype.createNode = function () {\r\n var node = new FlowDiagramNode();\r\n this._disposers.push(node);\r\n return node;\r\n };\r\n Object.defineProperty(FlowDiagram.prototype, \"links\", {\r\n /**\r\n * A list of chart's links.\r\n *\r\n * @param {ListTemplate}\r\n */\r\n get: function () {\r\n if (!this._links) {\r\n this._links = new ListTemplate(this.createLink());\r\n this._disposers.push(new ListDisposer(this._links));\r\n }\r\n return this._links;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n FlowDiagram.prototype.createLink = function () {\r\n var link = new FlowDiagramLink();\r\n this._disposers.push(link);\r\n return link;\r\n };\r\n /**\r\n * Setups the legend to use the chart's data.\r\n * @ignore\r\n */\r\n FlowDiagram.prototype.feedLegend = function () {\r\n var legend = this.legend;\r\n if (legend) {\r\n var legendData_1 = [];\r\n this.nodes.each(function (key, node) {\r\n legendData_1.push(node);\r\n });\r\n legend.data = legendData_1;\r\n legend.dataFields.name = \"name\";\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n FlowDiagram.prototype.disposeData = function () {\r\n _super.prototype.disposeData.call(this);\r\n this.nodes.clear();\r\n };\r\n return FlowDiagram;\r\n}(Chart));\r\nexport { FlowDiagram };\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[\"FlowDiagram\"] = FlowDiagram;\r\n//# sourceMappingURL=FlowDiagram.js.map","/**\r\n * Bullet module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Bullet } from \"./Bullet\";\r\nimport { Label } from \"../../core/elements/Label\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { color } from \"../../core/utils/Color\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a bullet with a textual label.\r\n *\r\n * Uses [[Label]] instance to draw the label, so the label itself is\r\n * configurable.\r\n *\r\n * @see {@link IBulletEvents} for a list of available events\r\n * @see {@link IBulletAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar LabelBullet = /** @class */ (function (_super) {\r\n __extends(LabelBullet, _super);\r\n /**\r\n * Constructor\r\n */\r\n function LabelBullet() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"LabelBullet\";\r\n var label = _this.createChild(Label);\r\n label.shouldClone = false;\r\n label.verticalCenter = \"middle\";\r\n label.horizontalCenter = \"middle\";\r\n label.truncate = true;\r\n label.hideOversized = false;\r\n label.maxWidth = 500;\r\n label.maxHeight = 500;\r\n label.stroke = color();\r\n label.strokeOpacity = 0;\r\n label.fill = new InterfaceColorSet().getFor(\"text\");\r\n _this.events.on(\"maxsizechanged\", _this.handleMaxSize, _this, false);\r\n _this.label = label;\r\n // not good, as lineSeries will have labels somewhere in the middle.\r\n //this.locationX = 0.5;\r\n //this.locationY = 0.5;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n LabelBullet.prototype.handleMaxSize = function () {\r\n this.label.maxWidth = this.maxWidth;\r\n this.label.maxHeight = this.maxHeight;\r\n };\r\n /**\r\n * Copies all proprities and related stuff from another instance of\r\n * [[LabelBullet]].\r\n *\r\n * @param source Source element\r\n */\r\n LabelBullet.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.label.copyFrom(source.label);\r\n };\r\n return LabelBullet;\r\n}(Bullet));\r\nexport { LabelBullet };\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[\"LabelBullet\"] = LabelBullet;\r\n//# sourceMappingURL=LabelBullet.js.map","/**\r\n * SankeyNode module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { FlowDiagramNode } from \"./FlowDiagramNode\";\r\nimport { LabelBullet } from \"./LabelBullet\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a node in a Sankey Diagram.\r\n *\r\n * A Sankey node is a block with a value, which represents its size on the\r\n * diagram.\r\n *\r\n * Nodes are connected via [[SankeyLink]] elements.\r\n *\r\n * @see {@link ISankeyNodeEvents} for a list of available events\r\n * @see {@link ISankeyNodeAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar SankeyNode = /** @class */ (function (_super) {\r\n __extends(SankeyNode, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SankeyNode() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * [nextInCoord description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n _this.nextInCoord = 0;\r\n /**\r\n * [nextOutCoord description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n _this.nextOutCoord = 0;\r\n _this.className = \"SankeyNode\";\r\n _this.width = 10;\r\n _this.height = 10;\r\n var nameLabel = _this.createChild(LabelBullet);\r\n nameLabel.shouldClone = false;\r\n //@should we auto update these locations if position is changed?\r\n nameLabel.locationX = 1;\r\n nameLabel.locationY = 0.5;\r\n nameLabel.label.text = \"{name}\";\r\n //nameLabel.label.textElement.hideOversized = false;\r\n nameLabel.width = 150;\r\n nameLabel.height = 150;\r\n nameLabel.label.horizontalCenter = \"left\";\r\n nameLabel.label.padding(0, 5, 0, 5);\r\n _this.nameLabel = nameLabel;\r\n var valueLabel = _this.createChild(LabelBullet);\r\n valueLabel.shouldClone = false;\r\n valueLabel.label.hideOversized = false;\r\n valueLabel.locationX = 0.5;\r\n valueLabel.locationY = 0.5;\r\n valueLabel.width = 150;\r\n valueLabel.height = 150;\r\n //valueLabel.label.text = \"{value}\";\r\n valueLabel.label.horizontalCenter = \"middle\";\r\n _this.valueLabel = valueLabel;\r\n var hiddenState = _this.hiddenState;\r\n hiddenState.properties.fill = new InterfaceColorSet().getFor(\"disabledBackground\");\r\n hiddenState.properties.opacity = 0.5;\r\n hiddenState.properties.visible = true;\r\n _this.background.hiddenState.copyFrom(hiddenState);\r\n return _this;\r\n }\r\n /**\r\n * Invalidates all links, attached to this node.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n SankeyNode.prototype.invalidateLinks = function () {\r\n var _this = this;\r\n _super.prototype.invalidateLinks.call(this);\r\n this.nextInCoord = 0;\r\n this.nextOutCoord = 0;\r\n var chart = this.chart;\r\n if (chart) {\r\n var orientation_1 = chart.orientation;\r\n if (this._incomingSorted) {\r\n $iter.each(this._incomingSorted, function (dataItem) {\r\n var link = dataItem.link;\r\n var value = dataItem.getWorkingValue(\"value\");\r\n if ($type.isNumber(value)) {\r\n link.parent = _this.chart.linksContainer;\r\n var x = void 0;\r\n var y = void 0;\r\n var angle = void 0;\r\n if (orientation_1 == \"horizontal\") {\r\n x = _this.pixelX + _this.dx;\r\n y = _this.nextInCoord + _this.pixelY + _this.dy;\r\n angle = 0;\r\n }\r\n else {\r\n y = _this.pixelY + _this.dy;\r\n x = _this.nextInCoord + _this.pixelX + _this.dx;\r\n angle = 90;\r\n }\r\n link.endX = x;\r\n link.endY = y;\r\n link.startAngle = angle;\r\n link.endAngle = angle;\r\n link.gradient.rotation = angle;\r\n link.linkWidth = value * chart.valueHeight;\r\n if (!dataItem.fromNode) {\r\n if (orientation_1 == \"horizontal\") {\r\n link.maxWidth = 200;\r\n link.startX = _this.pixelX + _this.dx - link.maxWidth;\r\n link.startY = link.endY;\r\n }\r\n else {\r\n link.maxHeight = 200;\r\n link.startX = link.endX;\r\n link.startY = _this.pixelY + _this.dy - link.maxHeight;\r\n }\r\n // TODO is this needed ?\r\n $utils.used(link.gradient);\r\n link.fill = dataItem.toNode.color;\r\n var stop_1 = link.gradient.stops.getIndex(0);\r\n if (stop_1) {\r\n if (link.colorMode == \"gradient\") {\r\n stop_1.color = _this.color;\r\n }\r\n stop_1.opacity = 0;\r\n link.fill = link.gradient;\r\n link.stroke = link.gradient;\r\n link.gradient.validate();\r\n }\r\n }\r\n //link.validate();\r\n _this.nextInCoord += link.linkWidth;\r\n }\r\n });\r\n }\r\n if (this._outgoingSorted) {\r\n $iter.each(this._outgoingSorted, function (dataItem) {\r\n var link = dataItem.link;\r\n link.parent = _this.chart.linksContainer;\r\n var value = dataItem.getWorkingValue(\"value\");\r\n if ($type.isNumber(value)) {\r\n var x = void 0;\r\n var y = void 0;\r\n var angle = void 0;\r\n if (orientation_1 == \"horizontal\") {\r\n angle = 0;\r\n x = _this.pixelX + _this.pixelWidth + _this.dx - 1;\r\n y = _this.nextOutCoord + _this.pixelY + _this.dy;\r\n }\r\n else {\r\n angle = 90;\r\n x = _this.nextOutCoord + _this.pixelX + _this.dx;\r\n y = _this.pixelY + _this.pixelHeight + _this.dy - 1;\r\n }\r\n link.startX = x;\r\n link.startY = y;\r\n link.startAngle = angle;\r\n link.endAngle = angle;\r\n link.gradient.rotation = angle;\r\n link.linkWidth = value * _this.chart.valueHeight;\r\n if (!dataItem.toNode) {\r\n if (orientation_1 == \"horizontal\") {\r\n link.maxWidth = 200;\r\n link.endX = _this.pixelX + link.maxWidth + _this.dx;\r\n link.endY = link.startY;\r\n }\r\n else {\r\n link.maxHeight = 200;\r\n link.endX = link.startX;\r\n link.endY = _this.pixelY + link.maxHeight + _this.dy;\r\n }\r\n link.opacity = _this.opacity;\r\n var stop_2 = link.gradient.stops.getIndex(1);\r\n if (stop_2) {\r\n if (link.colorMode == \"gradient\") {\r\n stop_2.color = _this.color;\r\n }\r\n stop_2.opacity = 0;\r\n link.fill = link.gradient;\r\n link.stroke = link.gradient;\r\n link.gradient.validate();\r\n }\r\n }\r\n //link.validate();\r\n _this.nextOutCoord += link.linkWidth;\r\n }\r\n });\r\n }\r\n }\r\n this.positionBullet(this.nameLabel);\r\n this.positionBullet(this.valueLabel);\r\n };\r\n /**\r\n * Positions the bullet so it is centered within the node element.\r\n *\r\n * @param bullet Target bullet\r\n */\r\n SankeyNode.prototype.positionBullet = function (bullet) {\r\n if (bullet) {\r\n bullet.x = this.measuredWidth * bullet.locationX;\r\n bullet.y = this.measuredHeight * bullet.locationY;\r\n }\r\n };\r\n Object.defineProperty(SankeyNode.prototype, \"level\", {\r\n /**\r\n * @return Level\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"level\");\r\n },\r\n /**\r\n * A level node is displayed at. (0 - ...)\r\n *\r\n * Levels are measured from left to right.\r\n *\r\n * The nodes in the left-most column will have `level = 0`.\r\n *\r\n * Nodes in second column - `level = 1`, etc.\r\n *\r\n * @param value Level\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"level\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies properties and labels from another [[SankeyNode]].\r\n *\r\n * @param source Source node\r\n */\r\n SankeyNode.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.nameLabel.copyFrom(source.nameLabel);\r\n this.valueLabel.copyFrom(source.valueLabel);\r\n };\r\n return SankeyNode;\r\n}(FlowDiagramNode));\r\nexport { SankeyNode };\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[\"SankeyNode\"] = SankeyNode;\r\n//# sourceMappingURL=SankeyNode.js.map","/**\r\n * SankeyLink module\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport { FlowDiagramLink } from \"./FlowDiagramLink\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { Polyspline } from \"../../core/elements/Polyspline\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $smoothing from \"../../core/rendering/Smoothing\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This class creates a link (waved color-filled line) between two nodes in a\r\n * Sankey Diagram.\r\n *\r\n * @see {@link ISankeyLinkEvents} for a list of available events\r\n * @see {@link ISankeyLinkAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar SankeyLink = /** @class */ (function (_super) {\r\n __extends(SankeyLink, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SankeyLink() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"SankeyLink\";\r\n // TODO can this be removed ?\r\n new InterfaceColorSet();\r\n _this.tension = 0.8;\r\n _this.controlPointDistance = 0.2;\r\n _this.startAngle = 0;\r\n _this.endAngle = 0;\r\n _this.linkWidth = 0;\r\n _this.startX = 0;\r\n _this.endX = 0;\r\n _this.startY = 0;\r\n _this.endY = 0;\r\n _this.middleLine = _this.createChild(Polyspline);\r\n _this.middleLine.shouldClone = false;\r\n _this.middleLine.strokeOpacity = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * (Re)validates (redraws) the link.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n SankeyLink.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n if (!this.isTemplate) {\r\n var x0 = this.startX;\r\n var y0 = this.startY;\r\n var x1 = this.endX;\r\n var y1 = this.endY;\r\n if (!$type.isNumber(x1)) {\r\n x1 = x0;\r\n }\r\n if (!$type.isNumber(y1)) {\r\n y1 = y0;\r\n }\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n var w = this.linkWidth;\r\n var path = \"\";\r\n var xt0 = x0;\r\n var yt0 = y0;\r\n var xt1 = x1;\r\n var yt1 = y1;\r\n var xb0 = x0 + w * $math.sin(startAngle);\r\n var xb1 = x1 + w * $math.sin(endAngle);\r\n var yb0 = y0 + w * $math.cos(startAngle);\r\n var yb1 = y1 + w * $math.cos(endAngle);\r\n var xm0 = x0 + w / 2 * $math.sin(startAngle);\r\n var xm1 = x1 + w / 2 * $math.sin(endAngle);\r\n var ym0 = y0 + w / 2 * $math.cos(startAngle);\r\n var ym1 = y1 + w / 2 * $math.cos(endAngle);\r\n this.zIndex = this.zIndex || this.dataItem.index;\r\n var tensionX = this.tension + (1 - this.tension) * $math.sin(startAngle);\r\n var tensionY = this.tension + (1 - this.tension) * $math.cos(startAngle);\r\n this.middleLine.tensionX = tensionX;\r\n this.middleLine.tensionY = tensionY;\r\n if ($type.isNumber(w) && ($type.isNumber(x0) && $type.isNumber(x1) && $type.isNumber(y0) && $type.isNumber(y1))) {\r\n // solves issues with gradient fill of straight lines\r\n if ($math.round(xt0, 3) == $math.round(xt1, 3)) {\r\n xt1 += 0.01;\r\n }\r\n if ($math.round(yt0, 3) == $math.round(yt1, 3)) {\r\n yt1 += 0.01;\r\n }\r\n if ($math.round(xb0, 3) == $math.round(xb1, 3)) {\r\n xb1 += 0.01;\r\n }\r\n if ($math.round(yb0, 3) == $math.round(yb1, 3)) {\r\n yb1 += 0.01;\r\n }\r\n var minX = Math.min(xb0, xb1, xt0, xt1);\r\n var minY = Math.min(yb0, yb1, yt0, yt1);\r\n var maxX = Math.max(xb0, xb1, xt0, xt1);\r\n var maxY = Math.max(yb0, yb1, yt0, yt1);\r\n this._bbox = {\r\n x: minX,\r\n y: minY,\r\n width: maxX - minX,\r\n height: maxY - minY\r\n };\r\n var cpd = this.controlPointDistance;\r\n var kxt0 = xt0 + (xt1 - xt0) * cpd * $math.cos(startAngle);\r\n var kyt0 = yt0 + (yt1 - yt0) * cpd * $math.sin(startAngle);\r\n var kxt1 = xt1 - (xt1 - xt0) * cpd * $math.cos(endAngle);\r\n var kyt1 = yt1 - (yt1 - yt0) * cpd * $math.sin(endAngle);\r\n var kxm0 = xm0 + (xm1 - xm0) * cpd * $math.cos(startAngle);\r\n var kym0 = ym0 + (ym1 - ym0) * cpd * $math.sin(startAngle);\r\n var kxm1 = xm1 - (xm1 - xm0) * cpd * $math.cos(endAngle);\r\n var kym1 = ym1 - (ym1 - ym0) * cpd * $math.sin(endAngle);\r\n var angle = $math.getAngle({ x: kxt0, y: kyt0 }, { x: kxt1, y: kyt1 });\r\n var dx = (w / $math.cos(angle) - w) / $math.tan(angle) * $math.cos(startAngle);\r\n var dy = (w / $math.sin(angle) - w) * $math.tan(angle) * $math.sin(startAngle);\r\n var kxb0 = -dx / 2 + xb0 + (xb1 - xb0) * cpd * $math.cos(startAngle);\r\n var kyb0 = -dy / 2 + yb0 + (yb1 - yb0) * cpd * $math.sin(startAngle);\r\n var kxb1 = -dx / 2 + xb1 - (xb1 - xb0) * cpd * $math.cos(endAngle);\r\n var kyb1 = -dy / 2 + yb1 - (yb1 - yb0) * cpd * $math.sin(endAngle);\r\n this.middleLine.segments = [[{ x: xm0, y: ym0 }, { x: kxm0, y: kym0 }, { x: kxm1, y: kym1 }, { x: xm1, y: ym1 }]];\r\n kxt0 += dx / 2;\r\n kyt0 += dy / 2;\r\n kxt1 += dx / 2;\r\n kyt1 += dy / 2;\r\n path += $path.moveTo({ x: xt0, y: yt0 });\r\n path += new $smoothing.Tension(tensionX, tensionY).smooth([{ x: xt0, y: yt0 }, { x: kxt0, y: kyt0 }, { x: kxt1, y: kyt1 }, { x: xt1, y: yt1 }]);\r\n path += $path.lineTo({ x: xb1, y: yb1 });\r\n path += new $smoothing.Tension(tensionX, tensionY).smooth([{ x: xb1, y: yb1 }, { x: kxb1, y: kyb1 }, { x: kxb0, y: kyb0 }, { x: xb0, y: yb0 }]);\r\n path += $path.closePath();\r\n }\r\n this.link.path = path;\r\n if (this.maskBullets) {\r\n this.bulletsMask.path = path;\r\n this.bulletsContainer.mask = this.bulletsMask;\r\n }\r\n this.positionBullets();\r\n }\r\n };\r\n Object.defineProperty(SankeyLink.prototype, \"startX\", {\r\n /**\r\n * @return Start X\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startX\");\r\n },\r\n /**\r\n * [startX description]\r\n *\r\n * @todo Description\r\n * @param value Start X\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startX\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SankeyLink.prototype, \"endX\", {\r\n /**\r\n * @return End X\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endX\");\r\n },\r\n /**\r\n * [endX description]\r\n *\r\n * @todo Description\r\n * @param value End X\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endX\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SankeyLink.prototype, \"startY\", {\r\n /**\r\n * @return Start Y\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startY\");\r\n },\r\n /**\r\n * [startY description]\r\n *\r\n * @todo Description\r\n * @param value Start Y\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startY\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SankeyLink.prototype, \"endY\", {\r\n /**\r\n * @return End Y\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endY\");\r\n },\r\n /**\r\n * [endY description]\r\n *\r\n * @todo Description\r\n * @param value End Y\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endY\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SankeyLink.prototype, \"linkWidth\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"linkWidth\");\r\n },\r\n /**\r\n * [linkWidth description]\r\n *\r\n * @todo Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"linkWidth\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SankeyLink.prototype, \"controlPointDistance\", {\r\n /**\r\n * @return relative control point distance\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"controlPointDistance\");\r\n },\r\n /**\r\n * Distance of control point of a link, defines relative distance from a node at which linke should bend\r\n * @default 0.2\r\n * @param value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"controlPointDistance\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SankeyLink.prototype, \"tension\", {\r\n /**\r\n * @return tension value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tension\");\r\n },\r\n /**\r\n * Tension of a spline, 1 would make the link to have sharp edges\r\n * @default 0.8\r\n * @param value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tension\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return SankeyLink;\r\n}(FlowDiagramLink));\r\nexport { SankeyLink };\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[\"SankeyLink\"] = SankeyLink;\r\n//# sourceMappingURL=SankeyLink.js.map","/**\r\n * Sankey diagram module.\r\n */\r\nimport { __extends, __read, __spread } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { FlowDiagram, FlowDiagramDataItem } from \"./FlowDiagram\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { SankeyNode } from \"../elements/SankeyNode\";\r\nimport { SankeyLink } from \"../elements/SankeyLink\";\r\nimport { Animation } from \"../../core/utils/Animation\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $object from \"../../core/utils/Object\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n//@todo rearange notes after dragged\r\n/**\r\n * Defines a [[DataItem]] for [[SankeyDiagram]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar SankeyDiagramDataItem = /** @class */ (function (_super) {\r\n __extends(SankeyDiagramDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SankeyDiagramDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"SankeyDiagramDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return SankeyDiagramDataItem;\r\n}(FlowDiagramDataItem));\r\nexport { SankeyDiagramDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a Sankey Diagram chart.\r\n *\r\n * @see {@link ISankeyDiagramEvents} for a list of available Events\r\n * @see {@link ISankeyDiagramAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/sankey-diagram/} for documentation\r\n * @important\r\n */\r\nvar SankeyDiagram = /** @class */ (function (_super) {\r\n __extends(SankeyDiagram, _super);\r\n /**\r\n * Constructor\r\n */\r\n function SankeyDiagram() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"SankeyDiagram\";\r\n _this.orientation = \"horizontal\";\r\n _this.nodeAlign = \"middle\";\r\n _this.nodesContainer.width = percent(100);\r\n _this.nodesContainer.height = percent(100);\r\n _this.linksContainer.width = percent(100);\r\n _this.linksContainer.height = percent(100);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * (Re)validates chart's data, effectively causing the chart to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n SankeyDiagram.prototype.validateData = function () {\r\n var _this = this;\r\n _super.prototype.validateData.call(this);\r\n this._levelCount = 0;\r\n this.nodes.each(function (key, node) {\r\n node.level = undefined;\r\n });\r\n this.nodes.each(function (key, node) {\r\n node.level = _this.getNodeLevel(node, 0);\r\n _this._levelCount = $math.max(_this._levelCount, node.level);\r\n });\r\n };\r\n /**\r\n * Returns node's highest level.\r\n *\r\n * @param node Node\r\n * @param level Current level\r\n * @return New level\r\n */\r\n SankeyDiagram.prototype.getNodeLevel = function (node, level) {\r\n var _this = this;\r\n //@todo solve circular so\r\n var levels = [level];\r\n $iter.each(node.incomingDataItems.iterator(), function (link) {\r\n if (link.fromNode) {\r\n if ($type.isNumber(link.fromNode.level)) {\r\n levels.push(link.fromNode.level + 1);\r\n }\r\n else {\r\n levels.push(_this.getNodeLevel(link.fromNode, level + 1));\r\n }\r\n }\r\n });\r\n return Math.max.apply(Math, __spread(levels));\r\n };\r\n /**\r\n * Calculates relation between pixel height and total value.\r\n *\r\n * In Sankey the actual thickness of links and height of nodes will depend\r\n * on their values.\r\n */\r\n SankeyDiagram.prototype.calculateValueHeight = function () {\r\n var _this = this;\r\n // calculate sums of each level\r\n this._levelSum = {};\r\n this._levelNodesCount = {};\r\n this.maxSum = 0;\r\n var total = this.dataItem.values.value.sum;\r\n $iter.each(this._sorted, function (strNode) {\r\n var node = strNode[1];\r\n _this.getNodeValue(node);\r\n });\r\n this.nodes.each(function (key, node) {\r\n var level = node.level;\r\n var value = Math.max(node.totalIncoming, node.totalOutgoing);\r\n if (value / total < _this.minNodeSize) {\r\n value = total * _this.minNodeSize;\r\n }\r\n if ($type.isNumber(_this._levelSum[level])) {\r\n _this._levelSum[level] += value;\r\n }\r\n else {\r\n _this._levelSum[level] = value;\r\n }\r\n if ($type.isNumber(_this._levelNodesCount[level])) {\r\n _this._levelNodesCount[level]++;\r\n }\r\n else {\r\n _this._levelNodesCount[level] = 1;\r\n }\r\n });\r\n var availableHeight;\r\n if (this.orientation == \"horizontal\") {\r\n availableHeight = this.chartContainer.maxHeight - 1;\r\n }\r\n else {\r\n availableHeight = this.chartContainer.maxWidth - 1;\r\n }\r\n var maxSumLevel;\r\n var minHeight;\r\n $object.each(this._levelSum, function (key, value) {\r\n var realValue = value;\r\n var levelNodeCount = _this._levelNodesCount[key];\r\n var valueHeight = (availableHeight - (levelNodeCount - 1) * _this.nodePadding) / realValue;\r\n if (valueHeight == Infinity) {\r\n valueHeight = 0;\r\n }\r\n if (minHeight > valueHeight || !$type.isNumber(minHeight)) {\r\n minHeight = valueHeight;\r\n _this.maxSum = realValue;\r\n maxSumLevel = $type.toNumber(key);\r\n }\r\n });\r\n this._maxSumLevel = maxSumLevel;\r\n var maxSumLevelNodeCount = this._levelNodesCount[this._maxSumLevel];\r\n var valueHeight = (availableHeight - (maxSumLevelNodeCount - 1) * this.nodePadding) / this.maxSum;\r\n if (valueHeight == Infinity) {\r\n valueHeight = 0;\r\n }\r\n if (!$type.isNumber(this.valueHeight)) {\r\n this.valueHeight = valueHeight;\r\n }\r\n else {\r\n var finalHeight = void 0;\r\n try {\r\n finalHeight = this._heightAnimation.animationOptions[0].to;\r\n }\r\n catch (err) {\r\n }\r\n // without animations it will be non-smooth as maxValue jumps from one column to another\r\n if (finalHeight != valueHeight) {\r\n var duration = this.interpolationDuration;\r\n try {\r\n duration = this.nodes.template.states.getKey(\"active\").transitionDuration;\r\n }\r\n catch (err) {\r\n }\r\n this._heightAnimation = new Animation(this, { property: \"valueHeight\", from: this.valueHeight, to: valueHeight }, duration, this.interpolationEasing).start();\r\n this._disposers.push(this._heightAnimation);\r\n }\r\n }\r\n };\r\n /**\r\n * Redraws the chart.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n SankeyDiagram.prototype.validate = function () {\r\n var _this = this;\r\n _super.prototype.validate.call(this);\r\n this.calculateValueHeight();\r\n var container = this.nodesContainer;\r\n var nextCoordinate = {};\r\n var maxSumLevelNodeCount = this._levelNodesCount[this._maxSumLevel];\r\n var total = this.dataItem.values.value.sum;\r\n $iter.each(this._sorted, function (strNode) {\r\n var node = strNode[1];\r\n var level = node.level;\r\n var levelCoordinate = 0;\r\n var nodeCount = _this._levelNodesCount[level];\r\n switch (_this.nodeAlign) {\r\n case \"bottom\":\r\n levelCoordinate = (_this.maxSum - _this._levelSum[level]) * _this.valueHeight - (nodeCount - maxSumLevelNodeCount) * _this.nodePadding;\r\n break;\r\n case \"middle\":\r\n levelCoordinate = (_this.maxSum - _this._levelSum[level]) * _this.valueHeight / 2 - (nodeCount - maxSumLevelNodeCount) * _this.nodePadding / 2;\r\n break;\r\n }\r\n node.parent = container;\r\n var delta;\r\n var x;\r\n var y;\r\n var value = Math.max(node.totalIncoming, node.totalOutgoing);\r\n if (value / total < _this.minNodeSize) {\r\n value = total * _this.minNodeSize;\r\n }\r\n if (_this.orientation == \"horizontal\") {\r\n delta = (_this.innerWidth - node.pixelWidth) / _this._levelCount;\r\n x = delta * node.level;\r\n y = nextCoordinate[level] || levelCoordinate;\r\n var h = value * _this.valueHeight;\r\n node.height = h;\r\n node.minX = x;\r\n node.maxX = x;\r\n nextCoordinate[level] = y + h + _this.nodePadding;\r\n }\r\n else {\r\n delta = (_this.innerHeight - node.pixelHeight) / _this._levelCount;\r\n x = nextCoordinate[level] || levelCoordinate;\r\n y = delta * node.level;\r\n var w = value * _this.valueHeight;\r\n node.width = w;\r\n node.minY = y;\r\n node.maxY = y;\r\n nextCoordinate[level] = x + w + _this.nodePadding;\r\n }\r\n node.x = x;\r\n node.y = y;\r\n });\r\n };\r\n /**\r\n * Performs actual operations to reveal this element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param duration Fade in duration (ms)\r\n * @return Fade in duration (ms)\r\n */\r\n SankeyDiagram.prototype.showReal = function (duration) {\r\n var _this = this;\r\n if (this.preventShow) {\r\n return;\r\n }\r\n if (this.interpolationDuration > 0) {\r\n var container_1 = this.nodesContainer;\r\n var i_1 = 0;\r\n $iter.each(this.links.iterator(), function (link) {\r\n link.hide(0);\r\n });\r\n $iter.each(this._sorted, function (strNode) {\r\n var node = strNode[1];\r\n var property;\r\n if (_this.orientation == \"horizontal\") {\r\n node.dx = -(container_1.pixelWidth - node.pixelWidth) / Math.max(_this._levelCount, 1);\r\n property = \"dx\";\r\n }\r\n else {\r\n node.dy = -(container_1.pixelHeight - node.pixelHeight) / Math.max(_this._levelCount, 1);\r\n property = \"dy\";\r\n }\r\n var delay = 0;\r\n var duration = _this.interpolationDuration;\r\n if (_this.sequencedInterpolation) {\r\n delay = _this.sequencedInterpolationDelay * i_1 + duration * i_1 / $iter.length(_this.nodes.iterator());\r\n }\r\n node.opacity = 0;\r\n node.invalidateLinks();\r\n node.animate([{ property: \"opacity\", from: 0, to: 1 }, { property: property, to: 0 }], _this.interpolationDuration, _this.interpolationEasing).delay(delay);\r\n $iter.each(node.outgoingDataItems.iterator(), function (dataItem) {\r\n var animation = dataItem.link.show(_this.interpolationDuration);\r\n if (animation && !animation.isFinished()) {\r\n animation.delay(delay);\r\n }\r\n });\r\n $iter.each(node.incomingDataItems.iterator(), function (dataItem) {\r\n if (!dataItem.fromNode) {\r\n var animation = dataItem.link.show(_this.interpolationDuration);\r\n if (animation && !animation.isFinished()) {\r\n animation.delay(delay);\r\n }\r\n }\r\n });\r\n i_1++;\r\n });\r\n }\r\n return _super.prototype.showReal.call(this);\r\n };\r\n /**\r\n * Changes the sort type of the nodes.\r\n *\r\n * This will actually reshuffle nodes using nice animation.\r\n */\r\n SankeyDiagram.prototype.changeSorting = function () {\r\n var _this = this;\r\n this.sortNodes();\r\n var nextCoordinate = {};\r\n $iter.each(this._sorted, function (strNode) {\r\n var node = strNode[1];\r\n var level = node.level;\r\n var levelCoordinate = (_this.maxSum - _this._levelSum[level]) * _this.valueHeight / 2;\r\n var property;\r\n var nodeHeight;\r\n if (_this.orientation == \"horizontal\") {\r\n property = \"y\";\r\n nodeHeight = node.pixelHeight;\r\n }\r\n else {\r\n property = \"x\";\r\n nodeHeight = node.pixelWidth;\r\n }\r\n node.animate({ property: property, to: nextCoordinate[level] || levelCoordinate }, _this.interpolationDuration, _this.interpolationEasing);\r\n nextCoordinate[level] = (nextCoordinate[level] || levelCoordinate) + nodeHeight + _this.nodePadding;\r\n node.invalidateLinks();\r\n });\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n SankeyDiagram.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Sankey diagram\");\r\n }\r\n };\r\n /**\r\n * Creates and returns a new data item.\r\n *\r\n * @return Data item\r\n */\r\n SankeyDiagram.prototype.createDataItem = function () {\r\n return new SankeyDiagramDataItem();\r\n };\r\n Object.defineProperty(SankeyDiagram.prototype, \"nodeAlign\", {\r\n /**\r\n * @returns Returns nodeAlign value\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"nodeAlign\");\r\n },\r\n /**\r\n * How to align nodes. In case layout is vertical, top means left and bottom means right\r\n *\r\n * @param value Node sorting\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"nodeAlign\", value);\r\n this.changeSorting();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SankeyDiagram.prototype, \"orientation\", {\r\n /**\r\n * @return Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"orientation\");\r\n },\r\n /**\r\n * Orientation of the chart: \"horizontal\" or \"vertical\";\r\n *\r\n * @param value Orientation\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"orientation\", value, true);\r\n var nameLabel = this.nodes.template.nameLabel;\r\n if (value == \"vertical\") {\r\n this.nodes.template.width = undefined;\r\n nameLabel.label.horizontalCenter = \"middle\";\r\n nameLabel.locationX = 0.5;\r\n }\r\n else {\r\n this.nodes.template.height = undefined;\r\n nameLabel.label.horizontalCenter = \"left\";\r\n nameLabel.locationX = 1;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n SankeyDiagram.prototype.createNode = function () {\r\n var node = new SankeyNode();\r\n this._disposers.push(node);\r\n return node;\r\n };\r\n /**\r\n * @ignore\r\n */\r\n SankeyDiagram.prototype.createLink = function () {\r\n var link = new SankeyLink();\r\n this._disposers.push(link);\r\n return link;\r\n };\r\n Object.defineProperty(SankeyDiagram.prototype, \"valueHeight\", {\r\n /**\r\n * @ignore\r\n */\r\n get: function () {\r\n return this._valueHeight;\r\n },\r\n /**\r\n * @ignore\r\n */\r\n set: function (value) {\r\n if (value != this._valueHeight) {\r\n this._valueHeight = value;\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n SankeyDiagram.prototype.disposeData = function () {\r\n _super.prototype.disposeData.call(this);\r\n this._sorted = this.nodes.iterator();\r\n };\r\n return SankeyDiagram;\r\n}(FlowDiagram));\r\nexport { SankeyDiagram };\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[\"SankeyDiagram\"] = SankeyDiagram;\r\n//# sourceMappingURL=SankeyDiagram.js.map","/**\r\n * ChordNode module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { FlowDiagramNode } from \"./FlowDiagramNode\";\r\nimport { AxisLabelCircular } from \"../axes/AxisLabelCircular\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { Slice } from \"../../core/elements/Slice\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { Bullet } from \"../elements/Bullet\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a node in a Chord Diagram.\r\n *\r\n * A Chord node is a block with a value, which represents its size on the\r\n * diagram.\r\n *\r\n * Nodes are connected via [[ChordLink]] elements.\r\n *\r\n * @see {@link IChordNodeEvents} for a list of available events\r\n * @see {@link IChordNodeAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar ChordNode = /** @class */ (function (_super) {\r\n __extends(ChordNode, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ChordNode() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ChordNode\";\r\n var label = _this.createChild(AxisLabelCircular);\r\n label.location = 0.5;\r\n label.radius = 5;\r\n label.text = \"{name}\";\r\n label.zIndex = 1;\r\n label.shouldClone = false;\r\n _this.label = label;\r\n _this.layout = \"none\";\r\n _this.events.on(\"positionchanged\", _this.updateRotation, _this, false);\r\n _this.isMeasured = false;\r\n _this.slice = _this.createChild(Slice);\r\n _this.slice.isMeasured = false;\r\n var hiddenState = _this.hiddenState;\r\n hiddenState.properties.fill = new InterfaceColorSet().getFor(\"disabledBackground\");\r\n hiddenState.properties.opacity = 0.5;\r\n hiddenState.properties.visible = true;\r\n _this.setStateOnChildren = false;\r\n _this.slice.hiddenState.properties.visible = true;\r\n _this.adapter.add(\"tooltipX\", function (tooltipX, target) {\r\n return target.slice.ix * (target.slice.radius - (target.slice.radius - target.slice.pixelInnerRadius) / 2);\r\n });\r\n _this.adapter.add(\"tooltipY\", function (tooltipY, target) {\r\n return target.slice.iy * (target.slice.radius - (target.slice.radius - target.slice.pixelInnerRadius) / 2);\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Invalidates all links, attached to this node.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ChordNode.prototype.invalidateLinks = function () {\r\n var _this = this;\r\n _super.prototype.invalidateLinks.call(this);\r\n var label = this.label;\r\n var slice = this.slice;\r\n var chart = this.chart;\r\n if (chart && slice) {\r\n var sum = this.total;\r\n var arc_1 = slice.arc;\r\n var sliceStartAngle_1 = slice.startAngle;\r\n this.children.each(function (child) {\r\n if (child instanceof Bullet) {\r\n var locationX = child.locationX;\r\n if (!$type.isNumber(locationX)) {\r\n locationX = 0.5;\r\n }\r\n var locationY = child.locationY;\r\n if (!$type.isNumber(locationY)) {\r\n locationY = 1;\r\n }\r\n var childAngle = sliceStartAngle_1 + arc_1 * locationX;\r\n var childRadius = locationY * slice.radius;\r\n child.x = childRadius * $math.cos(childAngle);\r\n child.y = childRadius * $math.sin(childAngle);\r\n }\r\n });\r\n var labelAngle = sliceStartAngle_1 + arc_1 * label.location;\r\n var startAngle = sliceStartAngle_1 + (1 - sum / this.adjustedTotal) * arc_1 * 0.5; // if value of a node is > then sum of the links, add to center link\r\n if ($type.isNaN(startAngle)) {\r\n startAngle = sliceStartAngle_1;\r\n }\r\n label.fixPosition(labelAngle, slice.radius);\r\n this.nextAngle = startAngle;\r\n if (this._outgoingSorted) {\r\n $iter.each(this._outgoingSorted, function (dataItem) {\r\n var link = dataItem.link;\r\n link.parent = _this.chart.linksContainer;\r\n var value = dataItem.getWorkingValue(\"value\");\r\n if ($type.isNumber(value)) {\r\n if (chart.nonRibbon) {\r\n var percentWidth = link.percentWidth;\r\n if (!$type.isNumber(percentWidth)) {\r\n percentWidth = 5;\r\n }\r\n percentWidth = percentWidth / 100;\r\n link.startAngle = sliceStartAngle_1 + arc_1 / 2 - arc_1 / 2 * percentWidth;\r\n link.arc = arc_1 * percentWidth;\r\n }\r\n else {\r\n link.arc = value * chart.valueAngle;\r\n link.startAngle = _this.nextAngle;\r\n _this.nextAngle += link.arc;\r\n }\r\n if (!dataItem.toNode) {\r\n link.endAngle = link.startAngle;\r\n }\r\n link.radius = slice.pixelInnerRadius;\r\n }\r\n //link.validate();\r\n });\r\n }\r\n if (this._incomingSorted) {\r\n $iter.each(this._incomingSorted, function (dataItem) {\r\n var link = dataItem.link;\r\n link.radius = slice.pixelInnerRadius;\r\n if (chart.nonRibbon) {\r\n var percentWidth = link.percentWidth;\r\n if (!$type.isNumber(percentWidth)) {\r\n percentWidth = 5;\r\n }\r\n percentWidth = percentWidth / 100;\r\n link.endAngle = sliceStartAngle_1 + arc_1 / 2 - arc_1 / 2 * percentWidth;\r\n link.arc = arc_1 * percentWidth;\r\n }\r\n else {\r\n link.endAngle = _this.nextAngle;\r\n var value = dataItem.getWorkingValue(\"value\");\r\n if ($type.isNumber(value)) {\r\n link.arc = value * chart.valueAngle; // yes, this is needed\r\n _this.nextAngle += link.arc;\r\n }\r\n }\r\n if (!dataItem.fromNode) {\r\n link.startAngle = link.endAngle;\r\n }\r\n //link.validate();\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * @ignore\r\n * updates slice start angle so that when we drag a node it would face the center\r\n */\r\n ChordNode.prototype.updateRotation = function () {\r\n var slice = this.slice;\r\n var mAngle = this.trueStartAngle + slice.arc / 2;\r\n var radius = slice.radius;\r\n var tx = radius * $math.cos(mAngle);\r\n var ty = radius * $math.sin(mAngle);\r\n var angle = $math.getAngle({ x: tx + this.pixelX, y: ty + this.pixelY });\r\n slice.startAngle = this.trueStartAngle + (angle - mAngle);\r\n this.dx = -this.pixelX;\r\n this.dy = -this.pixelY;\r\n };\r\n /**\r\n * Copies properties and labels from another [[ChordNode]].\r\n *\r\n * @param source Source node\r\n */\r\n ChordNode.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.label.copyFrom(source.label);\r\n this.slice.copyFrom(source.slice);\r\n };\r\n return ChordNode;\r\n}(FlowDiagramNode));\r\nexport { ChordNode };\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[\"ChordNode\"] = ChordNode;\r\n//# sourceMappingURL=ChordNode.js.map","/**\r\n * Functionality for drawing quadratic curves.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Line } from \"./Line\";\r\nimport { color } from \"../utils/Color\";\r\nimport * as $path from \"../rendering/Path\";\r\nimport * as $math from \"../utils/Math\";\r\nimport * as $type from \"../utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws a waved line.\r\n *\r\n * @see {@link IQuadraticCurveEvents} for a list of available events\r\n * @see {@link IQuadraticCurveAdapters} for a list of available Adapters\r\n */\r\nvar QuadraticCurve = /** @class */ (function (_super) {\r\n __extends(QuadraticCurve, _super);\r\n /**\r\n * Constructor\r\n */\r\n function QuadraticCurve() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"QuadraticCurve\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this.pixelPerfect = false;\r\n _this.fill = color();\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the waved line.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n QuadraticCurve.prototype.draw = function () {\r\n //super.draw();\r\n if ($type.isNumber(this.x1 + this.x2 + this.y1 + this.y2 + this.cpx + this.cpy)) {\r\n var p1 = { x: this.x1, y: this.y1 };\r\n var p2 = { x: this.x2, y: this.y2 };\r\n var cp = { x: this.cpx, y: this.cpy };\r\n var d = $path.moveTo(p1) + $path.quadraticCurveTo(p2, cp);\r\n this.path = d;\r\n }\r\n };\r\n Object.defineProperty(QuadraticCurve.prototype, \"cpx\", {\r\n /**\r\n * @return X\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cpx\");\r\n },\r\n /**\r\n * X coordinate of control point.\r\n *\r\n * @param value X\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"cpx\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(QuadraticCurve.prototype, \"cpy\", {\r\n /**\r\n * @return Y\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"cpy\");\r\n },\r\n /**\r\n * Y coordinate of control point.\r\n *\r\n * @param value Y\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"cpy\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\r\n QuadraticCurve.prototype.positionToPoint = function (position) {\r\n var p1 = { x: this.x1, y: this.y1 };\r\n var cp = { x: this.cpx, y: this.cpy };\r\n var p2 = { x: this.x2, y: this.y2 };\r\n var point1 = $math.getPointOnQuadraticCurve(p1, p2, cp, position);\r\n var point2 = $math.getPointOnQuadraticCurve(p1, p2, cp, position + 0.001);\r\n return { x: point1.x, y: point1.y, angle: $math.getAngle(point1, point2) };\r\n };\r\n return QuadraticCurve;\r\n}(Line));\r\nexport { QuadraticCurve };\r\n//# sourceMappingURL=QuadraticCurve.js.map","/**\r\n * ChordLink module\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport { FlowDiagramLink } from \"./FlowDiagramLink\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { QuadraticCurve } from \"../../core/elements/QuadraticCurve\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This class creates a link (waved color-filled line) between two nodes in a\r\n * Chord Diagram.\r\n *\r\n * @see {@link IChordLinkEvents} for a list of available events\r\n * @see {@link IChordLinkAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar ChordLink = /** @class */ (function (_super) {\r\n __extends(ChordLink, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ChordLink() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ChordLink\";\r\n _this.middleLine = _this.createChild(QuadraticCurve);\r\n _this.middleLine.shouldClone = false;\r\n _this.middleLine.strokeOpacity = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * (Re)validates (redraws) the link.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ChordLink.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n if (!this.isTemplate) {\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n var arc = this.arc;\r\n var radius = this.radius;\r\n var fromNode = this.dataItem.fromNode;\r\n var toNode = this.dataItem.toNode;\r\n var fromX = 0;\r\n var fromY = 0;\r\n if (fromNode) {\r\n fromX = fromNode.pixelX + fromNode.dx;\r\n fromY = fromNode.pixelY + fromNode.dy;\r\n }\r\n var toX = 0;\r\n var toY = 0;\r\n if (toNode) {\r\n toX = toNode.pixelX + toNode.dx;\r\n toY = toNode.pixelY + toNode.dy;\r\n }\r\n if (radius > 0) {\r\n var x1 = radius * $math.cos(startAngle) + fromX;\r\n var y1 = radius * $math.sin(startAngle) + fromY;\r\n var x2 = radius * $math.cos(endAngle) + toX;\r\n var y2 = radius * $math.sin(endAngle) + toY;\r\n //let cpAngle = startAngle + arc + (endAngle - startAngle - arc) / 2;\r\n //let arcWidth = $math.getDistance({x:x1, y:y1}, {x:x4, y:y4});\r\n //let cpx = (arcWidth) * $math.cos(cpAngle);\r\n //let cpy = (arcWidth) * $math.sin(cpAngle);\r\n var cp = { x: 0, y: 0 };\r\n var path = $path.moveTo({ x: x1, y: y1 });\r\n path += $path.arcTo(startAngle, arc, radius);\r\n path += $path.quadraticCurveTo({ x: x2, y: y2 }, cp);\r\n path += $path.arcTo(endAngle, arc, radius);\r\n path += $path.quadraticCurveTo({ x: x1, y: y1 }, cp);\r\n if (arc > 0) {\r\n this.link.path = path;\r\n }\r\n else {\r\n this.link.path = \"\";\r\n }\r\n if (this.maskBullets) {\r\n this.bulletsMask.path = path;\r\n this.bulletsContainer.mask = this.bulletsMask;\r\n }\r\n var mAngle1 = startAngle + arc / 2;\r\n var mAngle2 = endAngle + arc / 2;\r\n var middleLine = this.middleLine;\r\n middleLine.x1 = radius * $math.cos(mAngle1) + fromX;\r\n middleLine.y1 = radius * $math.sin(mAngle1) + fromY;\r\n middleLine.x2 = radius * $math.cos(mAngle2) + toX;\r\n middleLine.y2 = radius * $math.sin(mAngle2) + toY;\r\n middleLine.cpx = 0;\r\n middleLine.cpy = 0;\r\n middleLine.stroke = this.fill;\r\n this.positionBullets();\r\n }\r\n }\r\n };\r\n Object.defineProperty(ChordLink.prototype, \"radius\", {\r\n /**\r\n * @return End Y\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * [radius description]\r\n *\r\n * @todo Description\r\n * @param value End Y\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"radius\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChordLink.prototype, \"arc\", {\r\n /**\r\n * @return [description]\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"arc\");\r\n },\r\n /**\r\n * [arc description]\r\n *\r\n * @todo Description\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"arc\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ChordLink;\r\n}(FlowDiagramLink));\r\nexport { ChordLink };\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[\"ChordLink\"] = ChordLink;\r\n//# sourceMappingURL=ChordLink.js.map","/**\r\n * Chord diagram module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { FlowDiagram, FlowDiagramDataItem } from \"./FlowDiagram\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { ChordNode } from \"../elements/ChordNode\";\r\nimport { ChordLink } from \"../elements/ChordLink\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\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\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n//@todo rearange notes after dragged\r\n/**\r\n * Defines a [[DataItem]] for [[ChordDiagram]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar ChordDiagramDataItem = /** @class */ (function (_super) {\r\n __extends(ChordDiagramDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ChordDiagramDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ChordDiagramDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return ChordDiagramDataItem;\r\n}(FlowDiagramDataItem));\r\nexport { ChordDiagramDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a Chord Diagram chart.\r\n *\r\n * @see {@link IChordDiagramEvents} for a list of available Events\r\n * @see {@link IChordDiagramAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/chord-diagram/} for documentation\r\n * @important\r\n */\r\nvar ChordDiagram = /** @class */ (function (_super) {\r\n __extends(ChordDiagram, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ChordDiagram() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * [valueAngle description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n _this.valueAngle = 0;\r\n _this.className = \"ChordDiagram\";\r\n _this.startAngle = -90;\r\n _this.endAngle = 270;\r\n _this.radius = percent(80);\r\n _this.innerRadius = -15;\r\n _this.nodePadding = 5;\r\n var chordContainer = _this.chartContainer.createChild(Container);\r\n chordContainer.align = \"center\";\r\n chordContainer.valign = \"middle\";\r\n chordContainer.shouldClone = false;\r\n chordContainer.layout = \"absolute\";\r\n _this.chordContainer = chordContainer;\r\n _this.nodesContainer.parent = chordContainer;\r\n _this.linksContainer.parent = chordContainer;\r\n _this.chartContainer.events.on(\"maxsizechanged\", _this.invalidate, _this, false);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Redraws the chart.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ChordDiagram.prototype.validate = function () {\r\n var _this = this;\r\n var chartContainer = this.chartContainer;\r\n var endAngle = this.endAngle;\r\n var startAngle = this.startAngle + this.nodePadding / 2;\r\n var rect = $math.getArcRect(this.startAngle, this.endAngle, 1);\r\n var innerRect = { x: 0, y: 0, width: 0, height: 0 };\r\n rect = $math.getCommonRectangle([rect, innerRect]);\r\n var maxRadius = Math.min(chartContainer.innerWidth / rect.width, chartContainer.innerHeight / rect.height);\r\n if (!$type.isNumber(maxRadius)) {\r\n maxRadius = 0;\r\n }\r\n var radius = $utils.relativeRadiusToValue(this.radius, maxRadius);\r\n var pixelInnerRadius = $utils.relativeRadiusToValue(this.innerRadius, radius, true);\r\n var total = this.dataItem.values.value.sum;\r\n var count = 0;\r\n var newTotal = 0;\r\n $iter.each(this._sorted, function (strNode) {\r\n var node = strNode[1];\r\n _this.getNodeValue(node);\r\n count++;\r\n var value = node.total;\r\n if (node.total / total < _this.minNodeSize) {\r\n value = total * _this.minNodeSize;\r\n }\r\n newTotal += value;\r\n });\r\n this.valueAngle = (endAngle - this.startAngle - this.nodePadding * count) / newTotal;\r\n $iter.each(this._sorted, function (strNode) {\r\n var node = strNode[1];\r\n var slice = node.slice;\r\n slice.radius = radius;\r\n slice.innerRadius = pixelInnerRadius;\r\n var value = node.total;\r\n if (node.total / total < _this.minNodeSize) {\r\n value = total * _this.minNodeSize;\r\n }\r\n node.adjustedTotal = value;\r\n var arc;\r\n if (_this.nonRibbon) {\r\n arc = (endAngle - _this.startAngle) / count - _this.nodePadding;\r\n }\r\n else {\r\n arc = _this.valueAngle * value;\r\n }\r\n slice.arc = arc;\r\n slice.startAngle = startAngle;\r\n node.trueStartAngle = startAngle;\r\n node.parent = _this.nodesContainer;\r\n node.validate(); // otherwise flickers - nodes are already created, but not yet positioned etc.\r\n startAngle += arc + _this.nodePadding;\r\n });\r\n this.chordContainer.definedBBox = { x: radius * rect.x, y: radius * rect.y, width: radius * rect.width, height: radius * rect.height };\r\n this.chordContainer.invalidateLayout();\r\n _super.prototype.validate.call(this);\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n ChordDiagram.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Chord diagram\");\r\n }\r\n };\r\n /**\r\n * Creates and returns a new data item.\r\n *\r\n * @return Data item\r\n */\r\n ChordDiagram.prototype.createDataItem = function () {\r\n return new ChordDiagramDataItem();\r\n };\r\n Object.defineProperty(ChordDiagram.prototype, \"startAngle\", {\r\n /**\r\n * @return Start angle (degrees)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startAngle\");\r\n },\r\n /**\r\n * Starting angle of the Radar face. (degrees)\r\n *\r\n * Normally, a circular radar face begins (the radial axis is drawn) at the\r\n * top center. (at -90 degrees)\r\n *\r\n * You can use `startAngle` to change this setting.\r\n *\r\n * E.g. setting this to 0 will make the radial axis start horizontally to\r\n * the right, as opposed to vertical.\r\n *\r\n * For a perfect circle the absolute sum of `startAngle` and `endAngle`\r\n * needs to be 360.\r\n *\r\n * However, it's **not** necessary to do so. You can set those to lesser\r\n * numbers, to create semi-circles.\r\n *\r\n * E.g. `startAngle = -90` with `endAngle = 0` will create a radar face that\r\n * looks like a quarter of a circle.\r\n *\r\n * @default -90\r\n * @param value Start angle (degrees)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChordDiagram.prototype, \"endAngle\", {\r\n /**\r\n * @return End angle (degrees)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endAngle\");\r\n },\r\n /**\r\n * Starting angle of the Radar face. (degrees)\r\n *\r\n * Normally, a circular radar face ends (the radial axis is drawn) exactly\r\n * where it has started, forming a full 360 circle. (at 270 degrees)\r\n *\r\n * You can use `endAngle` to end the circle somewhere else.\r\n *\r\n * E.g. setting this to 180 will make the radar face end at horizontal line\r\n * to the left off the center.\r\n *\r\n * For a perfect circle the absolute sum of `startAngle` and `endAngle`\r\n * needs to be 360.\r\n *\r\n * However, it's **not** necessary to do so. You can set those to lesser\r\n * numbers, to create semi-circles.\r\n *\r\n * E.g. `startAngle = -90` with `endAngle = 0` will create a radar face that\r\n * looks like a quarter of a circle.\r\n *\r\n * @default -90\r\n * @param value End angle (degrees)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChordDiagram.prototype, \"radius\", {\r\n /**\r\n * @return Outer radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Outer radius of the Radar face.\r\n *\r\n * This can either be in absolute pixel value, or relative [[Percent]].\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChordDiagram.prototype, \"innerRadius\", {\r\n /**\r\n * @return Inner radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Inner radius of the Chord nodes.\r\n *\r\n * This can either be in absolute pixel value, or relative [[Percent]].\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChordDiagram.prototype, \"nonRibbon\", {\r\n /**\r\n * @return Non-ribbon\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"nonRibbon\");\r\n },\r\n /**\r\n *\r\n * If you set this to true, all the lines will be of the same width. This is done by making middleLine of a ChordLink visible.\r\n *\r\n * @param value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"nonRibbon\", value, true);\r\n this.links.template.middleLine.strokeOpacity = 1;\r\n this.links.template.link.fillOpacity = 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @ignore\r\n */\r\n ChordDiagram.prototype.createNode = function () {\r\n var node = new ChordNode();\r\n this._disposers.push(node);\r\n return node;\r\n };\r\n /**\r\n * @ignore\r\n */\r\n ChordDiagram.prototype.createLink = function () {\r\n var link = new ChordLink();\r\n this._disposers.push(link);\r\n return link;\r\n };\r\n return ChordDiagram;\r\n}(FlowDiagram));\r\nexport { ChordDiagram };\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[\"ChordDiagram\"] = ChordDiagram;\r\n//# sourceMappingURL=ChordDiagram.js.map","/**\r\n * Module that defines everything related to building Columns.\r\n * It is a container which has column element which is a RoundedRectangle.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { RoundedRectangle } from \"../../core/elements/RoundedRectangle\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport * as $math from \"../../core/utils/Math\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to creates Columns.\r\n *\r\n * @see {@link IColumnEvents} for a list of available events\r\n * @see {@link IColumnAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar Column = /** @class */ (function (_super) {\r\n __extends(Column, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Column() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Column\";\r\n _this.width = percent(80);\r\n _this.height = percent(80);\r\n //this.isMeasured = true; // for correct position of the tooltip\r\n _this.events.disableType(\"transformed\"); // not to bug parent\r\n _this.applyOnClones = true;\r\n _this.strokeOpacity = 1;\r\n _this.layout = \"none\";\r\n _this.createAssets();\r\n // otherwise users will have to set layout themselves if they'll want to align, scale etc children\r\n _this.events.on(\"childadded\", _this.handleKidAdded, _this, false);\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n Column.prototype.handleKidAdded = function () {\r\n if (this.layout == \"none\") {\r\n this.layout = \"absolute\";\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Column.prototype.createAssets = function () {\r\n this.column = this.createChild(RoundedRectangle);\r\n this.column.shouldClone = false;\r\n this.column.isMeasured = false;\r\n this.column.cornerRadius(0, 0, 0, 0);\r\n this._disposers.push(this.column);\r\n };\r\n /**\r\n * @ignore Exclude from docs\r\n */\r\n Column.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n var column = this.column;\r\n if (column) {\r\n column.width = $math.min(this.pixelWidth, this.maxWidth);\r\n column.height = $math.min(this.pixelHeight, this.maxHeight);\r\n if (column.invalid) {\r\n column.validate(); // important!\r\n }\r\n }\r\n };\r\n /**\r\n * Copies all parameters from another [[Column]].\r\n *\r\n * @param source Source Column\r\n */\r\n Column.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.column) {\r\n this.column.copyFrom(source.column);\r\n }\r\n };\r\n Object.defineProperty(Column.prototype, \"bbox\", {\r\n /**\r\n * Returns bounding box (square) for this element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n get: function () {\r\n if (this.definedBBox) {\r\n return this.definedBBox;\r\n }\r\n if (this.column) {\r\n return { x: 0, y: 0, width: this.column.measuredWidth, height: this.column.measuredHeight };\r\n }\r\n else {\r\n return { x: 0, y: 0, width: $math.min(this.pixelWidth, this.maxWidth), height: $math.min(this.pixelHeight, this.maxHeight) };\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Column;\r\n}(Container));\r\nexport { Column };\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[\"Column\"] = Column;\r\n//# sourceMappingURL=Column.js.map","/**\r\n * Column series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { XYSeries, XYSeriesDataItem } from \"./XYSeries\";\r\nimport { visualProperties } from \"../../core/Sprite\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { Dictionary } from \"../../core/utils/Dictionary\";\r\nimport { ValueAxis } from \"../axes/ValueAxis\";\r\nimport { CategoryAxis } from \"../axes/CategoryAxis\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { Column } from \"../elements/Column\";\r\nimport { RoundedRectangle } from \"../../core/elements/RoundedRectangle\";\r\nimport { percent, Percent } from \"../../core/utils/Percent\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { Disposer } from \"../../core/utils/Disposer\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[ColumnSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar ColumnSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(ColumnSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ColumnSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ColumnSeriesDataItem\";\r\n _this.locations[\"dateX\"] = 0.5;\r\n _this.locations[\"dateY\"] = 0.5;\r\n _this.locations[\"categoryX\"] = 0.5;\r\n _this.locations[\"categoryY\"] = 0.5;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(ColumnSeriesDataItem.prototype, \"column\", {\r\n /**\r\n * @return Column\r\n */\r\n get: function () {\r\n return this._column;\r\n },\r\n /**\r\n * A column used to draw a column for this data item.\r\n *\r\n * @param column\r\n */\r\n set: function (column) {\r\n this.setColumn(column);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ColumnSeriesDataItem.prototype.setColumn = function (column) {\r\n var _this = this;\r\n if (this._column && column != this._column) {\r\n $array.remove(this.sprites, this._column);\r\n }\r\n this._column = column;\r\n if (column) {\r\n var prevDataItem = column.dataItem;\r\n if (prevDataItem && prevDataItem != this) {\r\n prevDataItem.column = undefined;\r\n }\r\n this.addSprite(column);\r\n this._disposers.push(new Disposer(function () {\r\n // TODO investigate why component is undefined\r\n // https://codepen.io/team/amcharts/pen/dac4be245d658233a6d7e5597df2208b?editors=0010\r\n if (_this.component) {\r\n _this.component.columns.removeValue(column);\r\n }\r\n }));\r\n }\r\n };\r\n Object.defineProperty(ColumnSeriesDataItem.prototype, \"width\", {\r\n get: function () {\r\n var width = this.properties.width;\r\n if (this._adapterO) {\r\n width = this._adapterO.apply(\"width\", width);\r\n }\r\n return width;\r\n },\r\n set: function (value) {\r\n if (this.properties.width != value) {\r\n this.properties.width = value;\r\n if (this.component) {\r\n this.component.validateDataElement(this);\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColumnSeriesDataItem.prototype, \"rangesColumns\", {\r\n /**\r\n * A dictionary storing axes ranges columns by axis uid\r\n */\r\n get: function () {\r\n if (!this._rangesColumns) {\r\n this._rangesColumns = new Dictionary();\r\n }\r\n return this._rangesColumns;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ColumnSeriesDataItem;\r\n}(XYSeriesDataItem));\r\nexport { ColumnSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a column graph.\r\n *\r\n * @see {@link IColumnSeriesEvents} for a list of available Events\r\n * @see {@link IColumnSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar ColumnSeries = /** @class */ (function (_super) {\r\n __extends(ColumnSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ColumnSeries() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Start location within cell for columns.\r\n */\r\n _this._startLocation = 0;\r\n /**\r\n * End location within cell for columns.\r\n */\r\n _this._endLocation = 1;\r\n _this.className = \"ColumnSeries\";\r\n _this.width = percent(100);\r\n _this.height = percent(100);\r\n _this.strokeOpacity = 0;\r\n _this.fillOpacity = 1;\r\n _this.clustered = true;\r\n var columnsContainer = _this.mainContainer.createChild(Container);\r\n columnsContainer.shouldClone = false;\r\n columnsContainer.isMeasured = false;\r\n columnsContainer.layout = \"none\";\r\n _this._columnsContainer = columnsContainer;\r\n _this.columns.template.pixelPerfect = false;\r\n _this.tooltipColorSource = _this.columns.template;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(ColumnSeries.prototype, \"columnsContainer\", {\r\n /**\r\n * A container that columns are created in.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n get: function () {\r\n return this._columnsContainer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n ColumnSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Column Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n ColumnSeries.prototype.createDataItem = function () {\r\n return new ColumnSeriesDataItem();\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ColumnSeries.prototype.validate = function () {\r\n //@todo Check if we can do better than use `instanceof`\r\n // find start/end locations based on clustered/stacked settings\r\n // go through chart series instead of base axis series, because axis series doesn't maintain order\r\n var _this = this;\r\n this.group.node.removeAttribute(\"fill\");\r\n if (this.chart && this.xAxis && this.yAxis) {\r\n var baseAxisSeries = this.chart.series;\r\n var clusterCount_1 = 0;\r\n var index_1 = 0;\r\n var sortedByAxis_1 = [];\r\n $iter.each(baseAxisSeries.iterator(), function (series) {\r\n if (series instanceof ColumnSeries) {\r\n if (_this.baseAxis == series.baseAxis) {\r\n var index_2;\r\n if (_this.baseAxis == _this.xAxis) {\r\n index_2 = _this.chart.yAxes.indexOf(series.yAxis);\r\n }\r\n else {\r\n index_2 = _this.chart.xAxes.indexOf(series.xAxis);\r\n }\r\n sortedByAxis_1.push({ series: series, axis: index_2 });\r\n }\r\n }\r\n });\r\n sortedByAxis_1.sort(function (a, b) { return a.axis - b.axis; });\r\n var prevAxisIndex_1;\r\n $array.each(sortedByAxis_1, function (sortedItem) {\r\n var series = sortedItem.series;\r\n if (series instanceof ColumnSeries) {\r\n if ((!series.stacked && series.clustered) || (prevAxisIndex_1 != sortedItem.axis && series.clustered)) {\r\n clusterCount_1++;\r\n }\r\n if (series == _this) {\r\n index_1 = clusterCount_1 - 1;\r\n }\r\n }\r\n prevAxisIndex_1 = sortedItem.axis;\r\n });\r\n if (!this.clustered) {\r\n index_1 = 0;\r\n clusterCount_1 = 1;\r\n }\r\n var renderer = this.baseAxis.renderer;\r\n var cellStartLocation = renderer.cellStartLocation;\r\n var cellEndLocation = renderer.cellEndLocation;\r\n this._startLocation = cellStartLocation + (index_1 / clusterCount_1) * (cellEndLocation - cellStartLocation);\r\n this._endLocation = cellStartLocation + (index_1 + 1) / clusterCount_1 * (cellEndLocation - cellStartLocation);\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (xAxis instanceof CategoryAxis && yAxis instanceof ValueAxis) {\r\n if (xAxis.sortBySeries == this) {\r\n this.sortCategoryAxis(xAxis, \"valueY\");\r\n }\r\n }\r\n if (yAxis instanceof CategoryAxis && xAxis instanceof ValueAxis) {\r\n if (yAxis.sortBySeries == this) {\r\n this.sortCategoryAxis(yAxis, \"valueX\");\r\n }\r\n }\r\n }\r\n _super.prototype.validate.call(this);\r\n for (var i = 0; i < this.startIndex; i++) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n this.disableUnusedColumns(dataItem);\r\n }\r\n for (var i = this.dataItems.length - 1; i > this.endIndex; i--) {\r\n var dataItem = this.dataItems.getIndex(i);\r\n this.disableUnusedColumns(dataItem);\r\n }\r\n this._propertiesChanged = false;\r\n };\r\n ColumnSeries.prototype.sortCategoryAxis = function (axis, key) {\r\n var _this = this;\r\n this.dataItems.values.sort(function (x, y) {\r\n return y.values[key].workingValue - x.values[key].workingValue;\r\n });\r\n var i = 0;\r\n this.dataItems.each(function (dataItem) {\r\n dataItem._index = i;\r\n i++;\r\n });\r\n axis.dataItems.each(function (dataItem) {\r\n var axis = dataItem.component;\r\n var currentPosition = axis.categoryToPosition(dataItem.category) - dataItem.deltaPosition;\r\n var seriesDataItem = axis.getSeriesDataItemByCategory(dataItem.category, _this);\r\n if (seriesDataItem) {\r\n var index = _this.dataItems.indexOf(seriesDataItem);\r\n dataItem._index = index;\r\n var deltaPosition = $math.round((index + 0.5) / _this.dataItems.length - currentPosition, 3);\r\n if (dataItem.deltaAnimation && !dataItem.deltaAnimation.isDisposed() && dataItem.deltaAnimation.animationOptions[0].to == deltaPosition) {\r\n // void\r\n }\r\n else if (deltaPosition != $math.round(dataItem.deltaPosition, 3)) {\r\n if (dataItem.deltaAnimation) {\r\n dataItem.deltaAnimation.stop();\r\n }\r\n dataItem.deltaAnimation = dataItem.animate({ property: \"deltaPosition\", from: -deltaPosition, to: 0 }, axis.interpolationDuration, axis.interpolationEasing);\r\n _this._disposers.push(dataItem.deltaAnimation);\r\n }\r\n }\r\n });\r\n axis.dataItems.values.sort(function (x, y) {\r\n return x.index - y.index;\r\n });\r\n };\r\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n ColumnSeries.prototype.validateDataElement = function (dataItem) {\r\n // important oder here, first real, then super. we need this to know size\r\n if (this.chart && this.xAxis && this.yAxis) {\r\n this.validateDataElementReal(dataItem);\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n }\r\n };\r\n /**\r\n * Returns relative start location for the data item.\r\n *\r\n * @param dataItem Data item\r\n * @return Location (0-1)\r\n */\r\n ColumnSeries.prototype.getStartLocation = function (dataItem) {\r\n var startLocation = this._startLocation;\r\n if (this.baseAxis == this.xAxis) {\r\n startLocation += dataItem.locations[this.xOpenField] - 0.5;\r\n }\r\n else {\r\n startLocation += dataItem.locations[this.yOpenField] - 0.5;\r\n }\r\n return startLocation;\r\n };\r\n /**\r\n * [handleDataItemWorkingValueChange description]\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n /*\r\n public handleDataItemWorkingValueChange(dataItem?: this[\"_dataItem\"], name?: string): void {\r\n if (this.simplifiedProcessing) {\r\n this.validateDataElement(dataItem);\r\n }\r\n else {\r\n super.handleDataItemWorkingValueChange(dataItem, name);\r\n }\r\n }*/\r\n /**\r\n * Returns relative end location for the data item.\r\n *\r\n * @param dataItem Data item\r\n * @return Location (0-1)\r\n */\r\n ColumnSeries.prototype.getEndLocation = function (dataItem) {\r\n var endLocation = this._endLocation;\r\n if (this.baseAxis == this.xAxis) {\r\n endLocation += dataItem.locations[this.xField] - 0.5;\r\n }\r\n else {\r\n endLocation += dataItem.locations[this.yField] - 0.5;\r\n }\r\n return endLocation;\r\n };\r\n /**\r\n * Validates data item's elements.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n ColumnSeries.prototype.validateDataElementReal = function (dataItem) {\r\n var _this = this;\r\n //\tif (dataItem.hasValue([this.xField, this.yField])) { // todo: this doesn't work with categories, think of a better way\r\n var l;\r\n var r;\r\n var t;\r\n var b;\r\n var startLocation = this.getStartLocation(dataItem);\r\n var endLocation = this.getEndLocation(dataItem);\r\n var xField = this.xField;\r\n var xOpenField = this.xOpenField;\r\n var yField = this.yField;\r\n var yOpenField = this.yOpenField;\r\n var template = this.columns.template;\r\n var percentWidth = template.percentWidth;\r\n var percentHeight = template.percentHeight;\r\n var pixelWidth = template.pixelWidth;\r\n var pixelHeight = template.pixelHeight;\r\n var maxWidth = template.maxWidth;\r\n var maxHeight = template.maxHeight;\r\n var paddingLeft = template.pixelPaddingLeft;\r\n var paddingRight = template.pixelPaddingRight;\r\n var paddingTop = template.pixelPaddingTop;\r\n var paddingBottom = template.pixelPaddingBottom;\r\n var outOfBounds = false;\r\n var diw = dataItem.width;\r\n if ($type.hasValue(diw)) {\r\n if ($type.isNumber(diw)) {\r\n pixelWidth = diw;\r\n }\r\n if (diw instanceof Percent) {\r\n percentWidth = diw.value * 100;\r\n }\r\n }\r\n // two category axes\r\n if ((this.xAxis instanceof CategoryAxis) && (this.yAxis instanceof CategoryAxis)) {\r\n if (!dataItem.hasValue(this._xValueFields) || !dataItem.hasValue(this._yValueFields)) {\r\n return;\r\n }\r\n startLocation = 0;\r\n endLocation = 1;\r\n if (!$type.isNaN(percentWidth)) {\r\n var offset = $math.round((endLocation - startLocation) * (1 - percentWidth / 100) / 2, 5);\r\n startLocation += offset;\r\n endLocation -= offset;\r\n }\r\n l = this.xAxis.getX(dataItem, xOpenField, startLocation);\r\n r = this.xAxis.getX(dataItem, xField, endLocation);\r\n // in case width is set in pixels\r\n if ($type.isNaN(percentWidth)) {\r\n var offset = ((r - l) - pixelWidth) / 2;\r\n l += offset;\r\n r -= offset;\r\n }\r\n // in case max width is set in pixels\r\n if (!$type.isNaN(maxWidth) && maxWidth < Math.abs(r - l)) {\r\n var offset = ((r - l) - maxWidth) / 2;\r\n l += offset;\r\n r -= offset;\r\n }\r\n startLocation = 0;\r\n endLocation = 1;\r\n if (!$type.isNaN(percentHeight)) {\r\n var offset = $math.round((1 - percentHeight / 100) / 2, 5);\r\n startLocation += offset;\r\n endLocation -= offset;\r\n }\r\n t = this.yAxis.getY(dataItem, yOpenField, startLocation);\r\n b = this.yAxis.getY(dataItem, yField, endLocation);\r\n // in case width is set in pixels\r\n if ($type.isNaN(percentHeight)) {\r\n var offset = ((b - t) - pixelHeight) / 2;\r\n b += offset;\r\n t -= offset;\r\n }\r\n // in case max width is set in pixels\r\n if (!$type.isNaN(maxHeight) && maxHeight < Math.abs(b - t)) {\r\n var offset = ((b - t) - maxHeight) / 2;\r\n b += offset;\r\n t -= offset;\r\n }\r\n r = this.fixHorizontalCoordinate(r);\r\n l = this.fixHorizontalCoordinate(l);\r\n t = this.fixVerticalCoordinate(t);\r\n b = this.fixVerticalCoordinate(b);\r\n }\r\n else if (this.baseAxis == this.xAxis) {\r\n if (!dataItem.hasValue(this._yValueFields)) {\r\n return;\r\n }\r\n // in case width is set in percent\r\n if (!$type.isNaN(percentWidth)) {\r\n var offset = $math.round((endLocation - startLocation) * (1 - percentWidth / 100) / 2, 5);\r\n startLocation += offset;\r\n endLocation -= offset;\r\n }\r\n l = this.xAxis.getX(dataItem, xOpenField, startLocation);\r\n r = this.xAxis.getX(dataItem, xField, endLocation);\r\n // in case width is set in pixels\r\n if ($type.isNaN(percentWidth)) {\r\n var offset = ((r - l) - pixelWidth) / 2;\r\n l += offset;\r\n r -= offset;\r\n }\r\n // in case width is set in pixels\r\n if (!$type.isNaN(maxWidth) && maxWidth < Math.abs(r - l)) {\r\n var offset = ((r - l) - maxWidth) / 2;\r\n l += offset;\r\n r -= offset;\r\n }\r\n var bottomLocation = dataItem.locations[yOpenField];\r\n var topLocation = dataItem.locations[yField];\r\n // otherwise gantt chart will start items in the middle of a cell\r\n if (this.yAxis instanceof ValueAxis) {\r\n if (this.dataFields[this.yField] != this.dataFields[this.yOpenField]) {\r\n bottomLocation = 0;\r\n topLocation = 0;\r\n }\r\n }\r\n b = this.yAxis.getY(dataItem, yOpenField, bottomLocation);\r\n t = this.yAxis.getY(dataItem, yField, topLocation);\r\n // used to save location for bullets, but it's not a good approach\r\n // dataItem.locations[xField] = startLocation + (endLocation - startLocation) / 2;\r\n var axisLenght = Math.ceil(this.yAxis.axisLength);\r\n if ((t < 0 && b < 0) || (t > axisLenght && b > axisLenght)) {\r\n outOfBounds = true;\r\n }\r\n t = this.fixVerticalCoordinate(t);\r\n b = this.fixVerticalCoordinate(b);\r\n if (Math.abs(r - l) - paddingLeft - paddingRight == 0) {\r\n outOfBounds = true;\r\n }\r\n }\r\n // horizontal bars\r\n else {\r\n if (!dataItem.hasValue(this._xValueFields)) {\r\n return;\r\n }\r\n if (!$type.isNaN(percentHeight)) {\r\n var offset = $math.round((endLocation - startLocation) * (1 - percentHeight / 100) / 2, 5);\r\n startLocation += offset;\r\n endLocation -= offset;\r\n }\r\n t = this.yAxis.getY(dataItem, yOpenField, startLocation);\r\n b = this.yAxis.getY(dataItem, yField, endLocation);\r\n // in case height is set in pixels\r\n if ($type.isNaN(percentHeight)) {\r\n var offset = ((b - t) - pixelHeight) / 2;\r\n b -= offset;\r\n t += offset;\r\n }\r\n // in case height is set in pixels\r\n if (!$type.isNaN(maxHeight) && maxHeight < Math.abs(b - t)) {\r\n var offset = ((b - t) - maxHeight) / 2;\r\n b -= offset;\r\n t += offset;\r\n }\r\n var rightLocation = dataItem.locations[xField];\r\n var leftLocation = dataItem.locations[xOpenField];\r\n // otherwise gantt chart will start items in the middle of a cell\r\n if (this.xAxis instanceof ValueAxis) {\r\n if (this.dataFields[this.xField] != this.dataFields[this.xOpenField]) {\r\n rightLocation = 0;\r\n leftLocation = 0;\r\n }\r\n }\r\n r = this.xAxis.getX(dataItem, xField, rightLocation);\r\n l = this.xAxis.getX(dataItem, xOpenField, leftLocation);\r\n // used to save location for bullets, but it's not a good approach\r\n // dataItem.locations[yField] = startLocation + (endLocation - startLocation) / 2;\r\n var axisLenght = Math.ceil(this.xAxis.axisLength);\r\n if ((r < 0 && l < 0) || (r > axisLenght && l > axisLenght)) {\r\n outOfBounds = true;\r\n }\r\n r = this.fixHorizontalCoordinate(r);\r\n l = this.fixHorizontalCoordinate(l);\r\n if (Math.abs(t - b) - paddingTop - paddingBottom == 0) {\r\n outOfBounds = true;\r\n }\r\n }\r\n var w = Math.abs(r - l);\r\n var h = Math.abs(b - t);\r\n var x = Math.min(l, r);\r\n var y = Math.min(t, b);\r\n if (!outOfBounds) {\r\n var column_1;\r\n if (!dataItem.column) {\r\n column_1 = this.columns.create();\r\n //$object.forceCopyProperties(this.columns.template, column, visualProperties);\r\n $object.copyProperties(this, column_1, visualProperties); // need this because 3d columns are not in the same container\r\n $object.copyProperties(this.columns.template, column_1, visualProperties); // second time, no force, so that columns.template would override series properties\r\n dataItem.addSprite(column_1);\r\n dataItem.column = column_1;\r\n column_1.paper = this.paper; // sometimes pattern is not drawn if is set with adapter without this.\r\n // accessibility\r\n if (this.itemsFocusable()) {\r\n this.role = \"menu\";\r\n column_1.role = \"menuitem\";\r\n column_1.focusable = true;\r\n }\r\n else {\r\n this.role = \"list\";\r\n column_1.role = \"listitem\";\r\n column_1.focusable = false;\r\n }\r\n if (column_1.focusable) {\r\n column_1.events.on(\"focus\", function (ev) {\r\n column_1.readerTitle = _this.populateString(_this.itemReaderText, dataItem);\r\n }, undefined, false);\r\n column_1.events.on(\"blur\", function (ev) {\r\n column_1.readerTitle = \"\";\r\n }, undefined, false);\r\n }\r\n if (column_1.hoverable) {\r\n column_1.events.on(\"over\", function (ev) {\r\n column_1.readerTitle = _this.populateString(_this.itemReaderText, dataItem);\r\n }, undefined, false);\r\n column_1.events.on(\"out\", function (ev) {\r\n column_1.readerTitle = \"\";\r\n }, undefined, false);\r\n }\r\n column_1.parent = this.columnsContainer;\r\n column_1.virtualParent = this;\r\n }\r\n else {\r\n column_1 = dataItem.column;\r\n if (this._propertiesChanged) {\r\n $object.copyProperties(this, column_1, visualProperties);\r\n $object.copyProperties(this.columns.template, column_1, visualProperties);\r\n $array.each(visualProperties, function (property) {\r\n column_1[property] = column_1[property];\r\n });\r\n }\r\n }\r\n column_1.width = w;\r\n column_1.height = h;\r\n column_1.x = x;\r\n column_1.y = y;\r\n column_1.realX = l;\r\n column_1.realY = t;\r\n column_1.realWidth = r - l;\r\n column_1.realHeight = b - t;\r\n this.setColumnStates(column_1);\r\n if (column_1.invalid) {\r\n column_1.validate(); // validate as if it was used previously, it will flicker with previous dimensions\r\n }\r\n column_1.__disabled = false;\r\n //column.returnAfterTemp();\r\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\r\n var rangeColumn = dataItem.rangesColumns.getKey(axisRange.uid);\r\n if (!rangeColumn) {\r\n rangeColumn = _this.columns.create();\r\n //$object.forceCopyProperties(this.columns.template, rangeColumn, visualProperties);\r\n $object.copyProperties(axisRange.contents, rangeColumn, visualProperties); // need this because 3d columns are not in the same container\r\n dataItem.addSprite(rangeColumn);\r\n dataItem.rangesColumns.setKey(axisRange.uid, rangeColumn);\r\n rangeColumn.paper = _this.paper; // sometimes pattern is not drawn if is set with adapter without this.\r\n }\r\n rangeColumn.parent = axisRange.contents;\r\n rangeColumn.width = w;\r\n rangeColumn.height = h;\r\n rangeColumn.x = x;\r\n rangeColumn.y = y;\r\n _this.setColumnStates(rangeColumn);\r\n if (rangeColumn.invalid) {\r\n rangeColumn.validate(); // validate as if it was used previously, it will flicker with previous dimensions\r\n }\r\n rangeColumn.__disabled = false;\r\n //rangeColumn.returnAfterTemp();\r\n });\r\n }\r\n else {\r\n this.disableUnusedColumns(dataItem);\r\n }\r\n dataItem.itemWidth = w;\r\n dataItem.itemHeight = h;\r\n };\r\n /**\r\n * @ignore\r\n */\r\n ColumnSeries.prototype.disableUnusedColumns = function (dataItem) {\r\n if (dataItem) {\r\n if (dataItem.column) {\r\n // otherwise might flicker when enabling\r\n dataItem.column.width = 0;\r\n dataItem.column.height = 0;\r\n dataItem.column.__disabled = true;\r\n }\r\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\r\n var rangeColumn = dataItem.rangesColumns.getKey(axisRange.uid);\r\n if (rangeColumn) {\r\n // otherwise might flicker when enabling\r\n rangeColumn.width = 0;\r\n rangeColumn.height = 0;\r\n rangeColumn.__disabled = true;\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Apply different state/coloring to columns based on the change value.\r\n *\r\n * @param sprite Sprite to apply state to\r\n * @todo Do not apply accessibility to wicks of the candlesticks\r\n */\r\n ColumnSeries.prototype.setColumnStates = function (sprite) {\r\n if (this._dropFromOpenState || this._dropFromPreviousState || this._riseFromOpenState || this._riseFromPreviousState) {\r\n var dataItem = sprite.dataItem;\r\n if (this.xAxis instanceof ValueAxis || this.yAxis instanceof ValueAxis) {\r\n var open_1;\r\n var value = void 0;\r\n var change = void 0;\r\n if (this.baseAxis == this.yAxis) {\r\n if (this.xOpenField && this.xField && this.xAxis instanceof ValueAxis) {\r\n open_1 = dataItem.getValue(this.xOpenField);\r\n value = dataItem.getValue(this.xField);\r\n change = dataItem.getValue(this.xAxis.axisFieldName + \"X\", \"previousChange\");\r\n }\r\n }\r\n else {\r\n if (this.yOpenField && this.yField && this.yAxis instanceof ValueAxis) {\r\n open_1 = dataItem.getValue(this.yOpenField);\r\n value = dataItem.getValue(this.yField);\r\n change = dataItem.getValue(this.yAxis.axisFieldName + \"Y\", \"previousChange\");\r\n }\r\n }\r\n if (value < open_1) {\r\n dataItem.droppedFromOpen = true;\r\n sprite.defaultState.copyFrom(this._dropFromOpenState);\r\n sprite.setState(this._dropFromOpenState, 0);\r\n }\r\n else {\r\n dataItem.droppedFromOpen = false;\r\n sprite.defaultState.copyFrom(this._riseFromOpenState);\r\n sprite.setState(this._riseFromOpenState, 0);\r\n }\r\n if (change < 0) {\r\n dataItem.droppedFromPrevious = true;\r\n sprite.defaultState.copyFrom(this._dropFromPreviousState);\r\n sprite.setState((this._dropFromPreviousState), 0);\r\n }\r\n else {\r\n dataItem.droppedFromPrevious = false;\r\n sprite.defaultState.copyFrom(this._riseFromPreviousState);\r\n sprite.setState((this._riseFromPreviousState), 0);\r\n }\r\n }\r\n }\r\n };\r\n Object.defineProperty(ColumnSeries.prototype, \"columns\", {\r\n /**\r\n * A list of column elements in the series.\r\n *\r\n * @return Columns\r\n */\r\n get: function () {\r\n if (!this._columns) {\r\n this._columns = new ListTemplate(this.createColumnTemplate());\r\n this._disposers.push(new ListDisposer(this._columns));\r\n this._disposers.push(this._columns.template);\r\n }\r\n return this._columns;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates and returns a column element to use as a template.\r\n *\r\n * @return Column template\r\n */\r\n ColumnSeries.prototype.createColumnTemplate = function () {\r\n return new Column();\r\n };\r\n Object.defineProperty(ColumnSeries.prototype, \"clustered\", {\r\n /**\r\n * @return Clustered?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"clustered\");\r\n },\r\n /**\r\n * Cluster this series columns?\r\n *\r\n * Setting to `false` will make columns overlap with other series.\r\n *\r\n * @default true\r\n * @param value Clustered?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"clustered\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColumnSeries.prototype, \"dropFromOpenState\", {\r\n /**\r\n * @return State\r\n */\r\n get: function () {\r\n if (!this._dropFromOpenState) {\r\n this._dropFromOpenState = this.states.create(\"dropFromOpenState\");\r\n }\r\n return this._dropFromOpenState;\r\n },\r\n /**\r\n * A state to apply to a column when close value is lower than open value.\r\n *\r\n * Can be used to differentiate appearance based on value relations.\r\n *\r\n * NOTE: this will work only if at least one axis is [[ValueAxis]].\r\n *\r\n * @readonly You can modify state object, but can't overwrite it\r\n * @param value State\r\n */\r\n set: function (value) {\r\n this._dropFromOpenState = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColumnSeries.prototype, \"dropFromPreviousState\", {\r\n /**\r\n * @return State\r\n */\r\n get: function () {\r\n if (!this._dropFromPreviousState) {\r\n this._dropFromPreviousState = this.states.create(\"dropFromPreviousState\");\r\n }\r\n return this._dropFromPreviousState;\r\n },\r\n /**\r\n * A state to apply to a column when its value is lower value of a previous\r\n * column.\r\n *\r\n * Can be used to differentiate appearance based on value relations.\r\n *\r\n * @readonly You can modify state object, but can't overwrite it\r\n * @param value State\r\n */\r\n set: function (value) {\r\n this._dropFromPreviousState = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColumnSeries.prototype, \"riseFromOpenState\", {\r\n /**\r\n * @return State\r\n */\r\n get: function () {\r\n if (!this._riseFromOpenState) {\r\n this._riseFromOpenState = this.states.create(\"riseFromOpenState\");\r\n }\r\n return this._riseFromOpenState;\r\n },\r\n /**\r\n * A state to apply to a column when close value is same or higher than open\r\n * value.\r\n *\r\n * Can be used to differentiate appearance based on value relations.\r\n *\r\n * NOTE: this will work only if at least one axis is [[ValueAxis]].\r\n *\r\n * @readonly You can modify state object, but can't overwrite it\r\n * @param value State\r\n */\r\n set: function (value) {\r\n this._riseFromOpenState = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColumnSeries.prototype, \"riseFromPreviousState\", {\r\n /**\r\n * @return State\r\n */\r\n get: function () {\r\n if (!this._riseFromPreviousState) {\r\n this._riseFromPreviousState = this.states.create(\"riseFromPreviousState\");\r\n }\r\n return this._riseFromPreviousState;\r\n },\r\n /**\r\n * A state to apply to a column when its value is same or higher than value\r\n * of a previous column.\r\n *\r\n * Can be used to differentiate appearance based on value relations.\r\n *\r\n * @readonly You can modify state object, but can't overwrite it\r\n * @param value State\r\n */\r\n set: function (value) {\r\n this._riseFromPreviousState = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates value of the related legend item.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n ColumnSeries.prototype.updateLegendValue = function (dataItem, notRange) {\r\n var _this = this;\r\n _super.prototype.updateLegendValue.call(this, dataItem, notRange);\r\n if (this.legendDataItem) {\r\n var marker = this.legendDataItem.marker;\r\n var fromOpenState_1;\r\n var fromPreviousState_1;\r\n if (dataItem) {\r\n if (dataItem.droppedFromOpen) {\r\n fromOpenState_1 = this._dropFromOpenState;\r\n }\r\n else {\r\n fromOpenState_1 = this._riseFromOpenState;\r\n }\r\n if (dataItem.droppedFromPrevious) {\r\n fromPreviousState_1 = this._dropFromPreviousState;\r\n }\r\n else {\r\n fromPreviousState_1 = this._riseFromPreviousState;\r\n }\r\n }\r\n $iter.each(marker.children.iterator(), function (child) {\r\n if (dataItem) {\r\n child.setState(fromPreviousState_1);\r\n child.setState(fromOpenState_1);\r\n }\r\n else {\r\n // todo: think what to do here, maybe apply above states based on totals?\r\n child.setState(_this._riseFromPreviousState);\r\n child.setState(_this._riseFromOpenState);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Creates elements in related legend container, that mimics the look of this\r\n * Series.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Legend item container\r\n */\r\n ColumnSeries.prototype.createLegendMarker = function (marker) {\r\n var w = marker.pixelWidth;\r\n var h = marker.pixelHeight;\r\n marker.removeChildren();\r\n var column = marker.createChild(RoundedRectangle);\r\n column.shouldClone = false;\r\n $object.copyProperties(this, column, visualProperties);\r\n column.copyFrom(this.columns.template);\r\n column.padding(0, 0, 0, 0); // if columns will have padding (which is often), legend marker will be very narrow\r\n column.width = w;\r\n column.height = h;\r\n var legendDataItem = marker.dataItem;\r\n legendDataItem.color = this.fill;\r\n legendDataItem.colorOrig = this.fill;\r\n };\r\n /**\r\n * Copies all properties from another instance of [[ColumnSeries]].\r\n *\r\n * @param source Source series\r\n */\r\n ColumnSeries.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.columns.template.copyFrom(source.columns.template);\r\n };\r\n /**\r\n * returns bullet x location\r\n * @ignore\r\n */\r\n ColumnSeries.prototype.getBulletLocationX = function (bullet, field) {\r\n if (this.baseAxis == this.xAxis) {\r\n var bulletLocationX = bullet.locationX;\r\n if (!$type.isNumber(bulletLocationX)) {\r\n bulletLocationX = 0.5;\r\n }\r\n var endLocation = this.getEndLocation(bullet.dataItem);\r\n var startLocation = this.getStartLocation(bullet.dataItem);\r\n return endLocation - (endLocation - startLocation) * bulletLocationX;\r\n }\r\n else {\r\n return _super.prototype.getBulletLocationX.call(this, bullet, field);\r\n }\r\n };\r\n /**\r\n * returns bullet y location\r\n * @ignore\r\n */\r\n ColumnSeries.prototype.getBulletLocationY = function (bullet, field) {\r\n if (this.baseAxis == this.yAxis) {\r\n var bulletLocationY = bullet.locationY;\r\n if (!$type.isNumber(bulletLocationY)) {\r\n bulletLocationY = 0.5;\r\n }\r\n var endLocation = this.getEndLocation(bullet.dataItem);\r\n var startLocation = this.getStartLocation(bullet.dataItem);\r\n return endLocation - (endLocation - startLocation) * bulletLocationY;\r\n }\r\n else {\r\n return _super.prototype.getBulletLocationY.call(this, bullet, field);\r\n }\r\n };\r\n ColumnSeries.prototype.getAdjustedXLocation = function (dataItem, field, bulletLocationX) {\r\n //if (this.baseAxis == this.xAxis) {\r\n if (!$type.isNumber(bulletLocationX)) {\r\n if (dataItem) {\r\n bulletLocationX = dataItem.locations[field];\r\n }\r\n else {\r\n bulletLocationX = 0.5;\r\n }\r\n }\r\n return this._endLocation - (this._endLocation - this._startLocation) * (1 - bulletLocationX);\r\n //}\r\n //else {\r\n //\treturn super.getAdjustedXLocation(dataItem, field);\r\n //}\r\n };\r\n ColumnSeries.prototype.getAdjustedYLocation = function (dataItem, field, bulletLocationY) {\r\n //if (this.baseAxis == this.yAxis) {\r\n if (!$type.isNumber(bulletLocationY)) {\r\n if (dataItem) {\r\n bulletLocationY = dataItem.locations[field];\r\n }\r\n else {\r\n bulletLocationY = 0.5;\r\n }\r\n }\r\n return this._endLocation - (this._endLocation - this._startLocation) * bulletLocationY;\r\n //}\r\n //else {\r\n //\treturn super.getAdjustedYLocation(dataItem, field);\r\n //}\r\n };\r\n /**\r\n * @ignore Exclude from docs\r\n */\r\n ColumnSeries.prototype.fixVerticalCoordinate = function (coordinate) {\r\n var paddingBottom = this.columns.template.pixelPaddingBottom;\r\n var paddingTop = this.columns.template.pixelPaddingTop;\r\n var minY = -paddingTop;\r\n var maxY = this.yAxis.axisLength + paddingBottom;\r\n return $math.fitToRange(coordinate, minY, maxY);\r\n };\r\n /**\r\n * @ignore Exclude from docs\r\n */\r\n ColumnSeries.prototype.fixHorizontalCoordinate = function (coordinate) {\r\n var paddingLeft = this.columns.template.pixelPaddingLeft;\r\n var paddingRight = this.columns.template.pixelPaddingRight;\r\n var minX = -paddingLeft;\r\n var maxX = this.xAxis.axisLength + paddingRight;\r\n return $math.fitToRange(coordinate, minX, maxX);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n ColumnSeries.prototype.disposeData = function () {\r\n _super.prototype.disposeData.call(this);\r\n this.columns.clear();\r\n };\r\n return ColumnSeries;\r\n}(XYSeries));\r\nexport { ColumnSeries };\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[\"ColumnSeries\"] = ColumnSeries;\r\nregistry.registeredClasses[\"ColumnSeriesDataItem\"] = ColumnSeriesDataItem;\r\n//# sourceMappingURL=ColumnSeries.js.map","/**\r\n * TreeMap series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ColumnSeries, ColumnSeriesDataItem } from \"./ColumnSeries\";\r\nimport { visualProperties } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { RoundedRectangle } from \"../../core/elements/RoundedRectangle\";\r\nimport * as $object from \"../../core/utils/Object\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[TreeMapSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar TreeMapSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(TreeMapSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function TreeMapSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"TreeMapSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(TreeMapSeriesDataItem.prototype, \"parentName\", {\r\n /**\r\n * Data for the this particular item.\r\n *\r\n * @param value Item's data\r\n */\r\n //public set dataContext(value: Object) {\r\n //\tthis._dataContext = value;\r\n //}\r\n /**\r\n * @return Item's data\r\n */\r\n /*\r\n public get dataContext(): Object {\r\n // It's because data of tree series is TreeMapDataItems.\r\n if (this._dataContext) {\r\n return (this._dataContext).dataContext;\r\n }\r\n }*/\r\n /**\r\n * The name of the item's parent item.\r\n *\r\n * @return Parent name\r\n */\r\n get: function () {\r\n var treeMapDataItem = this.treeMapDataItem;\r\n if (treeMapDataItem && treeMapDataItem.parent) {\r\n return treeMapDataItem.parent.name;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapSeriesDataItem.prototype, \"value\", {\r\n /**\r\n * Item's numeric value.\r\n *\r\n * @readonly\r\n * @return Value\r\n */\r\n get: function () {\r\n var treeMapDataItem = this.treeMapDataItem;\r\n if (treeMapDataItem) {\r\n return treeMapDataItem.value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapSeriesDataItem.prototype, \"treeMapDataItem\", {\r\n /**\r\n * A corresponding data item from the tree map.\r\n *\r\n * @readonly\r\n * @return Data item\r\n */\r\n get: function () {\r\n return this._dataContext;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Hides the Data Item and related visual elements.\r\n *\r\n * @param duration Animation duration (ms)\r\n * @param delay Delay animation (ms)\r\n * @param toValue A value to set to `fields` when hiding\r\n * @param fields A list of data fields to set value to `toValue`\r\n */\r\n TreeMapSeriesDataItem.prototype.hide = function (duration, delay, toValue, fields) {\r\n var treeMapDataItem = this.treeMapDataItem;\r\n if (treeMapDataItem) {\r\n treeMapDataItem.hide(duration);\r\n }\r\n return _super.prototype.hide.call(this, duration, delay, toValue, fields);\r\n };\r\n /**\r\n * Shows the Data Item and related visual elements.\r\n *\r\n * @param duration Animation duration (ms)\r\n * @param delay Delay animation (ms)\r\n * @param fields A list of fields to set values of\r\n */\r\n TreeMapSeriesDataItem.prototype.show = function (duration, delay, fields) {\r\n var treeMapDataItem = this.treeMapDataItem;\r\n if (treeMapDataItem) {\r\n treeMapDataItem.show(duration, delay, fields);\r\n }\r\n return _super.prototype.show.call(this, duration, delay, fields);\r\n };\r\n return TreeMapSeriesDataItem;\r\n}(ColumnSeriesDataItem));\r\nexport { TreeMapSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines Series for a TreeMap chart.\r\n *\r\n * @see {@link ITreeMapSeriesEvents} for a list of available Events\r\n * @see {@link ITreeMapSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar TreeMapSeries = /** @class */ (function (_super) {\r\n __extends(TreeMapSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function TreeMapSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"TreeMapSeries\";\r\n _this.applyTheme();\r\n _this.fillOpacity = 1;\r\n _this.strokeOpacity = 1;\r\n _this.minBulletDistance = 0;\r\n _this.columns.template.tooltipText = \"{parentName} {name}: {value}\"; //@todo add format number?\r\n _this.columns.template.configField = \"config\";\r\n var interfaceColors = new InterfaceColorSet();\r\n _this.stroke = interfaceColors.getFor(\"background\");\r\n _this.dataFields.openValueX = \"x0\";\r\n _this.dataFields.valueX = \"x1\";\r\n _this.dataFields.openValueY = \"y0\";\r\n _this.dataFields.valueY = \"y1\";\r\n _this.sequencedInterpolation = false;\r\n _this.showOnInit = false;\r\n // otherwise nodes don't stack nicely to each other\r\n _this.columns.template.pixelPerfect = false;\r\n return _this;\r\n }\r\n /**\r\n * Processes data item.\r\n *\r\n * @param dataItem Data item\r\n * @param dataContext Raw data\r\n * @param index Index of the data item\r\n */\r\n TreeMapSeries.prototype.processDataItem = function (dataItem, dataContext) {\r\n dataContext.seriesDataItem = dataItem; // save a reference here. dataContext is TreeMapDataItem and we need to know dataItem sometimes\r\n _super.prototype.processDataItem.call(this, dataItem, dataContext);\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n TreeMapSeries.prototype.createDataItem = function () {\r\n return new TreeMapSeriesDataItem();\r\n };\r\n /**\r\n * Shows series.\r\n *\r\n * @param duration Duration of fade in (ms)\r\n * @return Animation\r\n */\r\n TreeMapSeries.prototype.show = function (duration) {\r\n if (this.preventShow) {\r\n return;\r\n }\r\n var interpolationDuration = this.defaultState.transitionDuration;\r\n if ($type.isNumber(duration)) {\r\n interpolationDuration = duration;\r\n }\r\n this.dataItems.each(function (dataItem) {\r\n //dataItem.treeMapDataItem.setWorkingValue(\"value\", dataItem.treeMapDataItem.values.value.value);\r\n dataItem.show(duration);\r\n });\r\n return _super.prototype.showReal.call(this, interpolationDuration);\r\n };\r\n /**\r\n * Hides series.\r\n *\r\n * @param duration Duration of fade out (ms)\r\n * @return Animation\r\n */\r\n TreeMapSeries.prototype.hide = function (duration) {\r\n var interpolationDuration = this.defaultState.transitionDuration;\r\n if ($type.isNumber(duration)) {\r\n interpolationDuration = duration;\r\n }\r\n var animation = _super.prototype.hideReal.call(this, interpolationDuration);\r\n this.dataItems.each(function (dataItem) {\r\n //dataItem.treeMapDataItem.setWorkingValue(\"value\", 0);\r\n dataItem.hide(duration);\r\n });\r\n return animation;\r\n };\r\n /**\r\n * Process values.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n TreeMapSeries.prototype.processValues = function () {\r\n // Just overriding so that inherited method does not kick in.\r\n };\r\n /**\r\n * Returns relative start location for the data item.\r\n *\r\n * @param dataItem Data item\r\n * @return Location (0-1)\r\n */\r\n TreeMapSeries.prototype.getStartLocation = function (dataItem) {\r\n return 0;\r\n };\r\n /**\r\n * Returns relative end location for the data item.\r\n *\r\n * @param dataItem Data item\r\n * @return Location (0-1)\r\n */\r\n TreeMapSeries.prototype.getEndLocation = function (dataItem) {\r\n return 1;\r\n };\r\n /**\r\n * @ignore\r\n */\r\n TreeMapSeries.prototype.dataChangeUpdate = function () {\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n TreeMapSeries.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Add empty data fields if the they are not set, so that XYSeries\r\n // dataField check does not result in error.\r\n if (!$type.hasValue(config.dataFields) || !$type.isObject(config.dataFields)) {\r\n config.dataFields = {};\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n /**\r\n * Creates elements in related legend container, that mimics the look of this\r\n * Series.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Legend item container\r\n */\r\n TreeMapSeries.prototype.createLegendMarker = function (marker) {\r\n var w = marker.pixelWidth;\r\n var h = marker.pixelHeight;\r\n marker.removeChildren();\r\n var column = marker.createChild(RoundedRectangle);\r\n column.shouldClone = false;\r\n $object.copyProperties(this, column, visualProperties);\r\n //column.copyFrom(this.columns.template);\r\n column.padding(0, 0, 0, 0); // if columns will have padding (which is often), legend marker will be very narrow\r\n column.width = w;\r\n column.height = h;\r\n var legendDataItem = marker.dataItem;\r\n legendDataItem.color = column.fill;\r\n legendDataItem.colorOrig = column.fill;\r\n };\r\n TreeMapSeries.prototype.disableUnusedColumns = function (dataItem) {\r\n _super.prototype.disableUnusedColumns.call(this, dataItem);\r\n if (dataItem.column) {\r\n dataItem.column.__disabled = false;\r\n }\r\n };\r\n return TreeMapSeries;\r\n}(ColumnSeries));\r\nexport { TreeMapSeries };\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[\"TreeMapSeries\"] = TreeMapSeries;\r\nregistry.registeredClasses[\"TreeMapSeriesDataItem\"] = TreeMapSeriesDataItem;\r\n//# sourceMappingURL=TreeMapSeries.js.map","/**\r\n * TreeMap chart module.\r\n *\r\n * Parts of the functionality used in this module are taken from D3.js library\r\n * (https://d3js.org/)\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { XYChart, XYChartDataItem } from \"./XYChart\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { DictionaryTemplate, DictionaryDisposer } from \"../../core/utils/Dictionary\";\r\nimport { ValueAxis } from \"../axes/ValueAxis\";\r\nimport { TreeMapSeries } from \"../series/TreeMapSeries\";\r\nimport { ColorSet } from \"../../core/utils/ColorSet\";\r\nimport { MouseCursorStyle } from \"../../core/interaction/Mouse\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $array from \"../../core/utils/Array\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[TreeMap]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar TreeMapDataItem = /** @class */ (function (_super) {\r\n __extends(TreeMapDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function TreeMapDataItem() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Required for squarify functionality.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n _this.rows = [];\r\n _this.className = \"TreeMapDataItem\";\r\n _this.values.value = {};\r\n _this.values.x0 = {};\r\n _this.values.y0 = {};\r\n _this.values.x1 = {};\r\n _this.values.y1 = {};\r\n _this.hasChildren.children = true;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(TreeMapDataItem.prototype, \"legendDataItem\", {\r\n /**\r\n * @return Legend data item\r\n */\r\n get: function () {\r\n return this._legendDataItem;\r\n },\r\n /**\r\n * A legend's data item, that corresponds to this data item.\r\n *\r\n * @param value Legend data item\r\n */\r\n set: function (value) {\r\n this._legendDataItem = value;\r\n if (value.label) {\r\n value.label.dataItem = this;\r\n }\r\n if (value.valueLabel) {\r\n value.valueLabel.dataItem = this;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a duration (ms) the Data Item should take to animate from one\r\n * value to another.\r\n *\r\n * If the duration is not specified via parameter, this method will try to\r\n * request a default duration from the related `Component`.\r\n *\r\n * @param duration Default duration (ms)\r\n * @return Duration (ms)\r\n */\r\n TreeMapDataItem.prototype.getDuration = function () {\r\n return 0;\r\n };\r\n Object.defineProperty(TreeMapDataItem.prototype, \"value\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n var value = 0;\r\n if (!this.children || this.children.length == 0) {\r\n value = this.values[\"value\"].workingValue;\r\n }\r\n else {\r\n $iter.each(this.children.iterator(), function (child) {\r\n var childValue = child.value;\r\n if ($type.isNumber(childValue)) {\r\n value += childValue;\r\n }\r\n });\r\n }\r\n return value;\r\n /*\r\n let value = this.values[\"value\"].workingValue;\r\n \r\n if (!$type.isNumber(value)) {\r\n value = 0;\r\n if (this.children) {\r\n $iter.each(this.children.iterator(), (child) => {\r\n if ($type.isNumber(child.value)) {\r\n value += child.value;\r\n }\r\n });\r\n }\r\n }\r\n return value;*/\r\n },\r\n /**\r\n * Numeric value of the item.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"value\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"percent\", {\r\n /**\r\n * Percent value of a node\r\n */\r\n get: function () {\r\n if (this.parent) {\r\n return this.value / this.parent.value * 100;\r\n }\r\n return 100;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"x0\", {\r\n /**\r\n * @return X\r\n */\r\n get: function () {\r\n return this.values.x0.value;\r\n },\r\n /**\r\n * Item's X position.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param value X\r\n */\r\n set: function (value) {\r\n this.setValue(\"x0\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"x1\", {\r\n /**\r\n * @return X\r\n */\r\n get: function () {\r\n return this.values.x1.value;\r\n },\r\n /**\r\n * Item's X position.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param value X\r\n */\r\n set: function (value) {\r\n this.setValue(\"x1\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"y0\", {\r\n /**\r\n * @return Y\r\n */\r\n get: function () {\r\n return this.values.y0.value;\r\n },\r\n /**\r\n * Item's Y position.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param value Y\r\n */\r\n set: function (value) {\r\n this.setValue(\"y0\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"y1\", {\r\n /**\r\n * @return Y\r\n */\r\n get: function () {\r\n return this.values.y1.value;\r\n },\r\n /**\r\n * Item's Y position.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param value Y\r\n */\r\n set: function (value) {\r\n this.setValue(\"y1\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"name\", {\r\n /**\r\n * @return Name\r\n */\r\n get: function () {\r\n return this.properties.name;\r\n },\r\n /**\r\n * Item's name.\r\n *\r\n * @param name Name\r\n */\r\n set: function (name) {\r\n this.setProperty(\"name\", name);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"children\", {\r\n /**\r\n * @return Item's children\r\n */\r\n get: function () {\r\n return this.properties.children;\r\n },\r\n /**\r\n * A list of item's sub-children.\r\n *\r\n * Having children means that the TreeMap chat will automatically be\r\n * \"drillable\". Clicking on an item with children will zoom to the item, then\r\n * display its children.\r\n *\r\n * Treemap can have any level of nesting.\r\n *\r\n * @param children Item's children\r\n */\r\n set: function (children) {\r\n this.setProperty(\"children\", children);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"level\", {\r\n /**\r\n * Depth level in the treemap hierarchy.\r\n *\r\n * The top-level item will have level set at 0. Its children will have\r\n * level 1, and so on.\r\n *\r\n * @readonly\r\n * @return Level\r\n */\r\n get: function () {\r\n if (!this.parent) {\r\n return 0;\r\n }\r\n else {\r\n return this.parent.level + 1;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"color\", {\r\n /**\r\n * @return Color\r\n */\r\n get: function () {\r\n var color = this.properties.color;\r\n if (color == undefined) {\r\n if (this.parent) {\r\n color = this.parent.color;\r\n }\r\n }\r\n if (color == undefined) {\r\n if (this.component) {\r\n color = this.component.colors.getIndex(this.component.colors.step * this.index);\r\n }\r\n }\r\n return color;\r\n },\r\n /**\r\n * Item's color.\r\n *\r\n * If not set, will use parent's color, or, if that is not set either,\r\n * automatically assigned color from chart's color set. (`chart.colors`)\r\n *\r\n * @param value Color\r\n */\r\n set: function (value) {\r\n this.setProperty(\"color\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"fill\", {\r\n /**\r\n * @ignore\r\n * For the legend to work properly\r\n */\r\n get: function () {\r\n return this.color;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMapDataItem.prototype, \"series\", {\r\n get: function () {\r\n return this._series;\r\n },\r\n /**\r\n * Series of children data items\r\n * @todo: proper descrition\r\n */\r\n set: function (series) {\r\n if (series != this._series) {\r\n if (this._series) {\r\n this.component.series.removeValue(this._series);\r\n this._series.dispose();\r\n }\r\n this._series = series;\r\n this._disposers.push(series);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Hides the Data Item and related visual elements.\r\n *\r\n * @param duration Animation duration (ms)\r\n * @param delay Delay animation (ms)\r\n * @param toValue A value to set to `fields` when hiding\r\n * @param fields A list of data fields to set value to `toValue`\r\n */\r\n TreeMapDataItem.prototype.hide = function (duration, delay, toValue, fields) {\r\n this.setWorkingValue(\"value\", 0);\r\n if (this.children) {\r\n this.children.each(function (child) {\r\n child.hide(duration, delay, toValue, fields);\r\n });\r\n }\r\n var seriesDataItem = this.seriesDataItem;\r\n if (seriesDataItem) {\r\n seriesDataItem.bullets.each(function (key, value) {\r\n value.hide();\r\n value.preventShow = true;\r\n });\r\n }\r\n return _super.prototype.hide.call(this, duration, delay, toValue, fields);\r\n };\r\n /**\r\n * Shows the Data Item and related visual elements.\r\n *\r\n * @param duration Animation duration (ms)\r\n * @param delay Delay animation (ms)\r\n * @param fields A list of fields to set values of\r\n */\r\n TreeMapDataItem.prototype.show = function (duration, delay, fields) {\r\n this.setWorkingValue(\"value\", this.values.value.value);\r\n if (this.children) {\r\n this.children.each(function (child) {\r\n child.show(duration, delay, fields);\r\n });\r\n }\r\n var seriesDataItem = this.seriesDataItem;\r\n if (seriesDataItem) {\r\n seriesDataItem.bullets.each(function (key, value) {\r\n value.preventShow = false;\r\n });\r\n }\r\n return _super.prototype.show.call(this, duration, delay, fields);\r\n };\r\n return TreeMapDataItem;\r\n}(XYChartDataItem));\r\nexport { TreeMapDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a TreeMap chart.\r\n *\r\n * @see {@link ITreeMapEvents} for a list of available Events\r\n * @see {@link ITreeMapAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/treemap/} for documentation\r\n */\r\nvar TreeMap = /** @class */ (function (_super) {\r\n __extends(TreeMap, _super);\r\n /**\r\n * Constructor\r\n */\r\n function TreeMap() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * An algorithm used to divide area into squares based on their value.\r\n *\r\n * Available options: squarify (default), binaryTree, slice, dice, sliceDice.\r\n *\r\n * ```TypeScript\r\n * chart.layoutAlgorithm = chart.sliceDice;\r\n * ```\r\n * ```JavaScript\r\n * chart.layoutAlgorithm = chart.sliceDice;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"layoutAlgorithm\": \"sliceDice\",\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/treemap/#Area_division_methods} For more info and examples.\r\n * @default squarify\r\n */\r\n _this.layoutAlgorithm = _this.squarify;\r\n /**\r\n * Is the chart zoomable?\r\n *\r\n * If the chart is `zoomable`, and items have sub-items, the chart will\r\n * drill-down to sub-items when click on their parent item.\r\n *\r\n * @default true\r\n */\r\n _this.zoomable = true;\r\n _this.className = \"TreeMap\";\r\n _this._usesData = true;\r\n _this.maxLevels = 2;\r\n _this.currentLevel = 0;\r\n _this.hideParentColumns = false;\r\n _this.colors = new ColorSet();\r\n _this.sorting = \"descending\";\r\n // create two value axes for the chart\r\n var xAxis = _this.xAxes.push(new ValueAxis());\r\n xAxis.title.disabled = true;\r\n xAxis.strictMinMax = true;\r\n var xRenderer = xAxis.renderer;\r\n xRenderer.inside = true;\r\n xRenderer.labels.template.disabled = true;\r\n xRenderer.ticks.template.disabled = true;\r\n xRenderer.grid.template.disabled = true;\r\n xRenderer.axisFills.template.disabled = true;\r\n xRenderer.minGridDistance = 100;\r\n xRenderer.line.disabled = true;\r\n xRenderer.baseGrid.disabled = true;\r\n //xRenderer.inversed = true;\r\n var yAxis = _this.yAxes.push(new ValueAxis());\r\n yAxis.title.disabled = true;\r\n yAxis.strictMinMax = true;\r\n var yRenderer = yAxis.renderer;\r\n yRenderer.inside = true;\r\n yRenderer.labels.template.disabled = true;\r\n yRenderer.ticks.template.disabled = true;\r\n yRenderer.grid.template.disabled = true;\r\n yRenderer.axisFills.template.disabled = true;\r\n yRenderer.minGridDistance = 100;\r\n yRenderer.line.disabled = true;\r\n yRenderer.baseGrid.disabled = true;\r\n yRenderer.inversed = true;\r\n // shortcuts\r\n _this.xAxis = xAxis;\r\n _this.yAxis = yAxis;\r\n var template = new TreeMapSeries();\r\n _this.seriesTemplates = new DictionaryTemplate(template);\r\n template.virtualParent = _this;\r\n _this._disposers.push(new DictionaryDisposer(_this.seriesTemplates));\r\n _this._disposers.push(template);\r\n _this.zoomOutButton.events.on(\"hit\", function () {\r\n _this.zoomToChartDataItem(_this._homeDataItem);\r\n }, undefined, false);\r\n _this.seriesTemplates.events.on(\"insertKey\", function (event) {\r\n event.newValue.isTemplate = true;\r\n }, undefined, false);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(TreeMap.prototype, \"navigationBar\", {\r\n /**\r\n * Returns navigationBar if it is added to a chart\r\n */\r\n get: function () {\r\n return this._navigationBar;\r\n },\r\n /**\r\n * A navigation bar used to show \"breadcrumb\" control, indicating current\r\n * drill-down path.\r\n */\r\n set: function (navigationBar) {\r\n var _this = this;\r\n if (this._navigationBar != navigationBar) {\r\n this._navigationBar = navigationBar;\r\n navigationBar.parent = this;\r\n navigationBar.toBack();\r\n navigationBar.links.template.events.on(\"hit\", function (event) {\r\n var dataItem = event.target.dataItem.dataContext;\r\n if (!dataItem.isDisposed()) {\r\n _this.zoomToChartDataItem(dataItem);\r\n _this.createTreeSeries(dataItem);\r\n }\r\n }, undefined, true);\r\n this._disposers.push(navigationBar);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * (Re)validates chart's data.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n TreeMap.prototype.validateData = function () {\r\n this.series.clear();\r\n this._tempSeries = [];\r\n _super.prototype.validateData.call(this);\r\n if (this._homeDataItem) {\r\n this._homeDataItem.dispose();\r\n }\r\n var homeDataItem = this.dataItems.template.clone(); // cant' use createDataItem here!\r\n this._homeDataItem = homeDataItem;\r\n $iter.each(this.dataItems.iterator(), function (dataItem) {\r\n dataItem.parent = homeDataItem;\r\n });\r\n homeDataItem.children = this.dataItems;\r\n homeDataItem.x0 = 0;\r\n homeDataItem.y0 = 0;\r\n homeDataItem.name = this._homeText;\r\n var maxX = 1000;\r\n var maxY = Math.round((maxX * this.pixelHeight / this.pixelWidth) / 10) * 10 || 1000;\r\n homeDataItem.x1 = maxX;\r\n homeDataItem.y1 = maxY;\r\n this.xAxis.min = 0;\r\n this.xAxis.max = maxX;\r\n this.xAxis.getMinMax();\r\n this.yAxis.min = 0;\r\n this.yAxis.max = maxY;\r\n this.yAxis.getMinMax();\r\n this.layoutItems(homeDataItem);\r\n this.createTreeSeries(homeDataItem);\r\n this.feedLegend();\r\n };\r\n /**\r\n * Layouts and sizes all items according to their value and\r\n * `layoutAlgorithm`.\r\n *\r\n * @ignore Exclude from docs\r\n * @param parent Parent data item\r\n */\r\n TreeMap.prototype.layoutItems = function (parent, sorting) {\r\n if (parent) {\r\n var children = parent.children;\r\n if (!sorting) {\r\n sorting = this.sorting;\r\n }\r\n if (sorting == \"ascending\") {\r\n children.values.sort(function (a, b) {\r\n return a.value - b.value;\r\n });\r\n }\r\n if (sorting == \"descending\") {\r\n children.values.sort(function (a, b) {\r\n return b.value - a.value;\r\n });\r\n }\r\n this._updateDataItemIndexes(0);\r\n this.layoutAlgorithm(parent);\r\n for (var i = 0, len = children.length; i < len; i++) {\r\n var node = children.getIndex(i);\r\n if (node.children) {\r\n this.layoutItems(node);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Creates and returns a new treemap series.\r\n *\r\n * @todo Description\r\n * @param dataItem Data item to create series out of\r\n */\r\n TreeMap.prototype.createTreeSeries = function (dataItem) {\r\n var _this = this;\r\n this._tempSeries = [];\r\n var navigationData = [dataItem];\r\n // create parent series and navigation data\r\n var parentDataItem = dataItem.parent;\r\n while (parentDataItem != undefined) {\r\n this.initSeries(parentDataItem);\r\n navigationData.push(parentDataItem);\r\n parentDataItem = parentDataItem.parent;\r\n }\r\n navigationData.reverse();\r\n if (this.navigationBar) {\r\n this.navigationBar.data = navigationData;\r\n }\r\n // create series and children series\r\n this.createTreeSeriesReal(dataItem);\r\n // add those which are not in the list\r\n $array.each(this._tempSeries, function (series) {\r\n if (_this.series.indexOf(series) == -1) {\r\n _this.series.push(series);\r\n }\r\n series.zIndex = series.level;\r\n });\r\n };\r\n /**\r\n * [createTreeSeriesReal description]\r\n *\r\n * @todo Description\r\n * @param dataItem [description]\r\n */\r\n TreeMap.prototype.createTreeSeriesReal = function (dataItem) {\r\n if (dataItem.children) {\r\n var level = dataItem.level;\r\n if (level < this.currentLevel + this.maxLevels) {\r\n this.initSeries(dataItem);\r\n for (var i = 0; i < dataItem.children.length; i++) {\r\n var child = dataItem.children.getIndex(i);\r\n if (child.children) {\r\n this.createTreeSeriesReal(child);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n TreeMap.prototype.setData = function (value) {\r\n this.currentLevel = 0;\r\n this.currentlyZoomed = undefined;\r\n this.xAxis.start = 0;\r\n this.xAxis.end = 1;\r\n this.yAxis.start = 0;\r\n this.yAxis.end = 1;\r\n _super.prototype.setData.call(this, value);\r\n };\r\n /**\r\n * @ignore\r\n * Overriding, as tree map series are created on the fly all the time\r\n */\r\n TreeMap.prototype.seriesAppeared = function () {\r\n return true;\r\n };\r\n /**\r\n * Initializes the treemap series.\r\n *\r\n * @todo Description\r\n * @param dataItem Chart data item\r\n */\r\n TreeMap.prototype.initSeries = function (dataItem) {\r\n var _this = this;\r\n if (!dataItem.series) {\r\n var series = void 0;\r\n var template = this.seriesTemplates.getKey(dataItem.level.toString());\r\n if (template) {\r\n series = template.clone();\r\n }\r\n else {\r\n series = this.series.create();\r\n }\r\n // for the legend to get {value}\r\n series.dataItem.dataContext = dataItem;\r\n series.name = dataItem.name;\r\n series.parentDataItem = dataItem;\r\n dataItem.series = series;\r\n var level = dataItem.level;\r\n series.level = level;\r\n var dataContext = dataItem.dataContext;\r\n if (dataContext) {\r\n series.config = dataContext.config;\r\n }\r\n this.dataUsers.removeValue(series); // series do not use data directly, that's why we remove it\r\n series.data = dataItem.children.values;\r\n series.fill = dataItem.color;\r\n series.columnsContainer.hide(0);\r\n series.bulletsContainer.hide(0);\r\n series.columns.template.adapter.add(\"fill\", function (fill, target) {\r\n var dataItem = target.dataItem;\r\n if (dataItem) {\r\n var treeMapDataItem = dataItem.treeMapDataItem;\r\n if (treeMapDataItem) {\r\n target.fill = treeMapDataItem.color;\r\n target.adapter.remove(\"fill\"); //@todo: make it possible adapters applied once?\r\n return treeMapDataItem.color;\r\n }\r\n }\r\n });\r\n if (this.zoomable && (dataItem.level > this.currentLevel || (dataItem.children && dataItem.children.length > 0))) {\r\n series.columns.template.cursorOverStyle = MouseCursorStyle.pointer;\r\n if (this.zoomable) {\r\n series.columns.template.events.on(\"hit\", function (event) {\r\n var seriesDataItem = event.target.dataItem;\r\n if (dataItem.level > _this.currentLevel) {\r\n _this.zoomToChartDataItem(seriesDataItem.treeMapDataItem.parent);\r\n }\r\n else {\r\n _this.zoomToSeriesDataItem(seriesDataItem);\r\n }\r\n }, this, undefined);\r\n }\r\n }\r\n }\r\n this._tempSeries.push(dataItem.series);\r\n };\r\n /**\r\n * Toggles bullets so that labels that belong to current drill level are\r\n * shown.\r\n *\r\n * @param duration Animation duration (ms)\r\n */\r\n TreeMap.prototype.toggleBullets = function (duration) {\r\n var _this = this;\r\n // hide all series which are not in tempSeries\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (_this._tempSeries.indexOf(series) == -1) {\r\n //series.hideReal(duration);\r\n series.columnsContainer.hide();\r\n series.bulletsContainer.hide(duration);\r\n }\r\n else {\r\n //series.showReal(duration);\r\n series.columnsContainer.show();\r\n series.bulletsContainer.show(duration);\r\n series.dataItems.each(function (dataItem) {\r\n dataItem.bullets.each(function (key, bullet) {\r\n bullet.show();\r\n });\r\n });\r\n if (series.level < _this.currentLevel) {\r\n if (_this.hideParentColumns) {\r\n series.columnsContainer.hide();\r\n }\r\n series.bulletsContainer.hide(duration);\r\n }\r\n else if (series.level == _this.currentLevel) {\r\n if (_this.maxLevels > 1) {\r\n series.dataItems.each(function (dataItem) {\r\n if (dataItem.treeMapDataItem.children) {\r\n dataItem.bullets.each(function (key, bullet) {\r\n bullet.hide();\r\n });\r\n }\r\n });\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Zooms to particular item in series.\r\n *\r\n * @param dataItem Data item\r\n */\r\n TreeMap.prototype.zoomToSeriesDataItem = function (dataItem) {\r\n this.zoomToChartDataItem(dataItem.treeMapDataItem);\r\n };\r\n /**\r\n * Zooms to particular item. If dataItem is not specified, the chart will zoom-out.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n TreeMap.prototype.zoomToChartDataItem = function (dataItem) {\r\n var _this = this;\r\n if (!dataItem) {\r\n dataItem = this._homeDataItem;\r\n }\r\n var zoomOutButton = this.zoomOutButton;\r\n // this is needed because if there is only one fist level, it wont' be shown\r\n if (zoomOutButton) {\r\n if (dataItem != this._homeDataItem) {\r\n zoomOutButton.show();\r\n }\r\n else {\r\n zoomOutButton.hide();\r\n }\r\n }\r\n if (dataItem && dataItem.children) {\r\n this.xAxis.zoomToValues(dataItem.x0, dataItem.x1);\r\n this.yAxis.zoomToValues(dataItem.y0, dataItem.y1);\r\n this.currentLevel = dataItem.level;\r\n this.currentlyZoomed = dataItem;\r\n this.createTreeSeries(dataItem);\r\n var rangeChangeAnimation = this.xAxis.rangeChangeAnimation || this.yAxis.rangeChangeAnimation;\r\n if (rangeChangeAnimation && !rangeChangeAnimation.isDisposed() && !rangeChangeAnimation.isFinished()) {\r\n this._dataDisposers.push(rangeChangeAnimation);\r\n rangeChangeAnimation.events.once(\"animationended\", function () {\r\n _this.toggleBullets();\r\n });\r\n }\r\n else {\r\n this.toggleBullets();\r\n }\r\n }\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n TreeMap.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n // Add a default screen reader title for accessibility\r\n // This will be overridden in screen reader if there are any `titles` set\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"TreeMap chart\");\r\n }\r\n //this.homeText = this.language.translate(\"Home\");\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n TreeMap.prototype.createDataItem = function () {\r\n return new TreeMapDataItem();\r\n };\r\n Object.defineProperty(TreeMap.prototype, \"maxLevels\", {\r\n /**\r\n * @return Maximum drill-down level\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maxLevels\");\r\n },\r\n /**\r\n * Maximum number of levels the chart will display initially.\r\n *\r\n * @default 2\r\n * @param value Maximum drill-down level\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"maxLevels\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMap.prototype, \"currentLevel\", {\r\n /**\r\n * @return Current level\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"currentLevel\");\r\n },\r\n /**\r\n * Current drill-down level the chart is at.\r\n *\r\n * @param value Current level\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"currentLevel\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMap.prototype, \"hideParentColumns\", {\r\n /**\r\n * @return Hide?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"hideParentColumns\");\r\n },\r\n /**\r\n * If set to `true`, columns of parent nodes will be hidden when user\r\n * drills-down into deeper levels.\r\n *\r\n * @sice 4.7.4\r\n * @default false\r\n * @param value Hide?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"hideParentColumns\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TreeMap.prototype, \"sorting\", {\r\n get: function () {\r\n return this.getPropertyValue(\"sorting\");\r\n },\r\n /**\r\n * Sorting direction of treemap items.\r\n *\r\n * Available options: \"none\", \"ascending\", and \"descending\" (default).\r\n *\r\n * @default \"descending\"\r\n * @param value [description]\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"sorting\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates and returns a new series of the suitable type.\r\n *\r\n * @return new series\r\n */\r\n TreeMap.prototype.createSeries = function () {\r\n return new TreeMapSeries();\r\n };\r\n Object.defineProperty(TreeMap.prototype, \"homeText\", {\r\n /**\r\n * @return Home text\r\n */\r\n get: function () {\r\n return this._homeText;\r\n },\r\n /**\r\n * A text displayed on the \"home\" button which is used to go back to level 0\r\n * after drill into sub-items.\r\n *\r\n * @param value Home text\r\n */\r\n set: function (value) {\r\n this._homeText = value;\r\n if (this._homeDataItem) {\r\n this._homeDataItem.name = this._homeText;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n TreeMap.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Instantiate layout algorithm\r\n if ($type.hasValue(config[\"layoutAlgorithm\"]) && $type.isString(config[\"layoutAlgorithm\"])) {\r\n switch (config[\"layoutAlgorithm\"]) {\r\n case \"squarify\":\r\n config[\"layoutAlgorithm\"] = this.squarify;\r\n break;\r\n case \"binaryTree\":\r\n config[\"layoutAlgorithm\"] = this.binaryTree;\r\n break;\r\n case \"slice\":\r\n config[\"layoutAlgorithm\"] = this.slice;\r\n break;\r\n case \"dice\":\r\n config[\"layoutAlgorithm\"] = this.dice;\r\n break;\r\n case \"sliceDice\":\r\n config[\"layoutAlgorithm\"] = this.sliceDice;\r\n break;\r\n default:\r\n delete config[\"layoutAlgorithm\"];\r\n break;\r\n }\r\n }\r\n // Set type for navigation bar\r\n if ($type.hasValue(config.navigationBar) && !$type.hasValue(config.navigationBar.type)) {\r\n config.navigationBar.type = \"NavigationBar\";\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n }\r\n };\r\n /**\r\n * Measures the size of container and informs its children of how much size\r\n * they can occupy, by setting their relative `maxWidth` and `maxHeight`\r\n * properties.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n TreeMap.prototype.validateLayout = function () {\r\n _super.prototype.validateLayout.call(this);\r\n this.layoutItems(this.currentlyZoomed);\r\n };\r\n /**\r\n * Validates (processes) data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n TreeMap.prototype.validateDataItems = function () {\r\n _super.prototype.validateDataItems.call(this);\r\n this.layoutItems(this._homeDataItem);\r\n $iter.each(this.series.iterator(), function (series) {\r\n series.validateRawData();\r\n });\r\n this.zoomToChartDataItem(this._homeDataItem);\r\n };\r\n /**\r\n * ==========================================================================\r\n * TREEMAP LAYOUT FUNCTIONS\r\n * ==========================================================================\r\n * @hidden\r\n */\r\n /**\r\n * The functions below are from D3.js library (https://d3js.org/)\r\n *\r\n * --------------------------------------------------------------------------\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n * notice,this list of conditions and the following disclaimer in the\r\n * documentation and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from\r\n * this software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * --------------------------------------------------------------------------\r\n * @hidden\r\n */\r\n /**\r\n * Treemap layout algorithm: binaryTree.\r\n *\r\n * @ignore Exclude from docs\r\n * @param parent Data item\r\n */\r\n TreeMap.prototype.binaryTree = function (parent) {\r\n var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1);\r\n for (sums[0] = sum = i = 0; i < n; ++i) {\r\n sums[i + 1] = sum += nodes.getIndex(i).value;\r\n }\r\n partition(0, n, parent.value, parent.x0, parent.y0, parent.x1, parent.y1);\r\n function partition(i, j, value, x0, y0, x1, y1) {\r\n if (i >= j - 1) {\r\n var node = nodes.getIndex(i);\r\n node.x0 = x0;\r\n node.y0 = y0;\r\n node.x1 = x1;\r\n node.y1 = y1;\r\n return;\r\n }\r\n var valueOffset = sums[i], valueTarget = (value / 2) + valueOffset, k = i + 1, hi = j - 1;\r\n while (k < hi) {\r\n var mid = k + hi >>> 1;\r\n if (sums[mid] < valueTarget) {\r\n k = mid + 1;\r\n }\r\n else {\r\n hi = mid;\r\n }\r\n }\r\n if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) {\r\n --k;\r\n }\r\n var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft;\r\n if ((x1 - x0) > (y1 - y0)) {\r\n var xk = (x0 * valueRight + x1 * valueLeft) / value;\r\n partition(i, k, valueLeft, x0, y0, xk, y1);\r\n partition(k, j, valueRight, xk, y0, x1, y1);\r\n }\r\n else {\r\n var yk = (y0 * valueRight + y1 * valueLeft) / value;\r\n partition(i, k, valueLeft, x0, y0, x1, yk);\r\n partition(k, j, valueRight, x0, yk, x1, y1);\r\n }\r\n }\r\n };\r\n /**\r\n * Treemap layout algorithm: slice.\r\n *\r\n * @ignore Exclude from docs\r\n * @param parent Data item\r\n */\r\n TreeMap.prototype.slice = function (parent) {\r\n var x0 = parent.x0;\r\n var x1 = parent.x1;\r\n var y0 = parent.y0;\r\n var y1 = parent.y1;\r\n var nodes = parent.children;\r\n var node;\r\n var i = -1;\r\n var n = nodes.length;\r\n var k = parent.value && (y1 - y0) / parent.value;\r\n while (++i < n) {\r\n node = nodes.getIndex(i);\r\n node.x0 = x0;\r\n node.x1 = x1;\r\n node.y0 = y0;\r\n y0 += node.value * k;\r\n node.y1 = y0;\r\n }\r\n };\r\n /**\r\n * Treemap layout algorithm: dice.\r\n *\r\n * @ignore Exclude from docs\r\n * @param parent Data item\r\n */\r\n TreeMap.prototype.dice = function (parent) {\r\n var x0 = parent.x0;\r\n var x1 = parent.x1;\r\n var y0 = parent.y0;\r\n var y1 = parent.y1;\r\n var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value;\r\n while (++i < n) {\r\n node = nodes.getIndex(i);\r\n node.y0 = y0;\r\n node.y1 = y1;\r\n node.x0 = x0;\r\n x0 += node.value * k;\r\n node.x1 = x0;\r\n }\r\n };\r\n /**\r\n * Treemap layout algorithm: slideDice.\r\n *\r\n * @ignore Exclude from docs\r\n * @param parent Data item\r\n */\r\n TreeMap.prototype.sliceDice = function (parent) {\r\n if (parent.level & 1) {\r\n this.slice(parent);\r\n }\r\n else {\r\n this.dice(parent);\r\n }\r\n };\r\n /**\r\n * Treemap layout algorithm: squarify.\r\n *\r\n * @ignore Exclude from docs\r\n * @param parent Data item\r\n */\r\n TreeMap.prototype.squarify = function (parent) {\r\n var ratio = (1 + Math.sqrt(5)) / 2;\r\n var x0 = parent.x0;\r\n var x1 = parent.x1;\r\n var y0 = parent.y0;\r\n var y1 = parent.y1;\r\n var nodes = parent.children;\r\n var nodeValue;\r\n var i0 = 0;\r\n var i1 = 0;\r\n var n = nodes.length;\r\n var dx;\r\n var dy;\r\n var value = parent.value;\r\n var sumValue;\r\n var minValue;\r\n var maxValue;\r\n var newRatio;\r\n var minRatio;\r\n var alpha;\r\n var beta;\r\n while (i0 < n) {\r\n dx = x1 - x0;\r\n dy = y1 - y0;\r\n // Find the next non-empty node.\r\n do {\r\n sumValue = nodes.getIndex(i1++).value;\r\n } while (!sumValue && i1 < n);\r\n minValue = maxValue = sumValue;\r\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\r\n beta = sumValue * sumValue * alpha;\r\n minRatio = Math.max(maxValue / beta, beta / minValue);\r\n // Keep adding nodes while the aspect ratio maintains or improves.\r\n for (; i1 < n; ++i1) {\r\n sumValue += nodeValue = nodes.getIndex(i1).value;\r\n if (nodeValue < minValue) {\r\n minValue = nodeValue;\r\n }\r\n if (nodeValue > maxValue) {\r\n maxValue = nodeValue;\r\n }\r\n beta = sumValue * sumValue * alpha;\r\n newRatio = Math.max(maxValue / beta, beta / minValue);\r\n if (newRatio > minRatio) {\r\n sumValue -= nodeValue;\r\n break;\r\n }\r\n minRatio = newRatio;\r\n }\r\n // Position and record the row orientation.\r\n var row = this.dataItems.template.clone();\r\n row.value = sumValue;\r\n row.dice = dx < dy;\r\n row.children = nodes.slice(i0, i1);\r\n row.x0 = x0;\r\n row.y0 = y0;\r\n row.x1 = x1;\r\n row.y1 = y1;\r\n if (row.dice) {\r\n row.y1 = value ? (y0 += (dy * sumValue) / value) : y1;\r\n this.dice(row);\r\n }\r\n else {\r\n row.x1 = value ? (x0 += (dx * sumValue) / value) : x1;\r\n this.slice(row);\r\n }\r\n value -= sumValue;\r\n i0 = i1;\r\n }\r\n };\r\n TreeMap.prototype.handleSeriesAdded2 = function () {\r\n // void\r\n };\r\n /**\r\n * [handleDataItemValueChange description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\n TreeMap.prototype.handleDataItemValueChange = function (dataItem, name) {\r\n if (name == \"value\") {\r\n this.invalidateDataItems();\r\n }\r\n };\r\n TreeMap.prototype.handleDataItemWorkingValueChange = function (dataItem, name) {\r\n if (name == \"value\") {\r\n this.invalidateDataItems();\r\n }\r\n };\r\n TreeMap.prototype.getLegendLevel = function (dataItem) {\r\n if (!dataItem) {\r\n return;\r\n }\r\n if (!dataItem.children) {\r\n return;\r\n }\r\n if (dataItem.children.length > 1) {\r\n return dataItem;\r\n }\r\n else if (dataItem.children.length == 1) {\r\n return this.getLegendLevel(dataItem.children.getIndex(0));\r\n }\r\n else {\r\n return dataItem;\r\n }\r\n };\r\n Object.defineProperty(TreeMap.prototype, \"homeDataItem\", {\r\n /**\r\n * A data item associated with top node.\r\n *\r\n * @since 4.8.2\r\n */\r\n get: function () {\r\n return this._homeDataItem;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Setups the legend to use the chart's data.\r\n * @ignore\r\n */\r\n TreeMap.prototype.feedLegend = function () {\r\n var legend = this.legend;\r\n if (legend) {\r\n legend.dataFields.name = \"name\";\r\n var legendParent = this.getLegendLevel(this._homeDataItem);\r\n if (legendParent) {\r\n var legendData_1 = [];\r\n legendParent.children.each(function (dataItem) {\r\n //if (!dataItem.hiddenInLegend) {\r\n legendData_1.push(dataItem);\r\n //}\r\n });\r\n legend.data = legendData_1;\r\n }\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n TreeMap.prototype.disposeData = function () {\r\n _super.prototype.disposeData.call(this);\r\n this._homeDataItem = undefined;\r\n this.series.clear();\r\n if (this.navigationBar) {\r\n this.navigationBar.disposeData();\r\n }\r\n this.xAxis.disposeData();\r\n this.yAxis.disposeData();\r\n };\r\n /**\r\n * Since this chart uses hierarchical data, we need to remove childrent\r\n * dataField from export of non-hierarchical formats such as CSV and XSLX.\r\n *\r\n * @return Export\r\n */\r\n TreeMap.prototype.getExporting = function () {\r\n var _this = this;\r\n var exporting = _super.prototype.getExporting.call(this);\r\n exporting.adapter.add(\"formatDataFields\", function (info) {\r\n if (info.format == \"csv\" || info.format == \"xlsx\") {\r\n if ($type.hasValue(_this.dataFields.children)) {\r\n delete info.dataFields[_this.dataFields.children];\r\n }\r\n }\r\n return info;\r\n });\r\n return exporting;\r\n };\r\n return TreeMap;\r\n}(XYChart));\r\nexport { TreeMap };\r\n/**\r\n * Register class, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"TreeMap\"] = TreeMap;\r\n//# sourceMappingURL=TreeMap.js.map","/**\r\n * Module, defining Axis Renderer for horizontal 3D axes.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisRendererX } from \"../axes/AxisRendererX\";\r\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Renderer for horizontal 3D axis.\r\n *\r\n * @see {@link IAxisRendererX3DEvents} for a list of available events\r\n * @see {@link IAxisRendererX3DAdapters} for a list of available Adapters\r\n */\r\nvar AxisRendererX3D = /** @class */ (function (_super) {\r\n __extends(AxisRendererX3D, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\r\n function AxisRendererX3D() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * A related chart.\r\n *\r\n * @todo Description\r\n */\r\n _this._chart = new MutableValueDisposer();\r\n _this.className = \"AxisRendererX3D\";\r\n _this._disposers.push(_this._chart);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererX3D.prototype.updateGridElement = function (grid, position, endPosition) {\r\n position = position + (endPosition - position) * grid.location;\r\n var point = this.positionToPoint(position);\r\n if (grid.element) {\r\n var dx = this.chart.dx3D || 0;\r\n var dy = this.chart.dy3D || 0;\r\n var h = this.getHeight();\r\n grid.path = $path.moveTo({ x: dx, y: dy }) + $path.lineTo({ x: dx, y: h + dy }) + $path.lineTo({ x: 0, y: h });\r\n }\r\n this.positionItem(grid, point);\r\n this.toggleVisibility(grid, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererX3D.prototype.updateBaseGridElement = function () {\r\n _super.prototype.updateBaseGridElement.call(this);\r\n var h = this.getHeight();\r\n var dx = this.chart.dx3D || 0;\r\n var dy = this.chart.dy3D || 0;\r\n this.baseGrid.path = $path.moveTo({ x: dx, y: dy }) + $path.lineTo({ x: 0, y: 0 }) + $path.lineTo({ x: 0, y: h });\r\n };\r\n Object.defineProperty(AxisRendererX3D.prototype, \"chart\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Chart\r\n */\r\n get: function () {\r\n return this._chart.get();\r\n },\r\n /**\r\n * Chart, associated with the Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Chart\r\n */\r\n set: function (chart) {\r\n if (chart) {\r\n this._chart.set(chart, chart.events.on(\"propertychanged\", this.handle3DChanged, this, false));\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Invoked when 3D-related settings change, like depth or angle.\r\n *\r\n * @param event Event\r\n */\r\n AxisRendererX3D.prototype.handle3DChanged = function (event) {\r\n if (event.property == \"depth\" || event.property == \"angle\") {\r\n this.invalidate();\r\n }\r\n };\r\n return AxisRendererX3D;\r\n}(AxisRendererX));\r\nexport { AxisRendererX3D };\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[\"AxisRendererX3D\"] = AxisRendererX3D;\r\n//# sourceMappingURL=AxisRendererX3D.js.map","/**\r\n * Module, defining Axis Renderer for vertical 3D axes.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { AxisRendererY } from \"../axes/AxisRendererY\";\r\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Renderer for vertical 3D axis.\r\n *\r\n * @see {@link IAxisRendererY3DEvents} for a list of available events\r\n * @see {@link IAxisRendererY3DAdapters} for a list of available Adapters\r\n */\r\nvar AxisRendererY3D = /** @class */ (function (_super) {\r\n __extends(AxisRendererY3D, _super);\r\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\r\n function AxisRendererY3D() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * A related chart.\r\n *\r\n * @todo Description\r\n */\r\n _this._chart = new MutableValueDisposer();\r\n _this.className = \"AxisRendererY3D\";\r\n _this._disposers.push(_this._chart);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\r\n AxisRendererY3D.prototype.updateGridElement = function (grid, position, endPosition) {\r\n position = position + (endPosition - position) * grid.location;\r\n var point = this.positionToPoint(position);\r\n if (grid.element) {\r\n var dx = this.chart.dx3D || 0;\r\n var dy = this.chart.dy3D || 0;\r\n var w = this.getWidth();\r\n grid.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: dx, y: dy }) + $path.lineTo({ x: w + dx, y: dy });\r\n }\r\n this.positionItem(grid, point);\r\n this.toggleVisibility(grid, position, 0, 1);\r\n };\r\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n AxisRendererY3D.prototype.updateBaseGridElement = function () {\r\n _super.prototype.updateBaseGridElement.call(this);\r\n var dx = this.chart.dx3D || 0;\r\n var dy = this.chart.dy3D || 0;\r\n var w = this.getWidth();\r\n this.baseGrid.path = $path.moveTo({ x: 0, y: 0 })\r\n + $path.lineTo({ x: w, y: 0 })\r\n + $path.lineTo({ x: w + dx, y: dy });\r\n };\r\n Object.defineProperty(AxisRendererY3D.prototype, \"chart\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Chart\r\n */\r\n get: function () {\r\n return this._chart.get();\r\n },\r\n /**\r\n * Chart, associated with the Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Chart\r\n */\r\n set: function (chart) {\r\n if (chart) {\r\n this._chart.set(chart, chart.events.on(\"propertychanged\", this.handle3DChanged, this, false));\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Invoked when 3D-related settings change, like depth or angle.\r\n *\r\n * @param event Event\r\n */\r\n AxisRendererY3D.prototype.handle3DChanged = function (event) {\r\n if (event.property == \"depth\" || event.property == \"angle\") {\r\n this.invalidate();\r\n }\r\n };\r\n return AxisRendererY3D;\r\n}(AxisRendererY));\r\nexport { AxisRendererY3D };\r\n//# sourceMappingURL=AxisRendererY3D.js.map","/**\r\n * Module that defines everything related to building 3D Columns.\r\n * It is a container which has column3D element which is a Rectangle3D.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Column } from \"./Column\";\r\nimport { Rectangle3D } from \"../../core/elements/3d/Rectangle3D\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to creates Column3Ds.\r\n *\r\n * @see {@link IColumn3DEvents} for a list of available events\r\n * @see {@link IColumn3DAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar Column3D = /** @class */ (function (_super) {\r\n __extends(Column3D, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Column3D() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Column3D\";\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n Column3D.prototype.createAssets = function () {\r\n this.column3D = this.createChild(Rectangle3D);\r\n this.column3D.shouldClone = false;\r\n this.column3D.strokeOpacity = 0;\r\n // some dirty hack so that if user access column, it won't get error\r\n this.column = this.column3D;\r\n };\r\n /**\r\n * @ignore Exclude from docs\r\n */\r\n Column3D.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n if (this.column3D) {\r\n this.column3D.width = this.pixelWidth;\r\n this.column3D.height = this.pixelHeight;\r\n if (this.column3D.invalid) {\r\n this.column3D.validate();\r\n }\r\n }\r\n };\r\n /**\r\n * Copies all parameters from another [[Column3D]].\r\n *\r\n * @param source Source Column3D\r\n */\r\n Column3D.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.column3D) {\r\n this.column3D.copyFrom(source.column3D);\r\n }\r\n };\r\n /**\r\n * Sets actual `fill` property on the SVG element, including applicable color\r\n * modifiers.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Fill\r\n */\r\n Column3D.prototype.setFill = function (value) {\r\n _super.prototype.setFill.call(this, value);\r\n this.column.fill = value;\r\n };\r\n return Column3D;\r\n}(Column));\r\nexport { Column3D };\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[\"Column3D\"] = Column3D;\r\n//# sourceMappingURL=Column3D.js.map","/**\r\n * 3D column series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ColumnSeries, ColumnSeriesDataItem } from \"../series/ColumnSeries\";\r\nimport { Column3D } from \"../elements/Column3D\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\nvar ColumnSeries3DDataItem = /** @class */ (function (_super) {\r\n __extends(ColumnSeries3DDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ColumnSeries3DDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ColumnSeries3DDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return ColumnSeries3DDataItem;\r\n}(ColumnSeriesDataItem));\r\nexport { ColumnSeries3DDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a 3D column graph.\r\n *\r\n * @see {@link IColumnSeries3DEvents} for a list of available Events\r\n * @see {@link IColumnSeries3DAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar ColumnSeries3D = /** @class */ (function (_super) {\r\n __extends(ColumnSeries3D, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ColumnSeries3D() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ColumnSeries3D\";\r\n _this.columns.template.column3D.applyOnClones = true;\r\n _this.columns.template.hiddenState.properties.visible = true;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(ColumnSeries3D.prototype, \"columnsContainer\", {\r\n /**\r\n * @ignore\r\n */\r\n get: function () {\r\n var chart = this.chart;\r\n if (chart && chart.columnsContainer && chart.leftAxesContainer.layout != \"vertical\" && chart.rightAxesContainer.layout != \"vertical\" && chart.bottomAxesContainer.layout != \"horizontal\" && chart.topAxesContainer.layout != \"horizontal\") {\r\n return chart.columnsContainer;\r\n }\r\n else {\r\n return this._columnsContainer;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Validates data item's elements.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n ColumnSeries3D.prototype.validateDataElementReal = function (dataItem) {\r\n _super.prototype.validateDataElementReal.call(this, dataItem);\r\n if (dataItem.column) {\r\n dataItem.column.dx = this.dx;\r\n dataItem.column.dy = this.dy;\r\n }\r\n };\r\n /**\r\n * Validates data item's elements.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n ColumnSeries3D.prototype.validateDataElements = function () {\r\n _super.prototype.validateDataElements.call(this);\r\n if (this.chart) {\r\n this.chart.invalidateLayout();\r\n }\r\n };\r\n /**\r\n * Returns an element to use for 3D bar.\r\n * @ignore\r\n * @return Element.\r\n */\r\n ColumnSeries3D.prototype.createColumnTemplate = function () {\r\n return new Column3D();\r\n };\r\n Object.defineProperty(ColumnSeries3D.prototype, \"depth\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Depth (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"depth\");\r\n },\r\n /**\r\n * Depth (height) of the slices in the series in pixels.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Depth (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"depth\", value, true);\r\n var template = this.columns.template; // todo: Cone is not Rectangle3D, maybe we should do some I3DShape?\r\n template.column3D.depth = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColumnSeries3D.prototype, \"angle\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Angle (0-360)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"angle\");\r\n },\r\n /**\r\n * Angle of view for the slices in series. (0-360)\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Angle (0-360)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"angle\", value);\r\n var template = this.columns.template;\r\n template.column3D.angle = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ColumnSeries3D;\r\n}(ColumnSeries));\r\nexport { ColumnSeries3D };\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[\"ColumnSeries3D\"] = ColumnSeries3D;\r\nregistry.registeredClasses[\"ColumnSeries3DDataItem\"] = ColumnSeries3DDataItem;\r\n//# sourceMappingURL=ColumnSeries3D.js.map","/**\r\n * Module for building 3D serial charts.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * Imports\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { XYChart, XYChartDataItem } from \"./XYChart\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { AxisRendererX3D } from \"../axes/AxisRendererX3D\";\r\nimport { AxisRendererY3D } from \"../axes/AxisRendererY3D\";\r\nimport { ColumnSeries3D } from \"../series/ColumnSeries3D\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[XYChart3D]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar XYChart3DDataItem = /** @class */ (function (_super) {\r\n __extends(XYChart3DDataItem, _super);\r\n function XYChart3DDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"XYChart3DDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return XYChart3DDataItem;\r\n}(XYChartDataItem));\r\nexport { XYChart3DDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a 3D XY chart.\r\n *\r\n * @see {@link IXYChart3DEvents} for a list of available Events\r\n * @see {@link IXYChart3DAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/xy-chart/} for documentation\r\n * @important\r\n */\r\nvar XYChart3D = /** @class */ (function (_super) {\r\n __extends(XYChart3D, _super);\r\n /**\r\n * Constructor\r\n */\r\n function XYChart3D() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Type of the axis renderer to use for X axes.\r\n */\r\n _this._axisRendererX = AxisRendererX3D;\r\n /**\r\n * Type of the axis renderer to use for Y axes.\r\n */\r\n _this._axisRendererY = AxisRendererY3D;\r\n _this.className = \"XYChart3D\";\r\n // Set defaults\r\n _this.depth = 30;\r\n _this.angle = 30;\r\n // Creeate container for columns\r\n var columnsContainer = _this.seriesContainer.createChild(Container);\r\n columnsContainer.shouldClone = false;\r\n columnsContainer.isMeasured = false;\r\n columnsContainer.layout = \"none\";\r\n _this.columnsContainer = columnsContainer;\r\n _this.columnsContainer.mask = _this.createChild(Sprite);\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * This is done because for some reason IE doesn't change mask if path of a\r\n * mask changes.\r\n */\r\n XYChart3D.prototype.updateSeriesMasks = function () {\r\n _super.prototype.updateSeriesMasks.call(this);\r\n if ($utils.isIE()) {\r\n var columnsContainer = this.columnsContainer;\r\n var mask = columnsContainer.mask;\r\n columnsContainer.mask = undefined;\r\n columnsContainer.mask = mask;\r\n }\r\n };\r\n Object.defineProperty(XYChart3D.prototype, \"depth\", {\r\n /**\r\n * @return Depth (px)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"depth\");\r\n },\r\n /**\r\n * Depth of the 3D chart / columns in pixels.\r\n *\r\n * @param value Depth (px)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"depth\", value);\r\n this.fixLayout();\r\n this.invalidateDataUsers();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYChart3D.prototype, \"angle\", {\r\n /**\r\n * @return Angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"angle\");\r\n },\r\n /**\r\n * Angle the chart is viewed at.\r\n *\r\n * @todo Description (review)\r\n * @param value Angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"angle\", value);\r\n this.fixLayout();\r\n this.invalidateDataUsers();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYChart3D.prototype, \"dx3D\", {\r\n /**\r\n * A calculated horizontal 3D offset (px).\r\n *\r\n * @readonly\r\n * @return Offset (px)\r\n */\r\n get: function () {\r\n return $math.cos(this.angle) * this.depth;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYChart3D.prototype, \"dy3D\", {\r\n /**\r\n * A calculated vertical 3D offset (px).\r\n *\r\n * @readonly\r\n * @return Offset (px)\r\n */\r\n get: function () {\r\n return -$math.sin(this.angle) * this.depth;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * (Re)validates layout\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYChart3D.prototype.validateLayout = function () {\r\n _super.prototype.validateLayout.call(this);\r\n this.fixColumns();\r\n };\r\n /**\r\n * Updates the layout (padding and scrollbar positions) to accommodate for\r\n * 3D depth and angle.\r\n */\r\n XYChart3D.prototype.fixLayout = function () {\r\n this.chartContainer.marginTop = -this.dy3D;\r\n this.chartContainer.paddingRight = this.dx3D;\r\n if (this.scrollbarX) {\r\n this.scrollbarX.dy = this.dy3D;\r\n this.scrollbarX.dx = this.dx3D;\r\n }\r\n if (this.scrollbarY) {\r\n this.scrollbarY.dy = this.dy3D;\r\n this.scrollbarY.dx = this.dx3D;\r\n }\r\n this.fixColumns();\r\n _super.prototype.fixLayout.call(this);\r\n };\r\n /**\r\n * Updates column positions, offset and dimensions based on chart's angle\r\n * and depth.\r\n */\r\n XYChart3D.prototype.fixColumns = function () {\r\n var _this = this;\r\n var count = 1;\r\n var i = 0;\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (series instanceof ColumnSeries3D) {\r\n if (!series.clustered && i > 0) {\r\n count++;\r\n }\r\n series.depthIndex = count - 1;\r\n i++;\r\n }\r\n });\r\n var s = 0;\r\n $iter.each(this.series.iterator(), function (series) {\r\n if (series instanceof ColumnSeries3D) {\r\n series.depth = _this.depth / (count);\r\n series.angle = _this.angle;\r\n if (series.columnsContainer == _this.columnsContainer) {\r\n series.dx = _this.depth / (count) * $math.cos(_this.angle) * (series.depthIndex);\r\n series.dy = -_this.depth / (count) * $math.sin(_this.angle) * (series.depthIndex);\r\n }\r\n var inversed_1 = false;\r\n if ((series.baseAxis == series.xAxis && series.xAxis.renderer.inversed) || (series.baseAxis == series.yAxis && series.yAxis.renderer.inversed)) {\r\n inversed_1 = true;\r\n }\r\n var i_1 = 1;\r\n series.dataItems.each(function (dataItem) {\r\n var column = dataItem.column;\r\n if (column) {\r\n if (inversed_1) {\r\n column.zIndex = 1000 * (1000 - i_1) + s - series.depthIndex * 100;\r\n }\r\n else {\r\n column.zIndex = 1000 * i_1 + s - series.depthIndex * 100;\r\n }\r\n }\r\n i_1++;\r\n });\r\n if (inversed_1) {\r\n s--;\r\n }\r\n else {\r\n s++;\r\n }\r\n }\r\n });\r\n this.maskColumns();\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n XYChart3D.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Set up series\r\n if ($type.hasValue(config.series) && $type.isArray(config.series)) {\r\n for (var i = 0, len = config.series.length; i < len; i++) {\r\n config.series[i].type = config.series[i].type || \"ColumnSeries3D\";\r\n }\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n XYChart3D.prototype.maskColumns = function () {\r\n var w = this.plotContainer.pixelWidth;\r\n var h = this.plotContainer.pixelHeight;\r\n var dx = this.dx3D;\r\n var dy = this.dy3D;\r\n var path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: dx, y: dy }) + $path.lineTo({ x: w + dx, y: dy }) + $path.lineTo({ x: w + dx, y: h + dy }) + $path.lineTo({ x: w, y: h }) + $path.lineTo({ x: w, y: h }) + $path.lineTo({ x: 0, y: h }) + $path.closePath();\r\n var columnsContainer = this.columnsContainer;\r\n if (columnsContainer && columnsContainer.mask) {\r\n columnsContainer.mask.path = path;\r\n }\r\n };\r\n return XYChart3D;\r\n}(XYChart));\r\nexport { XYChart3D };\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[\"XYChart3D\"] = XYChart3D;\r\n//# sourceMappingURL=XYChart3D.js.map","/**\r\n * HeatLegend module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { LinearGradient } from \"../../core/rendering/fills/LinearGradient\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { toColor, Color } from \"../../core/utils/Color\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { ValueAxis } from \"../../charts/axes/ValueAxis\";\r\nimport { AxisRendererX } from \"../../charts/axes/AxisRendererX\";\r\nimport { AxisRendererY } from \"../../charts/axes/AxisRendererY\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $colors from \"../../core/utils/Colors\";\r\nimport { RoundedRectangle } from \"../../core/elements/RoundedRectangle\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * This class creates a link (waved color-filled line) between two nodes in a\r\n * Sankey Diagram.\r\n *\r\n * @see {@link IHeatLegendEvents} for a list of available events\r\n * @see {@link IHeatLegendAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar HeatLegend = /** @class */ (function (_super) {\r\n __extends(HeatLegend, _super);\r\n /**\r\n * Constructor\r\n */\r\n function HeatLegend() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"HeatLegend\";\r\n _this.markerContainer = _this.createChild(Container);\r\n _this.markerContainer.shouldClone = false;\r\n _this.markerCount = 1;\r\n // Create a template container and list for the a marker\r\n var marker = new RoundedRectangle();\r\n marker.minHeight = 20;\r\n marker.minWidth = 20;\r\n marker.interactionsEnabled = false;\r\n marker.fillOpacity = 1;\r\n marker.cornerRadius(0, 0, 0, 0);\r\n _this.markerContainer.minHeight = 20;\r\n _this.markerContainer.minWidth = 20;\r\n _this.orientation = \"horizontal\";\r\n _this.markers = new ListTemplate(marker);\r\n _this._disposers.push(new ListDisposer(_this.markers));\r\n _this._disposers.push(_this.markers.template);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n HeatLegend.prototype.getMinFromRules = function (property) {\r\n var series = this.series;\r\n if (series) {\r\n var minValue_1;\r\n $iter.eachContinue(series.heatRules.iterator(), function (heatRule) {\r\n if (heatRule.property == property) {\r\n minValue_1 = heatRule.min;\r\n return false;\r\n }\r\n return true;\r\n });\r\n return minValue_1;\r\n }\r\n };\r\n HeatLegend.prototype.getMaxFromRules = function (property) {\r\n var series = this.series;\r\n if (series) {\r\n var maxValue_1;\r\n $iter.each(series.heatRules.iterator(), function (heatRule) {\r\n if (heatRule.property == property) {\r\n maxValue_1 = heatRule.max;\r\n return false;\r\n }\r\n return true;\r\n });\r\n return maxValue_1;\r\n }\r\n };\r\n /**\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n HeatLegend.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n this.valueAxis.renderer.inversed = this.reverseOrder;\r\n var series = this.series;\r\n var minColor = this.minColor;\r\n var maxColor = this.maxColor;\r\n if (!$type.hasValue(minColor)) {\r\n minColor = toColor(this.getMinFromRules(\"fill\"));\r\n }\r\n if (!$type.hasValue(maxColor)) {\r\n maxColor = toColor(this.getMaxFromRules(\"fill\"));\r\n }\r\n if (series) {\r\n var seriesFill = series.fill;\r\n if (!$type.hasValue(minColor) && seriesFill instanceof Color) {\r\n minColor = seriesFill;\r\n }\r\n if (!$type.hasValue(maxColor) && seriesFill instanceof Color) {\r\n maxColor = seriesFill;\r\n }\r\n }\r\n if (!$type.hasValue(maxColor)) {\r\n maxColor = toColor(this.getMaxFromRules(\"fill\"));\r\n }\r\n var minOpacity = $type.toNumber(this.getMinFromRules(\"fillOpacity\"));\r\n if (!$type.isNumber(minOpacity)) {\r\n minOpacity = 1;\r\n }\r\n var maxOpacity = $type.toNumber(this.getMaxFromRules(\"fillOpacity\"));\r\n if (!$type.isNumber(maxOpacity)) {\r\n maxOpacity = 1;\r\n }\r\n var minStrokeOpacity = $type.toNumber(this.getMinFromRules(\"strokeOpacity\"));\r\n if (!$type.isNumber(minStrokeOpacity)) {\r\n minStrokeOpacity = 1;\r\n }\r\n var maxStrokeOpacity = $type.toNumber(this.getMaxFromRules(\"strokeOpacity\"));\r\n if (!$type.isNumber(maxStrokeOpacity)) {\r\n maxStrokeOpacity = 1;\r\n }\r\n var minStroke = toColor(this.getMinFromRules(\"stroke\"));\r\n var maxStroke = toColor(this.getMaxFromRules(\"stroke\"));\r\n //if (series) {\r\n for (var i = 0; i < this.markerCount; i++) {\r\n var marker = this.markers.getIndex(i);\r\n if (!marker) {\r\n marker = this.markers.create();\r\n marker.parent = this.markerContainer;\r\n marker.height = percent(100);\r\n marker.width = percent(100);\r\n }\r\n if (this.markerCount == 1) {\r\n var gradient = new LinearGradient();\r\n if (this.reverseOrder) {\r\n gradient.addColor(maxColor, maxOpacity);\r\n gradient.addColor(minColor, minOpacity);\r\n }\r\n else {\r\n gradient.addColor(minColor, minOpacity);\r\n gradient.addColor(maxColor, maxOpacity);\r\n }\r\n if (this.orientation == \"vertical\") {\r\n gradient.rotation = -90;\r\n }\r\n marker.fill = gradient;\r\n if ($type.hasValue(minStroke) && $type.hasValue(maxStroke)) {\r\n var strokeGradient = new LinearGradient();\r\n if (this.reverseOrder) {\r\n strokeGradient.addColor(maxStroke, maxStrokeOpacity);\r\n strokeGradient.addColor(minStroke, minStrokeOpacity);\r\n }\r\n else {\r\n strokeGradient.addColor(minStroke, minStrokeOpacity);\r\n strokeGradient.addColor(maxStroke, maxStrokeOpacity);\r\n }\r\n if (this.orientation == \"vertical\") {\r\n strokeGradient.rotation = -90;\r\n }\r\n marker.stroke = strokeGradient;\r\n }\r\n }\r\n else {\r\n var c = i;\r\n if (this.reverseOrder) {\r\n c = this.markerCount - i - 1;\r\n }\r\n var color = new Color($colors.interpolate(minColor.rgb, maxColor.rgb, c / this.markerCount));\r\n marker.fill = color;\r\n var opacity = minOpacity + (maxOpacity - minOpacity) * c / this.markerCount;\r\n marker.fillOpacity = opacity;\r\n if ($type.hasValue(minStroke) && $type.hasValue(maxStroke)) {\r\n var color_1 = new Color($colors.interpolate(minStroke.rgb, maxStroke.rgb, c / this.markerCount));\r\n marker.stroke = color_1;\r\n var opacity_1 = minStrokeOpacity + (maxStrokeOpacity - minStrokeOpacity) * c / this.markerCount;\r\n marker.strokeOpacity = opacity_1;\r\n }\r\n }\r\n }\r\n var renderer = this.valueAxis.renderer;\r\n if (this.markerCount > 1) {\r\n if (this.orientation == \"horizontal\") {\r\n renderer.minGridDistance = this.measuredWidth / this.markerCount;\r\n }\r\n else {\r\n renderer.minGridDistance = this.measuredHeight / this.markerCount;\r\n }\r\n }\r\n this.valueAxis.invalidate();\r\n for (var i = this.markerCount, len = this.markers.length; i < len; i++) {\r\n this.markers.getIndex(i).parent = undefined;\r\n }\r\n };\r\n Object.defineProperty(HeatLegend.prototype, \"minColor\", {\r\n /**\r\n * Returns minColor value\r\n * @return {Color}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"minColor\");\r\n },\r\n /**\r\n * Min color of a heat legend. If a series is set for the legend, minColor is taken from series.\r\n *\r\n * @param {Color}\r\n */\r\n set: function (value) {\r\n if (!(value instanceof Color)) {\r\n value = toColor(value);\r\n }\r\n this.setColorProperty(\"minColor\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HeatLegend.prototype, \"maxColor\", {\r\n /**\r\n * Returns maxColor value\r\n * @return {Color}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maxColor\");\r\n },\r\n /**\r\n * Max color of a heat legend. If a series is set for the legend, maxColor is taken from series.\r\n *\r\n * @param {Color}\r\n */\r\n set: function (value) {\r\n if (!(value instanceof Color)) {\r\n value = toColor(value);\r\n }\r\n this.setColorProperty(\"maxColor\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HeatLegend.prototype, \"markerCount\", {\r\n /**\r\n * Returns number of color squares (markers).\r\n * @return {number}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"markerCount\");\r\n },\r\n /**\r\n * Number of color squares (markers) in the heat legend. If only 1 marker is used, it will be filled with gradient.\r\n *\r\n * @param {number}\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"markerCount\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HeatLegend.prototype, \"minValue\", {\r\n /**\r\n * Returns minimum value of heat legend.\r\n * @return {number}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"minValue\");\r\n },\r\n /**\r\n * Minimum value of heat legend's value axis. If a series is set for the legend, min is taken from series.\r\n *\r\n * @param {number}\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"minValue\", value);\r\n this.valueAxis.min = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HeatLegend.prototype, \"maxValue\", {\r\n /**\r\n * Returns maximum value of heat legend.\r\n * @return {number}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maxValue\");\r\n },\r\n /**\r\n * Maximum value of heat legend's value axis. If a series is set for the legend, max is taken from series.\r\n *\r\n * @param {number}\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"maxValue\", value);\r\n this.valueAxis.max = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HeatLegend.prototype, \"orientation\", {\r\n /**\r\n * Returns orientation value.\r\n *\r\n * @return {\"horizontal\" | \"vertical\"}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"orientation\");\r\n },\r\n /**\r\n * Heat legend orientation. Note, if you change orientation of a heat legend, you must set value axis renderer properties after that, as with orientation renderer changes.\r\n *\r\n * @param {\"horizontal\" | \"vertical\"}\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"orientation\", value, true);\r\n var markerContainer = this.markerContainer;\r\n var valueAxis = this.valueAxis;\r\n // HORIZONTAL\r\n if (value == \"horizontal\") {\r\n if (!$type.hasValue(this.width)) {\r\n this.width = 200;\r\n }\r\n this.height = undefined;\r\n valueAxis.width = percent(100);\r\n valueAxis.height = undefined;\r\n valueAxis.tooltip.pointerOrientation = \"vertical\";\r\n this.layout = \"vertical\";\r\n markerContainer.width = percent(100);\r\n markerContainer.height = undefined;\r\n if (!(valueAxis.renderer instanceof AxisRendererX)) {\r\n valueAxis.renderer = new AxisRendererX();\r\n }\r\n }\r\n // VERTICAL\r\n else {\r\n if (!$type.hasValue(this.height)) {\r\n this.height = 200;\r\n }\r\n this.width = undefined;\r\n this.layout = \"horizontal\";\r\n markerContainer.width = undefined;\r\n markerContainer.height = percent(100);\r\n valueAxis.height = percent(100);\r\n valueAxis.width = undefined;\r\n valueAxis.tooltip.pointerOrientation = \"horizontal\";\r\n if (!(valueAxis.renderer instanceof AxisRendererY)) {\r\n valueAxis.renderer = new AxisRendererY();\r\n }\r\n valueAxis.renderer.inside = true;\r\n valueAxis.renderer.labels.template.inside = true;\r\n this.markerContainer.reverseOrder = true;\r\n }\r\n var renderer = valueAxis.renderer;\r\n renderer.grid.template.disabled = true;\r\n renderer.axisFills.template.disabled = true;\r\n renderer.baseGrid.disabled = true;\r\n renderer.labels.template.padding(2, 3, 2, 3);\r\n renderer.minHeight = undefined;\r\n renderer.minWidth = undefined;\r\n this.markerContainer.layout = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HeatLegend.prototype, \"valueAxis\", {\r\n /**\r\n * Returns valueAxis value.\r\n * @return {ValueAxis}\r\n */\r\n get: function () {\r\n if (!this._valueAxis) {\r\n this.valueAxis = this.createChild(ValueAxis);\r\n this.valueAxis.shouldClone = false;\r\n }\r\n return this._valueAxis;\r\n },\r\n /**\r\n * Sets a value axis of heat legend. Value axis for heat legend is created automatically.\r\n * @param {ValueAxis}\r\n */\r\n set: function (valueAxis) {\r\n this._valueAxis = valueAxis;\r\n valueAxis.parent = this;\r\n valueAxis.strictMinMax = true;\r\n this.orientation = this.orientation;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HeatLegend.prototype, \"series\", {\r\n /**\r\n * Returns series value.\r\n * @return {Series}\r\n */\r\n get: function () {\r\n return this._series;\r\n },\r\n /**\r\n * You can set series for heat legend. It will take min, max, minColor and maxColor values from this series.\r\n * @param series\r\n */\r\n set: function (series) {\r\n var _this = this;\r\n this._series = series;\r\n var dataField = \"value\";\r\n try {\r\n var dataFieldDefined = series.heatRules.getIndex(0).dataField;\r\n if (dataFieldDefined) {\r\n dataField = dataFieldDefined;\r\n }\r\n }\r\n catch (err) {\r\n }\r\n this.updateMinMax(series.dataItem.values[dataField].low, series.dataItem.values[dataField].high);\r\n series.dataItem.events.on(\"calculatedvaluechanged\", function (event) {\r\n _this.updateMinMax(series.dataItem.values[dataField].low, series.dataItem.values[dataField].high);\r\n }, undefined, false);\r\n series.heatRules.events.on(\"inserted\", this.invalidate, this, false);\r\n series.heatRules.events.on(\"removed\", this.invalidate, this, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates min/max of value axis.\r\n * @ignore\r\n */\r\n HeatLegend.prototype.updateMinMax = function (min, max) {\r\n var valueAxis = this.valueAxis;\r\n if (!$type.isNumber(this.minValue)) {\r\n valueAxis.min = min;\r\n valueAxis.invalidate();\r\n }\r\n if (!$type.isNumber(this.maxValue)) {\r\n valueAxis.max = max;\r\n valueAxis.invalidate();\r\n }\r\n };\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n HeatLegend.prototype.processConfig = function (config) {\r\n if (config) {\r\n // Set up series\r\n if ($type.hasValue(config.series) && $type.isString(config.series)) {\r\n if ($type.isString(config.series)) {\r\n if (this.map.hasKey(config.series)) {\r\n config.series = this.map.getKey(config.series);\r\n }\r\n else {\r\n var seriesId_1 = config.series;\r\n var disposer_1 = this.map.events.on(\"insertKey\", function (ev) {\r\n if (ev.key == seriesId_1) {\r\n this.series = ev.newValue;\r\n disposer_1.dispose();\r\n }\r\n }, this);\r\n this._disposers.push(disposer_1);\r\n delete config.series;\r\n }\r\n }\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n return HeatLegend;\r\n}(Container));\r\nexport { HeatLegend };\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[\"HeatLegend\"] = HeatLegend;\r\n//# sourceMappingURL=HeatLegend.js.map","/**\r\n * Module that defines everything related to building Candlesticks.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Column } from \"./Column\";\r\nimport { Line } from \"../../core/elements/Line\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to creates Candlesticks.\r\n *\r\n * @see {@link ICandlestickEvents} for a list of available events\r\n * @see {@link ICandlestickAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar Candlestick = /** @class */ (function (_super) {\r\n __extends(Candlestick, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Candlestick() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"Candlestick\";\r\n _this.layout = \"none\";\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n Candlestick.prototype.createAssets = function () {\r\n _super.prototype.createAssets.call(this);\r\n this.lowLine = this.createChild(Line);\r\n this.lowLine.shouldClone = false;\r\n this.highLine = this.createChild(Line);\r\n this.highLine.shouldClone = false;\r\n };\r\n /**\r\n * Copies all parameters from another [[Candlestick]].\r\n *\r\n * @param source Source Candlestick\r\n */\r\n Candlestick.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.lowLine) {\r\n this.lowLine.copyFrom(source.lowLine);\r\n }\r\n if (this.highLine) {\r\n this.highLine.copyFrom(source.highLine);\r\n }\r\n };\r\n return Candlestick;\r\n}(Column));\r\nexport { Candlestick };\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[\"Candlestick\"] = Candlestick;\r\n//# sourceMappingURL=Candlestick.js.map","/**\r\n * Candlestick Series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ColumnSeries, ColumnSeriesDataItem } from \"./ColumnSeries\";\r\nimport { visualProperties } from \"../../core/Sprite\";\r\nimport { Candlestick } from \"../elements/Candlestick\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[CandlestickSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar CandlestickSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(CandlestickSeriesDataItem, _super);\r\n /**\r\n * Defines a type of [[Component]] this data item is used for\r\n * @todo Disabled to work around TS bug (see if we can re-enable it again)\r\n */\r\n //public _component!: CandlestickSeries;\r\n /**\r\n * Constructor\r\n */\r\n function CandlestickSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.values.lowValueX = {};\r\n _this.values.lowValueY = {};\r\n _this.values.highValueX = {};\r\n _this.values.highValueY = {};\r\n _this.className = \"CandlestickSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(CandlestickSeriesDataItem.prototype, \"lowValueX\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.lowValueX.value;\r\n },\r\n /**\r\n * Low value for horizontal axis.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"lowValueX\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CandlestickSeriesDataItem.prototype, \"lowValueY\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.lowValueY.value;\r\n },\r\n /**\r\n * Low value for vertical axis.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"lowValueY\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CandlestickSeriesDataItem.prototype, \"highValueX\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.highValueX.value;\r\n },\r\n /**\r\n * High value for horizontal axis.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"highValueX\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CandlestickSeriesDataItem.prototype, \"highValueY\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.highValueY.value;\r\n },\r\n /**\r\n * High value for vertical axis.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"highValueY\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CandlestickSeriesDataItem.prototype, \"closeValueX\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.valueX.value;\r\n },\r\n /**\r\n * Close value for horizontal axis.\r\n *\r\n * This is an alias for `valueX` added for convenience only.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"valueX\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CandlestickSeriesDataItem.prototype, \"closeValueY\", {\r\n /**\r\n * @return Value\r\n */\r\n get: function () {\r\n return this.values.valueY.value;\r\n },\r\n /**\r\n * Close value for vertical axis.\r\n *\r\n * This is an alias for `valueX` added for convenience only.\r\n *\r\n * @param value Value\r\n */\r\n set: function (value) {\r\n this.setValue(\"valueY\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CandlestickSeriesDataItem;\r\n}(ColumnSeriesDataItem));\r\nexport { CandlestickSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a candlestick graph.\r\n *\r\n * @see {@link ICandlestickSeriesEvents} for a list of available Events\r\n * @see {@link ICandlestickSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar CandlestickSeries = /** @class */ (function (_super) {\r\n __extends(CandlestickSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CandlestickSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"CandlestickSeries\";\r\n _this.groupFields.lowValueX = \"low\";\r\n _this.groupFields.lowValueY = \"low\";\r\n _this.groupFields.highValueX = \"high\";\r\n _this.groupFields.highValueY = \"high\";\r\n _this.strokeOpacity = 1;\r\n var interfaceColors = new InterfaceColorSet();\r\n var positiveColor = interfaceColors.getFor(\"positive\");\r\n var negativeColor = interfaceColors.getFor(\"negative\");\r\n _this.dropFromOpenState.properties.fill = negativeColor;\r\n _this.dropFromOpenState.properties.stroke = negativeColor;\r\n _this.riseFromOpenState.properties.fill = positiveColor;\r\n _this.riseFromOpenState.properties.stroke = positiveColor;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n CandlestickSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Candlestick Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n CandlestickSeries.prototype.createDataItem = function () {\r\n return new CandlestickSeriesDataItem();\r\n };\r\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n CandlestickSeries.prototype.validateDataElementReal = function (dataItem) {\r\n _super.prototype.validateDataElementReal.call(this, dataItem);\r\n this.validateCandlestick(dataItem);\r\n };\r\n CandlestickSeries.prototype.validateCandlestick = function (dataItem) {\r\n var column = dataItem.column;\r\n if (column) {\r\n var lowLine_1 = column.lowLine;\r\n var highLine_1 = column.highLine;\r\n if (this.baseAxis == this.xAxis) {\r\n var x = column.pixelWidth / 2;\r\n lowLine_1.x = x;\r\n highLine_1.x = x;\r\n var open_1 = dataItem.getWorkingValue(this.yOpenField);\r\n var close_1 = dataItem.getWorkingValue(this.yField);\r\n var yOpen = this.yAxis.getY(dataItem, this.yOpenField);\r\n var yClose = this.yAxis.getY(dataItem, this.yField);\r\n var yLow = this.yAxis.getY(dataItem, this.yLowField);\r\n var yHigh = this.yAxis.getY(dataItem, this.yHighField);\r\n var pixelY = column.pixelY;\r\n lowLine_1.y1 = yLow - pixelY;\r\n highLine_1.y1 = yHigh - pixelY;\r\n if (open_1 < close_1) {\r\n lowLine_1.y2 = yOpen - pixelY;\r\n highLine_1.y2 = yClose - pixelY;\r\n }\r\n else {\r\n lowLine_1.y2 = yClose - pixelY;\r\n highLine_1.y2 = yOpen - pixelY;\r\n }\r\n }\r\n if (this.baseAxis == this.yAxis) {\r\n var y = column.pixelHeight / 2;\r\n lowLine_1.y = y;\r\n highLine_1.y = y;\r\n var open_2 = dataItem.getWorkingValue(this.xOpenField);\r\n var close_2 = dataItem.getWorkingValue(this.xField);\r\n var xOpen = this.xAxis.getX(dataItem, this.xOpenField);\r\n var xClose = this.xAxis.getX(dataItem, this.xField);\r\n var xLow = this.xAxis.getX(dataItem, this.xLowField);\r\n var xHigh = this.xAxis.getX(dataItem, this.xHighField);\r\n var pixelX = column.pixelX;\r\n lowLine_1.x1 = xLow - pixelX;\r\n highLine_1.x1 = xHigh - pixelX;\r\n if (open_2 < close_2) {\r\n lowLine_1.x2 = xOpen - pixelX;\r\n highLine_1.x2 = xClose - pixelX;\r\n }\r\n else {\r\n lowLine_1.x2 = xClose - pixelX;\r\n highLine_1.x2 = xOpen - pixelX;\r\n }\r\n }\r\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\r\n // LOW LINE\r\n var rangeColumn = dataItem.rangesColumns.getKey(axisRange.uid);\r\n if (rangeColumn) {\r\n var rangeLowLine = rangeColumn.lowLine;\r\n rangeLowLine.x = lowLine_1.x;\r\n rangeLowLine.y = lowLine_1.y;\r\n rangeLowLine.x1 = lowLine_1.x1;\r\n rangeLowLine.x2 = lowLine_1.x2;\r\n rangeLowLine.y1 = lowLine_1.y1;\r\n rangeLowLine.y2 = lowLine_1.y2;\r\n // HIGH LINE\r\n var rangehighLine = rangeColumn.highLine;\r\n rangehighLine.x = highLine_1.x;\r\n rangehighLine.y = highLine_1.y;\r\n rangehighLine.x1 = highLine_1.x1;\r\n rangehighLine.x2 = highLine_1.x2;\r\n rangehighLine.y1 = highLine_1.y1;\r\n rangehighLine.y2 = highLine_1.y2;\r\n }\r\n });\r\n }\r\n };\r\n Object.defineProperty(CandlestickSeries.prototype, \"xLowField\", {\r\n /**\r\n * A data field to look for \"low\" value for horizontal axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Field name\r\n */\r\n get: function () {\r\n return this._xLowField;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CandlestickSeries.prototype, \"yLowField\", {\r\n /**\r\n * A data field to look for \"low\" value for vertical axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Field name\r\n */\r\n get: function () {\r\n return this._yLowField;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CandlestickSeries.prototype, \"xHighField\", {\r\n /**\r\n * A data field to look for \"high\" value for horizontal axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Field name\r\n */\r\n get: function () {\r\n return this._xHighField;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CandlestickSeries.prototype, \"yHighField\", {\r\n /**\r\n * A data field to look for \"high\" value for vertical axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Field name\r\n */\r\n get: function () {\r\n return this._yHighField;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets up which data fields to use for data access.\r\n */\r\n CandlestickSeries.prototype.defineFields = function () {\r\n _super.prototype.defineFields.call(this);\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (xAxis && yAxis) {\r\n if (this.baseAxis == xAxis) {\r\n var yAxisFieldName = $utils.capitalize(yAxis.axisFieldName);\r\n this._yLowField = (\"low\" + yAxisFieldName + \"Y\");\r\n this._yHighField = (\"high\" + yAxisFieldName + \"Y\");\r\n }\r\n if (this.baseAxis == yAxis) {\r\n var xAxisFieldName = $utils.capitalize(xAxis.axisFieldName);\r\n this._xLowField = (\"low\" + xAxisFieldName + \"X\");\r\n this._xHighField = (\"high\" + xAxisFieldName + \"X\");\r\n }\r\n this.addValueField(xAxis, this._xValueFields, this._xLowField);\r\n this.addValueField(xAxis, this._xValueFields, this._xHighField);\r\n this.addValueField(yAxis, this._yValueFields, this._yLowField);\r\n this.addValueField(yAxis, this._yValueFields, this._yHighField);\r\n }\r\n };\r\n /**\r\n * Creates elements in related legend container, that mimics the look of this\r\n * Series.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Legend item container\r\n */\r\n CandlestickSeries.prototype.createLegendMarker = function (marker) {\r\n var w = marker.pixelWidth;\r\n var h = marker.pixelHeight;\r\n marker.removeChildren();\r\n var column = marker.createChild(Candlestick);\r\n column.shouldClone = false;\r\n column.copyFrom(this.columns.template);\r\n var cw;\r\n var ch;\r\n var highLine = column.lowLine;\r\n var lowLine = column.highLine;\r\n if (this.baseAxis == this.yAxis) {\r\n cw = w / 3;\r\n ch = h;\r\n highLine.y = h / 2;\r\n lowLine.y = h / 2;\r\n highLine.x2 = w / 3;\r\n lowLine.x2 = w / 3;\r\n lowLine.x = w / 3 * 2;\r\n column.column.x = w / 3;\r\n }\r\n else {\r\n cw = w;\r\n ch = h / 3;\r\n highLine.x = w / 2;\r\n lowLine.x = w / 2;\r\n highLine.y2 = h / 3;\r\n lowLine.y2 = h / 3;\r\n lowLine.y = h / 3 * 2;\r\n column.column.y = h / 3;\r\n }\r\n column.width = cw;\r\n column.height = ch;\r\n $object.copyProperties(this, marker, visualProperties);\r\n $object.copyProperties(this.columns.template, column, visualProperties);\r\n column.stroke = this.riseFromOpenState.properties.stroke;\r\n column.fill = column.stroke;\r\n var legendDataItem = marker.dataItem;\r\n legendDataItem.color = column.fill;\r\n legendDataItem.colorOrig = column.fill;\r\n };\r\n /**\r\n * Returns an element to use for Candlestick\r\n * @ignore\r\n * @return Element.\r\n */\r\n CandlestickSeries.prototype.createColumnTemplate = function () {\r\n return new Candlestick();\r\n };\r\n return CandlestickSeries;\r\n}(ColumnSeries));\r\nexport { CandlestickSeries };\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[\"CandlestickSeries\"] = CandlestickSeries;\r\nregistry.registeredClasses[\"CandlestickSeriesDataItem\"] = CandlestickSeriesDataItem;\r\n//# sourceMappingURL=CandlestickSeries.js.map","/**\r\n * Module that defines everything related to building OHLCs.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Candlestick } from \"./Candlestick\";\r\nimport { Line } from \"../../core/elements/Line\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to creates OHLCs.\r\n *\r\n * @see {@link IOHLCEvents} for a list of available events\r\n * @see {@link IOHLCAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar OHLC = /** @class */ (function (_super) {\r\n __extends(OHLC, _super);\r\n /**\r\n * Constructor\r\n */\r\n function OHLC() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"OHLC\";\r\n _this.layout = \"none\";\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n OHLC.prototype.createAssets = function () {\r\n //super.createAssets();\r\n this.openLine = this.createChild(Line);\r\n this.openLine.shouldClone = false;\r\n this.highLowLine = this.createChild(Line);\r\n this.highLowLine.shouldClone = false;\r\n this.closeLine = this.createChild(Line);\r\n this.closeLine.shouldClone = false;\r\n };\r\n /**\r\n * Copies all parameters from another [[OHLC]].\r\n *\r\n * @param source Source OHLC\r\n */\r\n OHLC.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.openLine) {\r\n this.openLine.copyFrom(source.openLine);\r\n }\r\n if (this.highLowLine) {\r\n this.highLowLine.copyFrom(source.highLowLine);\r\n }\r\n if (this.closeLine) {\r\n this.closeLine.copyFrom(source.closeLine);\r\n }\r\n };\r\n return OHLC;\r\n}(Candlestick));\r\nexport { OHLC };\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[\"OHLC\"] = OHLC;\r\n//# sourceMappingURL=OHLC.js.map","/**\r\n * Candlestick Series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { CandlestickSeries, CandlestickSeriesDataItem } from \"./CandlestickSeries\";\r\nimport { visualProperties } from \"../../core/Sprite\";\r\nimport { OHLC } from \"../elements/OHLC\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[OHLCSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar OHLCSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(OHLCSeriesDataItem, _super);\r\n /**\r\n * Defines a type of [[Component]] this data item is used for\r\n * @todo Disabled to work around TS bug (see if we can re-enable it again)\r\n */\r\n //public _component!: OHLCSeries;\r\n /**\r\n * Constructor\r\n */\r\n function OHLCSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"OHLCSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return OHLCSeriesDataItem;\r\n}(CandlestickSeriesDataItem));\r\nexport { OHLCSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a candlestick graph.\r\n *\r\n * @see {@link IOHLCSeriesEvents} for a list of available Events\r\n * @see {@link IOHLCSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar OHLCSeries = /** @class */ (function (_super) {\r\n __extends(OHLCSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function OHLCSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"OHLCSeries\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n OHLCSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"OHLC Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n OHLCSeries.prototype.createDataItem = function () {\r\n return new OHLCSeriesDataItem();\r\n };\r\n OHLCSeries.prototype.validateCandlestick = function (dataItem) {\r\n var column = dataItem.column;\r\n if (column) {\r\n var openLine_1 = column.openLine;\r\n var highLowLine_1 = column.highLowLine;\r\n var closeLine_1 = column.closeLine;\r\n if (this.baseAxis == this.xAxis) {\r\n var x = column.pixelWidth / 2;\r\n highLowLine_1.x = x;\r\n // TODO can these be removed ?\r\n dataItem.getWorkingValue(this.yOpenField);\r\n dataItem.getWorkingValue(this.yField);\r\n var yOpen = this.yAxis.getY(dataItem, this.yOpenField);\r\n var yClose = this.yAxis.getY(dataItem, this.yField);\r\n var yLow = this.yAxis.getY(dataItem, this.yLowField);\r\n var yHigh = this.yAxis.getY(dataItem, this.yHighField);\r\n var pixelY = column.pixelY;\r\n openLine_1.y1 = yOpen - pixelY;\r\n openLine_1.y2 = yOpen - pixelY;\r\n openLine_1.x1 = 0;\r\n openLine_1.x2 = x;\r\n closeLine_1.y1 = yClose - pixelY;\r\n closeLine_1.y2 = yClose - pixelY;\r\n closeLine_1.x1 = x;\r\n closeLine_1.x2 = 2 * x;\r\n highLowLine_1.y1 = yHigh - pixelY;\r\n highLowLine_1.y2 = yLow - pixelY;\r\n }\r\n if (this.baseAxis == this.yAxis) {\r\n var y = column.pixelHeight / 2;\r\n highLowLine_1.y = y;\r\n // TODO can these be removed ?\r\n dataItem.getWorkingValue(this.xOpenField);\r\n dataItem.getWorkingValue(this.xField);\r\n var xOpen = this.xAxis.getX(dataItem, this.xOpenField);\r\n var xClose = this.xAxis.getX(dataItem, this.xField);\r\n var xLow = this.xAxis.getX(dataItem, this.xLowField);\r\n var xHigh = this.xAxis.getX(dataItem, this.xHighField);\r\n var pixelX = column.pixelX;\r\n openLine_1.x1 = xOpen - pixelX;\r\n openLine_1.x2 = xOpen - pixelX;\r\n openLine_1.y1 = y;\r\n openLine_1.y2 = 2 * y;\r\n closeLine_1.x1 = xClose - pixelX;\r\n closeLine_1.x2 = xClose - pixelX;\r\n closeLine_1.y1 = 0;\r\n closeLine_1.y2 = y;\r\n highLowLine_1.x1 = xHigh - pixelX;\r\n highLowLine_1.x2 = xLow - pixelX;\r\n }\r\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\r\n var rangeColumn = dataItem.rangesColumns.getKey(axisRange.uid);\r\n if (rangeColumn) {\r\n var rangeOpenLine = rangeColumn.openLine;\r\n rangeOpenLine.x = openLine_1.x;\r\n rangeOpenLine.y = openLine_1.y;\r\n rangeOpenLine.x1 = openLine_1.x1;\r\n rangeOpenLine.x2 = openLine_1.x2;\r\n rangeOpenLine.y1 = openLine_1.y1;\r\n rangeOpenLine.y2 = openLine_1.y2;\r\n var rangeCloseLine = rangeColumn.closeLine;\r\n rangeCloseLine.x = closeLine_1.x;\r\n rangeCloseLine.y = closeLine_1.y;\r\n rangeCloseLine.x1 = closeLine_1.x1;\r\n rangeCloseLine.x2 = closeLine_1.x2;\r\n rangeCloseLine.y1 = closeLine_1.y1;\r\n rangeCloseLine.y2 = closeLine_1.y2;\r\n var rangeHighLowLine = rangeColumn.highLowLine;\r\n rangeHighLowLine.x = highLowLine_1.x;\r\n rangeHighLowLine.y = highLowLine_1.y;\r\n rangeHighLowLine.x1 = highLowLine_1.x1;\r\n rangeHighLowLine.x2 = highLowLine_1.x2;\r\n rangeHighLowLine.y1 = highLowLine_1.y1;\r\n rangeHighLowLine.y2 = highLowLine_1.y2;\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Creates elements in related legend container, that mimics the look of this\r\n * Series.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Legend item container\r\n */\r\n OHLCSeries.prototype.createLegendMarker = function (marker) {\r\n var w = marker.pixelWidth;\r\n var h = marker.pixelHeight;\r\n marker.removeChildren();\r\n var column = marker.createChild(OHLC);\r\n column.shouldClone = false;\r\n column.copyFrom(this.columns.template);\r\n var cw;\r\n var ch;\r\n var openLine = column.openLine;\r\n var closeLine = column.closeLine;\r\n var highLowLine = column.highLowLine;\r\n if (this.baseAxis == this.yAxis) {\r\n cw = w / 3;\r\n ch = h;\r\n highLowLine.y = h / 2;\r\n highLowLine.x2 = w;\r\n openLine.x = w / 3 * 2;\r\n openLine.y2 = h / 2;\r\n closeLine.x = w / 3;\r\n closeLine.y2 = h;\r\n closeLine.y1 = h / 2;\r\n }\r\n else {\r\n cw = w;\r\n ch = h / 3;\r\n highLowLine.x = w / 2;\r\n highLowLine.y2 = h;\r\n openLine.y = h / 3 * 2;\r\n openLine.x2 = w / 2;\r\n closeLine.y = h / 3;\r\n closeLine.x2 = w;\r\n closeLine.x1 = w / 2;\r\n }\r\n column.width = cw;\r\n column.height = ch;\r\n $object.copyProperties(this, marker, visualProperties);\r\n $object.copyProperties(this.columns.template, column, visualProperties);\r\n column.stroke = this.riseFromOpenState.properties.stroke;\r\n var legendDataItem = marker.dataItem;\r\n legendDataItem.color = column.stroke;\r\n legendDataItem.colorOrig = column.stroke;\r\n };\r\n /**\r\n * Returns an element to use for Candlestick\r\n * @ignore\r\n * @return Element.\r\n */\r\n OHLCSeries.prototype.createColumnTemplate = function () {\r\n return new OHLC();\r\n };\r\n return OHLCSeries;\r\n}(CandlestickSeries));\r\nexport { OHLCSeries };\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[\"OHLCSeries\"] = OHLCSeries;\r\nregistry.registeredClasses[\"OHLCSeriesDataItem\"] = OHLCSeriesDataItem;\r\n//# sourceMappingURL=OHLCSeries.js.map","/**\r\n * Line series segment module.\r\n * @todo Add description about what this is\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { LineSeriesSegment } from \"./LineSeriesSegment\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Represents a line series segment.\r\n *\r\n * A line segment can be used to apply different properties to a part of the\r\n * line series, between two data points.\r\n *\r\n * @see {@link IStepLineSeriesSegmentEvents} for a list of available events\r\n * @see {@link IStepLineSeriesSegmentAdapters} for a list of available Adapters\r\n * @todo Example\r\n */\r\nvar StepLineSeriesSegment = /** @class */ (function (_super) {\r\n __extends(StepLineSeriesSegment, _super);\r\n /**\r\n * Constructor\r\n */\r\n function StepLineSeriesSegment() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"StepLineSeriesSegment\";\r\n return _this;\r\n }\r\n /**\r\n * Draws the series segment.\r\n *\r\n * @ignore Exclude from docs\r\n * @param points Points to connect\r\n * @param closePoints ?\r\n * @param smoothnessX Horizontal bezier setting (?)\r\n * @param smoothnessY Vertical bezier setting (?)\r\n */\r\n StepLineSeriesSegment.prototype.drawSegment = function (points, closePoints, smoothnessX, smoothnessY, noRisers, vertical) {\r\n if (points.length > 0 && closePoints.length > 0) {\r\n if (noRisers) {\r\n var path = $path.moveTo(points[0]);\r\n if (points.length > 0) {\r\n for (var i = 1; i < points.length; i++) {\r\n var point = points[i];\r\n if (i / 2 == Math.round(i / 2)) {\r\n path += $path.moveTo(point);\r\n }\r\n else {\r\n path += $path.lineTo(point);\r\n }\r\n }\r\n }\r\n this.strokeSprite.path = path;\r\n if (this.fillOpacity > 0 || this.fillSprite.fillOpacity > 0) { // helps to avoid drawing fill object if fill is not visible\r\n path = $path.moveTo(points[0]) + $path.polyline(points);\r\n path += $path.lineTo(closePoints[0]) + $path.polyline(closePoints);\r\n path += $path.lineTo(points[0]);\r\n path += $path.closePath();\r\n this.fillSprite.path = path;\r\n }\r\n else {\r\n }\r\n }\r\n else {\r\n var path = $path.moveTo(points[0]) + $path.polyline(points);\r\n this.strokeSprite.path = path;\r\n if (this.fillOpacity > 0 || this.fillSprite.fillOpacity > 0) { // helps to avoid drawing fill object if fill is not visible\r\n path += $path.lineTo(closePoints[0]) + $path.polyline(closePoints);\r\n path += $path.lineTo(points[0]);\r\n path += $path.closePath();\r\n this.fillSprite.path = path;\r\n }\r\n }\r\n }\r\n };\r\n return StepLineSeriesSegment;\r\n}(LineSeriesSegment));\r\nexport { StepLineSeriesSegment };\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[\"StepLineSeriesSegment\"] = StepLineSeriesSegment;\r\n//# sourceMappingURL=StepLineSeriesSegment.js.map","/**\r\n * Step line series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { LineSeries, LineSeriesDataItem } from \"./LineSeries\";\r\nimport { StepLineSeriesSegment } from \"./StepLineSeriesSegment\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[StepLineSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar StepLineSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(StepLineSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function StepLineSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"StepLineSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return StepLineSeriesDataItem;\r\n}(LineSeriesDataItem));\r\nexport { StepLineSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a step line graph.\r\n *\r\n * @see {@link IStepLineSeriesEvents} for a list of available Events\r\n * @see {@link IStepLineSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar StepLineSeries = /** @class */ (function (_super) {\r\n __extends(StepLineSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function StepLineSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"StepLineSeries\";\r\n _this.applyTheme();\r\n _this.startLocation = 0;\r\n _this.endLocation = 1;\r\n return _this;\r\n }\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n StepLineSeries.prototype.createDataItem = function () {\r\n return new StepLineSeriesDataItem();\r\n };\r\n /**\r\n * [addPoints description]\r\n *\r\n * @todo Description\r\n * @param points [description]\r\n * @param dataItem [description]\r\n * @param xField [description]\r\n * @param yField [description]\r\n * @param backwards [description]\r\n */\r\n StepLineSeries.prototype.addPoints = function (points, dataItem, xField, yField, backwards) {\r\n var startLocationX;\r\n var endLocationX;\r\n var startLocationY;\r\n var endLocationY;\r\n if (this.baseAxis == this.xAxis) {\r\n startLocationX = this.startLocation;\r\n endLocationX = this.endLocation;\r\n startLocationY = this.getAdjustedXLocation(dataItem, this.yOpenField);\r\n endLocationY = this.getAdjustedXLocation(dataItem, this.yField);\r\n }\r\n if (this.baseAxis == this.yAxis) {\r\n startLocationY = this.startLocation;\r\n endLocationY = this.endLocation;\r\n startLocationX = this.getAdjustedXLocation(dataItem, this.xOpenField);\r\n endLocationX = this.getAdjustedXLocation(dataItem, this.xField);\r\n }\r\n var x0 = this.xAxis.getX(dataItem, xField, startLocationX);\r\n var y0 = this.yAxis.getY(dataItem, yField, startLocationY);\r\n var x1 = this.xAxis.getX(dataItem, xField, endLocationX);\r\n var y1 = this.yAxis.getY(dataItem, yField, endLocationY);\r\n x0 = $math.fitToRange(x0, -100000, 100000); // from geometric point of view this is not right, but practically it's ok. this is done to avoid too big objects.\r\n y0 = $math.fitToRange(y0, -100000, 100000); // from geometric point of view this is not right, but practically it's ok. this is done to avoid too big objects.\r\n x1 = $math.fitToRange(x1, -100000, 100000); // from geometric point of view this is not right, but practically it's ok. this is done to avoid too big objects.\r\n y1 = $math.fitToRange(y1, -100000, 100000); // from geometric point of view this is not right, but practically it's ok. this is done to avoid too big objects.\r\n // this might make an impression that points are duplicated, and they indeed are, but this is needed to handle gaps in data\r\n if (!this.noRisers) {\r\n if (points.length > 1) {\r\n var prevPoint = points[points.length - 1];\r\n if (this.baseAxis == this.xAxis) {\r\n if (backwards) {\r\n points.push({ x: prevPoint.x, y: y1 });\r\n }\r\n else {\r\n points.push({ x: x0, y: prevPoint.y });\r\n }\r\n }\r\n if (this.baseAxis == this.yAxis) {\r\n if (backwards) {\r\n points.push({ x: x1, y: prevPoint.y });\r\n }\r\n else {\r\n points.push({ x: prevPoint.x, y: y0 });\r\n }\r\n }\r\n }\r\n }\r\n var point0 = { x: x0, y: y0 };\r\n var point1 = { x: x1, y: y1 };\r\n if (backwards) {\r\n points.push(point1, point0);\r\n }\r\n else {\r\n points.push(point0, point1);\r\n }\r\n };\r\n /**\r\n * Draws the line segment.\r\n *\r\n * @param segment Segment\r\n * @param points Segment points\r\n * @param closePoints Segment close points\r\n */\r\n StepLineSeries.prototype.drawSegment = function (segment, points, closePoints) {\r\n var vertical = false;\r\n if (this.yAxis == this.baseAxis) {\r\n vertical = true;\r\n }\r\n segment.drawSegment(points, closePoints, this.tensionX, this.tensionY, this.noRisers, vertical);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n StepLineSeries.prototype.createSegment = function () {\r\n return new StepLineSeriesSegment();\r\n };\r\n Object.defineProperty(StepLineSeries.prototype, \"noRisers\", {\r\n /**\r\n * @return No risers\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"noRisers\");\r\n },\r\n /**\r\n * Specifies if step line series should draw only horizontal (or only\r\n * vertical, depending on base axis) lines, instead of connecting them with\r\n * vertical (or horizontal) lines.\r\n *\r\n * @default false\r\n * @param value No risers\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"noRisers\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StepLineSeries.prototype, \"startLocation\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startLocation\");\r\n },\r\n /**\r\n * start location of the step\r\n *\r\n * @param value Location (0-1)\r\n * @default 0\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startLocation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StepLineSeries.prototype, \"endLocation\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endLocation\");\r\n },\r\n /**\r\n * Step end location.\r\n *\r\n * @param value Location (0-1)\r\n * #default 1\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endLocation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return StepLineSeries;\r\n}(LineSeries));\r\nexport { StepLineSeries };\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[\"StepLineSeries\"] = StepLineSeries;\r\nregistry.registeredClasses[\"StepLineSeriesDataItem\"] = StepLineSeriesDataItem;\r\n//# sourceMappingURL=StepLineSeries.js.map","/**\r\n * Module that defines everything related to building RadarColumns.\r\n * It is a container which has radarColumn element which is a Slice.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Column } from \"./Column\";\r\nimport { Slice } from \"../../core/elements/Slice\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to creates RadarColumns.\r\n *\r\n * @see {@link IRadarColumnEvents} for a list of available events\r\n * @see {@link IRadarColumnAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar RadarColumn = /** @class */ (function (_super) {\r\n __extends(RadarColumn, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RadarColumn() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"RadarColumn\";\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n RadarColumn.prototype.createAssets = function () {\r\n this.radarColumn = this.createChild(Slice);\r\n this.radarColumn.shouldClone = false;\r\n this.radarColumn.strokeOpacity = undefined;\r\n // some dirty hack so that if user access column, it won't get error\r\n this.column = this.radarColumn;\r\n };\r\n /**\r\n * Copies all parameters from another [[RadarColumn]].\r\n *\r\n * @param source Source RadarColumn\r\n */\r\n RadarColumn.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.radarColumn) {\r\n this.radarColumn.copyFrom(source.radarColumn);\r\n }\r\n };\r\n /**\r\n * X coordinate for the slice tooltip.\r\n *\r\n * @return X\r\n * @ignore\r\n */\r\n RadarColumn.prototype.getTooltipX = function () {\r\n var value = this.getPropertyValue(\"tooltipX\");\r\n if (!$type.isNumber(value)) {\r\n return this.radarColumn.getTooltipX();\r\n }\r\n return value;\r\n };\r\n /**\r\n * Y coordinate for the slice tooltip.\r\n *\r\n * @return Y\r\n * @ignore\r\n */\r\n RadarColumn.prototype.getTooltipY = function () {\r\n var value = this.getPropertyValue(\"tooltipX\");\r\n if (!$type.isNumber(value)) {\r\n return this.radarColumn.getTooltipY();\r\n }\r\n return value;\r\n };\r\n return RadarColumn;\r\n}(Column));\r\nexport { RadarColumn };\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[\"RadarColumn\"] = RadarColumn;\r\n//# sourceMappingURL=RadarColumn.js.map","/**\r\n * Radar column series module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ColumnSeries, ColumnSeriesDataItem } from \"../series/ColumnSeries\";\r\nimport { visualProperties } from \"../../core/Sprite\";\r\nimport { CategoryAxis } from \"../axes/CategoryAxis\";\r\nimport { RadarColumn } from \"../elements/RadarColumn\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $object from \"../../core/utils/Object\";\r\nimport { Percent } from \"../../core/utils/Percent\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $array from \"../../core/utils/Array\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[RadarColumnSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar RadarColumnSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(RadarColumnSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RadarColumnSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ColumnSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return RadarColumnSeriesDataItem;\r\n}(ColumnSeriesDataItem));\r\nexport { RadarColumnSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a 3D column graph.\r\n *\r\n * @see {@link IRadarColumnSeriesEvents} for a list of available Events\r\n * @see {@link IRadarColumnSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar RadarColumnSeries = /** @class */ (function (_super) {\r\n __extends(RadarColumnSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RadarColumnSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"RadarColumnSeries\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Creates and returns a RadarColumn element to use as column in radar chart.\r\n *\r\n * @return RadarColumn.\r\n */\r\n RadarColumnSeries.prototype.createColumnTemplate = function () {\r\n return new RadarColumn();\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n RadarColumnSeries.prototype.validate = function () {\r\n // so that radius would be updated\r\n if (this.chart.invalid) {\r\n this.chart.validate();\r\n }\r\n _super.prototype.validate.call(this);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n RadarColumnSeries.prototype.disableUnusedColumns = function (dataItem) {\r\n if (dataItem) {\r\n if (dataItem.column) {\r\n dataItem.column.__disabled = true;\r\n }\r\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\r\n var rangeColumn = dataItem.rangesColumns.getKey(axisRange.uid);\r\n if (rangeColumn) {\r\n rangeColumn.__disabled = true;\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n RadarColumnSeries.prototype.validateDataElementReal = function (dataItem) {\r\n var _this = this;\r\n var startAngle = this.chart.startAngle;\r\n var endAngle = this.chart.endAngle;\r\n var yField = this.yField;\r\n var yOpenField = this.yOpenField;\r\n var xField = this.xField;\r\n var xOpenField = this.xOpenField;\r\n var lAngle;\r\n var rAngle;\r\n var tRadius;\r\n var bRadius;\r\n var startLocation = this.getStartLocation(dataItem);\r\n var endLocation = this.getEndLocation(dataItem);\r\n var cellAngle = (endAngle - startAngle) / (this.dataItems.length * (this.end - this.start));\r\n var radarColumn = dataItem.column;\r\n if (!radarColumn) {\r\n radarColumn = this.columns.create();\r\n dataItem.column = radarColumn;\r\n $object.copyProperties(this, radarColumn, visualProperties); // need this \r\n $object.copyProperties(this.columns.template, radarColumn, visualProperties); // second time, no force, so that columns.template would override series properties\t\t\t\r\n dataItem.addSprite(radarColumn);\r\n radarColumn.paper = this.paper; // sometimes pattern is not drawn if is set with adapter without this.\r\n this.setColumnStates(radarColumn);\r\n }\r\n var width = radarColumn.width;\r\n var percentWidth = 100;\r\n if (width instanceof Percent) {\r\n percentWidth = width.percent;\r\n }\r\n var offset = $math.round((endLocation - startLocation) * (1 - percentWidth / 100) / 2, 5);\r\n startLocation += offset;\r\n endLocation -= offset;\r\n // two category axes\r\n if ((this.xAxis instanceof CategoryAxis) && (this.yAxis instanceof CategoryAxis)) {\r\n tRadius = $math.getDistance({ x: this.yAxis.getX(dataItem, yField, 0, \"valueY\"), y: this.yAxis.getY(dataItem, yField, 0, \"valueY\") });\r\n bRadius = $math.getDistance({ x: this.yAxis.getX(dataItem, yOpenField, 1, \"valueY\"), y: this.yAxis.getY(dataItem, yOpenField, 1, \"valueY\") });\r\n lAngle = this.xAxis.getAngle(dataItem, xOpenField, 0, \"valueX\");\r\n rAngle = this.xAxis.getAngle(dataItem, xField, 1, \"valueX\");\r\n startAngle = startAngle + startLocation * cellAngle;\r\n endAngle = endAngle - (1 - endLocation) * cellAngle;\r\n }\r\n else if (this.baseAxis == this.xAxis) {\r\n tRadius = $math.getDistance({ x: this.yAxis.getX(dataItem, yField, dataItem.locations[yField], \"valueY\"), y: this.yAxis.getY(dataItem, yField, dataItem.locations[yField], \"valueY\") });\r\n bRadius = $math.getDistance({ x: this.yAxis.getX(dataItem, yOpenField, dataItem.locations[yOpenField], \"valueY\"), y: this.yAxis.getY(dataItem, yOpenField, dataItem.locations[yOpenField], \"valueY\") });\r\n lAngle = this.xAxis.getAngle(dataItem, xOpenField, startLocation, \"valueX\");\r\n rAngle = this.xAxis.getAngle(dataItem, xField, endLocation, \"valueX\");\r\n startAngle = startAngle + startLocation * cellAngle;\r\n endAngle = endAngle - (1 - endLocation) * cellAngle;\r\n }\r\n else {\r\n tRadius = $math.getDistance({ x: this.yAxis.getX(dataItem, yField, startLocation, \"valueY\"), y: this.yAxis.getY(dataItem, yField, startLocation, \"valueY\") });\r\n bRadius = $math.getDistance({ x: this.yAxis.getX(dataItem, yOpenField, endLocation, \"valueY\"), y: this.yAxis.getY(dataItem, yOpenField, endLocation, \"valueY\") });\r\n lAngle = this.xAxis.getAngle(dataItem, xField, dataItem.locations[xField], \"valueX\");\r\n rAngle = this.xAxis.getAngle(dataItem, xOpenField, dataItem.locations[xOpenField], \"valueX\");\r\n }\r\n if (rAngle < lAngle) {\r\n var temp = rAngle;\r\n rAngle = lAngle;\r\n lAngle = temp;\r\n }\r\n lAngle = $math.fitToRange(lAngle, startAngle, endAngle);\r\n rAngle = $math.fitToRange(rAngle, startAngle, endAngle);\r\n var slice = radarColumn.radarColumn;\r\n slice.startAngle = lAngle;\r\n var arc = rAngle - lAngle;\r\n if (arc > 0) {\r\n slice.arc = arc;\r\n slice.radius = tRadius;\r\n slice.innerRadius = bRadius;\r\n radarColumn.__disabled = false;\r\n radarColumn.parent = this.columnsContainer;\r\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\r\n var rangeColumn = dataItem.rangesColumns.getKey(axisRange.uid);\r\n if (!rangeColumn) {\r\n rangeColumn = _this.columns.create();\r\n $object.forceCopyProperties(_this.columns.template, rangeColumn, visualProperties);\r\n $object.copyProperties(axisRange.contents, rangeColumn, visualProperties); // need this because 3d columns are not in the same container\r\n if (rangeColumn.dataItem) {\r\n $array.remove(rangeColumn.dataItem.sprites, rangeColumn);\r\n }\r\n dataItem.addSprite(rangeColumn);\r\n rangeColumn.paper = _this.paper; // sometimes pattern is not drawn if is set with adapter without this.\t\t\t\t\t\r\n _this.setColumnStates(rangeColumn);\r\n dataItem.rangesColumns.setKey(axisRange.uid, rangeColumn);\r\n }\r\n var slice = rangeColumn.radarColumn;\r\n slice.startAngle = lAngle;\r\n slice.arc = arc;\r\n slice.radius = tRadius;\r\n slice.innerRadius = bRadius;\r\n if (slice.invalid) {\r\n slice.paper = _this.paper;\r\n slice.validate(); // validate as if it was used previously, it will flicker with previous dimensions\r\n }\r\n rangeColumn.__disabled = false;\r\n rangeColumn.parent = axisRange.contents;\r\n });\r\n }\r\n else {\r\n this.disableUnusedColumns(dataItem);\r\n }\r\n };\r\n /**\r\n * Returns an [[IPoint]] coordinates of the specific Serie's data point.\r\n *\r\n * @param dataItem Data item\r\n * @param xKey Name of X data field\r\n * @param yKey Name of Y data field\r\n * @param locationX X location\r\n * @param locationY Y location\r\n * @param stackKeyX ?\r\n * @param stackKeyY ?\r\n * @returns Coordinates\r\n */\r\n RadarColumnSeries.prototype.getPoint = function (dataItem, xKey, yKey, locationX, locationY, stackKeyX, stackKeyY) {\r\n if (!stackKeyX) {\r\n stackKeyX = \"valueX\";\r\n }\r\n if (!stackKeyY) {\r\n stackKeyY = \"valueY\";\r\n }\r\n var x = this.yAxis.getX(dataItem, yKey, locationY, stackKeyY);\r\n var y = this.yAxis.getY(dataItem, yKey, locationY, stackKeyY);\r\n var radius = $math.getDistance({ x: x, y: y });\r\n // hack to be able to determine angle later\r\n if (radius == 0) {\r\n radius = 0.00001;\r\n }\r\n var angle = this.xAxis.getAngle(dataItem, xKey, locationX, stackKeyX);\r\n return { x: radius * $math.cos(angle), y: radius * $math.sin(angle) };\r\n };\r\n /**\r\n * Returns an SVG path to be used as a mask for the series.\r\n *\r\n * @return SVG path\r\n */\r\n RadarColumnSeries.prototype.getMaskPath = function () {\r\n var renderer = this.yAxis.renderer;\r\n return $path.arc(renderer.startAngle, renderer.endAngle - renderer.startAngle, renderer.pixelRadius, renderer.pixelInnerRadius);\r\n };\r\n RadarColumnSeries.prototype.positionBulletReal = function (bullet, positionX, positionY) {\r\n var xAxis = this.xAxis;\r\n var yAxis = this.yAxis;\r\n if (positionX < xAxis.start || positionX > xAxis.end || positionY < yAxis.start || positionY > yAxis.end) {\r\n bullet.visible = false;\r\n }\r\n bullet.moveTo(this.xAxis.renderer.positionToPoint(positionX, positionY));\r\n };\r\n RadarColumnSeries.prototype.setXAxis = function (axis) {\r\n _super.prototype.setXAxis.call(this, axis);\r\n this.updateRendererRefs();\r\n };\r\n RadarColumnSeries.prototype.setYAxis = function (axis) {\r\n _super.prototype.setYAxis.call(this, axis);\r\n this.updateRendererRefs();\r\n };\r\n RadarColumnSeries.prototype.updateRendererRefs = function () {\r\n var rendererX = this.xAxis.renderer;\r\n var rendererY = this.yAxis.renderer;\r\n rendererX.axisRendererY = rendererY;\r\n };\r\n return RadarColumnSeries;\r\n}(ColumnSeries));\r\nexport { RadarColumnSeries };\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[\"RadarColumnSeries\"] = RadarColumnSeries;\r\nregistry.registeredClasses[\"RadarColumnSeriesDataItem\"] = RadarColumnSeriesDataItem;\r\n//# sourceMappingURL=RadarColumnSeries.js.map","/**\r\n * Module that defines everything related to building Funnel slices.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to create [[FunnelSlice]] elements.\r\n *\r\n * @see {@link IFunnelSliceEvents} for a list of available events\r\n * @see {@link IFunnelSliceAdapters} for a list of available adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/sliced-chart/} for documentation\r\n * @important\r\n */\r\nvar FunnelSlice = /** @class */ (function (_super) {\r\n __extends(FunnelSlice, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FunnelSlice() {\r\n var _this = _super.call(this) || this;\r\n _this.slice = _this.createChild(Sprite);\r\n _this.slice.shouldClone = false;\r\n _this.slice.setElement(_this.paper.add(\"path\"));\r\n _this.slice.isMeasured = false;\r\n _this.orientation = \"vertical\";\r\n _this.bottomWidth = percent(100);\r\n _this.topWidth = percent(100);\r\n _this.isMeasured = false;\r\n _this.width = 10;\r\n _this.height = 10;\r\n _this.expandDistance = 0;\r\n _this.className = \"FunnelSlice\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the element.\r\n */\r\n FunnelSlice.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var pt = this.pixelPaddingTop;\r\n var pb = this.pixelPaddingBottom;\r\n var pr = this.pixelPaddingRight;\r\n var pl = this.pixelPaddingLeft;\r\n var w = this.pixelWidth - pr - pl;\r\n var h = this.pixelHeight - pt - pb;\r\n var ed = this.expandDistance;\r\n var path = \"\";\r\n if (this.orientation == \"vertical\") {\r\n var tw = $utils.relativeToValue(this.topWidth, w);\r\n var bw = $utils.relativeToValue(this.bottomWidth, w);\r\n var tl = { x: (w - tw) / 2 + pl, y: pt };\r\n var tr = { x: (w + tw) / 2 + pl, y: pt };\r\n var br = { x: (w + bw) / 2 + pl, y: pt + h };\r\n var bl = { x: (w - bw) / 2 + pl, y: pt + h };\r\n var cpr = { x: tr.x + (br.x - tr.x) / 2 + ed * h, y: tr.y + 0.5 * h };\r\n var cpl = { x: tl.x + (bl.x - tl.x) / 2 - ed * h, y: tl.y + 0.5 * h };\r\n var qp1 = $path.lineTo(br);\r\n var qp2 = \"\";\r\n if (ed != 0) {\r\n qp1 = $path.quadraticCurveTo(br, cpr);\r\n qp2 = $path.quadraticCurveTo(tl, cpl);\r\n }\r\n path = $path.moveTo(tl) + $path.lineTo(tr) + qp1 + $path.lineTo(bl) + qp2;\r\n this.tickPoint = { x: tr.x + (br.x - tr.x) / 2, y: tr.y + (br.y - tr.y) / 2 };\r\n }\r\n else {\r\n var tw = $utils.relativeToValue(this.topWidth, h);\r\n var bw = $utils.relativeToValue(this.bottomWidth, h);\r\n var tt = { x: pl, y: (h - tw) / 2 + pt };\r\n var tb = { x: pl, y: (h + tw) / 2 + pt };\r\n var bt = { x: pl + w, y: (h - bw) / 2 + pt };\r\n var bb = { x: pl + w, y: (h + bw) / 2 + pt };\r\n var cpr = { y: tt.y + (bt.y - tt.y) / 2 - ed * w, x: tt.x + 0.5 * w };\r\n var cpl = { y: tb.y + (bb.y - tb.y) / 2 + ed * w, x: tb.x + 0.5 * w };\r\n var qp1 = $path.lineTo(bt);\r\n var qp2 = \"\";\r\n if (ed != 0) {\r\n qp1 = $path.quadraticCurveTo(bt, cpr);\r\n qp2 = $path.quadraticCurveTo(tb, cpl);\r\n }\r\n path = $path.moveTo(tb) + $path.lineTo(tt) + qp1 + $path.lineTo(bb) + qp2;\r\n this.tickPoint = { y: tb.y + (bb.y - tb.y) / 2, x: tb.x + (bb.x - tb.x) / 2 };\r\n }\r\n this.slice.path = path;\r\n this.invalidateLayout();\r\n };\r\n FunnelSlice.prototype.getPoint = function (locationX, locationY) {\r\n var pt = this.pixelPaddingTop;\r\n var pb = this.pixelPaddingBottom;\r\n var pr = this.pixelPaddingRight;\r\n var pl = this.pixelPaddingLeft;\r\n var w = this.pixelWidth - pr - pl;\r\n var h = this.pixelHeight - pt - pb;\r\n if (this.orientation == \"vertical\") {\r\n var tw = $utils.relativeToValue(this.topWidth, w);\r\n var bw = $utils.relativeToValue(this.bottomWidth, w);\r\n var tl = { x: (w - tw) / 2 + pl, y: pt };\r\n var tr = { x: (w + tw) / 2 + pl, y: pt };\r\n var br = { x: (w + bw) / 2 + pl, y: pt + h };\r\n var bl = { x: (w - bw) / 2 + pl, y: pt + h };\r\n var mlx = tl.x + (bl.x - tl.x) * locationY;\r\n var mrx = tr.x + (br.x - tr.x) * locationY;\r\n return { x: mlx + (mrx - mlx) * locationX, y: tr.y + (br.y - tr.y) * locationY };\r\n }\r\n else {\r\n var tw = $utils.relativeToValue(this.topWidth, h);\r\n var bw = $utils.relativeToValue(this.bottomWidth, h);\r\n var tt = { x: pl, y: (h - tw) / 2 + pt };\r\n var tb = { x: pl, y: (h + tw) / 2 + pt };\r\n var bt = { x: pl + w, y: (h - bw) / 2 + pt };\r\n var bb = { x: pl + w, y: (h + bw) / 2 + pt };\r\n var mty = tt.y + (bt.y - tt.y) * locationX;\r\n var mby = tb.y + (bb.y - tb.y) * locationX;\r\n return { y: mty + (mby - mty) * locationY, x: tt.x + (bt.x - tt.x) * locationX };\r\n }\r\n };\r\n Object.defineProperty(FunnelSlice.prototype, \"bottomWidth\", {\r\n /**\r\n * @return bottom width\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"bottomWidth\");\r\n },\r\n /**\r\n * Bottom width in pixels or percent.\r\n *\r\n * IMPORTANT: this setting might be used to set dimensions if you use slice\r\n * as a standalone element. If it's a part of [[FunnelSeries]] this setting\r\n * becomes read-only as it will be automatically reset by series.\r\n *\r\n * @param value Bottom width\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"bottomWidth\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FunnelSlice.prototype, \"topWidth\", {\r\n /**\r\n * @return Top width\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"topWidth\");\r\n },\r\n /**\r\n * Top width in pixels or percent.\r\n *\r\n * IMPORTANT: this setting might be used to set dimensions if you use slice\r\n * as a standalone element. If it's a part of [[FunnelSeries]] this setting\r\n * becomes read-only as it will be automatically reset by series.\r\n *\r\n * @param value Top width\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"topWidth\", value, true, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FunnelSlice.prototype, \"orientation\", {\r\n /**\r\n * @return Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"orientation\");\r\n },\r\n /**\r\n * Orientation of the funnel slice: \"horizontal\" or \"vertical\".\r\n *\r\n * IMPORTANT: this setting might be used to set orintation if you use slice\r\n * as a standalone element. If it's a part of [[FunnelSeries]] this setting\r\n * becomes read-only as it will be automatically reset by series.\r\n *\r\n * @param value Orientation\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"orientation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FunnelSlice.prototype, \"expandDistance\", {\r\n /**\r\n * @return expandDistance\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"expandDistance\");\r\n },\r\n /**\r\n * A relative distance slice's sides should be bent to. It's relative to the\r\n * height of the slice.\r\n *\r\n * Zero (default) will mean the sides will be perfectly straight.\r\n *\r\n * Positive value will make them bend outwards, resulting in \"puffed\" slices.\r\n *\r\n * Negative values will make them bend inwards.\r\n *\r\n * @default 0\r\n * @param {number}\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"expandDistance\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all parameters from another [[Sprite]].\r\n *\r\n * @param source Source Sprite\r\n */\r\n FunnelSlice.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.slice) {\r\n this.slice.copyFrom(source.slice);\r\n }\r\n };\r\n return FunnelSlice;\r\n}(Container));\r\nexport { FunnelSlice };\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[\"FunnelSlice\"] = FunnelSlice;\r\n//# sourceMappingURL=FunnelSlice.js.map","/**\r\n * Funnel tick module.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Tick } from \"../elements/Tick\";\r\nimport { MutableValueDisposer, MultiDisposer } from \"../../core/utils/Disposer\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Draws an tick line for a funnel slice connecting it to a related label.\r\n *\r\n * @see {@link IFunnelTickEvents} for a list of available events\r\n * @see {@link IFunnelTickAdapters} for a list of available Adapters\r\n */\r\nvar FunnelTick = /** @class */ (function (_super) {\r\n __extends(FunnelTick, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FunnelTick() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * A label element this tick is attached to.\r\n */\r\n _this._label = new MutableValueDisposer();\r\n /**\r\n * A slice element this tick is attached to.\r\n */\r\n _this._slice = new MutableValueDisposer();\r\n _this.className = \"FunnelTick\";\r\n _this.element = _this.paper.add(\"path\");\r\n _this._disposers.push(_this._label);\r\n _this._disposers.push(_this._slice);\r\n _this.setPropertyValue(\"locationX\", 0);\r\n _this.setPropertyValue(\"locationY\", 0);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Draws the tick element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n FunnelTick.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var slice = this.slice;\r\n var point = slice.getPoint(this.locationX, this.locationY);\r\n if (point) {\r\n var label = this.label;\r\n var series = slice.dataItem.component;\r\n var p0 = void 0;\r\n var p1 = void 0;\r\n var p2 = void 0;\r\n if (series.orientation == \"vertical\") {\r\n var x1 = label.pixelX;\r\n var y1 = label.pixelY;\r\n if (!series.labelsOpposite) {\r\n x1 += label.maxRight;\r\n }\r\n p0 = $utils.spritePointToSprite(point, slice, this.parent);\r\n p2 = $utils.spritePointToSprite({ x: x1, y: y1 }, label.parent, this.parent);\r\n p1 = { x: label.parent.pixelX - this.length, y: p2.y };\r\n if (!series.labelsOpposite) {\r\n p1.x = label.parent.measuredWidth + this.length;\r\n }\r\n }\r\n else {\r\n var x1 = label.pixelX;\r\n var y1 = label.pixelY;\r\n if (!series.labelsOpposite) {\r\n y1 += label.maxBottom;\r\n }\r\n p0 = $utils.spritePointToSprite(point, slice, this.parent);\r\n p2 = $utils.spritePointToSprite({ x: x1, y: y1 }, label.parent, this.parent);\r\n p1 = { x: p2.x, y: label.parent.pixelY - this.length };\r\n if (!series.labelsOpposite) {\r\n p1.y = label.parent.measuredHeight + this.length;\r\n }\r\n }\r\n this.path = $path.moveTo(p0) + $path.lineTo(p1) + $path.lineTo(p2);\r\n }\r\n };\r\n Object.defineProperty(FunnelTick.prototype, \"slice\", {\r\n /**\r\n * @return FunnelSlice\r\n */\r\n get: function () {\r\n return this._slice.get();\r\n },\r\n /**\r\n * [[FunnelSlice]] element tick is attached to.\r\n *\r\n * @param slice Slice\r\n */\r\n set: function (slice) {\r\n this._slice.set(slice, new MultiDisposer([\r\n slice.events.on(\"transformed\", this.invalidate, this, false),\r\n slice.events.on(\"validated\", this.invalidate, this, false)\r\n ]));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FunnelTick.prototype, \"label\", {\r\n /**\r\n * @return Label\r\n */\r\n get: function () {\r\n return this._label.get();\r\n },\r\n /**\r\n * [[Label]] element tick is attached to.\r\n *\r\n * @param label Label\r\n */\r\n set: function (label) {\r\n this._label.set(label, label.events.on(\"transformed\", this.invalidate, this, false));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FunnelTick.prototype, \"locationX\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"locationX\");\r\n },\r\n /**\r\n * A relative horizontal position within target element a tick is pointing\r\n * to.\r\n *\r\n * A scale is from 0 to 1, where 0 means left edge, and 1 right edge.\r\n *\r\n * You can also set any value in-between (e.g. 0.5 will point to the middle\r\n * of the slice), or outside 0-1 range, which will put tick anchor position\r\n * outside target element.\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"locationX\", value, false, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FunnelTick.prototype, \"locationY\", {\r\n /**\r\n * @return Location (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"locationY\");\r\n },\r\n /**\r\n * A relative vertical position within target element a tick is pointing\r\n * to.\r\n *\r\n * A scale is from 0 to 1, where 0 means top edge, and 1 bottom edge.\r\n *\r\n * You can also set any value in-between (e.g. 0.5 will point to the middle\r\n * of the slice), or outside 0-1 range, which will put tick anchor position\r\n * outside target element.\r\n *\r\n * @param value Location (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"locationY\", value, false, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return FunnelTick;\r\n}(Tick));\r\nexport { FunnelTick };\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[\"FunnelTick\"] = FunnelTick;\r\n//# sourceMappingURL=FunnelTick.js.map","/**\r\n * Defines Funnel Chart Series.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { PercentSeries, PercentSeriesDataItem } from \"./PercentSeries\";\r\nimport { FunnelSlice } from \"../elements/FunnelSlice\";\r\nimport { FunnelTick } from \"../elements/FunnelTick\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { Disposer } from \"../../core/utils/Disposer\";\r\nimport { options } from \"../../core/Options\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n//@todo: sequenced?\r\n/**\r\n * Defines a [[DataItem]] for [[FunnelSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar FunnelSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(FunnelSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FunnelSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"FunnelSeriesDataItem\";\r\n // this helps to invalidate series when value is 0 an it is hidden (no other events are triggered then)\r\n _this.events.on(\"visibilitychanged\", function () {\r\n if (_this.component) {\r\n _this.component.invalidateDataItems();\r\n }\r\n }, _this, false);\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(FunnelSeriesDataItem.prototype, \"sliceLink\", {\r\n /**\r\n * A [[FunnelSlice]] element, related to this data item ([[FunnelSlice]]).\r\n *\r\n * @readonly\r\n * @return Slice element\r\n */\r\n get: function () {\r\n var _this = this;\r\n if (!this._sliceLink) {\r\n var sliceLink_1 = this.component.sliceLinks.create();\r\n this._sliceLink = sliceLink_1;\r\n this._disposers.push(sliceLink_1);\r\n sliceLink_1.parent = this.component.slicesContainer;\r\n this._disposers.push(new Disposer(function () {\r\n if (_this.component) {\r\n _this.component.sliceLinks.removeValue(sliceLink_1);\r\n }\r\n }));\r\n this.addSprite(sliceLink_1);\r\n sliceLink_1.visible = this.visible;\r\n }\r\n return this._sliceLink;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return FunnelSeriesDataItem;\r\n}(PercentSeriesDataItem));\r\nexport { FunnelSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a FunnelSlice series on a [[SlicedChart]].\r\n *\r\n * @see {@link IFunnelSeriesEvents} for a list of available Events\r\n * @see {@link IFunnelSeriesAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/sliced-chart/} for documentation\r\n * @important\r\n */\r\nvar FunnelSeries = /** @class */ (function (_super) {\r\n __extends(FunnelSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function FunnelSeries() {\r\n var _this = _super.call(this) || this;\r\n _this._nextY = 0;\r\n _this.className = \"FunnelSeries\";\r\n _this.orientation = \"vertical\";\r\n _this.width = percent(100);\r\n _this.height = percent(100);\r\n _this.slicesContainer.width = percent(100);\r\n _this.slicesContainer.height = percent(100);\r\n _this._disposers.push(_this.slicesContainer.events.on(\"maxsizechanged\", _this.invalidateDataItems, _this, false));\r\n _this.labelsOpposite = true;\r\n _this.labelsContainer.layout = \"absolute\";\r\n _this.bottomRatio = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Creates a [[FunnelSlice]] element.\r\n *\r\n * @return Slice\r\n */\r\n FunnelSeries.prototype.createSlice = function () {\r\n return new FunnelSlice();\r\n };\r\n /**\r\n * Creates a [[FunnelTick]] element.\r\n *\r\n * @return Tick\r\n */\r\n FunnelSeries.prototype.createTick = function () {\r\n return new FunnelTick();\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n FunnelSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Funnel Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n FunnelSeries.prototype.createDataItem = function () {\r\n return new FunnelSeriesDataItem();\r\n };\r\n /**\r\n * Inits FunnelSlice.\r\n *\r\n * @param slice to init\r\n */\r\n FunnelSeries.prototype.initSlice = function (slice) {\r\n slice.isMeasured = false;\r\n slice.defaultState.properties.scale = 1;\r\n slice.observe(\"scale\", this.handleSliceScale, this);\r\n slice.observe([\"dx\", \"dy\", \"x\", \"y\"], this.handleSliceMove, this);\r\n slice.tooltipText = \"{category}: {value.percent.formatNumber('#.#')}% ({value.value})\";\r\n var hoverState = slice.states.create(\"hover\");\r\n hoverState.properties.expandDistance = 0.2;\r\n };\r\n /**\r\n * [initLabel description]\r\n *\r\n * @todo Description\r\n * @param label [description]\r\n */\r\n FunnelSeries.prototype.initLabel = function (label) {\r\n _super.prototype.initLabel.call(this, label);\r\n label.verticalCenter = \"middle\";\r\n label.horizontalCenter = \"middle\";\r\n label.isMeasured = true;\r\n label.padding(5, 5, 5, 5);\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n FunnelSeries.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n this._nextY = 0;\r\n };\r\n /**\r\n * [validateDataElements description]\r\n *\r\n * @todo Description\r\n * @ignore Exclude from docs\r\n */\r\n FunnelSeries.prototype.validateDataElements = function () {\r\n var _this = this;\r\n var slicesContainer = this.slicesContainer;\r\n var labelsContainer = this.labelsContainer;\r\n var labelTemplate = this.labels.template;\r\n if (this.alignLabels) {\r\n labelTemplate.interactionsEnabled = true;\r\n slicesContainer.isMeasured = true;\r\n labelsContainer.isMeasured = true;\r\n }\r\n else {\r\n labelTemplate.interactionsEnabled = false;\r\n slicesContainer.isMeasured = false;\r\n labelsContainer.isMeasured = false;\r\n }\r\n var total = 0;\r\n var count = 0;\r\n this.dataItems.each(function (dItem) {\r\n if ($type.hasValue(dItem.value)) {\r\n count++;\r\n if (dItem.value > 0) {\r\n total += Math.abs(dItem.getWorkingValue(\"value\") / dItem.value);\r\n }\r\n else {\r\n if (_this.ignoreZeroValues) {\r\n count--;\r\n }\r\n else {\r\n if (!dItem.visible || dItem.__disabled || dItem.isHiding) {\r\n count--;\r\n }\r\n else {\r\n total += 1;\r\n }\r\n }\r\n }\r\n }\r\n });\r\n this._total = 1 / count * total;\r\n this._count = count;\r\n _super.prototype.validateDataElements.call(this);\r\n this.arrangeLabels();\r\n };\r\n /**\r\n * [getNextValue description]\r\n *\r\n * @todo Description\r\n * @param dataItem [description]\r\n * @return [description]\r\n */\r\n FunnelSeries.prototype.getNextValue = function (dataItem) {\r\n var index = dataItem.index;\r\n var nextValue = dataItem.getWorkingValue(\"value\");\r\n if (index < this.dataItems.length - 1) {\r\n var nextItem = this.dataItems.getIndex(index + 1);\r\n nextValue = nextItem.getWorkingValue(\"value\");\r\n if (!nextItem.visible || nextItem.isHiding || nextItem.__disabled || (nextItem.value == 0 && this.ignoreZeroValues)) {\r\n return this.getNextValue(nextItem);\r\n }\r\n }\r\n return nextValue;\r\n };\r\n /**\r\n * [formDataElement description]\r\n *\r\n * @todo Description\r\n */\r\n FunnelSeries.prototype.formDataElement = function () {\r\n };\r\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n FunnelSeries.prototype.validateDataElement = function (dataItem) {\r\n var _this = this;\r\n //if ($type.hasValue(dataItem.value)) {\r\n // FunnelSlice\r\n var slice = dataItem.slice;\r\n slice.orientation = this.orientation;\r\n var sliceLink = dataItem.sliceLink;\r\n sliceLink.orientation = this.orientation;\r\n var tick = dataItem.tick;\r\n var label = dataItem.label;\r\n tick.slice = slice;\r\n tick.label = label;\r\n if ($type.hasValue(dataItem.value)) {\r\n this.decorateSlice(dataItem);\r\n $array.each(dataItem.sprites, function (sprite) {\r\n if (dataItem.value == 0 && _this.ignoreZeroValues) {\r\n sprite.__disabled = true;\r\n }\r\n else {\r\n sprite.__disabled = false;\r\n }\r\n });\r\n }\r\n else {\r\n $array.each(dataItem.sprites, function (sprite) {\r\n sprite.__disabled = true;\r\n });\r\n }\r\n if (dataItem.index == this.dataItems.length - 1) {\r\n sliceLink.disabled = true;\r\n }\r\n // do this at the end, otherwise bullets won't be positioned properly\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n sliceLink.fill = slice.fill;\r\n //}\r\n };\r\n /**\r\n * [decorateSlice description]\r\n *\r\n * @todo Description\r\n * @param dataItem [description]\r\n */\r\n FunnelSeries.prototype.decorateSlice = function (dataItem) {\r\n var slice = dataItem.slice;\r\n var sliceLink = dataItem.sliceLink;\r\n var label = dataItem.label;\r\n var tick = dataItem.tick;\r\n var maxWidth = this.slicesContainer.innerWidth;\r\n var maxHeight = this.slicesContainer.innerHeight;\r\n var nextValue = this.getNextValue(dataItem);\r\n var workingValue = Math.abs(dataItem.getWorkingValue(\"value\"));\r\n var bottomRatio = this.bottomRatio;\r\n var d = 1;\r\n if (dataItem.value != 0) {\r\n d = workingValue / Math.abs(dataItem.value);\r\n }\r\n else {\r\n if (dataItem.__disabled || dataItem.isHiding || !dataItem.visible) {\r\n d = 0.000001;\r\n }\r\n }\r\n if (this.ignoreZeroValues && dataItem.value == 0) {\r\n dataItem.__disabled = true;\r\n return;\r\n }\r\n else {\r\n dataItem.__disabled = false;\r\n }\r\n if (this._nextY == Infinity) {\r\n this._nextY = 0;\r\n }\r\n if (this.orientation == \"vertical\") {\r\n var linkHeight = sliceLink.pixelHeight * d;\r\n maxHeight = maxHeight + linkHeight; // to avoid one link gap in the bottom\r\n slice.topWidth = workingValue / this.dataItem.values.value.high * maxWidth;\r\n slice.bottomWidth = (workingValue - (workingValue - nextValue) * bottomRatio) / this.dataItem.values.value.high * maxWidth;\r\n sliceLink.topWidth = slice.bottomWidth;\r\n sliceLink.bottomWidth = (workingValue - (workingValue - nextValue)) / this.dataItem.values.value.high * maxWidth;\r\n slice.y = this._nextY;\r\n slice.height = Math.min(100000, $math.max(0, maxHeight / this._count * d / this._total - linkHeight));\r\n slice.x = maxWidth / 2;\r\n if (!this.alignLabels) {\r\n label.x = slice.x;\r\n }\r\n else {\r\n label.x = undefined;\r\n }\r\n label.y = slice.pixelY + slice.pixelHeight * tick.locationY;\r\n this._nextY += slice.pixelHeight + linkHeight;\r\n sliceLink.y = this._nextY - linkHeight;\r\n sliceLink.x = slice.x;\r\n }\r\n else {\r\n var linkWidth = sliceLink.pixelWidth * d;\r\n maxWidth = maxWidth + linkWidth; // to avoid one link gap in the bottom\r\n slice.topWidth = workingValue / this.dataItem.values.value.high * maxHeight;\r\n slice.bottomWidth = (workingValue - (workingValue - nextValue) * bottomRatio) / this.dataItem.values.value.high * maxHeight;\r\n sliceLink.topWidth = slice.bottomWidth;\r\n sliceLink.bottomWidth = (workingValue - (workingValue - nextValue)) / this.dataItem.values.value.high * maxHeight;\r\n slice.x = this._nextY;\r\n slice.width = Math.min(100000, maxWidth / this._count * d * 1 / this._total - linkWidth);\r\n slice.y = maxHeight / 2;\r\n if (!this.alignLabels) {\r\n label.y = slice.y;\r\n }\r\n else {\r\n label.y = this.labelsContainer.measuredHeight;\r\n }\r\n label.x = slice.pixelX + slice.pixelWidth * tick.locationX;\r\n this._nextY += slice.pixelWidth + linkWidth;\r\n sliceLink.x = this._nextY - linkWidth;\r\n sliceLink.y = slice.y;\r\n }\r\n };\r\n FunnelSeries.prototype.getLastLabel = function (index) {\r\n if (index > 0) {\r\n var lastLabel = this.labels.getIndex(index);\r\n if (lastLabel.__disabled || !lastLabel.visible) {\r\n return this.getLastLabel(index - 1);\r\n }\r\n else {\r\n return lastLabel;\r\n }\r\n }\r\n };\r\n /**\r\n * [arrangeLabels description]\r\n *\r\n * @todo Description\r\n */\r\n FunnelSeries.prototype.arrangeLabels = function () {\r\n if (this.alignLabels) {\r\n var count = this.labels.length;\r\n if (count > 1) {\r\n var lastLabel = this.getLastLabel(count - 1);\r\n if (lastLabel) {\r\n var lastY = lastLabel.pixelY;\r\n var lastX = lastLabel.pixelX;\r\n if (count > 1) {\r\n for (var i = count - 2; i >= 0; i--) {\r\n var label = this.labels.getIndex(i);\r\n if (label.visible && !label.__disabled) {\r\n if (label.invalid) {\r\n label.validate();\r\n }\r\n if (this.orientation == \"vertical\") {\r\n if (label.pixelY + label.measuredHeight > lastY) {\r\n label.y = Math.min(1000000, lastY - label.measuredHeight);\r\n }\r\n }\r\n // horizontal\r\n else {\r\n if (label.pixelX + label.measuredWidth > lastX) {\r\n label.x = Math.min(1000000, lastX - label.measuredWidth);\r\n }\r\n }\r\n lastY = label.pixelY;\r\n lastX = label.pixelX;\r\n }\r\n }\r\n lastY = 0;\r\n lastX = 0;\r\n for (var i = 0; i < count; i++) {\r\n var label = this.labels.getIndex(i);\r\n if (label.visible && !label.__disabled) {\r\n if (label.invalid) {\r\n label.validate();\r\n }\r\n if (this.orientation == \"vertical\") {\r\n if (label.pixelY < lastY) {\r\n label.y = Math.min(1000000, lastY);\r\n }\r\n }\r\n // horizontal\r\n else {\r\n if (label.pixelX < lastX) {\r\n label.x = Math.min(1000000, lastX);\r\n }\r\n }\r\n lastY += label.measuredHeight;\r\n lastX += label.measuredWidth;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Positions series bullet.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet Bullet\r\n */\r\n FunnelSeries.prototype.positionBullet = function (bullet) {\r\n _super.prototype.positionBullet.call(this, bullet);\r\n var dataItem = bullet.dataItem;\r\n var slice = dataItem.slice;\r\n var locationX = bullet.locationX;\r\n if (!$type.isNumber(locationX)) {\r\n locationX = 0.5;\r\n }\r\n var locationY = bullet.locationY;\r\n if (!$type.isNumber(locationY)) {\r\n locationY = 1;\r\n }\r\n bullet.x = slice.pixelX + slice.measuredWidth * locationX;\r\n bullet.y = slice.pixelY + slice.measuredHeight * locationY;\r\n };\r\n Object.defineProperty(FunnelSeries.prototype, \"orientation\", {\r\n /**\r\n * @return Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"orientation\");\r\n },\r\n /**\r\n * Orientation of the funnel slices: \"horizontal\" or \"vertical\" (default).\r\n *\r\n * @default \"vertical\"\r\n * @param value Orientation\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"orientation\", value)) {\r\n this.labelsOpposite = this.labelsOpposite;\r\n this.invalidate();\r\n if (value == \"vertical\") {\r\n this.ticks.template.locationX = 1;\r\n this.ticks.template.locationY = 0.5;\r\n this.labels.template.rotation = 0;\r\n this.layout = \"horizontal\";\r\n }\r\n else {\r\n this.ticks.template.locationX = 0.5;\r\n this.ticks.template.locationY = 1;\r\n this.labels.template.rotation = -90;\r\n this.layout = \"vertical\";\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FunnelSeries.prototype, \"bottomRatio\", {\r\n /**\r\n * @return {number}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"bottomRatio\");\r\n },\r\n /**\r\n * Indicates how slice's bottom will change in relation to slices top AND\r\n * next slices top.\r\n *\r\n * Basically it's a relative value (0-1) that indicates bottom width\r\n * position between current slice's top width and the top withd of the next\r\n * one.\r\n *\r\n * The scale goes from 0 (closer to current slice width) to 1 (closer to next\r\n * slice with).\r\n *\r\n * `0` (default) will mean that bottom will be the same as top, resulting in\r\n * a prefectly square slice.\r\n *\r\n * From the data-viz standpoint `0` is a correct setting, since area of the\r\n * slices will depict their value correctly.\r\n *\r\n * `1` will mean that slice will become trapezoid with its bottom matching\r\n * width of the next slice.\r\n *\r\n * `0.5` will make bottom width be in the middle of width of current slice\r\n * and the next slice.\r\n *\r\n * @default 0\r\n * @param {number}\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"bottomRatio\", value)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FunnelSeries.prototype, \"sliceLinks\", {\r\n /**\r\n * A list of elements linking each actual slice.\r\n *\r\n * Please note that links are [[FunnelSlice]] objects, just like real links,\r\n * so they have all the same configuration options.\r\n *\r\n * You can use `template` of this link, to specify how links will look.\r\n *\r\n * ```TypeScript\r\n * series.sliceLinks.template.fillOpacity = 0.5;\r\n * ```\r\n * ```JavaScript\r\n * series.sliceLinks.template.fillOpacity = 0.5;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * \"type\": \"FunnelSeries\",\r\n * // ...\r\n * \"sliceLinks\": {\r\n * \"fillOpacity\": 0.5\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @return Funnel links\r\n */\r\n get: function () {\r\n if (!this._sliceLinks) {\r\n var sliceLink = new FunnelSlice();\r\n sliceLink.applyOnClones = true;\r\n sliceLink.fillOpacity = 0.5;\r\n sliceLink.expandDistance = -0.3;\r\n sliceLink.hiddenState.properties.opacity = 0;\r\n this._disposers.push(sliceLink);\r\n this._sliceLinks = new ListTemplate(sliceLink);\r\n this._disposers.push(new ListDisposer(this._sliceLinks));\r\n }\r\n return this._sliceLinks;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Shows hidden series.\r\n *\r\n * @param duration Duration of reveal animation (ms)\r\n * @return Animation\r\n */\r\n FunnelSeries.prototype.show = function (duration) {\r\n var _this = this;\r\n var startIndex = this.startIndex;\r\n var endIndex = this.endIndex;\r\n var interpolationDuration = this.defaultState.transitionDuration;\r\n if ($type.isNumber(duration)) {\r\n interpolationDuration = duration;\r\n }\r\n if (!options.animationsEnabled) {\r\n interpolationDuration = 0;\r\n }\r\n var delay = 0;\r\n $iter.each($iter.indexed(this.dataItems.iterator()), function (a) {\r\n var i = a[0];\r\n var dataItem = a[1];\r\n if (_this.sequencedInterpolation) {\r\n delay = _this.sequencedInterpolationDelay * i + interpolationDuration * (i - startIndex) / (endIndex - startIndex);\r\n }\r\n dataItem.show(interpolationDuration, delay, [\"value\"]);\r\n });\r\n var animation = _super.prototype.show.call(this, duration);\r\n return animation;\r\n };\r\n /**\r\n * Hides series.\r\n *\r\n * @param duration Duration of hiding animation (ms)\r\n * @return Animation\r\n */\r\n FunnelSeries.prototype.hide = function (duration) {\r\n var _this = this;\r\n var fields = [\"value\"];\r\n var value = 0;\r\n var startIndex = this.startIndex;\r\n var endIndex = this.endIndex;\r\n var delay = 0;\r\n var interpolationDuration = this.hiddenState.transitionDuration;\r\n if ($type.isNumber(duration)) {\r\n interpolationDuration = duration;\r\n }\r\n if (!options.animationsEnabled) {\r\n interpolationDuration = 0;\r\n }\r\n $iter.each($iter.indexed(this.dataItems.iterator()), function (a) {\r\n var i = a[0];\r\n var dataItem = a[1];\r\n if (_this.sequencedInterpolation) {\r\n delay = _this.sequencedInterpolationDelay * i + interpolationDuration * (i - startIndex) / (endIndex - startIndex);\r\n }\r\n dataItem.hide(interpolationDuration, delay, value, fields);\r\n });\r\n var animation = _super.prototype.hide.call(this, duration);\r\n if (animation && !animation.isFinished()) {\r\n animation.delay(delay);\r\n }\r\n return animation;\r\n };\r\n /**\r\n * @ignore\r\n */\r\n FunnelSeries.prototype.setAlignLabels = function (value) {\r\n _super.prototype.setAlignLabels.call(this, value);\r\n this.ticks.template.disabled = !value;\r\n var labelsContainer = this.labelsContainer;\r\n if (labelsContainer) {\r\n // do not align\r\n if (!value) {\r\n labelsContainer.width = percent(100);\r\n labelsContainer.height = percent(100);\r\n }\r\n //align\r\n else {\r\n labelsContainer.height = undefined;\r\n labelsContainer.width = undefined;\r\n labelsContainer.margin(10, 10, 10, 10);\r\n }\r\n }\r\n this.labelsOpposite = this.labelsOpposite;\r\n };\r\n Object.defineProperty(FunnelSeries.prototype, \"labelsOpposite\", {\r\n /**\r\n * @return Labels on opposite side?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"labelsOpposite\");\r\n },\r\n /**\r\n * Put labels on the oppsite side of the series?\r\n *\r\n * This setting is only used if `alignLabels = true`.\r\n *\r\n * If set to `true` (default) labels will be drawn to the right (on vertical\r\n * series), or to the bottom (on horizontal series).\r\n *\r\n * If set to `false`, labels will be positioned to the left or top\r\n * respectively.\r\n *\r\n * @default true\r\n * @since 4.1.13\r\n * @param value Labels on opposite side?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"labelsOpposite\", value);\r\n var labelTemplate = this.labels.template;\r\n var labelAlign = \"none\";\r\n var labelValign = \"none\";\r\n if (!this.alignLabels) {\r\n if (this.orientation == \"vertical\") {\r\n labelAlign = \"center\";\r\n }\r\n else {\r\n labelValign = \"middle\";\r\n }\r\n }\r\n else {\r\n // opposite (left/bottom)\r\n if (value) {\r\n this.labelsContainer.toFront();\r\n // left\r\n if (this.orientation == \"vertical\") {\r\n this.ticks.template.locationX = 1;\r\n labelTemplate.horizontalCenter = \"left\";\r\n labelAlign = \"right\";\r\n }\r\n // bottom\r\n else {\r\n this.ticks.template.locationY = 1;\r\n labelTemplate.horizontalCenter = \"right\";\r\n labelValign = \"bottom\";\r\n }\r\n }\r\n // non oposite (right/top)\r\n else {\r\n this.labelsContainer.toBack();\r\n // right\r\n if (this.orientation == \"vertical\") {\r\n this.ticks.template.locationX = 0;\r\n labelAlign = \"left\";\r\n }\r\n // top\r\n else {\r\n labelValign = \"top\";\r\n this.ticks.template.locationY = 0;\r\n }\r\n }\r\n }\r\n labelTemplate.align = labelAlign;\r\n labelTemplate.valign = labelValign;\r\n this.validateLayout();\r\n this.ticks.each(function (tick) {\r\n tick.invalidate();\r\n });\r\n this.invalidateDataItems();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return FunnelSeries;\r\n}(PercentSeries));\r\nexport { FunnelSeries };\r\n/**\r\n * bboxter 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[\"FunnelSeries\"] = FunnelSeries;\r\nregistry.registeredClasses[\"FunnelSeriesDataItem\"] = FunnelSeriesDataItem;\r\n//# sourceMappingURL=FunnelSeries.js.map","/**\r\n * Defines Pyramid Series.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { FunnelSeries, FunnelSeriesDataItem } from \"./FunnelSeries\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n//@todo: sequenced?\r\n/**\r\n * Defines a [[DataItem]] for [[PyramidSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar PyramidSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(PyramidSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PyramidSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PyramidSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return PyramidSeriesDataItem;\r\n}(FunnelSeriesDataItem));\r\nexport { PyramidSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a FunnelSlice series on a [[SlicedChart]].\r\n *\r\n * @see {@link IPyramidSeriesEvents} for a list of available Events\r\n * @see {@link IPyramidSeriesAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/sliced-chart/} for documentation\r\n * @important\r\n */\r\nvar PyramidSeries = /** @class */ (function (_super) {\r\n __extends(PyramidSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PyramidSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PyramidSeries\";\r\n _this.topWidth = percent(0);\r\n _this.bottomWidth = percent(100);\r\n _this.pyramidHeight = percent(100);\r\n _this.valueIs = \"area\";\r\n _this.sliceLinks.template.width = 0;\r\n _this.sliceLinks.template.height = 0;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n PyramidSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Pyramid Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n PyramidSeries.prototype.createDataItem = function () {\r\n return new PyramidSeriesDataItem();\r\n };\r\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n PyramidSeries.prototype.validate = function () {\r\n _super.prototype.validate.call(this);\r\n this._nextWidth = undefined;\r\n };\r\n /**\r\n * [getNextValue description]\r\n *\r\n * @todo Description\r\n * @param dataItem [description]\r\n * @return [description]\r\n */\r\n PyramidSeries.prototype.getNextValue = function (dataItem) {\r\n var index = dataItem.index;\r\n var nextValue = dataItem.getWorkingValue(\"value\");\r\n if (index < this.dataItems.length - 1) {\r\n var nextItem = this.dataItems.getIndex(index + 1);\r\n nextValue = nextItem.getWorkingValue(\"value\");\r\n }\r\n if (nextValue == 0) {\r\n nextValue = 0.000001;\r\n }\r\n return nextValue;\r\n };\r\n /**\r\n * [validateDataElements description]\r\n *\r\n * @todo Description\r\n * @ignore Exclude from docs\r\n */\r\n PyramidSeries.prototype.validateDataElements = function () {\r\n var _this = this;\r\n var maxWidth = this.slicesContainer.innerWidth;\r\n var maxHeight = this.slicesContainer.innerHeight;\r\n this.dataItems.each(function (dataItem) {\r\n if (dataItem.value > 0) {\r\n var relValue = dataItem.getWorkingValue(\"value\") / dataItem.value;\r\n var sliceLink = dataItem.sliceLink;\r\n if (_this.orientation == \"vertical\") {\r\n maxHeight -= (sliceLink.pixelHeight * relValue);\r\n }\r\n else {\r\n maxWidth -= (sliceLink.pixelWidth * relValue);\r\n }\r\n }\r\n });\r\n this._pyramidHeight = $utils.relativeToValue(this.pyramidHeight, maxHeight);\r\n this._pyramidWidth = $utils.relativeToValue(this.pyramidHeight, maxWidth);\r\n if (this.orientation == \"vertical\") {\r\n var y = (maxHeight - this._pyramidHeight) / 2;\r\n this.slicesContainer.y = y;\r\n this.labelsContainer.y = y;\r\n this.ticksContainer.y = y;\r\n }\r\n else {\r\n var x = (maxWidth - this._pyramidWidth) / 2;\r\n this.slicesContainer.x = x;\r\n this.labelsContainer.x = x;\r\n this.ticksContainer.x = x;\r\n }\r\n _super.prototype.validateDataElements.call(this);\r\n };\r\n /**\r\n * [decorateSlice description]\r\n *\r\n * @todo Description\r\n * @param dataItem [description]\r\n */\r\n PyramidSeries.prototype.decorateSlice = function (dataItem) {\r\n var sum = this.dataItem.values.value.absoluteSum;\r\n if (sum == 0) {\r\n return;\r\n }\r\n var slice = dataItem.slice;\r\n var sliceLink = dataItem.sliceLink;\r\n var label = dataItem.label;\r\n var tick = dataItem.tick;\r\n // TODO can this be removed ?\r\n this.getNextValue(dataItem);\r\n var workingValue = Math.abs(dataItem.getWorkingValue(\"value\"));\r\n var pyramidWidth = this._pyramidWidth;\r\n var pyramidHeight = this._pyramidHeight;\r\n var maxWidth = this.slicesContainer.innerWidth;\r\n var maxHeight = this.slicesContainer.innerHeight;\r\n var linkWidth = sliceLink.pixelWidth;\r\n var linkHeight = sliceLink.pixelHeight;\r\n if (dataItem.value == 0 && this.ignoreZeroValues) {\r\n dataItem.__disabled = true;\r\n }\r\n else {\r\n dataItem.__disabled = false;\r\n }\r\n if (this.orientation == \"vertical\") {\r\n var topWidth = $utils.relativeToValue(this.topWidth, maxWidth);\r\n if (!$type.isNumber(this._nextWidth)) {\r\n this._nextWidth = topWidth;\r\n }\r\n var bottomWidth = $utils.relativeToValue(this.bottomWidth, maxWidth);\r\n var sliceTopWidth = this._nextWidth;\r\n var angle = Math.atan2(pyramidHeight, topWidth - bottomWidth);\r\n var c = Math.tan(Math.PI / 2 - angle);\r\n if (c == 0) {\r\n c = 0.00000001;\r\n }\r\n var sliceHeight = void 0;\r\n var sliceBottomWidth = void 0;\r\n if (this.valueIs == \"area\") {\r\n var totalSquare = (topWidth + bottomWidth) / 2 * pyramidHeight;\r\n var square = totalSquare * workingValue / sum;\r\n var s = Math.abs(sliceTopWidth * sliceTopWidth - 2 * square * c);\r\n sliceHeight = (sliceTopWidth - Math.sqrt(s)) / c;\r\n if (sliceHeight > 0) {\r\n sliceBottomWidth = (2 * square - sliceHeight * sliceTopWidth) / sliceHeight;\r\n }\r\n else {\r\n sliceBottomWidth = sliceTopWidth;\r\n }\r\n }\r\n else {\r\n sliceHeight = pyramidHeight * workingValue / sum;\r\n sliceBottomWidth = sliceTopWidth - sliceHeight * c;\r\n }\r\n slice.height = sliceHeight;\r\n slice.width = maxWidth;\r\n slice.bottomWidth = sliceBottomWidth;\r\n slice.topWidth = sliceTopWidth;\r\n sliceLink.topWidth = slice.bottomWidth;\r\n sliceLink.bottomWidth = slice.bottomWidth;\r\n slice.y = this._nextY;\r\n //slice.x = maxWidth / 2;\r\n if (!this.alignLabels) {\r\n label.x = maxWidth / 2;\r\n }\r\n else {\r\n label.x = 0;\r\n }\r\n label.y = slice.pixelY + slice.pixelHeight * tick.locationY + slice.dy;\r\n this._nextY += slice.pixelHeight + linkHeight * workingValue / Math.max(Math.abs(dataItem.value), 0.00000001);\r\n sliceLink.y = this._nextY - linkHeight;\r\n sliceLink.x = maxWidth / 2;\r\n }\r\n else {\r\n var topWidth = $utils.relativeToValue(this.topWidth, maxHeight);\r\n if (!$type.isNumber(this._nextWidth)) {\r\n this._nextWidth = topWidth;\r\n }\r\n var bottomWidth = $utils.relativeToValue(this.bottomWidth, maxHeight);\r\n var sliceTopWidth = this._nextWidth;\r\n var angle = Math.atan2(pyramidWidth, topWidth - bottomWidth);\r\n var c = Math.tan(Math.PI / 2 - angle);\r\n if (c == 0) {\r\n c = 0.00000001;\r\n }\r\n var sliceWidth = void 0;\r\n var sliceBottomWidth = void 0;\r\n if (this.valueIs == \"area\") {\r\n var totalSquare = (topWidth + bottomWidth) / 2 * pyramidWidth;\r\n var square = totalSquare * workingValue / sum;\r\n sliceWidth = (sliceTopWidth - Math.sqrt(sliceTopWidth * sliceTopWidth - 2 * square * c)) / c;\r\n sliceBottomWidth = (2 * square - sliceWidth * sliceTopWidth) / sliceWidth;\r\n }\r\n else {\r\n sliceWidth = pyramidWidth * workingValue / sum;\r\n sliceBottomWidth = sliceTopWidth - sliceWidth * c;\r\n }\r\n slice.width = sliceWidth;\r\n slice.height = maxHeight;\r\n slice.bottomWidth = sliceBottomWidth;\r\n slice.topWidth = sliceTopWidth;\r\n sliceLink.topWidth = slice.bottomWidth;\r\n sliceLink.bottomWidth = slice.bottomWidth;\r\n slice.x = this._nextY;\r\n if (!this.alignLabels) {\r\n label.y = maxHeight / 2;\r\n }\r\n else {\r\n label.y = this.labelsContainer.measuredHeight;\r\n }\r\n label.x = slice.pixelX + slice.pixelWidth * tick.locationX + slice.dx;\r\n this._nextY += slice.pixelWidth + linkWidth * workingValue / Math.max(Math.abs(dataItem.value), 0.00000001);\r\n sliceLink.x = this._nextY - linkWidth;\r\n sliceLink.y = maxHeight / 2;\r\n }\r\n this._nextWidth = slice.bottomWidth;\r\n };\r\n Object.defineProperty(PyramidSeries.prototype, \"topWidth\", {\r\n /**\r\n * @return {number | Percent}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"topWidth\");\r\n },\r\n /**\r\n * Width of the pyramid's tip in pixels or relative (`Percent`).\r\n *\r\n * `0%` (default) means the pyramid will be perfectly pointy.\r\n * `50%` will have a cut off / blunt top that is half the width of the chart.\r\n * `100%` will take the whole width of the chart.\r\n *\r\n * If you need the downward-pointing pyramid, you might want to `topWidth` to\r\n * `100%` and `bottomWidth` to `0%`.\r\n *\r\n * @default 0%\r\n * @param {number | Percent}\r\n */\r\n set: function (value) {\r\n if (this.setPercentProperty(\"topWidth\", value, false, false, 10, false)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PyramidSeries.prototype, \"pyramidHeight\", {\r\n /**\r\n * @return {number | Percent}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"pyramidHeight\");\r\n },\r\n /**\r\n * Height of pyramid\r\n *\r\n *\r\n * @default 100%\r\n * @param {number | Percent}\r\n */\r\n set: function (value) {\r\n if (this.setPercentProperty(\"pyramidHeight\", value, false, false, 10, false)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PyramidSeries.prototype, \"bottomWidth\", {\r\n /**\r\n * @return {number | Percent}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"bottomWidth\");\r\n },\r\n /**\r\n * Width of the pyramid's bottom (bsae) in pixels or relative (`Percent`).\r\n *\r\n * `0%` means the pyramid's botto will be pointy.\r\n * `50%` will have a cut off / blunt bottom that is half the width of the chart.\r\n * `100%` (default) will take the whole width of the chart.\r\n *\r\n * If you need the downward-pointing pyramid, you might want to `topWidth` to\r\n * `100%` and `bottomWidth` to `0%`.\r\n *\r\n * @param {number | Percent}\r\n */\r\n set: function (value) {\r\n if (this.setPercentProperty(\"bottomWidth\", value, false, false, 10, false)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PyramidSeries.prototype, \"valueIs\", {\r\n /**\r\n * @return {\"area\" | \"height\"}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"valueIs\");\r\n },\r\n /**\r\n * Indicates how slice's value will influence its size.\r\n *\r\n * `\"area\"` (default) means that the whole area of the pyramid (counting in\r\n * modifications by `topWidth` and `bottomWidth`) will be divvied up between\r\n * slices based on their value.\r\n *\r\n * With this setting at `\"area\"` the area of the trapezoids of each slice\r\n * will represent their value relatively to values of the other slices.\r\n *\r\n * This is a correct way to depict \"weight\" of each slice based on their\r\n * values.\r\n *\r\n * `\"height\"` means whole height (as opposed to area) of the pyramid will be\r\n * divvied up between slices. Actual slice width or area is not counted in.\r\n *\r\n * From the data-viz standpoint this does not make a lot of sense, since\r\n * slices with lesser values might appear more prominent if they are placed\r\n * towards thick end of the pyramid since their areas will be bigger.\r\n *\r\n * @default \"area\"\r\n * @param {\"area\" | \"height\"}\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"valueIs\", value)) {\r\n this.invalidate();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PyramidSeries;\r\n}(FunnelSeries));\r\nexport { PyramidSeries };\r\n/**\r\n * bboxter 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[\"PyramidSeries\"] = PyramidSeries;\r\nregistry.registeredClasses[\"PyramidSeriesDataItem\"] = PyramidSeriesDataItem;\r\n//# sourceMappingURL=PyramidSeries.js.map","/**\r\n * Defines Pictorial Stacked Series.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { PyramidSeries, PyramidSeriesDataItem } from \"./PyramidSeries\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n//@todo: sequenced?\r\n/**\r\n * Defines a [[DataItem]] for [[PictorialStackedSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar PictorialStackedSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(PictorialStackedSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PictorialStackedSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PictorialStackedSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return PictorialStackedSeriesDataItem;\r\n}(PyramidSeriesDataItem));\r\nexport { PictorialStackedSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a PictorialStacked series on a [[SlicedChart]].\r\n *\r\n * @see {@link IPictorialStackedSeriesEvents} for a list of available Events\r\n * @see {@link IPictorialStackedSeriesAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/sliced-chart/} for documentation\r\n * @important\r\n */\r\nvar PictorialStackedSeries = /** @class */ (function (_super) {\r\n __extends(PictorialStackedSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function PictorialStackedSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"PictorialStackedSeries\";\r\n _this.topWidth = percent(100);\r\n _this.bottomWidth = percent(100);\r\n _this.valueIs = \"height\";\r\n _this.applyTheme();\r\n _this.startLocation = 0;\r\n _this.endLocation = 1;\r\n _this.align = \"center\";\r\n _this.valign = \"middle\";\r\n _this._maskSprite = _this.slicesContainer.createChild(Sprite);\r\n _this._maskSprite.visible = false;\r\n _this._maskSprite.zIndex = 100;\r\n _this._maskSprite.shouldClone = false;\r\n return _this;\r\n }\r\n /**\r\n * Sizes the mask to fit the series.\r\n *\r\n * @ignore\r\n */\r\n PictorialStackedSeries.prototype.validateDataElements = function () {\r\n var maxWidth = this.slicesContainer.maxWidth;\r\n var maxHeight = this.slicesContainer.maxHeight;\r\n var maskSprite = this._maskSprite;\r\n //maskSprite.validatePosition(); // for some reason size of the maskSprite is 0x0 after we removed validatePosition in afterdraw\r\n var pictureWidth = maskSprite.measuredWidth / maskSprite.scale;\r\n var pictureHeight = maskSprite.measuredHeight / maskSprite.scale;\r\n var scale = $math.min(maxHeight / pictureHeight, maxWidth / pictureWidth);\r\n if (scale == Infinity) {\r\n scale = 1; // can't return here, won't draw legend properly\r\n }\r\n scale = $math.max(0.001, scale);\r\n var startLocation = this.startLocation;\r\n var endLocation = this.endLocation;\r\n var newWidth = $math.min(maxWidth, pictureWidth * scale);\r\n var newHeight = $math.min(maxHeight, pictureHeight * scale);\r\n maskSprite.scale = scale;\r\n if (this.orientation == \"vertical\") {\r\n this.topWidth = newWidth + 4;\r\n this.bottomWidth = newWidth + 4;\r\n this.pyramidHeight = newHeight * (endLocation - startLocation);\r\n maskSprite.x = maxWidth / 2;\r\n maskSprite.y = newHeight / 2;\r\n }\r\n else {\r\n this.topWidth = newHeight + 4;\r\n this.bottomWidth = newHeight + 4;\r\n this.pyramidHeight = newWidth * (endLocation - startLocation);\r\n maskSprite.valign = \"middle\";\r\n maskSprite.x = newWidth / 2;\r\n maskSprite.y = maxHeight / 2;\r\n }\r\n maskSprite.verticalCenter = \"middle\";\r\n maskSprite.horizontalCenter = \"middle\";\r\n _super.prototype.validateDataElements.call(this);\r\n var y;\r\n var x;\r\n if (this.orientation == \"vertical\") {\r\n if (this.valign == \"bottom\") {\r\n y = (maxHeight - newHeight);\r\n }\r\n if (this.valign == \"middle\") {\r\n y = (maxHeight - newHeight) / 2;\r\n }\r\n if (this.valign == \"top\") {\r\n y = 0;\r\n }\r\n if (this.align == \"left\") {\r\n x = -(maxWidth - newWidth) / 2;\r\n }\r\n if (this.align == \"center\") {\r\n x = 0;\r\n }\r\n if (this.align == \"right\") {\r\n x = (maxWidth - newWidth) / 2;\r\n }\r\n this.slices.template.dy = startLocation * newHeight;\r\n if (this.alignLabels) {\r\n this.slicesContainer.dx = x;\r\n }\r\n }\r\n else {\r\n if (this.valign == \"bottom\") {\r\n y = (maxHeight - newHeight) / 2;\r\n }\r\n if (this.valign == \"middle\") {\r\n y = 0;\r\n }\r\n if (this.valign == \"top\") {\r\n y = -(maxHeight - newHeight) / 2;\r\n }\r\n if (this.align == \"left\") {\r\n x = 0;\r\n }\r\n if (this.align == \"center\") {\r\n x = (maxWidth - newWidth) / 2;\r\n }\r\n if (this.align == \"right\") {\r\n x = (maxWidth - newWidth);\r\n }\r\n this.slices.template.dx = startLocation * newWidth;\r\n if (this.alignLabels) {\r\n this.slicesContainer.dy = y;\r\n }\r\n }\r\n this.slicesContainer.x = x;\r\n this.labelsContainer.x = x;\r\n this.ticksContainer.x = x;\r\n this.slicesContainer.y = y;\r\n this.labelsContainer.y = y;\r\n this.ticksContainer.y = y;\r\n if (newWidth > 0 && newHeight > 0) {\r\n this.slicesContainer.mask = maskSprite;\r\n }\r\n };\r\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\r\n PictorialStackedSeries.prototype.applyInternalDefaults = function () {\r\n _super.prototype.applyInternalDefaults.call(this);\r\n if (!$type.hasValue(this.readerTitle)) {\r\n this.readerTitle = this.language.translate(\"Pyramid Series\");\r\n }\r\n };\r\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\r\n PictorialStackedSeries.prototype.createDataItem = function () {\r\n return new PictorialStackedSeriesDataItem();\r\n };\r\n Object.defineProperty(PictorialStackedSeries.prototype, \"maskSprite\", {\r\n /**\r\n * A [[Sprite]] element that is used as a series mask.\r\n *\r\n * If set, this element's shape will be used to apply shape to the whole\r\n * stacked pictorial series.\r\n *\r\n * You can use this element's `path` property to set an SVG path for the\r\n * shape:\r\n *\r\n * ```TypeScript\r\n * let iconPath = \"M511.82,329.991c-0.256-1.212-1.064-2.244-2.192-2.784l-24.396-11.684c17.688-29.776,11.804-68.912-15.58-91.88 c-53.756-45.084-131.696-70.936-213.828-70.936c-82.128,0-160.068,25.856-213.82,70.936c-27.416,22.992-33.28,62.18-15.524,91.972 L2.276,327.203c-1.128,0.54-1.936,1.572-2.192,2.792c-0.256,1.22,0.08,2.496,0.896,3.436l21.204,24.388 c0.764,0.88,1.868,1.376,3.02,1.376c0.084,0,0.172,0,0.26-0.008c1.244-0.084,2.384-0.74,3.072-1.776l14.852-22.376 c12.648,10.112,28.392,15.776,44.916,15.776c16.872,0,33.284-5.98,46.232-16.836c27.828-23.34,73.172-37.272,121.288-37.272 c48.12,0,93.464,13.932,121.296,37.272c12.944,10.856,29.36,16.836,46.228,16.836c16.596,0,32.4-5.724,45.08-15.916l14.94,22.512 c0.692,1.04,1.824,1.696,3.076,1.776c0.084,0.008,0.172,0.008,0.256,0.008c1.156,0,2.256-0.496,3.02-1.376l21.2-24.388C511.74,332.487,512.068,331.211,511.82,329.991z\";\r\n * // ...\r\n * series.maskSprite.path = iconPath;\r\n * ```\r\n * ```JavaScript\r\n * let iconPath = \"M511.82,329.991c-0.256-1.212-1.064-2.244-2.192-2.784l-24.396-11.684c17.688-29.776,11.804-68.912-15.58-91.88 c-53.756-45.084-131.696-70.936-213.828-70.936c-82.128,0-160.068,25.856-213.82,70.936c-27.416,22.992-33.28,62.18-15.524,91.972 L2.276,327.203c-1.128,0.54-1.936,1.572-2.192,2.792c-0.256,1.22,0.08,2.496,0.896,3.436l21.204,24.388 c0.764,0.88,1.868,1.376,3.02,1.376c0.084,0,0.172,0,0.26-0.008c1.244-0.084,2.384-0.74,3.072-1.776l14.852-22.376 c12.648,10.112,28.392,15.776,44.916,15.776c16.872,0,33.284-5.98,46.232-16.836c27.828-23.34,73.172-37.272,121.288-37.272 c48.12,0,93.464,13.932,121.296,37.272c12.944,10.856,29.36,16.836,46.228,16.836c16.596,0,32.4-5.724,45.08-15.916l14.94,22.512 c0.692,1.04,1.824,1.696,3.076,1.776c0.084,0.008,0.172,0.008,0.256,0.008c1.156,0,2.256-0.496,3.02-1.376l21.2-24.388C511.74,332.487,512.068,331.211,511.82,329.991z\";\r\n * // ...\r\n * series.maskSprite.path = iconPath;\r\n * ```\r\n * ```JSON\r\n * let iconPath = \"M511.82,329.991c-0.256-1.212-1.064-2.244-2.192-2.784l-24.396-11.684c17.688-29.776,11.804-68.912-15.58-91.88 c-53.756-45.084-131.696-70.936-213.828-70.936c-82.128,0-160.068,25.856-213.82,70.936c-27.416,22.992-33.28,62.18-15.524,91.972 L2.276,327.203c-1.128,0.54-1.936,1.572-2.192,2.792c-0.256,1.22,0.08,2.496,0.896,3.436l21.204,24.388 c0.764,0.88,1.868,1.376,3.02,1.376c0.084,0,0.172,0,0.26-0.008c1.244-0.084,2.384-0.74,3.072-1.776l14.852-22.376 c12.648,10.112,28.392,15.776,44.916,15.776c16.872,0,33.284-5.98,46.232-16.836c27.828-23.34,73.172-37.272,121.288-37.272 c48.12,0,93.464,13.932,121.296,37.272c12.944,10.856,29.36,16.836,46.228,16.836c16.596,0,32.4-5.724,45.08-15.916l14.94,22.512 c0.692,1.04,1.824,1.696,3.076,1.776c0.084,0.008,0.172,0.008,0.256,0.008c1.156,0,2.256-0.496,3.02-1.376l21.2-24.388C511.74,332.487,512.068,331.211,511.82,329.991z\";\r\n * // ...\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * \"type\": \"PictorialStackedSeries\",\r\n * // ...\r\n * \"maskSprite\": {\r\n * \"path\": iconPath\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @return Mask sprite\r\n */\r\n get: function () {\r\n return this._maskSprite;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Inits FunnelSlice.\r\n *\r\n * @param slice to init\r\n */\r\n PictorialStackedSeries.prototype.initSlice = function (slice) {\r\n _super.prototype.initSlice.call(this, slice);\r\n var hs = slice.states.getKey(\"hover\");\r\n if (hs) {\r\n hs.properties.expandDistance = 0;\r\n }\r\n };\r\n Object.defineProperty(PictorialStackedSeries.prototype, \"startLocation\", {\r\n /**\r\n * @return Start location\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startLocation\");\r\n },\r\n /**\r\n * Relative location to start series from.\r\n *\r\n * Range of values: 0 to 1.\r\n *\r\n * This setting indicates where actual slices will start relatively to the\r\n * whole height/width of the series.\r\n *\r\n * For example, if we want slices to start at 30% from the top/left of the\r\n * series, we can set `startLocation = 0.3`.\r\n *\r\n * To fill shape outside of the location range, use background of the\r\n * property `slicesContainer`.\r\n *\r\n * ```TypeScript\r\n * series.startLocation = 0.2;\r\n * series.endLocation = 0.8;\r\n * series.slicesContainer.background.fill = am4core.color(\"#eee\");\r\n * ```\r\n * ```JavaScript\r\n * series.startLocation = 0.2;\r\n * series.endLocation = 0.8;\r\n * series.slicesContainer.background.fill = am4core.color(\"#eee\");\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * // ...\r\n * \"startLocation\": 0.2,\r\n * \"endLocation\": 0.8,\r\n * \"slicesContainer\": {\r\n * \"background\": {\r\n * \"fill\": \"#eee\"\r\n * }\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @default 0\r\n * @since 4.1.13\r\n * @param value Start location\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"startLocation\", value)) {\r\n this.invalidateDataItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PictorialStackedSeries.prototype, \"endLocation\", {\r\n /**\r\n * @return End location\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endLocation\");\r\n },\r\n /**\r\n * Relative location to end series at.\r\n *\r\n * Range of values: 0 to 1.\r\n *\r\n * This setting indicates where actual slices will end relatively to the\r\n * whole height/width of the series.\r\n *\r\n * For example, if we want slices to end at 70% from the top/left of the\r\n * series, we can set `endLocation = 0.7`.\r\n *\r\n * To fill shape outside of the location range, use background of the\r\n * property `slicesContainer`.\r\n *\r\n * ```TypeScript\r\n * series.startLocation = 0.2;\r\n * series.endLocation = 0.8;\r\n * series.slicesContainer.background.fill = am4core.color(\"#eee\");\r\n * ```\r\n * ```JavaScript\r\n * series.startLocation = 0.2;\r\n * series.endLocation = 0.8;\r\n * series.slicesContainer.background.fill = am4core.color(\"#eee\");\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * // ...\r\n * \"startLocation\": 0.2,\r\n * \"endLocation\": 0.8,\r\n * \"slicesContainer\": {\r\n * \"background\": {\r\n * \"fill\": \"#eee\"\r\n * }\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @default 1\r\n * @since 4.1.13\r\n * @param value End location\r\n */\r\n set: function (value) {\r\n if (this.setPropertyValue(\"endLocation\", value)) {\r\n this.invalidateDataItems();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PictorialStackedSeries;\r\n}(PyramidSeries));\r\nexport { PictorialStackedSeries };\r\n/**\r\n * bboxter 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[\"PictorialStackedSeries\"] = PictorialStackedSeries;\r\nregistry.registeredClasses[\"PictorialStackedSeriesDataItem\"] = PictorialStackedSeriesDataItem;\r\n//# sourceMappingURL=PictorialStackedSeries.js.map","/**\r\n * Module that defines everything related to building Cone Columns.\r\n * It is a container which has coneColumn element which is a Cone.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Column } from \"./Column\";\r\nimport { Cone } from \"../../core/elements/3d/Cone\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to creates ConeColumns.\r\n *\r\n * @see {@link IConeColumnEvents} for a list of available events\r\n * @see {@link IConeColumnAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar ConeColumn = /** @class */ (function (_super) {\r\n __extends(ConeColumn, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ConeColumn() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ConeColumn\";\r\n return _this;\r\n }\r\n /**\r\n * @ignore\r\n */\r\n ConeColumn.prototype.createAssets = function () {\r\n this.coneColumn = this.createChild(Cone);\r\n this.coneColumn.shouldClone = false;\r\n // some dirty hack so that if user access column, it won't get error\r\n this.column = this.coneColumn;\r\n };\r\n /**\r\n * Copies all parameters from another [[ConeColumn]].\r\n *\r\n * @param source Source ConeColumn\r\n */\r\n ConeColumn.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.coneColumn) {\r\n this.coneColumn.copyFrom(source.coneColumn);\r\n }\r\n };\r\n return ConeColumn;\r\n}(Column));\r\nexport { ConeColumn };\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[\"ConeColumn\"] = ConeColumn;\r\n//# sourceMappingURL=ConeColumn.js.map","/**\r\n * ConeSeries module\r\n * Not recommended using if you use scrollbars or your chart is zoomable in some other way.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ColumnSeries, ColumnSeriesDataItem } from \"./ColumnSeries\";\r\nimport { ConeColumn } from \"../elements/ConeColumn\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[ConeSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar ConeSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(ConeSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ConeSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ConeSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return ConeSeriesDataItem;\r\n}(ColumnSeriesDataItem));\r\nexport { ConeSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a cone graph.\r\n *\r\n * @see {@link IConeSeriesEvents} for a list of available Events\r\n * @see {@link IConeSeriesAdapters} for a list of available Adapters\r\n * @todo Example\r\n * @important\r\n */\r\nvar ConeSeries = /** @class */ (function (_super) {\r\n __extends(ConeSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ConeSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ConeSeries\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Returns an element to use for Candlestick\r\n * @ignore\r\n * @return Element.\r\n */\r\n ConeSeries.prototype.createColumnTemplate = function () {\r\n return new ConeColumn();\r\n };\r\n /**\r\n * Returns an SVG path to use as series mask.\r\n *\r\n * @return SVG path\r\n */\r\n ConeSeries.prototype.getMaskPath = function () {\r\n var dx = 0;\r\n var dy = 0;\r\n var column = this.columns.getIndex(0);\r\n if (column) {\r\n if (this.baseAxis == this.xAxis) {\r\n dy = column.coneColumn.innerWidth / 2 + 1;\r\n }\r\n else {\r\n dx = column.coneColumn.innerHeight / 2 + 1;\r\n }\r\n return $path.rectToPath({\r\n x: -dx,\r\n y: 0,\r\n width: this.xAxis.axisLength + dx,\r\n height: this.yAxis.axisLength + dy\r\n });\r\n }\r\n };\r\n /**\r\n * Validates data item's elements.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n ConeSeries.prototype.validateDataElementReal = function (dataItem) {\r\n _super.prototype.validateDataElementReal.call(this, dataItem);\r\n var column = dataItem.column;\r\n if (column) {\r\n var coneColumn = dataItem.column.coneColumn;\r\n coneColumn.fill = dataItem.column.fill;\r\n if (this.baseAxis == this.yAxis) {\r\n coneColumn.orientation = \"horizontal\";\r\n }\r\n else {\r\n coneColumn.orientation = \"vertical\";\r\n }\r\n }\r\n };\r\n return ConeSeries;\r\n}(ColumnSeries));\r\nexport { ConeSeries };\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[\"ConeSeries\"] = ConeSeries;\r\nregistry.registeredClasses[\"ConeSeriesDataItem\"] = ConeSeriesDataItem;\r\n//# sourceMappingURL=ConeSeries.js.map","/**\r\n * Module that defines everything related to building Curved Columns.\r\n * It is a container which has CurvedColumn element which is a Sprite.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Column } from \"./Column\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $smoothing from \"../../core/rendering/Smoothing\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Class used to creates CurvedColumns.\r\n *\r\n * @see {@link ICurvedColumnEvents} for a list of available events\r\n * @see {@link ICurvedColumnAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar CurvedColumn = /** @class */ (function (_super) {\r\n __extends(CurvedColumn, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CurvedColumn() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"CurvedColumn\";\r\n return _this;\r\n }\r\n /**\r\n * [createAssets description]\r\n *\r\n * @todo Description\r\n * @ignore Exclude from docs\r\n */\r\n CurvedColumn.prototype.createAssets = function () {\r\n this.curvedColumn = this.createChild(Sprite);\r\n this.curvedColumn.shouldClone = false;\r\n this.setPropertyValue(\"tension\", 0.7);\r\n this.width = percent(120);\r\n this.height = percent(120);\r\n // some dirty hack so that if user access column, it won't get error\r\n this.column = this.curvedColumn;\r\n };\r\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n CurvedColumn.prototype.draw = function () {\r\n _super.prototype.draw.call(this);\r\n var w = this.realWidth;\r\n var h = this.realHeight;\r\n var x = this.realX - this.pixelX;\r\n var y = this.realY - this.pixelY;\r\n var points;\r\n // TODO can this be removed ?\r\n $utils.used(this.width);\r\n var tensionX = 1;\r\n var tensionY = 1;\r\n if (this.orientation == \"vertical\") {\r\n tensionX = this.tension;\r\n points = [{ x: 0, y: h + y }, { x: w / 2, y: y }, { x: w, y: h + y }];\r\n }\r\n else {\r\n tensionY = this.tension;\r\n points = [{ x: x, y: 0 }, { x: x + w, y: h / 2 }, { x: x, y: h }];\r\n }\r\n var path = $path.moveTo(points[0]) + new $smoothing.Tension(tensionX, tensionY).smooth(points);\r\n this.column.path = path;\r\n };\r\n /**\r\n * Copies all parameters from another [[CurvedColumn]].\r\n *\r\n * @param source Source CurvedColumn\r\n */\r\n CurvedColumn.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (this.curvedColumn) {\r\n this.curvedColumn.copyFrom(source.curvedColumn);\r\n }\r\n };\r\n Object.defineProperty(CurvedColumn.prototype, \"tension\", {\r\n /**\r\n * @return Tension (0-1)\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"tension\");\r\n },\r\n /**\r\n * Horizontal tension of the curve.\r\n *\r\n * Tension defines how \"lose\" the line will be.\r\n *\r\n * 1 is the maximum tension which would result in pointy columns with\r\n * straight edges.\r\n *\r\n * The smaller the tension th wider the column will be.\r\n *\r\n * @default 0.7\r\n * @param value tension (0-1)\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"tension\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CurvedColumn.prototype, \"orientation\", {\r\n /**\r\n * Orientation\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"orientation\");\r\n },\r\n /**\r\n * Orientation of the column.\r\n *\r\n * Available options: \"vertical\" (default) and \"horizontal\".\r\n *\r\n * @default \"vertical\"\r\n * @param value Orientation\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"orientation\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CurvedColumn;\r\n}(Column));\r\nexport { CurvedColumn };\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[\"CurvedColumn\"] = CurvedColumn;\r\n//# sourceMappingURL=CurvedColumn.js.map","/**\r\n * CurvedColumnSeries module.\r\n *\r\n * Not recommended using if you use scrollbars or your chart is zoomable in some other way.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { ColumnSeries, ColumnSeriesDataItem } from \"./ColumnSeries\";\r\nimport { CurvedColumn } from \"../elements/CurvedColumn\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[CurvedColumnSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar CurvedColumnSeriesDataItem = /** @class */ (function (_super) {\r\n __extends(CurvedColumnSeriesDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CurvedColumnSeriesDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"CurvedColumnSeriesDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n return CurvedColumnSeriesDataItem;\r\n}(ColumnSeriesDataItem));\r\nexport { CurvedColumnSeriesDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines [[Series]] for a curved columns graph.\r\n *\r\n * @see {@link ICurvedColumnSeriesEvents} for a list of available Events\r\n * @see {@link ICurvedColumnSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\r\nvar CurvedColumnSeries = /** @class */ (function (_super) {\r\n __extends(CurvedColumnSeries, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CurvedColumnSeries() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"CurvedColumnSeries\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Returns an element to use for the curved column.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Element.\r\n */\r\n CurvedColumnSeries.prototype.createColumnTemplate = function () {\r\n return new CurvedColumn();\r\n };\r\n /**\r\n * Validates data item's elements.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n CurvedColumnSeries.prototype.validateDataElementReal = function (dataItem) {\r\n _super.prototype.validateDataElementReal.call(this, dataItem);\r\n var column = dataItem.column;\r\n column = dataItem.column;\r\n if (column) {\r\n var curvedColumn = dataItem.column.curvedColumn;\r\n curvedColumn.fill = dataItem.column.fill;\r\n if (this.baseAxis == this.yAxis) {\r\n column.orientation = \"horizontal\";\r\n }\r\n else {\r\n column.orientation = \"vertical\";\r\n }\r\n }\r\n };\r\n return CurvedColumnSeries;\r\n}(ColumnSeries));\r\nexport { CurvedColumnSeries };\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[\"CurvedColumnSeries\"] = CurvedColumnSeries;\r\nregistry.registeredClasses[\"CurvedColumnSeriesDataItem\"] = CurvedColumnSeriesDataItem;\r\n//# sourceMappingURL=CurvedColumnSeries.js.map","/**\r\n * Bullet module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Bullet } from \"./Bullet\";\r\nimport { Circle } from \"../../core/elements/Circle\";\r\nimport { registry } from \"../../core/Registry\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a bullet with a textual label.\r\n *\r\n * Uses [[Label]] instance to draw the label, so the label itself is\r\n * configurable.\r\n *\r\n * @see {@link IBulletEvents} for a list of available events\r\n * @see {@link IBulletAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar CircleBullet = /** @class */ (function (_super) {\r\n __extends(CircleBullet, _super);\r\n /**\r\n * Constructor\r\n */\r\n function CircleBullet() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"CircleBullet\";\r\n var circle = _this.createChild(Circle);\r\n circle.shouldClone = false;\r\n circle.radius = 5;\r\n circle.isMeasured = false;\r\n _this.circle = circle;\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Copies all proprities and related stuff from another instance of\r\n * [[CircleBullet]].\r\n *\r\n * @param source Source element\r\n */\r\n CircleBullet.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.circle.copyFrom(source.circle);\r\n };\r\n return CircleBullet;\r\n}(Bullet));\r\nexport { CircleBullet };\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[\"CircleBullet\"] = CircleBullet;\r\n//# sourceMappingURL=CircleBullet.js.map","/**\r\n * Bullet module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Bullet } from \"./Bullet\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Creates a bullet with a textual label.\r\n *\r\n * Uses [[Label]] instance to draw the label, so the label itself is\r\n * configurable.\r\n *\r\n * @see {@link IBulletEvents} for a list of available events\r\n * @see {@link IBulletAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\r\nvar ErrorBullet = /** @class */ (function (_super) {\r\n __extends(ErrorBullet, _super);\r\n /**\r\n * Constructor\r\n */\r\n function ErrorBullet() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"ErrorBullet\";\r\n _this.errorLine = _this.createChild(Sprite);\r\n _this.errorLine.shouldClone = false;\r\n _this.width = 20;\r\n _this.height = 20;\r\n _this.strokeOpacity = 1;\r\n _this.isDynamic = true;\r\n return _this;\r\n }\r\n ErrorBullet.prototype.validatePosition = function () {\r\n _super.prototype.validatePosition.call(this);\r\n var w = this.pixelWidth / 2;\r\n var h = this.pixelHeight / 2;\r\n this.errorLine.path = $path.moveTo({ x: -w, y: -h }) + $path.lineTo({ x: w, y: -h }) + $path.moveTo({ x: 0, y: -h }) + $path.lineTo({ x: 0, y: h }) + $path.moveTo({ x: -w, y: h }) + $path.lineTo({ x: w, y: h });\r\n };\r\n /**\r\n * Copies all proprities and related stuff from another instance of\r\n * [[ErrorBullet]].\r\n *\r\n * @param source Source element\r\n */\r\n ErrorBullet.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n this.errorLine.copyFrom(source.errorLine);\r\n };\r\n return ErrorBullet;\r\n}(Bullet));\r\nexport { ErrorBullet };\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[\"ErrorBullet\"] = ErrorBullet;\r\n//# sourceMappingURL=ErrorBullet.js.map","/**\r\n * Functionality for drawing simple NavigationBar.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Component } from \"../../core/Component\";\r\nimport { DataItem } from \"../../core/DataItem\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { TextLink } from \"../../core/elements/TextLink\";\r\nimport { Triangle } from \"../../core/elements/Triangle\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport * as $iter from \"../../core/utils/Iterator\";\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Defines a [[DataItem]] for [[NavigationBar]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nvar NavigationBarDataItem = /** @class */ (function (_super) {\r\n __extends(NavigationBarDataItem, _super);\r\n /**\r\n * Constructor\r\n */\r\n function NavigationBarDataItem() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"NavigationBarDataItem\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n Object.defineProperty(NavigationBarDataItem.prototype, \"name\", {\r\n /**\r\n * @return Name\r\n */\r\n get: function () {\r\n return this.properties[\"name\"];\r\n },\r\n /**\r\n * Name of the navigation bar item.\r\n *\r\n * @param value Name\r\n */\r\n set: function (value) {\r\n this.setProperty(\"name\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return NavigationBarDataItem;\r\n}(DataItem));\r\nexport { NavigationBarDataItem };\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * NavigationBar class can be used to create a multi-level breadcrumb-style\r\n * navigation control.\r\n *\r\n * @see {@link INavigationBarEvents} for a list of available events\r\n * @see {@link INavigationBarAdapters} for a list of available Adapters\r\n * @todo Implement better\r\n * @important\r\n */\r\nvar NavigationBar = /** @class */ (function (_super) {\r\n __extends(NavigationBar, _super);\r\n /**\r\n * Constructor\r\n */\r\n function NavigationBar() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"NavigationBar\";\r\n var interfaceColors = new InterfaceColorSet();\r\n var textLink = new TextLink();\r\n textLink.valign = \"middle\";\r\n textLink.paddingTop = 8;\r\n textLink.paddingBottom = 8;\r\n _this.paddingBottom = 2;\r\n _this.links = new ListTemplate(textLink);\r\n _this._disposers.push(new ListDisposer(_this.links));\r\n _this._disposers.push(textLink);\r\n _this._linksIterator = new $iter.ListIterator(_this.links, function () { return _this.links.create(); });\r\n _this._linksIterator.createNewItems = true;\r\n var triangle = new Triangle();\r\n triangle.direction = \"right\";\r\n triangle.width = 8;\r\n triangle.height = 12;\r\n triangle.fill = interfaceColors.getFor(\"alternativeBackground\");\r\n triangle.fillOpacity = 0.5;\r\n triangle.valign = \"middle\";\r\n triangle.marginLeft = 10;\r\n triangle.marginRight = 10;\r\n _this.separators = new ListTemplate(triangle);\r\n _this._disposers.push(new ListDisposer(_this.separators));\r\n _this._disposers.push(triangle);\r\n var activeLink = new TextLink();\r\n _this.activeLink = activeLink;\r\n activeLink.copyFrom(textLink);\r\n activeLink.valign = \"middle\";\r\n activeLink.fontWeight = \"bold\";\r\n _this.width = percent(100);\r\n _this.layout = \"grid\";\r\n _this.dataFields.name = \"name\";\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Completely redraws the navigation bar.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n NavigationBar.prototype.validateDataElements = function () {\r\n this.removeChildren();\r\n this._linksIterator.reset();\r\n _super.prototype.validateDataElements.call(this);\r\n //@todo: dispose\r\n };\r\n /**\r\n * Creates a visual element for a data item (nav item).\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\r\n NavigationBar.prototype.validateDataElement = function (dataItem) {\r\n _super.prototype.validateDataElement.call(this, dataItem);\r\n var textLink;\r\n if (dataItem.index < this.dataItems.length - 1) {\r\n textLink = this._linksIterator.getLast();\r\n textLink.parent = this;\r\n var separator = this.separators.create();\r\n separator.parent = this;\r\n separator.valign = \"middle\";\r\n }\r\n else {\r\n textLink = this.activeLink;\r\n textLink.events.copyFrom(this.links.template.events);\r\n textLink.hide(0);\r\n textLink.show();\r\n textLink.parent = this;\r\n }\r\n textLink.dataItem = dataItem;\r\n textLink.text = dataItem.name;\r\n textLink.validate();\r\n };\r\n return NavigationBar;\r\n}(Component));\r\nexport { NavigationBar };\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[\"NavigationBar\"] = NavigationBar;\r\nregistry.registeredClasses[\"NavigationBarDataItem\"] = NavigationBarDataItem;\r\n//# sourceMappingURL=NavigationBar.js.map","/**\r\n * Cursor module\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Container } from \"../../core/Container\";\r\nimport { getInteraction } from \"../../core/interaction/Interaction\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { percent } from \"../../core/utils/Percent\";\r\nimport { MouseCursorStyle } from \"../../core/interaction/Mouse\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport { system } from \"../../core/System\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Main Cursor class with common cursor functionality.\r\n *\r\n * Chart-specific cursors must extend this class.\r\n *\r\n * @see {@link ICursorEvents} for a list of available events\r\n * @see {@link ICursorAdapters} for a list of available Adapters\r\n * @todo Add description, examples\r\n * @todo Should we allow changing `_generalBehavior`?\r\n */\r\nvar Cursor = /** @class */ (function (_super) {\r\n __extends(Cursor, _super);\r\n /**\r\n * Constructor\r\n */\r\n function Cursor() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Current cursor position during selection.\r\n *\r\n * @todo Better description\r\n */\r\n _this.point = { x: 0, y: 0 };\r\n /**\r\n * Specifies the rules when cursor needs to be moved or hidden.\r\n */\r\n _this._stick = \"none\";\r\n _this.className = \"Cursor\";\r\n // Set defaults\r\n _this.width = percent(100);\r\n _this.height = percent(100);\r\n _this.shouldClone = false;\r\n _this.hide(0);\r\n _this.trackable = true;\r\n _this.clickable = true;\r\n _this.isMeasured = false;\r\n // Add events on body to trigger down and up events (to start zooming or\r\n // selection)\r\n var interaction = getInteraction();\r\n _this._disposers.push(interaction.body.events.on(\"down\", _this.handleCursorDown, _this));\r\n _this._disposers.push(interaction.body.events.on(\"up\", _this.handleCursorUp, _this));\r\n _this._disposers.push(interaction.body.events.on(\"track\", _this.handleCursorMove, _this));\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Handle pointer movement in document and update cursor position as needed.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\r\n Cursor.prototype.handleCursorMove = function (event) {\r\n if (!this.interactionsEnabled || (this.interactions.isTouchProtected && event.touch)) {\r\n return;\r\n }\r\n if (((this._generalBehavior != \"zoom\" && this._generalBehavior != \"pan\") || !this.downPoint) && !getInteraction().isLocalElement(event.pointer, this.paper.svg, this.uid)) {\r\n // We want to let zoom/pan continue even if cursor is outside chart area\r\n if (!this.isHidden || !this.isHiding) {\r\n this.hide();\r\n }\r\n return;\r\n }\r\n var local = $utils.documentPointToSprite(event.pointer.point, this);\r\n if (this._stick == \"hard\" && this._stickPoint) {\r\n local = this._stickPoint;\r\n }\r\n if (this._stick == \"soft\" && this._stickPoint) {\r\n if (!this.fitsToBounds(local)) {\r\n local = this._stickPoint;\r\n }\r\n }\r\n this.triggerMove(local);\r\n return local;\r\n };\r\n /**\r\n * Hides actual SVG elements and handles hiding animations.\r\n *\r\n * @param duration Fade out duration (ms)\r\n * @return Fade out duration (ms)\r\n * @ignore\r\n */\r\n Cursor.prototype.hideReal = function (duration) {\r\n if ((this._stick == \"hard\" || this._stick == \"soft\") && this._stickPoint) {\r\n return;\r\n }\r\n return _super.prototype.hideReal.call(this, duration);\r\n };\r\n /**\r\n * Places the cursor at specific point.\r\n *\r\n * The second parameter has following options:\r\n *\r\n * `\"none\"` - placed cursor will only be there until mouse/touch moves, then\r\n * it either moves to a new place (if pointer over plot area) or is hidden.\r\n *\r\n * `\"soft\"` - cursor will stay in the place if mouse/touch is happening\r\n * outside chart, but will move to a new place whe plot area is hovered or\r\n * touched.\r\n *\r\n * `\"hard\"` - cursor will stay in place no matter what, until it is moved by\r\n * another `triggerMove()` call.\r\n *\r\n * The third parameter - `force` (since `4.9.5`) - if set to `true` will\r\n * make cursor execute all of the actions associated with cursor move,\r\n * including line redraws, tooltip updates, etc. Useful when underlying\r\n * chart data is dynamically being updated.\r\n *\r\n * @param point Point to place cursor at\r\n * @param stick Level of cursor stickiness to the place\r\n * @param force Force cursor move\r\n */\r\n Cursor.prototype.triggerMove = function (point, stick, force) {\r\n point.x = $math.round(point.x, 1);\r\n point.y = $math.round(point.y, 1);\r\n if (stick) {\r\n this._stick = stick;\r\n }\r\n if (stick == \"hard\" || stick == \"soft\") {\r\n this._stickPoint = point;\r\n }\r\n this.triggerMoveReal(point, force);\r\n };\r\n /**\r\n * Places the cursor at specific point.\r\n *\r\n * @param point Point to place cursor at\r\n */\r\n Cursor.prototype.triggerMoveReal = function (point, force) {\r\n if (this.point.x != point.x || this.point.y != point.y || force) {\r\n this.point = point;\r\n this.invalidatePosition();\r\n // hide cursor if it's out of bounds\r\n if (this.fitsToBounds(point)) {\r\n this.show(0);\r\n }\r\n else {\r\n // unless we are selecting (mouse is down)\r\n if (!this.downPoint) {\r\n this.hide(0);\r\n }\r\n }\r\n if (this.visible) {\r\n this.getPositions();\r\n this.dispatch(\"cursorpositionchanged\"); // not good to dispatch later (check step count example)\r\n }\r\n }\r\n };\r\n /**\r\n * Simulates pressing down (click/touch) action by a cursor.\r\n *\r\n * @param point Point of action\r\n */\r\n Cursor.prototype.triggerDown = function (point) {\r\n this.triggerDownReal(point);\r\n };\r\n /**\r\n * Simulates pressing down (click/touch) action by a cursor.\r\n *\r\n * @param point Point of action\r\n */\r\n Cursor.prototype.triggerDownReal = function (point) {\r\n switch (this._generalBehavior) {\r\n case \"zoom\":\r\n this.dispatchImmediately(\"zoomstarted\");\r\n break;\r\n case \"select\":\r\n this.dispatchImmediately(\"selectstarted\");\r\n break;\r\n case \"pan\":\r\n this.dispatchImmediately(\"panstarted\");\r\n getInteraction().setGlobalStyle(MouseCursorStyle.grabbing);\r\n break;\r\n }\r\n };\r\n /**\r\n * Simulates the action of release of the mouse down / touch.\r\n *\r\n * @param point Point of action\r\n */\r\n Cursor.prototype.triggerUp = function (point) {\r\n this.triggerUpReal(point);\r\n };\r\n /**\r\n * Simulates the action of release of the mouse down / touch.\r\n *\r\n * @param point Point of action\r\n */\r\n Cursor.prototype.triggerUpReal = function (point) {\r\n system.requestFrame();\r\n this.updatePoint(this.upPoint);\r\n var interaction = getInteraction();\r\n if ($math.getDistance(this._upPointOrig, this._downPointOrig) > interaction.getHitOption(this.interactions, \"hitTolerance\")) {\r\n switch (this._generalBehavior) {\r\n case \"zoom\":\r\n this.dispatch(\"zoomended\");\r\n break;\r\n case \"select\":\r\n this.dispatch(\"selectended\");\r\n break;\r\n case \"pan\":\r\n this.dispatch(\"panended\");\r\n interaction.setGlobalStyle(MouseCursorStyle.default);\r\n break;\r\n }\r\n this.downPoint = undefined;\r\n this.updateSelection();\r\n }\r\n /*\r\n else {\r\n \r\n if(this._generalBehavior == \"select\"){\r\n this.dispatchImmediately(\"selectended\");\r\n }\r\n this.dispatchImmediately(\"behaviorcanceled\");\r\n interaction.setGlobalStyle(MouseCursorStyle.default);\r\n this.downPoint = undefined;\r\n }*/\r\n };\r\n /**\r\n * Updates selection dimensions on size change.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n Cursor.prototype.updateSelection = function () {\r\n };\r\n /**\r\n * Updates cursors current positions.\r\n */\r\n Cursor.prototype.getPositions = function () {\r\n // positions are used by axes or series\r\n this.xPosition = this.point.x / this.innerWidth;\r\n this.yPosition = 1 - this.point.y / this.innerHeight;\r\n };\r\n /**\r\n * Handles pointer down event so we can start zoom or selection.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Original event\r\n */\r\n Cursor.prototype.handleCursorDown = function (event) {\r\n if (!this.interactionsEnabled || (this.interactions.isTouchProtected && event.touch) || !getInteraction().isLocalElement(event.pointer, this.paper.svg, this.uid)) {\r\n return;\r\n }\r\n // Get local point\r\n var local = $utils.documentPointToSprite(event.pointer.point, this);\r\n if (this._stick == \"hard\" && this._stickPoint) {\r\n local = this._stickPoint;\r\n }\r\n if (!this.fitsToBounds(local)) {\r\n return;\r\n }\r\n this._downPointOrig = { x: local.x, y: local.y };\r\n // We need to cancel the event to prevent gestures on touch devices\r\n if (event.event.cancelable && this.shouldPreventGestures(event.touch) && this.fitsToBounds(local)) {\r\n event.event.preventDefault();\r\n }\r\n // Make this happen\r\n this.triggerMove(local);\r\n this.triggerDown(local);\r\n };\r\n /**\r\n * Determines whether Cursor should prevent default action on move.\r\n *\r\n * Child classes should override this as necessary.\r\n *\r\n * @return Prevent default?\r\n */\r\n Cursor.prototype.shouldPreventGestures = function (touch) {\r\n return true;\r\n };\r\n /**\r\n * Updates the coordinates of where pointer down event occurred\r\n * (was pressed).\r\n */\r\n Cursor.prototype.updatePoint = function (point) {\r\n };\r\n /**\r\n * Handles pointer up event - finishes zoom or selection action.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Original event\r\n */\r\n Cursor.prototype.handleCursorUp = function (event) {\r\n if (!this.interactionsEnabled) {\r\n return;\r\n }\r\n if (!this.downPoint && !getInteraction().isLocalElement(event.pointer, this.paper.svg, this.uid)) {\r\n return;\r\n }\r\n var local = $utils.documentPointToSprite(event.pointer.point, this);\r\n if (!this.downPoint || !this.fitsToBounds(this.downPoint)) {\r\n return;\r\n }\r\n if (this._stick == \"hard\" && this._stickPoint) {\r\n local = this._stickPoint;\r\n }\r\n this._upPointOrig = { x: local.x, y: local.y };\r\n this.triggerMove(local);\r\n this.triggerUp(local);\r\n };\r\n Object.defineProperty(Cursor.prototype, \"chart\", {\r\n /**\r\n * @return Chart\r\n */\r\n get: function () {\r\n return this._chart;\r\n },\r\n /**\r\n * A reference to a [[Chart]] the cursor belongs to.\r\n *\r\n * @param value Chart\r\n */\r\n set: function (value) {\r\n this._chart = value;\r\n if ($type.hasValue(this._chart.plotContainer)) {\r\n getInteraction().lockElement(this._chart.plotContainer.interactions);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Cursor;\r\n}(Container));\r\nexport { Cursor };\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[\"Cursor\"] = Cursor;\r\n//# sourceMappingURL=Cursor.js.map","/**\r\n * Cursor for XY chart\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Cursor } from \"./Cursor\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { MutableValueDisposer, MultiDisposer } from \"../../core/utils/Disposer\";\r\nimport { ValueAxis } from \"../axes/ValueAxis\";\r\nimport { DateAxis } from \"../axes/DateAxis\";\r\nimport { XYSeries } from \"../series/XYSeries\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { color } from \"../../core/utils/Color\";\r\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { getInteraction } from \"../../core/interaction/Interaction\";\r\nimport { MouseCursorStyle } from \"../../core/interaction/Mouse\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $array from \"../../core/utils/Array\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A cursor used on [[XYChart]].\r\n *\r\n * @see {@link IXYCursorEvents} for a list of available events\r\n * @see {@link IXYCursorAdapters} for a list of available Adapters\r\n * @todo Add description, examples\r\n */\r\nvar XYCursor = /** @class */ (function (_super) {\r\n __extends(XYCursor, _super);\r\n /**\r\n * Constructor\r\n */\r\n function XYCursor() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Vertical cursor line element.\r\n */\r\n _this._lineX = new MutableValueDisposer();\r\n /**\r\n * Horizontal cursor line element.\r\n */\r\n _this._lineY = new MutableValueDisposer();\r\n /**\r\n * Horizontal [[Axis]].\r\n */\r\n _this._xAxis = new MutableValueDisposer();\r\n /**\r\n * Vertical [[Axis]].\r\n */\r\n _this._yAxis = new MutableValueDisposer();\r\n _this._snapToDisposers = [];\r\n _this.className = \"XYCursor\";\r\n // Defaults\r\n _this.behavior = \"zoomX\";\r\n _this.maxPanOut = 0.1;\r\n var interfaceColors = new InterfaceColorSet();\r\n // Create selection element\r\n var selection = _this.createChild(Sprite);\r\n selection.shouldClone = false;\r\n selection.fillOpacity = 0.2;\r\n selection.fill = interfaceColors.getFor(\"alternativeBackground\");\r\n selection.isMeasured = false;\r\n selection.visible = false;\r\n selection.interactionsEnabled = false;\r\n _this.selection = selection;\r\n _this._disposers.push(_this.selection);\r\n // Create cursor's vertical line\r\n var lineX = _this.createChild(Sprite);\r\n lineX.shouldClone = false;\r\n lineX.stroke = interfaceColors.getFor(\"grid\");\r\n lineX.fill = color();\r\n lineX.strokeDasharray = \"3,3\";\r\n lineX.isMeasured = false;\r\n lineX.strokeOpacity = 0.4;\r\n lineX.interactionsEnabled = false;\r\n lineX.y = 0; // important\r\n _this.lineX = lineX;\r\n _this._disposers.push(_this.lineX);\r\n // Create cursor's horizontal line\r\n var lineY = _this.createChild(Sprite);\r\n lineY.shouldClone = false;\r\n lineY.stroke = interfaceColors.getFor(\"grid\");\r\n lineY.fill = color();\r\n lineY.strokeDasharray = \"3,3\";\r\n lineY.isMeasured = false;\r\n lineY.strokeOpacity = 0.4;\r\n lineY.interactionsEnabled = false;\r\n lineY.x = 0; // important\r\n _this.lineY = lineY;\r\n _this._disposers.push(_this.lineY);\r\n // Add handler for size changes\r\n _this.events.on(\"sizechanged\", _this.updateSize, _this, false);\r\n _this._disposers.push(_this._lineX);\r\n _this._disposers.push(_this._lineY);\r\n _this._disposers.push(_this._xAxis);\r\n _this._disposers.push(_this._yAxis);\r\n _this.mask = _this;\r\n _this.hideSeriesTooltipsOnSelection = true;\r\n // Apply theme\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n /**\r\n * Updates cursor element dimensions on size change.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYCursor.prototype.updateSize = function () {\r\n if (this.lineX) {\r\n this.lineX.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: 0, y: this.innerHeight });\r\n }\r\n if (this.lineY) {\r\n this.lineY.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: this.innerWidth, y: 0 });\r\n }\r\n };\r\n /**\r\n * Updates selection dimensions on size change.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYCursor.prototype.updateSelection = function () {\r\n if (this._usesSelection) {\r\n var downPoint = this.downPoint;\r\n var behavior = this.behavior;\r\n if (downPoint) {\r\n var point = this.point;\r\n if (this.lineX) {\r\n point.x = this.lineX.pixelX;\r\n }\r\n if (this.lineY) {\r\n point.y = this.lineY.pixelY;\r\n }\r\n var selection = this.selection;\r\n var x = Math.min(point.x, downPoint.x);\r\n var y = Math.min(point.y, downPoint.y);\r\n var w = $math.round(Math.abs(downPoint.x - point.x), this._positionPrecision);\r\n var h = $math.round(Math.abs(downPoint.y - point.y), this._positionPrecision);\r\n switch (behavior) {\r\n case \"zoomX\":\r\n y = 0;\r\n h = this.pixelHeight;\r\n break;\r\n case \"zoomY\":\r\n x = 0;\r\n w = this.pixelWidth;\r\n break;\r\n case \"selectX\":\r\n y = 0;\r\n h = this.pixelHeight;\r\n break;\r\n case \"selectY\":\r\n x = 0;\r\n w = this.pixelWidth;\r\n break;\r\n }\r\n selection.x = x;\r\n selection.y = y;\r\n selection.path = $path.rectangle(w, h);\r\n selection.validatePosition(); // otherwise Edge shoes some incorrect size rectangle\r\n }\r\n else {\r\n if (this._generalBehavior != \"select\") {\r\n this.selection.hide();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYCursor.prototype.fixPoint = function (point) {\r\n point.x = Math.max(0, point.x);\r\n point.y = Math.max(0, point.y);\r\n point.x = Math.min(this.pixelWidth, point.x);\r\n point.y = Math.min(this.pixelHeight, point.y);\r\n return point;\r\n };\r\n /**\r\n * Places the cursor at specific point.\r\n *\r\n * @param point Point to place cursor at\r\n */\r\n XYCursor.prototype.triggerMoveReal = function (point, force) {\r\n _super.prototype.triggerMoveReal.call(this, point, force);\r\n var snapToSeries = this.snapToSeries;\r\n if ((snapToSeries && !this.downPoint)) {\r\n if (snapToSeries instanceof XYSeries) {\r\n if (snapToSeries.isHidden) {\r\n this.updateLinePositions(point);\r\n }\r\n }\r\n else {\r\n var allHidden_1 = true;\r\n $array.each(snapToSeries, function (s) {\r\n if (!s.isHidden) {\r\n allHidden_1 = false;\r\n }\r\n });\r\n if (allHidden_1) {\r\n this.updateLinePositions(point);\r\n }\r\n }\r\n }\r\n else {\r\n this.updateLinePositions(point);\r\n }\r\n if (this.downPoint && $math.getDistance(this.downPoint, point) > 3) {\r\n if (this._generalBehavior == \"pan\") {\r\n this.getPanningRanges();\r\n this.dispatch(\"panning\");\r\n }\r\n }\r\n };\r\n /**\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n XYCursor.prototype.updateLinePositions = function (point) {\r\n point = this.fixPoint(this.point);\r\n if (this.lineX && this.lineX.visible && !this.xAxis) {\r\n this.lineX.x = point.x;\r\n }\r\n if (this.lineY && this.lineY.visible && !this.yAxis) {\r\n this.lineY.y = point.y;\r\n }\r\n this.updateSelection();\r\n };\r\n XYCursor.prototype.triggerDownReal = function (point) {\r\n if (this.visible && !this.isHiding) {\r\n if (this._generalBehavior == \"select\") {\r\n this.selection.parent = this.parent;\r\n }\r\n if (this.fitsToBounds(point)) {\r\n this.downPoint = { x: point.x, y: point.y };\r\n this.updatePoint(point);\r\n //this.updateLinePositions(point); // otherwise lines won't be in correct position and touch won't work fine\r\n this.point.x = this.downPoint.x;\r\n this.point.y = this.downPoint.y;\r\n var selection = this.selection;\r\n var selectionX = this.downPoint.x;\r\n var selectionY = this.downPoint.y;\r\n if (this._usesSelection) {\r\n selection.x = selectionX;\r\n selection.y = selectionY;\r\n selection.path = \"\";\r\n selection.show();\r\n }\r\n _super.prototype.triggerDownReal.call(this, point);\r\n }\r\n else {\r\n this.downPoint = undefined;\r\n }\r\n }\r\n else {\r\n this.downPoint = undefined;\r\n }\r\n };\r\n /**\r\n * Updates the coordinates of where pointer down event occurred\r\n * (was pressed).\r\n */\r\n XYCursor.prototype.updatePoint = function (point) {\r\n if (this.lineX) {\r\n point.x = this.lineX.pixelX;\r\n }\r\n if (this.lineY) {\r\n point.y = this.lineY.pixelY;\r\n }\r\n };\r\n /**\r\n * Handle action when cursor is released, which should perform an operation\r\n * based on its `behavior`, like zoom.\r\n *\r\n * @param point Release point\r\n */\r\n XYCursor.prototype.triggerUpReal = function (point) {\r\n if (this.hasMoved()) {\r\n if (this.downPoint) {\r\n this.upPoint = point;\r\n this.updatePoint(this.upPoint);\r\n if (this._generalBehavior != \"pan\") {\r\n this.getRanges();\r\n }\r\n if (this._generalBehavior != \"select\") {\r\n this.selection.hide();\r\n }\r\n _super.prototype.triggerUpReal.call(this, point);\r\n }\r\n }\r\n else {\r\n if (this._generalBehavior != \"select\") {\r\n this.selection.hide(0);\r\n }\r\n else {\r\n this.xRange = undefined;\r\n this.yRange = undefined;\r\n this.dispatchImmediately(\"selectended\");\r\n }\r\n // reset cursor style, just in case\r\n if (this._generalBehavior == \"pan\") {\r\n var interaction = getInteraction();\r\n interaction.setGlobalStyle(MouseCursorStyle.default);\r\n }\r\n this.dispatchImmediately(\"behaviorcanceled\");\r\n }\r\n this.downPoint = undefined;\r\n this.dispatch(\"cursorpositionchanged\");\r\n };\r\n /**\r\n * Calculates if the cursor has moved enough based on its `behavior`.\r\n *\r\n * @return Moved?\r\n */\r\n XYCursor.prototype.hasMoved = function () {\r\n var distance;\r\n if (this.behavior == \"zoomX\" || this.behavior == \"panX\") {\r\n distance = $math.getHorizontalDistance(this._upPointOrig, this._downPointOrig);\r\n }\r\n else if (this.behavior == \"zoomY\" || this.behavior == \"panY\") {\r\n distance = $math.getVerticalDistance(this._upPointOrig, this._downPointOrig);\r\n }\r\n else {\r\n distance = $math.getDistance(this._upPointOrig, this._downPointOrig);\r\n }\r\n return distance > getInteraction().getHitOption(this.interactions, \"hitTolerance\");\r\n };\r\n /**\r\n * [getRanges description]\r\n *\r\n * @todo Description\r\n */\r\n XYCursor.prototype.getPanningRanges = function () {\r\n var startX = $math.round(this.downPoint.x / this.innerWidth, 5);\r\n var startY = 1 - $math.round(this.downPoint.y / this.innerHeight, 5);\r\n var currentX = $math.round(this.point.x / this.innerWidth, 5);\r\n var currentY = 1 - $math.round(this.point.y / this.innerHeight, 5);\r\n var deltaX = startX - currentX;\r\n var deltaY = startY - currentY;\r\n this.xRange = { start: deltaX, end: 1 + deltaX };\r\n this.yRange = { start: deltaY, end: 1 + deltaY };\r\n if (this.behavior == \"panX\") {\r\n this.yRange.start = 0;\r\n this.yRange.end = 1;\r\n }\r\n if (this.behavior == \"panY\") {\r\n this.xRange.start = 0;\r\n this.xRange.end = 1;\r\n }\r\n };\r\n /**\r\n * [getRanges description]\r\n *\r\n * @todo Description\r\n */\r\n XYCursor.prototype.getRanges = function () {\r\n if (this.lineX) {\r\n this.upPoint.x = this.lineX.pixelX;\r\n }\r\n if (this.lineY) {\r\n this.upPoint.y = this.lineY.pixelY;\r\n }\r\n // @todo Is this needed?\r\n $utils.used(this.selection);\r\n var startX = $math.round(this.downPoint.x / this.innerWidth, 5);\r\n var endX = $math.round((this.upPoint.x) / this.innerWidth, 5);\r\n var startY = 1 - $math.round(this.downPoint.y / this.innerHeight, 5);\r\n var endY = 1 - $math.round((this.upPoint.y) / this.innerHeight, 5);\r\n this.xRange = { start: $math.min(startX, endX), end: $math.max(startX, endX) };\r\n this.yRange = { start: $math.min(startY, endY), end: $math.max(startY, endY) };\r\n };\r\n Object.defineProperty(XYCursor.prototype, \"behavior\", {\r\n /**\r\n * Behavior\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"behavior\");\r\n },\r\n /**\r\n * Cursor's behavior when it's moved with pointer down:\r\n *\r\n * * `\"zoomX\"` - zooms horizontally.\r\n * * `\"zoomY\"` - zooms vertically.\r\n * * `\"zoomXY\"` - zooms both horizontally and vertically.\r\n * * `\"selectX\"` - selects a range horizontally.\r\n * * `\"selectY\"` - selects a range vertically.\r\n * * `\"selectXY\"` - selects a range both horizontally and vertically.\r\n * * `\"panX\"` - moves (pans) current selection horizontally.\r\n * * `\"panY\"` - moves (pans) current selection vertically.\r\n * * `\"panXY\"` - moves (pans) current selection both horizontally and vertically.\r\n * * `\"none\"` - does nothing with pointer down.\r\n *\r\n * E.g. \"zoomXY\" will mean that pressing a mouse (or touching) over plot area\r\n * and dragging it will start zooming the chart.\r\n *\r\n * NOTE: `\"zoomXY\"` acts differently when used on a `DateAxis`.\r\n * See [this note](https://www.amcharts.com/docs/v4/concepts/chart-cursor/#zoomXY_behavior_and_DateAxis).\r\n *\r\n * @param value Bheavior\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"behavior\", value, true);\r\n this._usesSelection = false;\r\n if (value.indexOf(\"zoom\") != -1) {\r\n this._generalBehavior = \"zoom\";\r\n this._usesSelection = true;\r\n }\r\n if (value.indexOf(\"select\") != -1) {\r\n this._generalBehavior = \"select\";\r\n this._usesSelection = true;\r\n }\r\n if (value.indexOf(\"pan\") != -1) {\r\n this._generalBehavior = \"pan\";\r\n this._usesSelection = false;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Determines whether Cursor should prevent default action on move.\r\n *\r\n * If cursor's behavior is \"none\", it should not obstruct the page scrolling.\r\n *\r\n * @return Prevent default?\r\n */\r\n XYCursor.prototype.shouldPreventGestures = function (touch) {\r\n return (!this.interactions.isTouchProtected || !touch) && this.behavior != \"none\";\r\n };\r\n Object.defineProperty(XYCursor.prototype, \"fullWidthLineX\", {\r\n /**\r\n * @return Full width?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"fullWidthLineX\");\r\n },\r\n /**\r\n * Cursor's horizontal line is expanded to take full width of the related\r\n * Axis' cell/category.\r\n *\r\n * NOTE: this setting will work properly if `xAxis` is set and only in case\r\n * `xAxis` is [[CategoryAxis]] or [[DateAxis]].\r\n *\r\n * @param value Full width?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"fullWidthLineX\", value);\r\n if (!value) {\r\n this.updateSize();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYCursor.prototype, \"fullWidthLineY\", {\r\n /**\r\n * @return Full width?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"fullWidthLineY\");\r\n },\r\n /**\r\n * Cursor's vertical line is expanded to take full width of the related\r\n * Axis' cell/category.\r\n *\r\n * NOTE: this setting will work properly if `yAxis` is set and only in case\r\n * `yAxis` is [[CategoryAxis]] or [[DateAxis]].\r\n *\r\n * @param value Full width?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"fullWidthLineY\", value);\r\n if (!value) {\r\n this.updateSize();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYCursor.prototype, \"hideSeriesTooltipsOnSelection\", {\r\n /**\r\n * @return hide tooltip?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"hideSeriesTooltipsOnSelection\");\r\n },\r\n /**\r\n * If set to `true` this will hide series tooltips when selecting with cursor.\r\n *\r\n * @since 4.5.15\r\n * @param value hide tooltips?\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"hideSeriesTooltipsOnSelection\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYCursor.prototype, \"maxTooltipDistance\", {\r\n /**\r\n * @return Distance\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maxTooltipDistance\");\r\n },\r\n /**\r\n * If set to a numeric value, cursor will display closest series' tooltips\r\n * plus tooltips from series that are closer to than `maxTooltipDistance` to\r\n * it.\r\n *\r\n * Set it to `-1` to always force one tooltip, even if there are multiple\r\n * data items in exactly same place.\r\n *\r\n * @since 4.7.18\r\n * @param value Distance\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"maxTooltipDistance\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYCursor.prototype, \"maxPanOut\", {\r\n /**\r\n * @return Full width?\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"maxPanOut\");\r\n },\r\n /**\r\n * If cursor behavior is panX or panY, we allow to pan plot out of it's max bounds for a better user experience.\r\n * This setting specifies relative value by how much we can pan out the plot\r\n *\r\n * @param value\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"maxPanOut\", value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYCursor.prototype, \"xAxis\", {\r\n /**\r\n * @return X axis\r\n */\r\n get: function () {\r\n return this._xAxis.get();\r\n },\r\n /**\r\n * A reference to X [[Axis]].\r\n *\r\n * An XY cursor can live without `xAxis` set. You set xAxis for cursor when\r\n * you have axis tooltip enabled and you want cursor line to be at the same\r\n * position as tooltip.\r\n *\r\n * This works with [[CategoryAxis]] and [[DateAxis]] but not with\r\n * [[ValueAxis]].\r\n *\r\n * @todo Description (review)\r\n * @param axis X axis\r\n */\r\n set: function (axis) {\r\n var _this = this;\r\n if (this._xAxis.get() != axis) {\r\n this._xAxis.set(axis, new MultiDisposer([\r\n axis.tooltip.events.on(\"positionchanged\", this.handleXTooltipPosition, this, false),\r\n axis.events.on(\"rangechangestarted\", function (event) {\r\n _this.hide(0);\r\n _this.preventShow = true;\r\n }, undefined, false),\r\n axis.events.on(\"rangechangeended\", function (event) {\r\n _this.preventShow = false;\r\n _this.hide(0);\r\n _this.dispatch(\"cursorpositionchanged\");\r\n }, undefined, false)\r\n ]));\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYCursor.prototype, \"yAxis\", {\r\n /**\r\n * @return Y Axis\r\n */\r\n get: function () {\r\n return this._yAxis.get();\r\n },\r\n /**\r\n * A reference to Y [[Axis]].\r\n *\r\n * An XY cursor can live without `yAxis` set. You set xAxis for cursor when\r\n * you have axis tooltip enabled and you want cursor line to be at the same\r\n * position as tooltip.\r\n *\r\n * This works with [[CategoryAxis]] and [[DateAxis]] but not with\r\n * [[ValueAxis]].\r\n *\r\n * @todo Description (review)\r\n * @param axis Y axis\r\n */\r\n set: function (axis) {\r\n var _this = this;\r\n if (this._yAxis.get() != axis) {\r\n this._yAxis.set(axis, new MultiDisposer([\r\n axis.tooltip.events.on(\"positionchanged\", this.handleYTooltipPosition, this, false),\r\n axis.events.on(\"rangechangestarted\", function (event) {\r\n _this.hide(0);\r\n _this.__disabled = true;\r\n }, undefined, false),\r\n axis.events.on(\"rangechangeended\", function (event) {\r\n _this.__disabled = false;\r\n _this.hide(0);\r\n _this.dispatch(\"cursorpositionchanged\");\r\n }, undefined, false)\r\n ]));\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates Cursor's position when axis tooltip changes position.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Original Axis event\r\n */\r\n XYCursor.prototype.handleXTooltipPosition = function (event) {\r\n var tooltip = this.xAxis.tooltip;\r\n var point = $utils.svgPointToSprite({ x: tooltip.pixelX, y: tooltip.pixelY }, this);\r\n var x = point.x;\r\n point.y = 1;\r\n if (this.lineX) {\r\n this.lineX.x = x;\r\n if (!this.fitsToBounds(point)) {\r\n this.hide();\r\n }\r\n }\r\n if (this.xAxis && this.fullWidthLineX) {\r\n var startPoint = this.xAxis.currentItemStartPoint;\r\n var endPoint = this.xAxis.currentItemEndPoint;\r\n if (startPoint && endPoint) {\r\n this.lineX.x = x;\r\n var width = endPoint.x - startPoint.x;\r\n this.lineX.path = $path.rectangle(width, this.innerHeight, -width / 2);\r\n }\r\n }\r\n };\r\n /**\r\n * Updates Cursor's position when Y axis changes position or scale.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Original Axis event\r\n */\r\n XYCursor.prototype.handleYTooltipPosition = function (event) {\r\n var tooltip = this.yAxis.tooltip;\r\n var point = $utils.svgPointToSprite({ x: tooltip.pixelX, y: tooltip.pixelY }, this);\r\n var y = point.y;\r\n point.x = 1;\r\n if (this.lineY) {\r\n this.lineY.y = y;\r\n if (!this.fitsToBounds(point)) {\r\n this.hide();\r\n }\r\n }\r\n if (this.yAxis && this.fullWidthLineY) {\r\n var startPoint = this.yAxis.currentItemStartPoint;\r\n var endPoint = this.yAxis.currentItemEndPoint;\r\n if (startPoint && endPoint) {\r\n this.lineY.y = y;\r\n var height = endPoint.y - startPoint.y;\r\n this.lineY.path = $path.rectangle(this.innerWidth, height, 0, -height / 2);\r\n }\r\n }\r\n };\r\n Object.defineProperty(XYCursor.prototype, \"lineX\", {\r\n /**\r\n * @return Line element\r\n */\r\n get: function () {\r\n return this._lineX.get();\r\n },\r\n /**\r\n * A Line element to use for X axis.\r\n *\r\n * @param lineX Line\r\n */\r\n set: function (lineX) {\r\n if (lineX) {\r\n lineX.setElement(this.paper.add(\"path\"));\r\n this._lineX.set(lineX, lineX.events.on(\"positionchanged\", this.updateSelection, this, false));\r\n lineX.interactionsEnabled = false;\r\n lineX.parent = this;\r\n }\r\n else {\r\n this._lineX.reset();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYCursor.prototype, \"lineY\", {\r\n /**\r\n * @return Line element\r\n */\r\n get: function () {\r\n return this._lineY.get();\r\n },\r\n /**\r\n * A Line element to use Y axis.\r\n *\r\n * @param lineY Line\r\n */\r\n set: function (lineY) {\r\n if (lineY) {\r\n lineY.setElement(this.paper.add(\"path\"));\r\n this._lineY.set(lineY, lineY.events.on(\"positionchanged\", this.updateSelection, this, false));\r\n lineY.parent = this;\r\n lineY.interactionsEnabled = false;\r\n }\r\n else {\r\n this._lineY.reset();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(XYCursor.prototype, \"selection\", {\r\n /**\r\n * @return Selection rectangle\r\n */\r\n get: function () {\r\n return this._selection;\r\n },\r\n /**\r\n * A selection element ([[Sprite]]).\r\n *\r\n * @param selection Selection rectangle\r\n */\r\n set: function (selection) {\r\n this._selection = selection;\r\n if (selection) {\r\n selection.element = this.paper.add(\"path\");\r\n selection.parent = this;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * Looks if `xAxis` and `yAxis` is set via ID in JSON config, and replaces\r\n * with real references.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\r\n XYCursor.prototype.processConfig = function (config) {\r\n var _this = this;\r\n if (config) {\r\n // Set up axes\r\n if ($type.hasValue(config.xAxis) && $type.isString(config.xAxis)) {\r\n if (this.map.hasKey(config.xAxis)) {\r\n config.xAxis = this.map.getKey(config.xAxis);\r\n }\r\n else {\r\n this.processingErrors.push(\"[XYCursor] No axis with id \\\"\" + config.xAxis + \"\\\" found for `xAxis`\");\r\n delete config.xAxis;\r\n }\r\n }\r\n if ($type.hasValue(config.yAxis) && $type.isString(config.yAxis)) {\r\n if (this.map.hasKey(config.yAxis)) {\r\n config.yAxis = this.map.getKey(config.yAxis);\r\n }\r\n else {\r\n this.processingErrors.push(\"[XYCursor] No axis with id \\\"\" + config.yAxis + \"\\\" found for `yAxis`\");\r\n delete config.yAxis;\r\n }\r\n }\r\n if ($type.hasValue(config.snapToSeries)) {\r\n var snapTo_1 = $type.isArray(config.snapToSeries) ? config.snapToSeries : [config.snapToSeries];\r\n var snapError_1 = false;\r\n $array.each(snapTo_1, function (snap, index) {\r\n if ($type.isString(snap)) {\r\n if (_this.map.hasKey(snap)) {\r\n snapTo_1[index] = _this.map.getKey(snap);\r\n }\r\n else {\r\n _this.processingErrors.push(\"[XYCursor] No series with id \\\"\" + snap + \"\\\" found for `series`\");\r\n snapError_1 = true;\r\n }\r\n }\r\n });\r\n if (snapError_1) {\r\n delete config.snapToSeries;\r\n }\r\n else {\r\n config.snapToSeries = snapTo_1;\r\n }\r\n }\r\n }\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n Object.defineProperty(XYCursor.prototype, \"snapToSeries\", {\r\n /**\r\n * @return {XYSeries | XYSeries[]}\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"snapToSeries\");\r\n },\r\n /**\r\n * Specifies to which series cursor lines should be snapped.\r\n *\r\n * Can be a single series instance or an array of series.\r\n *\r\n * @param {XYSeries | XYSeries[]}\r\n */\r\n set: function (series) {\r\n var _this = this;\r\n if (this.setPropertyValue(\"snapToSeries\", series)) {\r\n if (series instanceof XYSeries) {\r\n series = [series];\r\n }\r\n if (this._snapToDisposers) {\r\n $array.each(this._snapToDisposers, function (disposer) {\r\n disposer.dispose();\r\n });\r\n }\r\n this._snapToDisposers = [];\r\n if (series) {\r\n $array.each(series, function (s) {\r\n _this._snapToDisposers.push(s.events.on(\"tooltipshownat\", function () { _this.handleSnap(s); }, undefined, false));\r\n });\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * [handleSnap description]\r\n *\r\n * @ignore\r\n * @todo Description\r\n */\r\n XYCursor.prototype.handleSnap = function (series) {\r\n if (!this.downPoint) {\r\n var x = series.getTooltipX() + series.xAxis.pixelX;\r\n var y = series.getTooltipY() + series.yAxis.pixelY;\r\n if (this.xAxis) {\r\n if (this.xAxis.renderer.opposite) {\r\n y -= this.pixelHeight;\r\n }\r\n }\r\n this.point = { x: x, y: y };\r\n this.getPositions();\r\n var xx = x;\r\n var yy = y;\r\n x -= this.pixelWidth;\r\n if (this.yAxis) {\r\n if (this.yAxis.renderer.opposite) {\r\n x += this.pixelWidth;\r\n }\r\n }\r\n var tooltip = series.tooltip;\r\n var duration = tooltip.animationDuration;\r\n var easing = tooltip.animationEasing;\r\n var xAxis = series.xAxis;\r\n var yAxis = series.yAxis;\r\n if (xAxis instanceof ValueAxis && !(xAxis instanceof DateAxis) && yAxis instanceof ValueAxis && !(yAxis instanceof DateAxis)) {\r\n series.yAxis.showTooltipAtPosition(this.yPosition);\r\n series.xAxis.showTooltipAtPosition(this.xPosition);\r\n }\r\n else {\r\n if (series.baseAxis == series.xAxis) {\r\n series.yAxis.showTooltipAtPosition(this.yPosition);\r\n }\r\n if (series.baseAxis == series.yAxis) {\r\n series.xAxis.showTooltipAtPosition(this.xPosition);\r\n }\r\n }\r\n this.lineX.animate([{ property: \"y\", to: y }], duration, easing);\r\n this.lineY.animate([{ property: \"x\", to: x }], duration, easing);\r\n if (!this.xAxis) {\r\n this.lineX.animate([{ property: \"x\", to: xx }], duration, easing);\r\n }\r\n if (!this.yAxis) {\r\n this.lineY.animate([{ property: \"y\", to: yy }], duration, easing);\r\n }\r\n }\r\n };\r\n /**\r\n * Destroys this object and all related data.\r\n */\r\n XYCursor.prototype.dispose = function () {\r\n this.hide(0);\r\n _super.prototype.dispose.call(this);\r\n };\r\n return XYCursor;\r\n}(Cursor));\r\nexport { XYCursor };\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[\"XYCursor\"] = XYCursor;\r\n//# sourceMappingURL=XYCursor.js.map","import { __extends } from \"tslib\";\r\nimport { XYCursor } from \"./XYCursor\";\r\nimport { Percent, percent } from \"../../core/utils/Percent\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Cursor for [[RadarChart]].\r\n *\r\n * @see {@link IRadarCursorEvents} for a list of available events\r\n * @see {@link IRadarCursorAdapters} for a list of available Adapters\r\n */\r\nvar RadarCursor = /** @class */ (function (_super) {\r\n __extends(RadarCursor, _super);\r\n /**\r\n * Constructor\r\n */\r\n function RadarCursor() {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n _this.className = \"RadarCursor\";\r\n _this.radius = percent(100);\r\n _this.innerRadius = percent(0);\r\n // Apply theme\r\n _this.applyTheme();\r\n _this.mask = undefined;\r\n return _this;\r\n }\r\n /**\r\n * Checks if point is within bounds of a container.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point Point to check\r\n * @return Fits within container?\r\n */\r\n RadarCursor.prototype.fitsToBounds = function (point) {\r\n var radius = $math.getDistance(point);\r\n //if(!$math.isAngleInRange(angle, this.startAngle, this.endAngle)){\r\n //return false;\r\n //}\r\n if (radius < this.truePixelRadius + 1 && radius > this.pixelInnerRadius - 1) { // ok to add/remove some\r\n return true;\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(RadarCursor.prototype, \"startAngle\", {\r\n /**\r\n * @return Start angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"startAngle\");\r\n },\r\n /**\r\n * Starting angle of the cursor's radial line.\r\n *\r\n * @param value Start angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"startAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarCursor.prototype, \"endAngle\", {\r\n /**\r\n * @return End angle\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"endAngle\");\r\n },\r\n /**\r\n * End angle of the cursor's radial line.\r\n *\r\n * @param value End angle\r\n */\r\n set: function (value) {\r\n this.setPropertyValue(\"endAngle\", value, true);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RadarCursor.prototype.triggerMoveReal = function (point, force) {\r\n if (!this.xAxis || (this.xAxis && (!this.xAxis.cursorTooltipEnabled || this.xAxis.tooltip.disabled))) {\r\n this.updateLineX(this.point);\r\n }\r\n if (!this.yAxis || (this.yAxis && (!this.yAxis.cursorTooltipEnabled || this.yAxis.tooltip.disabled))) {\r\n this.updateLineY(this.point);\r\n }\r\n this.updateSelection();\r\n _super.prototype.triggerMoveReal.call(this, point, force);\r\n };\r\n /**\r\n * (Re)draws the horizontal (circular) cursor's line.\r\n *\r\n * @param point New target point\r\n */\r\n RadarCursor.prototype.updateLineX = function (point) {\r\n var radius = this.pixelRadius;\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n var innerRadius = this.pixelInnerRadius;\r\n if (radius > 0 && $type.isNumber(startAngle) && $type.isNumber(endAngle) && $type.isNumber(innerRadius)) {\r\n var angle = $math.fitAngleToRange($math.getAngle(point), startAngle, endAngle);\r\n var path = void 0;\r\n if (this.lineX && this.lineX.visible) {\r\n this.lineX.moveTo({ x: 0, y: 0 });\r\n // fill\r\n if (this.xAxis && this.fullWidthLineX) {\r\n var startPoint = this.xAxis.currentItemStartPoint;\r\n var endPoint = this.xAxis.currentItemEndPoint;\r\n if (startPoint && endPoint) {\r\n var fillStartAngle = $math.fitAngleToRange($math.getAngle(startPoint), startAngle, endAngle);\r\n var fillEndAngle = $math.fitAngleToRange($math.getAngle(endPoint), startAngle, endAngle);\r\n var arc = fillEndAngle - fillStartAngle;\r\n // clockwise\r\n // this is needed, normalizeAngle doesn't solve it\r\n if (startAngle < endAngle) {\r\n if (arc < 0) {\r\n arc += 360;\r\n }\r\n }\r\n // ccw\r\n else {\r\n if (arc > 0) {\r\n arc -= 360;\r\n }\r\n }\r\n angle -= arc / 2;\r\n path = $path.moveTo({ x: innerRadius * $math.cos(angle), y: innerRadius * $math.sin(angle) })\r\n + $path.lineTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) })\r\n + $path.arcTo(angle, arc, radius)\r\n + $path.lineTo({ x: innerRadius * $math.cos(angle + arc), y: innerRadius * $math.sin(angle + arc) })\r\n + $path.arcTo(angle + arc, -arc, innerRadius);\r\n }\r\n }\r\n // line\r\n if (!path) {\r\n path = $path.moveTo({ x: innerRadius * $math.cos(angle), y: innerRadius * $math.sin(angle) }) + $path.lineTo({ x: radius * $math.cos(angle), y: radius * $math.sin(angle) });\r\n }\r\n this.lineX.path = path;\r\n }\r\n }\r\n };\r\n /**\r\n * (Re)draws the vertical (radial) cursor's line.\r\n *\r\n * @param point New target point\r\n */\r\n RadarCursor.prototype.updateLineY = function (point) {\r\n if (this.lineY && this.lineY.visible) {\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n var truePixelRadius = this.truePixelRadius;\r\n var radius = $math.fitToRange($math.getDistance(point), 0, this.truePixelRadius);\r\n if ($type.isNumber(radius) && $type.isNumber(startAngle)) {\r\n this.lineY.moveTo({ x: 0, y: 0 });\r\n var path = void 0;\r\n var arc = endAngle - startAngle;\r\n if (this.yAxis && this.fullWidthLineY) {\r\n // fill\r\n var startPoint = this.yAxis.currentItemStartPoint;\r\n var endPoint = this.yAxis.currentItemEndPoint;\r\n if (startPoint && endPoint) {\r\n var innerRadius = $math.fitToRange($math.getDistance(startPoint), 0, truePixelRadius);\r\n radius = $math.fitToRange($math.getDistance(endPoint), 0, truePixelRadius);\r\n path = $path.moveTo({ x: radius * $math.cos(startAngle), y: radius * $math.sin(startAngle) }) + $path.arcTo(startAngle, arc, radius);\r\n path += $path.moveTo({ x: innerRadius * $math.cos(endAngle), y: innerRadius * $math.sin(endAngle) }) + $path.arcTo(endAngle, -arc, innerRadius);\r\n }\r\n }\r\n if (!path) {\r\n path = $path.moveTo({ x: radius * $math.cos(startAngle), y: radius * $math.sin(startAngle) }) + $path.arcTo(startAngle, endAngle - startAngle, radius);\r\n }\r\n this.lineY.path = path;\r\n }\r\n }\r\n };\r\n /**\r\n * Updates selection dimensions on size change.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n RadarCursor.prototype.updateSelection = function () {\r\n if (this._usesSelection) {\r\n var downPoint = this.downPoint;\r\n if (downPoint) {\r\n var point = this.point;\r\n var radius = this.pixelRadius;\r\n var truePixelRadius = this.truePixelRadius;\r\n var innerRadius = this.pixelInnerRadius;\r\n var startAngle = Math.min(this.startAngle, this.endAngle);\r\n var endAngle = Math.max(this.startAngle, this.endAngle);\r\n var downAngle = $math.fitAngleToRange($math.getAngle(downPoint), startAngle, endAngle);\r\n var angle = $math.fitAngleToRange($math.getAngle(point), startAngle, endAngle);\r\n var downRadius = $math.getDistance(downPoint);\r\n if (downRadius < truePixelRadius) {\r\n var currentRadius = $math.fitToRange($math.getDistance(point), 0, truePixelRadius);\r\n this._prevAngle = angle;\r\n var path = $path.moveTo({ x: 0, y: 0 });\r\n var downSin = $math.sin(downAngle);\r\n var downCos = $math.cos(downAngle);\r\n var sin = $math.sin(angle);\r\n var cos = $math.cos(angle);\r\n var behavior = this.behavior;\r\n if (behavior == \"zoomX\" || behavior == \"selectX\") {\r\n path += $path.lineTo({ x: radius * downCos, y: radius * downSin }) + $path.arcTo(downAngle, angle - downAngle, radius) + $path.lineTo({ x: innerRadius * cos, y: innerRadius * sin }) + $path.arcTo(angle, downAngle - angle, innerRadius);\r\n }\r\n else if (behavior == \"zoomY\" || behavior == \"selectY\") {\r\n path = $path.moveTo({ x: currentRadius * $math.cos(startAngle), y: currentRadius * $math.sin(startAngle) }) + $path.arcTo(startAngle, endAngle - startAngle, currentRadius) + $path.lineTo({ x: downRadius * $math.cos(endAngle), y: downRadius * $math.sin(endAngle) }) + $path.arcTo(endAngle, startAngle - endAngle, downRadius) + $path.closePath();\r\n }\r\n else if (behavior == \"zoomXY\") {\r\n path = $path.moveTo({ x: currentRadius * $math.cos(downAngle), y: currentRadius * $math.sin(downAngle) }) + $path.arcTo(downAngle, angle - downAngle, currentRadius) + $path.lineTo({ x: downRadius * $math.cos(angle), y: downRadius * $math.sin(angle) }) + $path.arcTo(angle, downAngle - angle, downRadius) + $path.closePath();\r\n }\r\n this.selection.path = path;\r\n }\r\n this.selection.moveTo({ x: 0, y: 0 });\r\n }\r\n }\r\n };\r\n /**\r\n * Updates cursors current positions.\r\n */\r\n RadarCursor.prototype.getPositions = function () {\r\n // positions are used by axes or series\r\n var chart = this.chart;\r\n if (chart) {\r\n var innerRadius = this.pixelInnerRadius;\r\n var radius = this.truePixelRadius - innerRadius;\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n var angle = $math.fitAngleToRange($math.getAngle(this.point), startAngle, endAngle);\r\n var xPosition = ((angle - startAngle) / (endAngle - startAngle));\r\n this.xPosition = xPosition;\r\n this.yPosition = $math.fitToRange(($math.getDistance(this.point) - innerRadius) / radius, 0, 1);\r\n }\r\n };\r\n /**\r\n * Overriding inherited method, so that nothing happens when it's triggered.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n RadarCursor.prototype.updatePoint = function (point) {\r\n };\r\n /**\r\n * Updates Cursor's position when axis tooltip changes horizontal position.\r\n *\r\n * @param event Axis event\r\n */\r\n RadarCursor.prototype.handleXTooltipPosition = function (event) {\r\n if (this.xAxis.cursorTooltipEnabled) {\r\n var tooltip = this.xAxis.tooltip;\r\n this.updateLineX($utils.svgPointToSprite({ x: tooltip.pixelX, y: tooltip.pixelY }, this));\r\n }\r\n };\r\n /**\r\n * Updates Cursor's position when axis tooltip changes vertical position.\r\n *\r\n * @todo Description\r\n * @param event Axis event\r\n */\r\n RadarCursor.prototype.handleYTooltipPosition = function (event) {\r\n if (this.yAxis.cursorTooltipEnabled) {\r\n var tooltip = this.yAxis.tooltip;\r\n this.updateLineY($utils.svgPointToSprite({ x: tooltip.pixelX, y: tooltip.pixelY }, this));\r\n }\r\n };\r\n /**\r\n * needs to be overriden\r\n * @ignore\r\n */\r\n RadarCursor.prototype.updateLinePositions = function (point) {\r\n };\r\n /**\r\n * [getRanges description]\r\n *\r\n * @todo Description\r\n */\r\n RadarCursor.prototype.getRanges = function () {\r\n var downPoint = this.downPoint;\r\n if (downPoint) {\r\n var upPoint = this.upPoint;\r\n var chart = this.chart;\r\n if (chart) {\r\n var radius = this.pixelRadius;\r\n var startAngle = this.startAngle;\r\n var endAngle = this.endAngle;\r\n var downAngle = $math.fitAngleToRange($math.getAngle(downPoint), this.startAngle, this.endAngle);\r\n var upAngle = $math.fitAngleToRange($math.getAngle(upPoint), this.startAngle, this.endAngle);\r\n var downRadius = $math.fitToRange($math.getDistance(downPoint), 0, radius);\r\n var upRadius = $math.fitToRange($math.getDistance(upPoint), 0, radius);\r\n var startX = 0;\r\n var endX = 1;\r\n var startY = 0;\r\n var endY = 1;\r\n var behavior = this.behavior;\r\n if (behavior == \"zoomX\" || behavior == \"selectX\" || behavior == \"zoomXY\" || behavior == \"selectXY\") {\r\n var arc = endAngle - startAngle;\r\n startX = $math.round((downAngle - startAngle) / arc, 5);\r\n endX = $math.round((upAngle - startAngle) / arc, 5);\r\n }\r\n if (behavior == \"zoomY\" || behavior == \"selectY\" || behavior == \"zoomXY\" || behavior == \"selectXY\") {\r\n startY = $math.round(downRadius / radius, 5);\r\n endY = $math.round(upRadius / radius, 5);\r\n }\r\n this.xRange = { start: Math.min(startX, endX), end: Math.max(startX, endX) };\r\n this.yRange = { start: Math.min(startY, endY), end: Math.max(startY, endY) };\r\n if (this.behavior == \"selectX\" || this.behavior == \"selectY\" || this.behavior == \"selectXY\") {\r\n // void\r\n }\r\n else {\r\n this.selection.hide();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Overriding inherited method, so that nothing happens when `updateSize`\r\n * is triggered.\r\n *\r\n * RadarCursor is quite complicated and needs own sizing logic.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n RadarCursor.prototype.updateSize = function () { };\r\n Object.defineProperty(RadarCursor.prototype, \"radius\", {\r\n /**\r\n * @return Outer radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"radius\");\r\n },\r\n /**\r\n * Outer radius of the cursor's circular line.\r\n * Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @param value Outer radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"radius\", value, false, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarCursor.prototype, \"pixelRadius\", {\r\n /**\r\n * Outer radius of the circular line in pixels.\r\n *\r\n * @return Outer radius (px)\r\n * @readonly\r\n */\r\n get: function () {\r\n return $utils.relativeRadiusToValue(this.radius, this.truePixelRadius);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarCursor.prototype, \"truePixelRadius\", {\r\n /**\r\n * [truePixelRadius description]\r\n *\r\n * @todo Description\r\n * @return Outer radius (px)\r\n * @readonly\r\n */\r\n get: function () {\r\n return $utils.relativeToValue(percent(100), $math.min(this.innerWidth / 2, this.innerHeight / 2));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarCursor.prototype, \"innerRadius\", {\r\n /**\r\n * @return Inner radius\r\n */\r\n get: function () {\r\n return this.getPropertyValue(\"innerRadius\");\r\n },\r\n /**\r\n * Inner radius of the cursor's circular line.\r\n * Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @param value Inner radius\r\n */\r\n set: function (value) {\r\n this.setPercentProperty(\"innerRadius\", value, false, false, 10, false);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadarCursor.prototype, \"pixelInnerRadius\", {\r\n /**\r\n * Inner radius of the circular line in pixels.\r\n *\r\n * @return Inner radius (px)\r\n * @readonly\r\n */\r\n get: function () {\r\n var innerRadius = this.innerRadius;\r\n if (innerRadius instanceof Percent) {\r\n innerRadius = percent(100 * innerRadius.value * this.chart.innerRadiusModifyer);\r\n }\r\n return $utils.relativeRadiusToValue(innerRadius, this.truePixelRadius) || 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n RadarCursor.prototype.fixPoint = function (point) {\r\n // overriding xy method\r\n return point;\r\n };\r\n return RadarCursor;\r\n}(XYCursor));\r\nexport { RadarCursor };\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[\"RadarCursor\"] = RadarCursor;\r\n//# sourceMappingURL=RadarCursor.js.map","/**\r\n * Color set from Frozen movie borrowed from https://twitter.com/CINEMAPALETTES\r\n */\r\nimport { is } from \"../core/Registry\";\r\nimport { color } from \"../core/utils/Color\";\r\nvar theme = function (object) {\r\n if (is(object, \"ColorSet\")) {\r\n object.list = [\r\n color(\"#bec4f8\"),\r\n color(\"#a5abee\"),\r\n color(\"#6a6dde\"),\r\n color(\"#4d42cf\"),\r\n color(\"#713e8d\"),\r\n color(\"#a160a0\"),\r\n color(\"#eb6eb0\"),\r\n color(\"#f597bb\"),\r\n color(\"#fbb8c9\"),\r\n color(\"#f8d4d8\")\r\n ];\r\n object.minLightness = 0.2;\r\n object.maxLightness = 0.7;\r\n object.reuse = true;\r\n }\r\n};\r\nexport default theme;\r\n//# sourceMappingURL=frozen.js.map","\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LogChart.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LogChart.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./LogChart.vue?vue&type=template&id=68a2c398&scoped=true&\"\nimport script from \"./LogChart.vue?vue&type=script&lang=js&\"\nexport * from \"./LogChart.vue?vue&type=script&lang=js&\"\nimport style0 from \"./LogChart.vue?vue&type=style&index=0&id=68a2c398&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"68a2c398\",\n null\n \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VCard } from 'vuetify/lib/components/VCard';\nimport { VCol } from 'vuetify/lib/components/VGrid';\nimport { VRow } from 'vuetify/lib/components/VGrid';\ninstallComponents(component, {VCard,VCol,VRow})\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-card',{staticStyle:{\"width\":\"100% !important\",\"height\":\"90%\",\"min-height\":\"90% !important\"}},[_c('v-row',{attrs:{\"no-gutters\":\"\"}},[_c('v-col',{attrs:{\"cols\":\"12\"}},[_c('div',{ref:\"chartdiv\",staticClass:\"amchartDiv\"})])],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DatapointsLiveChart.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DatapointsLiveChart.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./DatapointsLiveChart.vue?vue&type=template&id=1ffa702c&scoped=true&\"\nimport script from \"./DatapointsLiveChart.vue?vue&type=script&lang=js&\"\nexport * from \"./DatapointsLiveChart.vue?vue&type=script&lang=js&\"\nimport style0 from \"./DatapointsLiveChart.vue?vue&type=style&index=0&id=1ffa702c&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"1ffa702c\",\n null\n \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VCard } from 'vuetify/lib/components/VCard';\nimport { VCol } from 'vuetify/lib/components/VGrid';\nimport { VRow } from 'vuetify/lib/components/VGrid';\ninstallComponents(component, {VCard,VCol,VRow})\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-card',{staticClass:\"align-center justify-center text-center\",staticStyle:{\"width\":\"100% !important\",\"height\":\"55% !important\"},attrs:{\"no-gutter\":\"\"}},[_c('v-card-title',{staticClass:\"headline mb-2\"},[_vm._v(\" \"+_vm._s(_vm.$t(\"log.activeUsersTable.title\"))+\" \"),_c('v-spacer'),_c('v-text-field',{attrs:{\"append-icon\":\"mdi-magnify\",\"label\":\"Search\",\"single-line\":\"\",\"hide-details\":\"\"},model:{value:(_vm.search),callback:function ($$v) {_vm.search=$$v},expression:\"search\"}})],1),_c('v-data-table',{staticClass:\"logtable\",attrs:{\"headers\":_vm.headers,\"items\":_vm.activeUsers,\"loading\":_vm.loading,\"hide-default-footer\":\"\",\"search\":_vm.search,\"disable-pagination\":\"\"},scopedSlots:_vm._u([(_vm.activeUsers.length > 0)?{key:\"item.status\",fn:function(){return [_c('v-icon',{attrs:{\"fab\":\"\",\"color\":\"green\"}},[_vm._v(\"mdi-account\")])]},proxy:true}:null,{key:\"item.createdAt\",fn:function(ref){\nvar item = ref.item;\nreturn [_vm._v(_vm._s(_vm.humanDate(item.createdAt)))]}}],null,true)})],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\n \r\n \r\n {{ $t(\"log.activeUsersTable.title\") }}\r\n \r\n \r\n \r\n\r\n \r\n 0\">\r\n mdi-account\r\n \r\n {{\r\n humanDate(item.createdAt)\r\n }}\r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ActiveUsersTable.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ActiveUsersTable.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./ActiveUsersTable.vue?vue&type=template&id=108cee50&scoped=true&\"\nimport script from \"./ActiveUsersTable.vue?vue&type=script&lang=js&\"\nexport * from \"./ActiveUsersTable.vue?vue&type=script&lang=js&\"\nimport style0 from \"./ActiveUsersTable.vue?vue&type=style&index=0&id=108cee50&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"108cee50\",\n null\n \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VCard } from 'vuetify/lib/components/VCard';\nimport { VCardTitle } from 'vuetify/lib/components/VCard';\nimport { VDataTable } from 'vuetify/lib/components/VDataTable';\nimport { VIcon } from 'vuetify/lib/components/VIcon';\nimport { VSpacer } from 'vuetify/lib/components/VGrid';\nimport { VTextField } from 'vuetify/lib/components/VTextField';\ninstallComponents(component, {VCard,VCardTitle,VDataTable,VIcon,VSpacer,VTextField})\n","\r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AdminDashboard.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AdminDashboard.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./AdminDashboard.vue?vue&type=template&id=b8028834&scoped=true&\"\nimport script from \"./AdminDashboard.vue?vue&type=script&lang=js&\"\nexport * from \"./AdminDashboard.vue?vue&type=script&lang=js&\"\nimport style0 from \"./AdminDashboard.vue?vue&type=style&index=0&id=b8028834&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"b8028834\",\n null\n \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VCol } from 'vuetify/lib/components/VGrid';\nimport { VContainer } from 'vuetify/lib/components/VGrid';\nimport { VRow } from 'vuetify/lib/components/VGrid';\ninstallComponents(component, {VCol,VContainer,VRow})\n","import mod from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ActiveUsersTable.vue?vue&type=style&index=0&id=108cee50&scoped=true&lang=css&\"; export default mod; export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ActiveUsersTable.vue?vue&type=style&index=0&id=108cee50&scoped=true&lang=css&\"","import mod from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DatapointsLiveChart.vue?vue&type=style&index=0&id=1ffa702c&scoped=true&lang=css&\"; export default mod; export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DatapointsLiveChart.vue?vue&type=style&index=0&id=1ffa702c&scoped=true&lang=css&\""],"sourceRoot":""}