UNPKG

highcharts

Version:
1,560 lines (1,515 loc) 125 kB
/** * @license Highcharts JS v12.1.2 (2024-12-21) * @module highcharts/modules/treemap * @requires highcharts * * (c) 2014-2024 Highsoft AS * Authors: Jon Arild Nygard / Oystein Moseng * * License: www.highcharts.com/license */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(root["_Highcharts"], root["_Highcharts"]["Templating"], root["_Highcharts"]["Color"], root["_Highcharts"]["SeriesRegistry"], root["_Highcharts"]["SVGElement"]); else if(typeof define === 'function' && define.amd) define("highcharts/modules/treemap", ["highcharts/highcharts"], function (amd1) {return factory(amd1,amd1["Templating"],amd1["Color"],amd1["SeriesRegistry"],amd1["SVGElement"]);}); else if(typeof exports === 'object') exports["highcharts/modules/treemap"] = factory(root["_Highcharts"], root["_Highcharts"]["Templating"], root["_Highcharts"]["Color"], root["_Highcharts"]["SeriesRegistry"], root["_Highcharts"]["SVGElement"]); else root["Highcharts"] = factory(root["Highcharts"], root["Highcharts"]["Templating"], root["Highcharts"]["Color"], root["Highcharts"]["SeriesRegistry"], root["Highcharts"]["SVGElement"]); })(typeof window === 'undefined' ? this : window, (__WEBPACK_EXTERNAL_MODULE__944__, __WEBPACK_EXTERNAL_MODULE__984__, __WEBPACK_EXTERNAL_MODULE__620__, __WEBPACK_EXTERNAL_MODULE__512__, __WEBPACK_EXTERNAL_MODULE__28__) => { return /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 620: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE__620__; /***/ }), /***/ 28: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE__28__; /***/ }), /***/ 512: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE__512__; /***/ }), /***/ 984: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE__984__; /***/ }), /***/ 944: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE__944__; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": () => (/* binding */ treemap_src) }); // EXTERNAL MODULE: external {"amd":["highcharts/highcharts"],"commonjs":["highcharts"],"commonjs2":["highcharts"],"root":["Highcharts"]} var highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_ = __webpack_require__(944); var highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default = /*#__PURE__*/__webpack_require__.n(highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_); ;// ./code/es-modules/Extensions/Breadcrumbs/BreadcrumbsDefaults.js /* * * * Highcharts Breadcrumbs module * * Authors: Grzegorz Blachlinski, Karol Kolodziej * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ /* * * * Constants * * */ /** * @optionparent lang */ const lang = { /** * @since 10.0.0 * @product highcharts highmaps * * @private */ mainBreadcrumb: 'Main' }; /** * Options for breadcrumbs. Breadcrumbs general options are defined in * `navigation.breadcrumbs`. Specific options for drilldown are set in * `drilldown.breadcrumbs` and for tree-like series traversing, in * `plotOptions[series].breadcrumbs`. * * @since 10.0.0 * @product highcharts * @optionparent navigation.breadcrumbs */ const options = { /** * A collection of attributes for the buttons. The object takes SVG * attributes like `fill`, `stroke`, `stroke-width`, as well as `style`, * a collection of CSS properties for the text. * * The object can also be extended with states, so you can set * presentational options for `hover`, `select` or `disabled` button * states. * * @sample {highcharts} highcharts/breadcrumbs/single-button * Themed, single button * * @type {Highcharts.SVGAttributes} * @since 10.0.0 * @product highcharts */ buttonTheme: { /** @ignore */ fill: 'none', /** @ignore */ height: 18, /** @ignore */ padding: 2, /** @ignore */ 'stroke-width': 0, /** @ignore */ zIndex: 7, /** @ignore */ states: { select: { fill: 'none' } }, style: { color: "#334eff" /* Palette.highlightColor80 */ } }, /** * The default padding for each button and separator in each direction. * * @type {number} * @since 10.0.0 */ buttonSpacing: 5, /** * Fires when clicking on the breadcrumbs button. Two arguments are * passed to the function. First breadcrumb button as an SVG element. * Second is the breadcrumbs class, containing reference to the chart, * series etc. * * ```js * click: function(button, breadcrumbs) { * console.log(button); * } * ``` * * Return false to stop default buttons click action. * * @type {Highcharts.BreadcrumbsClickCallbackFunction} * @since 10.0.0 * @apioption navigation.breadcrumbs.events.click */ /** * When the breadcrumbs are floating, the plot area will not move to * make space for it. By default, the chart will not make space for the * buttons. This property won't work when positioned in the middle. * * @sample highcharts/breadcrumbs/single-button * Floating button * * @type {boolean} * @since 10.0.0 */ floating: false, /** * A format string for the breadcrumbs button. Variables are enclosed by * curly brackets. Available values are passed in the declared point * options. * * @type {string|undefined} * @since 10.0.0 * @default undefined * @sample {highcharts} highcharts/breadcrumbs/format Display custom * values in breadcrumb button. */ format: void 0, /** * Callback function to format the breadcrumb text from scratch. * * @type {Highcharts.BreadcrumbsFormatterCallbackFunction} * @since 10.0.0 * @default undefined * @apioption navigation.breadcrumbs.formatter */ /** * What box to align the button to. Can be either `plotBox` or * `spacingBox`. * * @type {Highcharts.ButtonRelativeToValue} * @default plotBox * @since 10.0.0 * @product highcharts highmaps */ relativeTo: 'plotBox', /** * Whether to reverse the order of buttons. This is common in Arabic * and Hebrew. * * @sample {highcharts} highcharts/breadcrumbs/rtl * Breadcrumbs in RTL * * @type {boolean} * @since 10.2.0 */ rtl: false, /** * Positioning for the button row. The breadcrumbs buttons will be * aligned properly for the default chart layout (title, subtitle, * legend, range selector) for the custom chart layout set the position * properties. * * @sample {highcharts} highcharts/breadcrumbs/single-button * Single, right aligned button * * @type {Highcharts.BreadcrumbsAlignOptions} * @since 10.0.0 * @product highcharts highmaps */ position: { /** * Horizontal alignment of the breadcrumbs buttons. * * @type {Highcharts.AlignValue} */ align: 'left', /** * Vertical alignment of the breadcrumbs buttons. * * @type {Highcharts.VerticalAlignValue} */ verticalAlign: 'top', /** * The X offset of the breadcrumbs button group. * * @type {number} */ x: 0, /** * The Y offset of the breadcrumbs button group. When `undefined`, * and `floating` is `false`, the `y` position is adapted so that * the breadcrumbs are rendered outside the target area. * * @type {number|undefined} */ y: void 0 }, /** * Options object for Breadcrumbs separator. * * @since 10.0.0 */ separator: { /** * @type {string} * @since 10.0.0 * @product highcharts */ text: '/', /** * CSS styles for the breadcrumbs separator. * * In styled mode, the breadcrumbs separators are styled by the * `.highcharts-separator` rule with its different states. * @type {Highcharts.CSSObject} * @since 10.0.0 */ style: { color: "#666666" /* Palette.neutralColor60 */, fontSize: '0.8em' } }, /** * Show full path or only a single button. * * @sample {highcharts} highcharts/breadcrumbs/single-button * Single, styled button * * @type {boolean} * @since 10.0.0 */ showFullPath: true, /** * CSS styles for all breadcrumbs. * * In styled mode, the breadcrumbs buttons are styled by the * `.highcharts-breadcrumbs-buttons .highcharts-button` rule with its * different states. * * @type {Highcharts.SVGAttributes} * @since 10.0.0 */ style: {}, /** * Whether to use HTML to render the breadcrumbs items texts. * * @type {boolean} * @since 10.0.0 */ useHTML: false, /** * The z index of the breadcrumbs group. * * @type {number} * @since 10.0.0 */ zIndex: 7 }; /* * * * Default Export * * */ const BreadcrumbsDefaults = { lang, options }; /* harmony default export */ const Breadcrumbs_BreadcrumbsDefaults = (BreadcrumbsDefaults); // EXTERNAL MODULE: external {"amd":["highcharts/highcharts","Templating"],"commonjs":["highcharts","Templating"],"commonjs2":["highcharts","Templating"],"root":["Highcharts","Templating"]} var highcharts_Templating_commonjs_highcharts_Templating_commonjs2_highcharts_Templating_root_Highcharts_Templating_ = __webpack_require__(984); var highcharts_Templating_commonjs_highcharts_Templating_commonjs2_highcharts_Templating_root_Highcharts_Templating_default = /*#__PURE__*/__webpack_require__.n(highcharts_Templating_commonjs_highcharts_Templating_commonjs2_highcharts_Templating_root_Highcharts_Templating_); ;// ./code/es-modules/Extensions/Breadcrumbs/Breadcrumbs.js /* * * * Highcharts Breadcrumbs module * * Authors: Grzegorz Blachlinski, Karol Kolodziej * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ const { format } = (highcharts_Templating_commonjs_highcharts_Templating_commonjs2_highcharts_Templating_root_Highcharts_Templating_default()); const { composed } = (highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default()); const { addEvent, defined, extend, fireEvent, isString, merge, objectEach, pick, pushUnique } = (highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default()); /* * * * Functions * * */ /** * Shift the drillUpButton to make the space for resetZoomButton, #8095. * @private */ function onChartAfterShowResetZoom() { const chart = this; if (chart.breadcrumbs) { const bbox = chart.resetZoomButton && chart.resetZoomButton.getBBox(), breadcrumbsOptions = chart.breadcrumbs.options; if (bbox && breadcrumbsOptions.position.align === 'right' && breadcrumbsOptions.relativeTo === 'plotBox') { chart.breadcrumbs.alignBreadcrumbsGroup(-bbox.width - breadcrumbsOptions.buttonSpacing); } } } /** * Remove resize/afterSetExtremes at chart destroy. * @private */ function onChartDestroy() { if (this.breadcrumbs) { this.breadcrumbs.destroy(); this.breadcrumbs = void 0; } } /** * Logic for making space for the buttons above the plot area * @private */ function onChartGetMargins() { const breadcrumbs = this.breadcrumbs; if (breadcrumbs && !breadcrumbs.options.floating && breadcrumbs.level) { const breadcrumbsOptions = breadcrumbs.options, buttonTheme = breadcrumbsOptions.buttonTheme, breadcrumbsHeight = ((buttonTheme.height || 0) + 2 * (buttonTheme.padding || 0) + breadcrumbsOptions.buttonSpacing), verticalAlign = breadcrumbsOptions.position.verticalAlign; if (verticalAlign === 'bottom') { this.marginBottom = (this.marginBottom || 0) + breadcrumbsHeight; breadcrumbs.yOffset = breadcrumbsHeight; } else if (verticalAlign !== 'middle') { this.plotTop += breadcrumbsHeight; breadcrumbs.yOffset = -breadcrumbsHeight; } else { breadcrumbs.yOffset = void 0; } } } /** * @private */ function onChartRedraw() { this.breadcrumbs && this.breadcrumbs.redraw(); } /** * After zooming out, shift the drillUpButton to the previous position, #8095. * @private */ function onChartSelection(event) { if (event.resetSelection === true && this.breadcrumbs) { this.breadcrumbs.alignBreadcrumbsGroup(); } } /* * * * Class * * */ /** * The Breadcrumbs class * * @private * @class * @name Highcharts.Breadcrumbs * * @param {Highcharts.Chart} chart * Chart object * @param {Highcharts.Options} userOptions * User options */ class Breadcrumbs { /* * * * Functions * * */ static compose(ChartClass, highchartsDefaultOptions) { if (pushUnique(composed, 'Breadcrumbs')) { addEvent(ChartClass, 'destroy', onChartDestroy); addEvent(ChartClass, 'afterShowResetZoom', onChartAfterShowResetZoom); addEvent(ChartClass, 'getMargins', onChartGetMargins); addEvent(ChartClass, 'redraw', onChartRedraw); addEvent(ChartClass, 'selection', onChartSelection); // Add language support. extend(highchartsDefaultOptions.lang, Breadcrumbs_BreadcrumbsDefaults.lang); } } /* * * * Constructor * * */ constructor(chart, userOptions) { this.elementList = {}; this.isDirty = true; this.level = 0; this.list = []; const chartOptions = merge(chart.options.drilldown && chart.options.drilldown.drillUpButton, Breadcrumbs.defaultOptions, chart.options.navigation && chart.options.navigation.breadcrumbs, userOptions); this.chart = chart; this.options = chartOptions || {}; } /* * * * Functions * * */ /** * Update Breadcrumbs properties, like level and list. * * @function Highcharts.Breadcrumbs#updateProperties * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ updateProperties(list) { this.setList(list); this.setLevel(); this.isDirty = true; } /** * Set breadcrumbs list. * @function Highcharts.Breadcrumbs#setList * * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. * @param {Highcharts.BreadcrumbsOptions} list * Breadcrumbs list. */ setList(list) { this.list = list; } /** * Calculate level on which chart currently is. * * @function Highcharts.Breadcrumbs#setLevel * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ setLevel() { this.level = this.list.length && this.list.length - 1; } /** * Get Breadcrumbs level * * @function Highcharts.Breadcrumbs#getLevel * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ getLevel() { return this.level; } /** * Default button text formatter. * * @function Highcharts.Breadcrumbs#getButtonText * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. * @param {Highcharts.Breadcrumbs} breadcrumb * Breadcrumb. * @return {string} * Formatted text. */ getButtonText(breadcrumb) { const breadcrumbs = this, chart = breadcrumbs.chart, breadcrumbsOptions = breadcrumbs.options, lang = chart.options.lang, textFormat = pick(breadcrumbsOptions.format, breadcrumbsOptions.showFullPath ? '{level.name}' : '← {level.name}'), defaultText = lang && pick(lang.drillUpText, lang.mainBreadcrumb); let returnText = breadcrumbsOptions.formatter && breadcrumbsOptions.formatter(breadcrumb) || format(textFormat, { level: breadcrumb.levelOptions }, chart) || ''; if (((isString(returnText) && !returnText.length) || returnText === '← ') && defined(defaultText)) { returnText = !breadcrumbsOptions.showFullPath ? '← ' + defaultText : defaultText; } return returnText; } /** * Redraw. * * @function Highcharts.Breadcrumbs#redraw * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ redraw() { if (this.isDirty) { this.render(); } if (this.group) { this.group.align(); } this.isDirty = false; } /** * Create a group, then draw breadcrumbs together with the separators. * * @function Highcharts.Breadcrumbs#render * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ render() { const breadcrumbs = this, chart = breadcrumbs.chart, breadcrumbsOptions = breadcrumbs.options; // A main group for the breadcrumbs. if (!breadcrumbs.group && breadcrumbsOptions) { breadcrumbs.group = chart.renderer .g('breadcrumbs-group') .addClass('highcharts-no-tooltip highcharts-breadcrumbs') .attr({ zIndex: breadcrumbsOptions.zIndex }) .add(); } // Draw breadcrumbs. if (breadcrumbsOptions.showFullPath) { this.renderFullPathButtons(); } else { this.renderSingleButton(); } this.alignBreadcrumbsGroup(); } /** * Draw breadcrumbs together with the separators. * * @function Highcharts.Breadcrumbs#renderFullPathButtons * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ renderFullPathButtons() { // Make sure that only one type of button is visible. this.destroySingleButton(); this.resetElementListState(); this.updateListElements(); this.destroyListElements(); } /** * Render Single button - when showFullPath is not used. The button is * similar to the old drillUpButton * * @function Highcharts.Breadcrumbs#renderSingleButton * @param {Highcharts.Breadcrumbs} this Breadcrumbs class. */ renderSingleButton() { const breadcrumbs = this, chart = breadcrumbs.chart, list = breadcrumbs.list, breadcrumbsOptions = breadcrumbs.options, buttonSpacing = breadcrumbsOptions.buttonSpacing; // Make sure that only one type of button is visible. this.destroyListElements(); // Draw breadcrumbs. Initial position for calculating the breadcrumbs // group. const posX = breadcrumbs.group ? breadcrumbs.group.getBBox().width : buttonSpacing, posY = buttonSpacing; const previousBreadcrumb = list[list.length - 2]; if (!chart.drillUpButton && (this.level > 0)) { chart.drillUpButton = breadcrumbs.renderButton(previousBreadcrumb, posX, posY); } else if (chart.drillUpButton) { if (this.level > 0) { // Update button. this.updateSingleButton(); } else { this.destroySingleButton(); } } } /** * Update group position based on align and it's width. * * @function Highcharts.Breadcrumbs#renderSingleButton * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ alignBreadcrumbsGroup(xOffset) { const breadcrumbs = this; if (breadcrumbs.group) { const breadcrumbsOptions = breadcrumbs.options, buttonTheme = breadcrumbsOptions.buttonTheme, positionOptions = breadcrumbsOptions.position, alignTo = (breadcrumbsOptions.relativeTo === 'chart' || breadcrumbsOptions.relativeTo === 'spacingBox' ? void 0 : 'plotBox'), bBox = breadcrumbs.group.getBBox(), additionalSpace = 2 * (buttonTheme.padding || 0) + breadcrumbsOptions.buttonSpacing; // Store positionOptions positionOptions.width = bBox.width + additionalSpace; positionOptions.height = bBox.height + additionalSpace; const newPositions = merge(positionOptions); // Add x offset if specified. if (xOffset) { newPositions.x += xOffset; } if (breadcrumbs.options.rtl) { newPositions.x += positionOptions.width; } newPositions.y = pick(newPositions.y, this.yOffset, 0); breadcrumbs.group.align(newPositions, true, alignTo); } } /** * Render a button. * * @function Highcharts.Breadcrumbs#renderButton * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. * @param {Highcharts.Breadcrumbs} breadcrumb * Current breadcrumb * @param {Highcharts.Breadcrumbs} posX * Initial horizontal position * @param {Highcharts.Breadcrumbs} posY * Initial vertical position * @return {SVGElement|void} * Returns the SVG button */ renderButton(breadcrumb, posX, posY) { const breadcrumbs = this, chart = this.chart, breadcrumbsOptions = breadcrumbs.options, buttonTheme = merge(breadcrumbsOptions.buttonTheme); const button = chart.renderer .button(breadcrumbs.getButtonText(breadcrumb), posX, posY, function (e) { // Extract events from button object and call const buttonEvents = breadcrumbsOptions.events && breadcrumbsOptions.events.click; let callDefaultEvent; if (buttonEvents) { callDefaultEvent = buttonEvents.call(breadcrumbs, e, breadcrumb); } // (difference in behaviour of showFullPath and drillUp) if (callDefaultEvent !== false) { // For single button we are not going to the button // level, but the one level up if (!breadcrumbsOptions.showFullPath) { e.newLevel = breadcrumbs.level - 1; } else { e.newLevel = breadcrumb.level; } fireEvent(breadcrumbs, 'up', e); } }, buttonTheme) .addClass('highcharts-breadcrumbs-button') .add(breadcrumbs.group); if (!chart.styledMode) { button.attr(breadcrumbsOptions.style); } return button; } /** * Render a separator. * * @function Highcharts.Breadcrumbs#renderSeparator * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. * @param {Highcharts.Breadcrumbs} posX * Initial horizontal position * @param {Highcharts.Breadcrumbs} posY * Initial vertical position * @return {Highcharts.SVGElement} * Returns the SVG button */ renderSeparator(posX, posY) { const breadcrumbs = this, chart = this.chart, breadcrumbsOptions = breadcrumbs.options, separatorOptions = breadcrumbsOptions.separator; const separator = chart.renderer .label(separatorOptions.text, posX, posY, void 0, void 0, void 0, false) .addClass('highcharts-breadcrumbs-separator') .add(breadcrumbs.group); if (!chart.styledMode) { separator.css(separatorOptions.style); } return separator; } /** * Update. * @function Highcharts.Breadcrumbs#update * * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. * @param {Highcharts.BreadcrumbsOptions} options * Breadcrumbs class. * @param {boolean} redraw * Redraw flag */ update(options) { merge(true, this.options, options); this.destroy(); this.isDirty = true; } /** * Update button text when the showFullPath set to false. * @function Highcharts.Breadcrumbs#updateSingleButton * * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ updateSingleButton() { const chart = this.chart, currentBreadcrumb = this.list[this.level - 1]; if (chart.drillUpButton) { chart.drillUpButton.attr({ text: this.getButtonText(currentBreadcrumb) }); } } /** * Destroy the chosen breadcrumbs group * * @function Highcharts.Breadcrumbs#destroy * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ destroy() { this.destroySingleButton(); // Destroy elements one by one. It's necessary because // g().destroy() does not remove added HTML this.destroyListElements(true); // Then, destroy the group itself. if (this.group) { this.group.destroy(); } this.group = void 0; } /** * Destroy the elements' buttons and separators. * * @function Highcharts.Breadcrumbs#destroyListElements * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ destroyListElements(force) { const elementList = this.elementList; objectEach(elementList, (element, level) => { if (force || !elementList[level].updated) { element = elementList[level]; element.button && element.button.destroy(); element.separator && element.separator.destroy(); delete element.button; delete element.separator; delete elementList[level]; } }); if (force) { this.elementList = {}; } } /** * Destroy the single button if exists. * * @function Highcharts.Breadcrumbs#destroySingleButton * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ destroySingleButton() { if (this.chart.drillUpButton) { this.chart.drillUpButton.destroy(); this.chart.drillUpButton = void 0; } } /** * Reset state for all buttons in elementList. * * @function Highcharts.Breadcrumbs#resetElementListState * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ resetElementListState() { objectEach(this.elementList, (element) => { element.updated = false; }); } /** * Update rendered elements inside the elementList. * * @function Highcharts.Breadcrumbs#updateListElements * * @param {Highcharts.Breadcrumbs} this * Breadcrumbs class. */ updateListElements() { const breadcrumbs = this, elementList = breadcrumbs.elementList, buttonSpacing = breadcrumbs.options.buttonSpacing, posY = buttonSpacing, list = breadcrumbs.list, rtl = breadcrumbs.options.rtl, rtlFactor = rtl ? -1 : 1, updateXPosition = function (element, spacing) { return rtlFactor * element.getBBox().width + rtlFactor * spacing; }, adjustToRTL = function (element, posX, posY) { element.translate(posX - element.getBBox().width, posY); }; // Initial position for calculating the breadcrumbs group. let posX = breadcrumbs.group ? updateXPosition(breadcrumbs.group, buttonSpacing) : buttonSpacing, currentBreadcrumb, breadcrumb; for (let i = 0, iEnd = list.length; i < iEnd; ++i) { const isLast = i === iEnd - 1; let button, separator; breadcrumb = list[i]; if (elementList[breadcrumb.level]) { currentBreadcrumb = elementList[breadcrumb.level]; button = currentBreadcrumb.button; // Render a separator if it was not created before. if (!currentBreadcrumb.separator && !isLast) { // Add spacing for the next separator posX += rtlFactor * buttonSpacing; currentBreadcrumb.separator = breadcrumbs.renderSeparator(posX, posY); if (rtl) { adjustToRTL(currentBreadcrumb.separator, posX, posY); } posX += updateXPosition(currentBreadcrumb.separator, buttonSpacing); } else if (currentBreadcrumb.separator && isLast) { currentBreadcrumb.separator.destroy(); delete currentBreadcrumb.separator; } elementList[breadcrumb.level].updated = true; } else { // Render a button. button = breadcrumbs.renderButton(breadcrumb, posX, posY); if (rtl) { adjustToRTL(button, posX, posY); } posX += updateXPosition(button, buttonSpacing); // Render a separator. if (!isLast) { separator = breadcrumbs.renderSeparator(posX, posY); if (rtl) { adjustToRTL(separator, posX, posY); } posX += updateXPosition(separator, buttonSpacing); } elementList[breadcrumb.level] = { button, separator, updated: true }; } if (button) { button.setState(isLast ? 2 : 0); } } } } /* * * * Static Properties * * */ Breadcrumbs.defaultOptions = Breadcrumbs_BreadcrumbsDefaults.options; /* * * * Default Export * * */ /* harmony default export */ const Breadcrumbs_Breadcrumbs = (Breadcrumbs); /* * * * API Declarations * * */ /** * Callback function to react on button clicks. * * @callback Highcharts.BreadcrumbsClickCallbackFunction * * @param {Highcharts.Event} event * Event. * * @param {Highcharts.BreadcrumbOptions} options * Breadcrumb options. * * @param {global.Event} e * Event arguments. */ /** * Callback function to format the breadcrumb text from scratch. * * @callback Highcharts.BreadcrumbsFormatterCallbackFunction * * @param {Highcharts.Event} event * Event. * * @param {Highcharts.BreadcrumbOptions} options * Breadcrumb options. * * @return {string} * Formatted text or false */ /** * Options for the one breadcrumb. * * @interface Highcharts.BreadcrumbOptions */ /** * Level connected to a specific breadcrumb. * @name Highcharts.BreadcrumbOptions#level * @type {number} */ /** * Options for series or point connected to a specific breadcrumb. * @name Highcharts.BreadcrumbOptions#levelOptions * @type {SeriesOptions|PointOptionsObject} */ /** * Options for aligning breadcrumbs group. * * @interface Highcharts.BreadcrumbsAlignOptions */ /** * Align of a Breadcrumb group. * @default right * @name Highcharts.BreadcrumbsAlignOptions#align * @type {AlignValue} */ /** * Vertical align of a Breadcrumb group. * @default top * @name Highcharts.BreadcrumbsAlignOptions#verticalAlign * @type {VerticalAlignValue} */ /** * X offset of a Breadcrumbs group. * @name Highcharts.BreadcrumbsAlignOptions#x * @type {number} */ /** * Y offset of a Breadcrumbs group. * @name Highcharts.BreadcrumbsAlignOptions#y * @type {number} */ /** * Options for all breadcrumbs. * * @interface Highcharts.BreadcrumbsOptions */ /** * Button theme. * @name Highcharts.BreadcrumbsOptions#buttonTheme * @type { SVGAttributes | undefined } */ (''); // Keeps doclets above in JS file // EXTERNAL MODULE: external {"amd":["highcharts/highcharts","Color"],"commonjs":["highcharts","Color"],"commonjs2":["highcharts","Color"],"root":["Highcharts","Color"]} var highcharts_Color_commonjs_highcharts_Color_commonjs2_highcharts_Color_root_Highcharts_Color_ = __webpack_require__(620); var highcharts_Color_commonjs_highcharts_Color_commonjs2_highcharts_Color_root_Highcharts_Color_default = /*#__PURE__*/__webpack_require__.n(highcharts_Color_commonjs_highcharts_Color_commonjs2_highcharts_Color_root_Highcharts_Color_); // EXTERNAL MODULE: external {"amd":["highcharts/highcharts","SeriesRegistry"],"commonjs":["highcharts","SeriesRegistry"],"commonjs2":["highcharts","SeriesRegistry"],"root":["Highcharts","SeriesRegistry"]} var highcharts_SeriesRegistry_commonjs_highcharts_SeriesRegistry_commonjs2_highcharts_SeriesRegistry_root_Highcharts_SeriesRegistry_ = __webpack_require__(512); var highcharts_SeriesRegistry_commonjs_highcharts_SeriesRegistry_commonjs2_highcharts_SeriesRegistry_root_Highcharts_SeriesRegistry_default = /*#__PURE__*/__webpack_require__.n(highcharts_SeriesRegistry_commonjs_highcharts_SeriesRegistry_commonjs2_highcharts_SeriesRegistry_root_Highcharts_SeriesRegistry_); // EXTERNAL MODULE: external {"amd":["highcharts/highcharts","SVGElement"],"commonjs":["highcharts","SVGElement"],"commonjs2":["highcharts","SVGElement"],"root":["Highcharts","SVGElement"]} var highcharts_SVGElement_commonjs_highcharts_SVGElement_commonjs2_highcharts_SVGElement_root_Highcharts_SVGElement_ = __webpack_require__(28); var highcharts_SVGElement_commonjs_highcharts_SVGElement_commonjs2_highcharts_SVGElement_root_Highcharts_SVGElement_default = /*#__PURE__*/__webpack_require__.n(highcharts_SVGElement_commonjs_highcharts_SVGElement_commonjs2_highcharts_SVGElement_root_Highcharts_SVGElement_); ;// ./code/es-modules/Series/ColorMapComposition.js /* * * * (c) 2010-2024 Torstein Honsi * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ const { column: { prototype: columnProto } } = (highcharts_SeriesRegistry_commonjs_highcharts_SeriesRegistry_commonjs2_highcharts_SeriesRegistry_root_Highcharts_SeriesRegistry_default()).seriesTypes; const { addEvent: ColorMapComposition_addEvent, defined: ColorMapComposition_defined } = (highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default()); /* * * * Composition * * */ var ColorMapComposition; (function (ColorMapComposition) { /* * * * Constants * * */ ColorMapComposition.pointMembers = { dataLabelOnNull: true, moveToTopOnHover: true, isValid: pointIsValid }; ColorMapComposition.seriesMembers = { colorKey: 'value', axisTypes: ['xAxis', 'yAxis', 'colorAxis'], parallelArrays: ['x', 'y', 'value'], pointArrayMap: ['value'], trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'], colorAttribs: seriesColorAttribs, pointAttribs: columnProto.pointAttribs }; /* * * * Functions * * */ /** * @private */ function compose(SeriesClass) { const PointClass = SeriesClass.prototype.pointClass; ColorMapComposition_addEvent(PointClass, 'afterSetState', onPointAfterSetState); return SeriesClass; } ColorMapComposition.compose = compose; /** * Move points to the top of the z-index order when hovered. * @private */ function onPointAfterSetState(e) { const point = this, series = point.series, renderer = series.chart.renderer; if (point.moveToTopOnHover && point.graphic) { if (!series.stateMarkerGraphic) { // Create a `use` element and add it to the end of the group, // which would make it appear on top of the other elements. This // deals with z-index without reordering DOM elements (#13049). series.stateMarkerGraphic = new (highcharts_SVGElement_commonjs_highcharts_SVGElement_commonjs2_highcharts_SVGElement_root_Highcharts_SVGElement_default())(renderer, 'use') .css({ pointerEvents: 'none' }) .add(point.graphic.parentGroup); } if (e?.state === 'hover') { // Give the graphic DOM element the same id as the Point // instance point.graphic.attr({ id: this.id }); series.stateMarkerGraphic.attr({ href: `${renderer.url}#${this.id}`, visibility: 'visible' }); } else { series.stateMarkerGraphic.attr({ href: '' }); } } } /** * Color points have a value option that determines whether or not it is * a null point * @private */ function pointIsValid() { return (this.value !== null && this.value !== Infinity && this.value !== -Infinity && // Undefined is allowed, but NaN is not (#17279) (this.value === void 0 || !isNaN(this.value))); } /** * Get the color attributes to apply on the graphic * @private * @function Highcharts.colorMapSeriesMixin.colorAttribs * @param {Highcharts.Point} point * @return {Highcharts.SVGAttributes} * The SVG attributes */ function seriesColorAttribs(point) { const ret = {}; if (ColorMapComposition_defined(point.color) && (!point.state || point.state === 'normal') // #15746 ) { ret[this.colorProp || 'fill'] = point.color; } return ret; } })(ColorMapComposition || (ColorMapComposition = {})); /* * * * Default Export * * */ /* harmony default export */ const Series_ColorMapComposition = (ColorMapComposition); ;// ./code/es-modules/Series/Treemap/TreemapAlgorithmGroup.js /* * * * (c) 2014-2024 Highsoft AS * * Authors: Jon Arild Nygard / Oystein Moseng * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ /* * * * Class * * */ class TreemapAlgorithmGroup { /* * * * Constructor * * */ constructor(h, w, d, p) { this.height = h; this.width = w; this.plot = p; this.direction = d; this.startDirection = d; this.total = 0; this.nW = 0; this.lW = 0; this.nH = 0; this.lH = 0; this.elArr = []; this.lP = { total: 0, lH: 0, nH: 0, lW: 0, nW: 0, nR: 0, lR: 0, aspectRatio: function (w, h) { return Math.max((w / h), (h / w)); } }; } /* * * * Functions * * */ addElement(el) { this.lP.total = this.elArr[this.elArr.length - 1]; this.total = this.total + el; if (this.direction === 0) { // Calculate last point old aspect ratio this.lW = this.nW; this.lP.lH = this.lP.total / this.lW; this.lP.lR = this.lP.aspectRatio(this.lW, this.lP.lH); // Calculate last point new aspect ratio this.nW = this.total / this.height; this.lP.nH = this.lP.total / this.nW; this.lP.nR = this.lP.aspectRatio(this.nW, this.lP.nH); } else { // Calculate last point old aspect ratio this.lH = this.nH; this.lP.lW = this.lP.total / this.lH; this.lP.lR = this.lP.aspectRatio(this.lP.lW, this.lH); // Calculate last point new aspect ratio this.nH = this.total / this.width; this.lP.nW = this.lP.total / this.nH; this.lP.nR = this.lP.aspectRatio(this.lP.nW, this.nH); } this.elArr.push(el); } reset() { this.nW = 0; this.lW = 0; this.elArr = []; this.total = 0; } } /* * * * Default Export * * */ /* harmony default export */ const Treemap_TreemapAlgorithmGroup = (TreemapAlgorithmGroup); ;// ./code/es-modules/Series/Treemap/TreemapNode.js /* * * * (c) 2010-2024 Pawel Lysy * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ /* * * * Class * * */ class TreemapNode { constructor() { /* * * * Properties * * */ this.childrenTotal = 0; this.visible = false; } /* * * * Functions * * */ init(id, i, children, height, level, series, parent) { this.id = id; this.i = i; this.children = children; this.height = height; this.level = level; this.series = series; this.parent = parent; return this; } } /* * * * Default Export * * */ /* harmony default export */ const Treemap_TreemapNode = (TreemapNode); ;// ./code/es-modules/Series/DrawPointUtilities.js /* * * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ /* * * * Functions * * */ /** * Handles the drawing of a component. * Can be used for any type of component that reserves the graphic property, * and provides a shouldDraw on its context. * * @private * * @todo add type checking. * @todo export this function to enable usage */ function draw(point, params) { const { animatableAttribs, onComplete, css, renderer } = params; const animation = (point.series && point.series.chart.hasRendered) ? // Chart-level animation on updates void 0 : // Series-level animation on new points (point.series && point.series.options.animation); let graphic = point.graphic; params.attribs = { ...params.attribs, 'class': point.getClassName() } || {}; if ((point.shouldDraw())) { if (!graphic) { if (params.shapeType === 'text') { graphic = renderer.text(); } else if (params.shapeType === 'image') { graphic = renderer.image(params.imageUrl || '') .attr(params.shapeArgs || {}); } else { graphic = renderer[params.shapeType](params.shapeArgs || {}); } point.graphic = graphic; graphic.add(params.group); } if (css) { graphic.css(css); } graphic .attr(params.attribs) .animate(animatableAttribs, params.isNew ? false : animation, onComplete); } else if (graphic) { const destroy = () => { point.graphic = graphic = (graphic && graphic.destroy()); if (typeof onComplete === 'function') { onComplete(); } }; // Animate only runs complete callback if something was animated. if (Object.keys(animatableAttribs).length) { graphic.animate(animatableAttribs, void 0, () => destroy()); } else { destroy(); } } } /* * * * Default Export * * */ const DrawPointUtilities = { draw }; /* harmony default export */ const Series_DrawPointUtilities = (DrawPointUtilities); ;// ./code/es-modules/Series/Treemap/TreemapPoint.js /* * * * (c) 2014-2024 Highsoft AS * * Authors: Jon Arild Nygard / Oystein Moseng * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ const { pie: { prototype: { pointClass: PiePoint } }, scatter: { prototype: { pointClass: ScatterPoint } } } = (highcharts_SeriesRegistry_commonjs_highcharts_SeriesRegistry_commonjs2_highcharts_SeriesRegistry_root_Highcharts_SeriesRegistry_default()).seriesTypes; const { extend: TreemapPoint_extend, isNumber, pick: TreemapPoint_pick } = (highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default()); /* * * * Class * * */ class TreemapPoint extends ScatterPoint { constructor() { /* * * * Properties * * */ super(...arguments); this.groupedPointsAmount = 0; this.shapeType = 'rect'; } /* * * * Functions * * */ draw(params) { Series_DrawPointUtilities.draw(this, params); } getClassName() { const series = this.series, options = series.options; let className = super.getClassName(); // Above the current level if (this.node.level <= series.nodeMap[series.rootNode].level && this.node.children.length) { className += ' highcharts-above-level'; } else if (!this.node.isGroup && !this.node.isLeaf && !series.nodeMap[series.rootNode].isGroup && !TreemapPoint_pick(options.interactByLeaf, !options.allowTraversingTree)) { className += ' highcharts-internal-node-interactive'; } else if (!this.node.isGroup && !this.node.isLeaf && !series.nodeMap[series.rootNode].isGroup) { className += ' highcharts-internal-node'; } return className; } /** * A tree point is valid if it has han id too, assume it may be a parent * item. * * @private * @function Highcharts.Point#isValid */ isValid() { return Boolean(this.id || isNumber(this.value)); } setState(state) { super.setState.apply(this, arguments); // Graphic does not exist when point is not visible. if (this.graphic) { this.graphic.attr({ zIndex: state === 'hover' ? 1 : 0 }); } } shouldDraw() { return isNumber(this.plotY) && this.y !== null; } } TreemapPoint_extend(TreemapPoint.prototype, { setVisible: PiePoint.prototype.setVisible }); /* * * * Default Export * * */ /* harmony default export */ const Treemap_TreemapPoint = (TreemapPoint); ;// ./code/es-modules/Series/Treemap/TreemapSeriesDefaults.js /* * * * (c) 2014-2024 Highsoft AS * * Authors: Jon Arild Nygard / Oystein Moseng * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ const { isString: TreemapSeriesDefaults_isString } = (highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default()); /* * * * API Options * * */ /** * A treemap displays hierarchical data using nested rectangles. The data * can be laid out in varying ways depending on options. * * @sample highcharts/demo/treemap-large-dataset/ * Treemap * * @extends plotOptions.scatter * @excluding connectEnds, connectNulls, dataSorting, dragDrop,