highcharts
Version:
JavaScript charting framework
249 lines (234 loc) • 9.28 kB
JavaScript
// SPDX-License-Identifier: LicenseRef-Highcharts
/**
* @license Highcharts Gantt JS v13.0.1 (2026-08-17)
* @module highcharts/modules/current-date-indicator
* @requires highcharts
*
* CurrentDateIndicator
*
* (c) 2010-2026 Highsoft AS
* Author: Lars A. V. Cabrera
*
* A commercial license may be required depending on use,
* see www.highcharts.com/license
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(root["_Highcharts"]);
else if(typeof define === 'function' && define.amd)
define("highcharts/modules/current-date-indicator", ["highcharts/highcharts"], function (amd1) {return factory(amd1);});
else if(typeof exports === 'object')
exports["highcharts/modules/current-date-indicator"] = factory(root["_Highcharts"]);
else
root["Highcharts"] = factory(root["Highcharts"]);
})(typeof window === 'undefined' ? this : window, (__WEBPACK_EXTERNAL_MODULE__944__) => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 944
(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__944__;
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ const __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ const cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ const 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) => {
/******/ const getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter/value functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ if(Array.isArray(definition)) {
/******/ var i = 0;
/******/ while(i < definition.length) {
/******/ var key = definition[i++];
/******/ var binding = definition[i++];
/******/ if(!__webpack_require__.o(exports, key)) {
/******/ if(binding === 0) {
/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
/******/ } else {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
/******/ }
/******/ } else if(binding === 0) { i++; }
/******/ }
/******/ } else {
/******/ 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))
/******/ })();
/******/
/************************************************************************/
let __webpack_exports__ = {};
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ current_date_indicator_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/CurrentDateIndication.js
/* *
*
* (c) 2016-2026 Highsoft AS
*
* Author: Lars A. V. Cabrera
*
* Integration of this software requires a license.
* - For commercial use, see www.highcharts.com/license
* - For non-commercial, see www.highcharts.com/license-eula
*
*
* */
const { composed } = (highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default());
/* *
*
* Constants
*
* */
/**
* Show an indicator on the axis for the current date and time. Can be a
* boolean or a configuration object similar to
* [xAxis.plotLines](#xAxis.plotLines).
*
* @sample gantt/current-date-indicator/demo
* Current date indicator enabled
* @sample gantt/current-date-indicator/object-config
* Current date indicator with custom options
*
* @declare Highcharts.CurrentDateIndicatorOptions
* @type {boolean|CurrentDateIndicatorOptions}
* @default true
* @extends xAxis.plotLines
* @excluding className, value
* @product gantt
* @apioption xAxis.currentDateIndicator
*/
const defaultOptions = {
/**
* @type {Highcharts.ColorType}
*/
color: 'var(--highcharts-highlight-color-20)',
width: 2,
/**
* @declare Highcharts.AxisCurrentDateIndicatorLabelOptions
*/
label: {
/**
* Format of the label. This options is passed as the first argument to
* [dateFormat](/class-reference/Highcharts.Time#dateFormat) function.
*
* @type {string|Intl.DateTimeFormatOptions}
* @product gantt
* @default %[abdYHM]
* @apioption xAxis.currentDateIndicator.label.format
*/
format: '%[abdYHM]',
formatter: function (value, format) {
return this.axis.chart.time.dateFormat(format || '', value, true);
},
rotation: 0,
/**
* @type {Highcharts.CSSObject}
*/
style: {
/** @internal */
fontSize: '0.7em'
}
}
};
/* *
*
* Functions
*
* */
/** @internal */
function composeCurrentDateIndication(AxisClass, PlotLineOrBandClass) {
if ((0,highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_.pushUnique)(composed, 'CurrentDateIndication')) {
(0,highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_.addEvent)(AxisClass, 'afterSetOptions', onAxisAfterSetOptions);
(0,highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_.addEvent)(PlotLineOrBandClass, 'render', onPlotLineOrBandRender);
(0,highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_.wrap)(PlotLineOrBandClass.prototype, 'getLabelText', wrapPlotLineOrBandGetLabelText);
}
}
/** @internal */
function onAxisAfterSetOptions() {
const options = this.options, cdiOptions = options.currentDateIndicator;
if (cdiOptions) {
const plotLineOptions = typeof cdiOptions === 'object' ?
(0,highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_.merge)(defaultOptions, cdiOptions) :
(0,highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_.merge)(defaultOptions);
plotLineOptions.value = Date.now();
plotLineOptions.className = 'highcharts-current-date-indicator';
options.plotLines ?? (options.plotLines = []);
options.plotLines.push(plotLineOptions);
}
}
/** @internal */
function onPlotLineOrBandRender() {
// If the label already exists, update its text
this.label?.attr({
text: this.getLabelText(this.options.label || {})
});
}
/** @internal */
function wrapPlotLineOrBandGetLabelText(defaultMethod, defaultLabelOptions) {
if (this.options.className &&
this.options.className.indexOf('highcharts-current-date-indicator') !== -1 &&
typeof this.options.label?.formatter === 'function') {
const options = this.options;
options.value = Date.now();
return options.label?.formatter?.call(this, options.value, options.label.format, this) || '';
}
return defaultMethod.call(this, defaultLabelOptions);
}
;// ./code/es-modules/masters/modules/current-date-indicator.src.js
const G = (highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default());
composeCurrentDateIndication(G.Axis, G.PlotLineOrBand);
/* harmony default export */ const current_date_indicator_src = ((highcharts_commonjs_highcharts_commonjs2_highcharts_root_Highcharts_default()));
__webpack_exports__ = __webpack_exports__["default"];
/******/ return __webpack_exports__;
/******/ })()
;
});