UNPKG

highcharts

Version:
1,402 lines (1,384 loc) 415 kB
/** * @license Highstock JS v12.2.0 (2025-04-07) * @module highcharts/modules/stock * @requires highcharts * * Highcharts Stock as a plugin for Highcharts * * (c) 2010-2025 Torstein Honsi * * License: www.highcharts.com/license */ import * as __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__ from "../highcharts.src.js"; import * as __WEBPACK_EXTERNAL_MODULE__broken_axis_src_js_5f3d6d24__ from "./broken-axis.src.js"; import * as __WEBPACK_EXTERNAL_MODULE__datagrouping_src_js_902e97be__ from "./datagrouping.src.js"; import * as __WEBPACK_EXTERNAL_MODULE__mouse_wheel_zoom_src_js_c5a2afed__ from "./mouse-wheel-zoom.src.js"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* 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)) /******/ })(); /******/ /************************************************************************/ ;// external ["../highcharts.src.js","default"] const external_highcharts_src_js_default_namespaceObject = __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__["default"]; var external_highcharts_src_js_default_default = /*#__PURE__*/__webpack_require__.n(external_highcharts_src_js_default_namespaceObject); ;// external ["../highcharts.src.js","default","Axis"] const external_highcharts_src_js_default_Axis_namespaceObject = __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__["default"].Axis; var external_highcharts_src_js_default_Axis_default = /*#__PURE__*/__webpack_require__.n(external_highcharts_src_js_default_Axis_namespaceObject); ;// external ["../highcharts.src.js","default","Point"] const external_highcharts_src_js_default_Point_namespaceObject = __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__["default"].Point; var external_highcharts_src_js_default_Point_default = /*#__PURE__*/__webpack_require__.n(external_highcharts_src_js_default_Point_namespaceObject); ;// external ["../highcharts.src.js","default","Series"] const external_highcharts_src_js_default_Series_namespaceObject = __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__["default"].Series; var external_highcharts_src_js_default_Series_default = /*#__PURE__*/__webpack_require__.n(external_highcharts_src_js_default_Series_namespaceObject); ;// ./code/es-modules/Series/DataModifyComposition.js /* * * * (c) 2010-2025 Torstein Honsi * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ const { tooltipFormatter: pointTooltipFormatter } = (external_highcharts_src_js_default_Point_default()).prototype; const { addEvent, arrayMax, arrayMin, correctFloat, defined, isArray, isNumber, isString, pick } = (external_highcharts_src_js_default_default()); /* * * * Composition * * */ var DataModifyComposition; (function (DataModifyComposition) { /* * * * Declarations * * */ /* * * * Functions * * */ /** * Extends the series, axis and point classes with * compare and cumulative support. * * @private * * @param SeriesClass * Series class to use. * * @param AxisClass * Axis class to extend. * * @param PointClass * Point class to use. */ function compose(SeriesClass, AxisClass, PointClass) { const axisProto = AxisClass.prototype, pointProto = PointClass.prototype, seriesProto = SeriesClass.prototype; if (!seriesProto.setCompare) { seriesProto.setCompare = seriesSetCompare; seriesProto.setCumulative = seriesSetCumulative; addEvent(SeriesClass, 'afterInit', afterInit); addEvent(SeriesClass, 'afterGetExtremes', afterGetExtremes); addEvent(SeriesClass, 'afterProcessData', afterProcessData); } if (!axisProto.setCompare) { axisProto.setCompare = axisSetCompare; axisProto.setModifier = setModifier; axisProto.setCumulative = axisSetCumulative; pointProto.tooltipFormatter = tooltipFormatter; } return SeriesClass; } DataModifyComposition.compose = compose; /* ********************************************************************** * * Start shared compare and cumulative logic * * ********************************************************************** */ /** * Shared code for the axis.setCompare() and the axis.setCumulative() * methods. Inits the 'compare' or the 'cumulative' mode. * @private */ function setModifier(mode, modeState, redraw) { if (!this.isXAxis) { this.series.forEach(function (series) { if (mode === 'compare' && typeof modeState !== 'boolean') { series.setCompare(modeState, false); } else if (mode === 'cumulative' && !isString(modeState)) { series.setCumulative(modeState, false); } }); if (pick(redraw, true)) { this.chart.redraw(); } } } /** * Extend the tooltip formatter by adding support for the point.change * variable as well as the changeDecimals option. * * @ignore * @function Highcharts.Point#tooltipFormatter * * @param {string} pointFormat */ function tooltipFormatter(pointFormat) { const point = this, { numberFormatter } = point.series.chart, replace = function (value) { pointFormat = pointFormat.replace('{point.' + value + '}', (point[value] > 0 && value === 'change' ? '+' : '') + numberFormatter(point[value], pick(point.series.tooltipOptions.changeDecimals, 2))); }; if (defined(point.change)) { replace('change'); } if (defined(point.cumulativeSum)) { replace('cumulativeSum'); } return pointTooltipFormatter.apply(this, [pointFormat]); } /** * Extend series.init by adding a methods to modify the y values used * for plotting on the y axis. For compare mode, this method is called both * from the axis when finding dataMin and dataMax, * and from the series.translate method. * * @ignore * @function Highcharts.Series#init */ function afterInit() { const compare = this.options.compare; let dataModify; if (compare === 'percent' || compare === 'value' || this.options.cumulative) { dataModify = new Additions(this); if (compare === 'percent' || compare === 'value') { // Set comparison mode dataModify.initCompare(compare); } else { // Set Cumulative Sum mode dataModify.initCumulative(); } } this.dataModify = dataModify; } /** * Adjust the extremes (compare and cumulative modify the data). * @private */ function afterGetExtremes(e) { const dataExtremes = e.dataExtremes, activeYData = dataExtremes.activeYData; if (this.dataModify && dataExtremes) { let extremes; if (this.options.compare) { extremes = [ this.dataModify.modifyValue(dataExtremes.dataMin), this.dataModify.modifyValue(dataExtremes.dataMax) ]; } else if (this.options.cumulative && isArray(activeYData) && // If only one y visible, sum doesn't change // so no need to change extremes activeYData.length >= 2) { extremes = Additions.getCumulativeExtremes(activeYData); } if (extremes) { dataExtremes.dataMin = arrayMin(extremes); dataExtremes.dataMax = arrayMax(extremes); } } } /* ********************************************************************** * * End shared compare and cumulative logic * * ********************************************************************** */ /* ********************************************************************** * * Start value compare logic * * ********************************************************************** */ /** * Highcharts Stock only. Set the * [compare](https://api.highcharts.com/highstock/plotOptions.series.compare) * mode of the series after render time. * In most cases it is more useful running * {@link Axis#setCompare} on the X axis to update all its series. * * @function Highcharts.Series#setCompare * * @param {string|null} [compare] * Can be one of `undefined` (default), `null`, `"percent"` * or `"value"`. * * @param {boolean} [redraw=true] * Whether to redraw the chart or to wait for a later call to * {@link Chart#redraw}. */ function seriesSetCompare(compare, redraw) { // Survive to export, #5485 (and for options generally) this.options.compare = this.userOptions.compare = compare; // Fire series.init() that will set or delete series.dataModify this.update({}, pick(redraw, true)); if (this.dataModify && (compare === 'value' || compare === 'percent')) { this.dataModify.initCompare(compare); } else { // When disabling, clear the points this.points.forEach((point) => { delete point.change; }); } } /** * Extend series.processData by finding the first y value in the plot area, * used for comparing the following values * * @ignore * @function Highcharts.Series#processData */ function afterProcessData() { const series = this, // For series with more than one value (range, OHLC etc), compare // against close or the pointValKey (#4922, #3112, #9854) compareColumn = this.getColumn((series.pointArrayMap && (series.options.pointValKey || series.pointValKey)) || 'y', true); if (series.xAxis && // Not pies compareColumn.length && series.dataModify) { const processedXData = series.getColumn('x', true), length = series.dataTable.rowCount, compareStart = series.options.compareStart === true ? 0 : 1; // Find the first value for comparison for (let i = 0; i < length - compareStart; i++) { const compareValue = compareColumn[i]; if (isNumber(compareValue) && compareValue !== 0 && processedXData[i + compareStart] >= (series.xAxis.min || 0)) { series.dataModify.compareValue = compareValue; break; } } } } /** * Highcharts Stock only. Set the compare mode on all series * belonging to a Y axis. * * @see [plotOptions.series.compare](https://api.highcharts.com/highstock/plotOptions.series.compare) * * @sample stock/members/axis-setcompare/ * Set compare * * @function Highcharts.Axis#setCompare * * @param {string|null} [compare] * The compare mode. Can be one of `undefined` (default), `null`, * `"value"` or `"percent"`. * * @param {boolean} [redraw=true] * Whether to redraw the chart or to wait for a later call to * {@link Chart#redraw}. */ function axisSetCompare(compare, redraw) { this.setModifier('compare', compare, redraw); } /* ********************************************************************** * * End value compare logic * * ********************************************************************** */ /* ********************************************************************** * * Start Cumulative Sum logic, author: Rafal Sebestjanski * * ********************************************************************** */ /** * Highcharts Stock only. Set the * [cumulative](https://api.highcharts.com/highstock/plotOptions.series.cumulative) * mode of the series after render time. * In most cases it is more useful running * {@link Axis#setCumulative} on the Y axis to update all its series. * * @function Highcharts.Series#setCumulative * * @param {boolean} [cumulative=false] * Either enable or disable Cumulative Sum mode. * Can be one of `false` (default) or `true`. * * @param {boolean} [redraw=true] * Whether to redraw the chart or to wait for a later call to * {@link Chart#redraw}. */ function seriesSetCumulative(cumulative, redraw) { // Set default value to false cumulative = pick(cumulative, false); // Survive to export, #5485 (and for options generally) this.options.cumulative = this.userOptions.cumulative = cumulative; // Fire series.init() that will set or delete series.dataModify this.update({}, pick(redraw, true)); // If should, turn on the Cumulative Sum mode if (this.dataModify) { this.dataModify.initCumulative(); } else { // When disabling, clear the points this.points.forEach((point) => { delete point.cumulativeSum; }); } } /** * Highcharts Stock only. Set the cumulative mode on all series * belonging to a Y axis. * * @see [plotOptions.series.cumulative](https://api.highcharts.com/highstock/plotOptions.series.cumulative) * * @sample stock/members/axis-setcumulative/ * Set cumulative * * @function Highcharts.Axis#setCumulative * * @param {boolean} [cumulative] * Whether to disable or enable the cumulative mode. * Can be one of `undefined` (default, treated as `false`), * `false` or `true`. * * @param {boolean} [redraw=true] * Whether to redraw the chart or to wait for a later call to * {@link Chart#redraw}. */ function axisSetCumulative(cumulative, redraw) { this.setModifier('cumulative', cumulative, redraw); } /* * * * Classes * * */ /** * @private */ class Additions { /* * * * Constructors * * */ /** * @private */ constructor(series) { this.series = series; } /* * * * Functions * * */ /** * @private */ modifyValue() { return 0; } /** * @ignore * @function Highcharts.Series#getCumulativeExtremes * * @param {Array} [activeYData] * An array cointaining all the points' y values * in a visible range. */ static getCumulativeExtremes(activeYData) { let cumulativeDataMin = Infinity, cumulativeDataMax = -Infinity; activeYData.reduce((prev, cur) => { const sum = prev + cur; cumulativeDataMin = Math.min(cumulativeDataMin, sum, prev); cumulativeDataMax = Math.max(cumulativeDataMax, sum, prev); return sum; }); return [cumulativeDataMin, cumulativeDataMax]; } /** * @ignore * @function Highcharts.Series#initCompare * * @param {string} [compare] * Can be one of `"percent"` or `"value"`. */ initCompare(compare) { // Set the modifyValue method this.modifyValue = function (value, index) { if (value === null) { value = 0; } const compareValue = this.compareValue; if (typeof value !== 'undefined' && typeof compareValue !== 'undefined') { // #2601, #5814 // Get the modified value if (compare === 'value') { value -= compareValue; // Compare percent } else { const compareBase = this.series.options.compareBase; value = 100 * (value / compareValue) - (compareBase === 100 ? 0 : 100); } // Record for tooltip etc. if (typeof index !== 'undefined') { const point = this.series.points[index]; if (point) { point.change = value; } } return value; } return 0; }; } /** * @ignore * @function Highcharts.Series#initCumulative */ initCumulative() { // Set the modifyValue method this.modifyValue = function (value, index) { if (value === null) { value = 0; } if (value !== void 0 && index !== void 0) { const prevPoint = index > 0 ? this.series.points[index - 1] : null; // Get the modified value if (prevPoint && prevPoint.cumulativeSum) { value = correctFloat(prevPoint.cumulativeSum + value); } // Record for tooltip etc. const point = this.series.points[index]; const cumulativeStart = point.series.options.cumulativeStart, withinRange = point.x <= this.series.xAxis.max && point.x >= this.series.xAxis.min; if (point) { if (!cumulativeStart || withinRange) { point.cumulativeSum = value; } else { point.cumulativeSum = void 0; } } return value; } return 0; }; } } DataModifyComposition.Additions = Additions; })(DataModifyComposition || (DataModifyComposition = {})); /* * * * Default Export * * */ /* harmony default export */ const Series_DataModifyComposition = (DataModifyComposition); /* * * * API Options * * */ /** * Compare the values of the series against the first non-null, non- * zero value in the visible range. The y axis will show percentage * or absolute change depending on whether `compare` is set to `"percent"` * or `"value"`. When this is applied to multiple series, it allows * comparing the development of the series against each other. Adds * a `change` field to every point object. * * @see [compareBase](#plotOptions.series.compareBase) * @see [Axis.setCompare()](/class-reference/Highcharts.Axis#setCompare) * @see [Series.setCompare()](/class-reference/Highcharts.Series#setCompare) * * @sample {highstock} stock/plotoptions/series-compare-percent/ * Percent * @sample {highstock} stock/plotoptions/series-compare-value/ * Value * * @type {string} * @since 1.0.1 * @product highstock * @validvalue ["percent", "value"] * @apioption plotOptions.series.compare */ /** * Defines if comparison should start from the first point within the visible * range or should start from the last point **before** the range. * * In other words, this flag determines if first point within the visible range * will have 0% (`compareStart=true`) or should have been already calculated * according to the previous point (`compareStart=false`). * * @sample {highstock} stock/plotoptions/series-comparestart/ * Calculate compare within visible range * * @type {boolean} * @default false * @since 6.0.0 * @product highstock * @apioption plotOptions.series.compareStart */ /** * When [compare](#plotOptions.series.compare) is `percent`, this option * dictates whether to use 0 or 100 as the base of comparison. * * @sample {highstock} stock/plotoptions/series-comparebase/ * Compare base is 100 * * @type {number} * @default 0 * @since 5.0.6 * @product highstock * @validvalue [0, 100] * @apioption plotOptions.series.compareBase */ /** * Cumulative Sum feature replaces points' values with the following formula: * `sum of all previous points' values + current point's value`. * Works only for points in a visible range. * Adds the `cumulativeSum` field to each point object that can be accessed * e.g. in the [tooltip.pointFormat](https://api.highcharts.com/highstock/tooltip.pointFormat). * * With `dataGrouping` enabled, default grouping approximation is set to `sum`. * * @see [Axis.setCumulative()](/class-reference/Highcharts.Axis#setCumulative) * @see [Series.setCumulative()](/class-reference/Highcharts.Series#setCumulative) * * @sample {highstock} stock/plotoptions/series-cumulative-sum/ * Cumulative Sum * * @type {boolean} * @default false * @since 9.3.0 * @product highstock * @apioption plotOptions.series.cumulative */ /** * Defines if cumulation should start from the first point within the visible * range or should start from the last point **before** the range. * * In other words, this flag determines if first point within the visible range * will start at 0 (`cumulativeStart=true`) or should have been already calculated * according to the previous point (`cumulativeStart=false`). * * @sample {highstock} stock/plotoptions/series-cumulativestart/ * Cumulative Start * * @type {boolean} * @default false * @since 11.4.2 * @product highstock * @apioption plotOptions.series.cumulativeStart */ ''; // Keeps doclets above in transpiled file ;// ./code/es-modules/Stock/Navigator/ChartNavigatorComposition.js /* * * * (c) 2010-2025 Torstein Honsi * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ const { isTouchDevice } = (external_highcharts_src_js_default_default()); const { addEvent: ChartNavigatorComposition_addEvent, merge, pick: ChartNavigatorComposition_pick } = (external_highcharts_src_js_default_default()); /* * * * Constants * * */ const composedMembers = []; /* * * * Variables * * */ let NavigatorConstructor; /* * * * Functions * * */ /** * @private */ function compose(ChartClass, NavigatorClass) { if (external_highcharts_src_js_default_default().pushUnique(composedMembers, ChartClass)) { const chartProto = ChartClass.prototype; NavigatorConstructor = NavigatorClass; chartProto.callbacks.push(onChartCallback); ChartNavigatorComposition_addEvent(ChartClass, 'afterAddSeries', onChartAfterAddSeries); ChartNavigatorComposition_addEvent(ChartClass, 'afterSetChartSize', onChartAfterSetChartSize); ChartNavigatorComposition_addEvent(ChartClass, 'afterUpdate', onChartAfterUpdate); ChartNavigatorComposition_addEvent(ChartClass, 'beforeRender', onChartBeforeRender); ChartNavigatorComposition_addEvent(ChartClass, 'beforeShowResetZoom', onChartBeforeShowResetZoom); ChartNavigatorComposition_addEvent(ChartClass, 'update', onChartUpdate); } } /** * Handle adding new series. * @private */ function onChartAfterAddSeries() { if (this.navigator) { // Recompute which series should be shown in navigator, and add them this.navigator.setBaseSeries(null, false); } } /** * For stock charts, extend the Chart.setChartSize method so that we can set the * final top position of the navigator once the height of the chart, including * the legend, is determined. #367. We can't use Chart.getMargins, because * labels offsets are not calculated yet. * @private */ function onChartAfterSetChartSize() { const legend = this.legend, navigator = this.navigator; let legendOptions, xAxis, yAxis; if (navigator) { legendOptions = legend && legend.options; xAxis = navigator.xAxis; yAxis = navigator.yAxis; const { scrollbarHeight, scrollButtonSize } = navigator; // Compute the top position if (this.inverted) { navigator.left = navigator.opposite ? this.chartWidth - scrollbarHeight - navigator.height : this.spacing[3] + scrollbarHeight; navigator.top = this.plotTop + scrollButtonSize; } else { navigator.left = ChartNavigatorComposition_pick(xAxis.left, this.plotLeft + scrollButtonSize); navigator.top = navigator.navigatorOptions.top || this.chartHeight - navigator.height - scrollbarHeight - (this.scrollbar?.options.margin || 0) - this.spacing[2] - (this.rangeSelector && this.extraBottomMargin ? this.rangeSelector.getHeight() : 0) - ((legendOptions && legendOptions.verticalAlign === 'bottom' && legendOptions.layout !== 'proximate' && // #13392 legendOptions.enabled && !legendOptions.floating) ? legend.legendHeight + ChartNavigatorComposition_pick(legendOptions.margin, 10) : 0) - (this.titleOffset ? this.titleOffset[2] : 0); } if (xAxis && yAxis) { // False if navigator is disabled (#904) if (this.inverted) { xAxis.options.left = yAxis.options.left = navigator.left; } else { xAxis.options.top = yAxis.options.top = navigator.top; } xAxis.setAxisSize(); yAxis.setAxisSize(); } } } /** * Initialize navigator, if no scrolling exists yet. * @private */ function onChartAfterUpdate(event) { if (!this.navigator && !this.scroller && (this.options.navigator.enabled || this.options.scrollbar.enabled)) { this.scroller = this.navigator = new NavigatorConstructor(this); if (ChartNavigatorComposition_pick(event.redraw, true)) { this.redraw(event.animation); // #7067 } } } /** * Initialize navigator for stock charts * @private */ function onChartBeforeRender() { const options = this.options; if (options.navigator.enabled || options.scrollbar.enabled) { this.scroller = this.navigator = new NavigatorConstructor(this); } } /** * For Stock charts. For x only zooming, do not to create the zoom button * because X axis zooming is already allowed by the Navigator and Range * selector. (#9285) * @private */ function onChartBeforeShowResetZoom() { const chartOptions = this.options, navigator = chartOptions.navigator, rangeSelector = chartOptions.rangeSelector; if (((navigator && navigator.enabled) || (rangeSelector && rangeSelector.enabled)) && ((!isTouchDevice && this.zooming.type === 'x') || (isTouchDevice && this.zooming.pinchType === 'x'))) { return false; } } /** * @private */ function onChartCallback(chart) { const navigator = chart.navigator; // Initialize the navigator if (navigator && chart.xAxis[0]) { const extremes = chart.xAxis[0].getExtremes(); navigator.render(extremes.min, extremes.max); } } /** * Merge options, if no scrolling exists yet * @private */ function onChartUpdate(e) { const navigatorOptions = (e.options.navigator || {}), scrollbarOptions = (e.options.scrollbar || {}); if (!this.navigator && !this.scroller && (navigatorOptions.enabled || scrollbarOptions.enabled)) { merge(true, this.options.navigator, navigatorOptions); merge(true, this.options.scrollbar, scrollbarOptions); delete e.options.navigator; delete e.options.scrollbar; } } /* * * * Default Export * * */ const ChartNavigatorComposition = { compose }; /* harmony default export */ const Navigator_ChartNavigatorComposition = (ChartNavigatorComposition); ;// ./code/es-modules/Core/Axis/NavigatorAxisComposition.js /* * * * (c) 2010-2025 Torstein Honsi * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ const { isTouchDevice: NavigatorAxisComposition_isTouchDevice } = (external_highcharts_src_js_default_default()); const { addEvent: NavigatorAxisComposition_addEvent, correctFloat: NavigatorAxisComposition_correctFloat, defined: NavigatorAxisComposition_defined, isNumber: NavigatorAxisComposition_isNumber, pick: NavigatorAxisComposition_pick } = (external_highcharts_src_js_default_default()); /* * * * Functions * * */ /** * @private */ function onAxisInit() { const axis = this; if (!axis.navigatorAxis) { axis.navigatorAxis = new NavigatorAxisAdditions(axis); } } /** * For Stock charts, override selection zooming with some special features * because X axis zooming is already allowed by the Navigator and Range * selector. * @private */ function onAxisSetExtremes(e) { const axis = this, chart = axis.chart, chartOptions = chart.options, navigator = chartOptions.navigator, navigatorAxis = axis.navigatorAxis, pinchType = chart.zooming.pinchType, rangeSelector = chartOptions.rangeSelector, zoomType = chart.zooming.type; let zoomed; if (axis.isXAxis && (navigator?.enabled || rangeSelector?.enabled)) { // For y only zooming, ignore the X axis completely if (zoomType === 'y' && e.trigger === 'zoom') { zoomed = false; // For xy zooming, record the state of the zoom before zoom selection, // then when the reset button is pressed, revert to this state. This // should apply only if the chart is initialized with a range (#6612), // otherwise zoom all the way out. } else if (((e.trigger === 'zoom' && zoomType === 'xy') || (NavigatorAxisComposition_isTouchDevice && pinchType === 'xy')) && axis.options.range) { const previousZoom = navigatorAxis.previousZoom; // Minimum defined, zooming in if (NavigatorAxisComposition_defined(e.min)) { navigatorAxis.previousZoom = [axis.min, axis.max]; // Minimum undefined, resetting zoom } else if (previousZoom) { e.min = previousZoom[0]; e.max = previousZoom[1]; navigatorAxis.previousZoom = void 0; } } } if (typeof zoomed !== 'undefined') { e.preventDefault(); } } /* * * * Class * * */ /** * @private * @class */ class NavigatorAxisAdditions { /* * * * Static Functions * * */ /** * @private */ static compose(AxisClass) { if (!AxisClass.keepProps.includes('navigatorAxis')) { AxisClass.keepProps.push('navigatorAxis'); NavigatorAxisComposition_addEvent(AxisClass, 'init', onAxisInit); NavigatorAxisComposition_addEvent(AxisClass, 'setExtremes', onAxisSetExtremes); } } /* * * * Constructors * * */ constructor(axis) { this.axis = axis; } /* * * * Functions * * */ /** * @private */ destroy() { this.axis = void 0; } /** * Add logic to normalize the zoomed range in order to preserve the pressed * state of range selector buttons * * @private * @function Highcharts.Axis#toFixedRange */ toFixedRange(pxMin, pxMax, fixedMin, fixedMax) { const axis = this.axis, halfPointRange = (axis.pointRange || 0) / 2; let newMin = NavigatorAxisComposition_pick(fixedMin, axis.translate(pxMin, true, !axis.horiz)), newMax = NavigatorAxisComposition_pick(fixedMax, axis.translate(pxMax, true, !axis.horiz)); // Add/remove half point range to/from the extremes (#1172) if (!NavigatorAxisComposition_defined(fixedMin)) { newMin = NavigatorAxisComposition_correctFloat(newMin + halfPointRange); } if (!NavigatorAxisComposition_defined(fixedMax)) { newMax = NavigatorAxisComposition_correctFloat(newMax - halfPointRange); } if (!NavigatorAxisComposition_isNumber(newMin) || !NavigatorAxisComposition_isNumber(newMax)) { // #1195, #7411 newMin = newMax = void 0; } return { min: newMin, max: newMax }; } } /* * * * Default Export * * */ /* harmony default export */ const NavigatorAxisComposition = (NavigatorAxisAdditions); ;// external ["../highcharts.src.js","default","Color"] const external_highcharts_src_js_default_Color_namespaceObject = __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__["default"].Color; var external_highcharts_src_js_default_Color_default = /*#__PURE__*/__webpack_require__.n(external_highcharts_src_js_default_Color_namespaceObject); ;// external ["../highcharts.src.js","default","SeriesRegistry"] const external_highcharts_src_js_default_SeriesRegistry_namespaceObject = __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__["default"].SeriesRegistry; var external_highcharts_src_js_default_SeriesRegistry_default = /*#__PURE__*/__webpack_require__.n(external_highcharts_src_js_default_SeriesRegistry_namespaceObject); ;// ./code/es-modules/Stock/Navigator/NavigatorDefaults.js /* * * * (c) 2010-2025 Torstein Honsi * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ const { parse: color } = (external_highcharts_src_js_default_Color_default()); const { seriesTypes } = (external_highcharts_src_js_default_SeriesRegistry_default()); /* * * * Constants * * */ /** * The navigator is a small series below the main series, displaying * a view of the entire data set. It provides tools to zoom in and * out on parts of the data as well as panning across the dataset. * * @product highstock gantt * @optionparent navigator */ const NavigatorDefaults = { /** * Whether the navigator and scrollbar should adapt to updated data * in the base X axis. When loading data async, as in the demo below, * this should be `false`. Otherwise new data will trigger navigator * redraw, which will cause unwanted looping. In the demo below, the * data in the navigator is set only once. On navigating, only the main * chart content is updated. * * @sample {highstock} stock/demo/lazy-loading/ * Set to false with async data loading * * @type {boolean} * @default true * @apioption navigator.adaptToUpdatedData */ /** * An integer identifying the index to use for the base series, or a * string representing the id of the series. * * **Note**: As of Highcharts 5.0, this is now a deprecated option. * Prefer [series.showInNavigator](#plotOptions.series.showInNavigator). * * @see [series.showInNavigator](#plotOptions.series.showInNavigator) * * @deprecated * @type {number|string} * @default 0 * @apioption navigator.baseSeries */ /** * Enable or disable the navigator. * * @sample {highstock} stock/navigator/enabled/ * Disable the navigator * * @type {boolean} * @default true * @apioption navigator.enabled */ /** * When the chart is inverted, whether to draw the navigator on the * opposite side. * * @type {boolean} * @default false * @since 5.0.8 * @apioption navigator.opposite */ /** * The height of the navigator. * * @sample {highstock} stock/navigator/height/ * A higher navigator */ height: 40, /** * The distance from the nearest element, the X axis or X axis labels. * * @sample {highstock} stock/navigator/margin/ * A margin of 2 draws the navigator closer to the X axis labels */ margin: 22, /** * Whether the mask should be inside the range marking the zoomed * range, or outside. In Highcharts Stock 1.x it was always `false`. * * @sample {highstock} stock/demo/maskinside-false/ * False, mask outside * * @since 2.0 */ maskInside: true, /** * Options for the handles for dragging the zoomed area. * * @sample {highstock} stock/navigator/handles/ * Colored handles */ handles: { /** * Width for handles. * * @sample {highstock} stock/navigator/styled-handles/ * Styled handles * * @since 6.0.0 */ width: 7, /** * Border radius of the handles. * * @sample {highstock} stock/navigator/handles-border-radius/ * Border radius on the navigator handles. * * @since 11.4.2 */ borderRadius: 0, /** * Height for handles. * * @sample {highstock} stock/navigator/styled-handles/ * Styled handles * * @since 6.0.0 */ height: 15, /** * Array to define shapes of handles. 0-index for left, 1-index for * right. * * Additionally, the URL to a graphic can be given on this form: * `url(graphic.png)`. Note that for the image to be applied to * exported charts, its URL needs to be accessible by the export * server. * * Custom callbacks for symbol path generation can also be added to * `Highcharts.SVGRenderer.prototype.symbols`. The callback is then * used by its method name, as shown in the demo. * * @sample {highstock} stock/navigator/styled-handles/ * Styled handles * * @type {Array<string>} * @default ["navigator-handle", "navigator-handle"] * @since 6.0.0 */ symbols: ['navigator-handle', 'navigator-handle'], /** * Allows to enable/disable handles. * * @since 6.0.0 */ enabled: true, /** * The width for the handle border and the stripes inside. * * @sample {highstock} stock/navigator/styled-handles/ * Styled handles * * @since 6.0.0 * @apioption navigator.handles.lineWidth */ lineWidth: 1, /** * The fill for the handle. * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} */ backgroundColor: "#f2f2f2" /* Palette.neutralColor5 */, /** * The stroke for the handle border and the stripes inside. * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} */ borderColor: "#999999" /* Palette.neutralColor40 */ }, /** * The color of the mask covering the areas of the navigator series * that are currently not visible in the main series. The default * color is bluish with an opacity of 0.3 to see the series below. * * @see In styled mode, the mask is styled with the * `.highcharts-navigator-mask` and * `.highcharts-navigator-mask-inside` classes. * * @sample {highstock} stock/navigator/maskfill/ * Blue, semi transparent mask * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} * @default rgba(102,133,194,0.3) */ maskFill: color("#667aff" /* Palette.highlightColor60 */).setOpacity(0.3).get(), /** * The color of the line marking the currently zoomed area in the * navigator. * * @sample {highstock} stock/navigator/outline/ * 2px blue outline * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} * @default #cccccc */ outlineColor: "#999999" /* Palette.neutralColor40 */, /** * The width of the line marking the currently zoomed area in the * navigator. * * @see In styled mode, the outline stroke width is set with the * `.highcharts-navigator-outline` class. * * @sample {highstock} stock/navigator/outline/ * 2px blue outline * * @type {number} */ outlineWidth: 1, /** * Options for the navigator series. Available options are the same * as any series, documented at [plotOptions](#plotOptions.series) * and [series](#series). * * Unless data is explicitly defined on navigator.series, the data * is borrowed from the first series in the chart. * * Default series options for the navigator series are: * ```js * series: { * type: 'areaspline', * fillOpacity: 0.05, * dataGrouping: { * smoothed: true * }, * lineWidth: 1, * marker: { * enabled: false * } * } * ``` * * @see In styled mode, the navigator series is styled with the * `.highcharts-navigator-series` class. * * @sample {highstock} stock/navigator/series-data/ * Using a separate data set for the navigator * @sample {highstock} stock/navigator/series/ * A green navigator series * * @type {*|Array<*>|Highcharts.SeriesOptionsType|Array<Highcharts.SeriesOptionsType>} */ series: { /** * The type of the navigator series. * * Heads up: * In column-type navigator, zooming is limited to at least one * point with its `pointRange`. * * @sample {highstock} stock/navigator/column/ * Column type navigator * * @type {string} * @default {highstock} `areaspline` if defined, otherwise `line` * @default {gantt} gantt */ type: (typeof seriesTypes.areaspline === 'undefined' ? 'line' : 'areaspline'), /** * The fill opacity of the navigator series. */ fillOpacity: 0.05, /** * The pixel line width of the navigator series. */ lineWidth: 1, /** * @ignore-option */ compare: null, /** * @ignore-option */ sonification: { enabled: false }, /** * Unless data is explicitly defined, the data is borrowed from the * first series in the chart. * * @type {Array<number|Array<number|string|null>|object|null>} * @product highstock * @apioption navigator.series.data */ /** * Data grouping options for the navigator series. * * @extends plotOptions.series.dataGrouping */ dataGrouping: { approximation: 'average', enabled: true, groupPixelWidth: 2, // Replace smoothed property by anchors, #12455. firstAnchor: 'firstPoint', anchor: 'middle', lastAnchor: 'lastPoint', // Day and week differs from plotOptions.series.dataGrouping units: [ ['millisecond', [1, 2, 5, 10, 20, 25, 50, 100, 200, 500]], ['second', [1, 2, 5, 10, 15, 30]], ['minute', [1, 2, 5, 10, 15, 30]], ['hour', [1, 2, 3, 4, 6, 8, 12]], ['day', [1, 2, 3, 4]], ['week', [1, 2, 3]], ['month', [1, 3, 6]], ['year', null] ] }, /** * Data label options for the navigator series. Data labels are * disabled by default on the navigator series. * * @extends plotOptions.series.dataLabels */ dataLabels: { enabled: false, zIndex: 2 // #1839 }, id: 'highcharts-navigator-series', className: 'highcharts-navigator-series', /** * Sets the fill color of the navigator series. * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} * @apioption navigator.series.color */ /** * Line color for the navigator series. Allows setting the color * while disallowing the default candlestick setting. * * @type {Highcharts.ColorString|null} */ lineColor: null, // #4602 marker: { enabled: false }, /** * Since Highcharts Stock v8, default value is the same as default * `pointRange` defined for a specific type (e.g. `null` for * column type). * * In Highcharts Stock version < 8, defaults to 0. * * @extends plotOptions.series.pointRange * @type {number|null} * @apioption navigator.series.pointRange */ /** * The threshold option. Setting it to 0 will make the default * navigator area series draw its area from the 0 value and up. * * @type {number|null} */ threshold: null }, /** * Enable or disable navigator sticking to right, while adding new * points. If `undefined`, the navigator sticks to the axis maximum only * if it was already at the maximum prior to adding points. * * @type {boolean} * @default undefined * @since 10.2.1 * @sample {highstock} stock/navigator/sticktomax-false/ * stickToMax set to false * @apioption navigator.stickToMax */ /** * Options for the navigator X axis. Default series options for the * navigator xAxis are: * ```js * xAxis: { * tickWidth: 0, * lineWidth: 0, * gridLineWidth: 1, * tickPixelInterval: 200, * labels: { * align: 'left', * style: { * color: '#888' * }, * x: 3, * y: -4 * } * } * ``` * * @extends xAxis * @excluding linkedTo, maxZoom, minRange, opposite, range, scrollbar, * showEmpty, maxRange */ xAxis: { /** * Additional range on the right side of the xAxis. Works similar to * `xAxis.maxPadding`, but the value is set in terms of axis values, * percentage or pixels. * * If it's a number, it is interpreted as axis values, which in a * datetime axis equals milliseconds. * * If it's a percentage string, is interpreted as percentages of the * axis length. An overscroll of 50% will make a 100px axis 50px longer. * * If it's a pixel string, it is interpreted as a fixed pixel value, but * limited to 90% of the axis length. * * If it's undefined, the value is inherited from `xAxis.overscroll`. * * Can be set for both, main xAxis and navigator's xAxis. * * @type {number | string | undefined} * @since 6.0.0 * @apioption navigator.xAxis.overscroll */ className: 'highcharts-navigator-xaxis', tickLength: 0, lineWidth: 0, gridLineColor: "#e6e6e6" /* Palette.neutralColor10 */, id: 'navigator-x-axis', gridLineWidth: 1, tickPixelInterval: 200, labels: { align: 'left', /** * @type {Highcharts.CSSObject} */ style: { /** @ignore */ color: "#000000" /* Palette.neutralColor100 */, /**