highcharts
Version:
JavaScript charting framework
1,361 lines (1,327 loc) • 49.4 kB
JavaScript
/**
* @license Highmaps JS v12.2.0 (2025-04-07)
* @module highcharts/modules/heatmap
* @requires highcharts
*
* (c) 2009-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__coloraxis_src_js_cdd22a72__ from "./coloraxis.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 "./coloraxis.src.js"
var x = (y) => {
var x = {}; __webpack_require__.d(x,
y); return x
}
var y = (x) => (() => (x))
const external_coloraxis_src_js_namespaceObject = x({ });
;// 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);
;// external ["../highcharts.src.js","default","SVGElement"]
const external_highcharts_src_js_default_SVGElement_namespaceObject = __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__["default"].SVGElement;
var external_highcharts_src_js_default_SVGElement_default = /*#__PURE__*/__webpack_require__.n(external_highcharts_src_js_default_SVGElement_namespaceObject);
;// ./code/es-modules/Series/ColorMapComposition.js
/* *
*
* (c) 2010-2025 Torstein Honsi
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
const { column: { prototype: columnProto } } = (external_highcharts_src_js_default_SeriesRegistry_default()).seriesTypes;
const { addEvent, defined } = (external_highcharts_src_js_default_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;
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 (external_highcharts_src_js_default_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 (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/Heatmap/HeatmapPoint.js
/* *
*
* (c) 2010-2025 Torstein Honsi
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
const { scatter: { prototype: { pointClass: ScatterPoint } } } = (external_highcharts_src_js_default_SeriesRegistry_default()).seriesTypes;
const { clamp, defined: HeatmapPoint_defined, extend, pick } = (external_highcharts_src_js_default_default());
/* *
*
* Class
*
* */
class HeatmapPoint extends ScatterPoint {
/* *
*
* Functions
*
* */
/** @private */
applyOptions(options, x) {
// #17970, if point is null remove its color, because it may be updated
if (this.isNull || this.value === null) {
delete this.color;
}
super.applyOptions(options, x);
this.formatPrefix = this.isNull || this.value === null ?
'null' : 'point';
return this;
}
/** @private */
getCellAttributes() {
const point = this, series = point.series, seriesOptions = series.options, xPad = (seriesOptions.colsize || 1) / 2, yPad = (seriesOptions.rowsize || 1) / 2, xAxis = series.xAxis, yAxis = series.yAxis, markerOptions = point.options.marker || series.options.marker, pointPlacement = series.pointPlacementToXValue(), // #7860
pointPadding = pick(point.pointPadding, seriesOptions.pointPadding, 0), cellAttr = {
x1: clamp(Math.round(xAxis.len -
xAxis.translate(point.x - xPad, false, true, false, true, -pointPlacement)), -xAxis.len, 2 * xAxis.len),
x2: clamp(Math.round(xAxis.len -
xAxis.translate(point.x + xPad, false, true, false, true, -pointPlacement)), -xAxis.len, 2 * xAxis.len),
y1: clamp(Math.round(yAxis.translate(point.y - yPad, false, true, false, true)), -yAxis.len, 2 * yAxis.len),
y2: clamp(Math.round(yAxis.translate(point.y + yPad, false, true, false, true)), -yAxis.len, 2 * yAxis.len)
};
const dimensions = [['width', 'x'], ['height', 'y']];
// Handle marker's fixed width, and height values including border
// and pointPadding while calculating cell attributes.
for (const dimension of dimensions) {
const prop = dimension[0], direction = dimension[1];
let start = direction + '1', end = direction + '2';
const side = Math.abs(cellAttr[start] - cellAttr[end]), borderWidth = markerOptions &&
markerOptions.lineWidth || 0, plotPos = Math.abs(cellAttr[start] + cellAttr[end]) / 2, widthOrHeight = markerOptions && markerOptions[prop];
if (HeatmapPoint_defined(widthOrHeight) && widthOrHeight < side) {
const halfCellSize = widthOrHeight / 2 + borderWidth / 2;
cellAttr[start] = plotPos - halfCellSize;
cellAttr[end] = plotPos + halfCellSize;
}
// Handle pointPadding
if (pointPadding) {
if ((direction === 'x' && xAxis.reversed) ||
(direction === 'y' && !yAxis.reversed)) {
start = end;
end = direction + '1';
}
cellAttr[start] += pointPadding;
cellAttr[end] -= pointPadding;
}
}
return cellAttr;
}
/**
* @private
*/
haloPath(size) {
if (!size) {
return [];
}
const { x = 0, y = 0, width = 0, height = 0 } = this.shapeArgs || {};
return [
['M', x - size, y - size],
['L', x - size, y + height + size],
['L', x + width + size, y + height + size],
['L', x + width + size, y - size],
['Z']
];
}
/**
* Color points have a value option that determines whether or not it is
* a null point
* @private
*/
isValid() {
// Undefined is allowed
return (this.value !== Infinity &&
this.value !== -Infinity);
}
}
extend(HeatmapPoint.prototype, {
dataLabelOnNull: true,
moveToTopOnHover: true,
ttBelow: false
});
/* *
*
* Default Export
*
* */
/* harmony default export */ const Heatmap_HeatmapPoint = (HeatmapPoint);
;// ./code/es-modules/Series/Heatmap/HeatmapSeriesDefaults.js
/* *
*
* (c) 2010-2025 Torstein Honsi
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
const { isNumber } = (external_highcharts_src_js_default_default());
/* *
*
* API Options
*
* */
/**
* A heatmap is a graphical representation of data where the individual
* values contained in a matrix are represented as colors.
*
* @productdesc {highcharts}
* Requires `modules/heatmap`.
*
* @sample highcharts/demo/heatmap/
* Simple heatmap
* @sample highcharts/demo/heatmap-canvas/
* Heavy heatmap
*
* @extends plotOptions.scatter
* @excluding animationLimit, cluster, connectEnds, connectNulls,
* cropThreshold, dashStyle, dragDrop, findNearestPointBy,
* getExtremesFromAll, jitter, legendSymbolColor, linecap,
* lineWidth, pointInterval, pointIntervalUnit, pointRange,
* pointStart, shadow, softThreshold, stacking, step, threshold
* @product highcharts highmaps
* @optionparent plotOptions.heatmap
*/
const HeatmapSeriesDefaults = {
/**
* Animation is disabled by default on the heatmap series.
*/
animation: false,
/**
* The border radius for each heatmap item. The border's color and
* width can be set in marker options.
*
* @see [lineColor](#plotOptions.heatmap.marker.lineColor)
* @see [lineWidth](#plotOptions.heatmap.marker.lineWidth)
*/
borderRadius: 0,
/**
* The border width for each heatmap item.
*/
borderWidth: 0,
/**
* Padding between the points in the heatmap.
*
* @type {number}
* @default 0
* @since 6.0
* @apioption plotOptions.heatmap.pointPadding
*/
/**
* @default value
* @apioption plotOptions.heatmap.colorKey
*/
/**
* The main color of the series. In heat maps this color is rarely used,
* as we mostly use the color to denote the value of each point. Unless
* options are set in the [colorAxis](#colorAxis), the default value
* is pulled from the [options.colors](#colors) array.
*
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
* @since 4.0
* @product highcharts
* @apioption plotOptions.heatmap.color
*/
/**
* The column size - how many X axis units each column in the heatmap
* should span.
*
* @sample {highcharts} maps/demo/heatmap/
* One day
* @sample {highmaps} maps/demo/heatmap/
* One day
*
* @type {number}
* @default 1
* @since 4.0
* @product highcharts highmaps
* @apioption plotOptions.heatmap.colsize
*/
/**
* The row size - how many Y axis units each heatmap row should span.
*
* @sample {highcharts} maps/demo/heatmap/
* 1 by default
* @sample {highmaps} maps/demo/heatmap/
* 1 by default
*
* @type {number}
* @default 1
* @since 4.0
* @product highcharts highmaps
* @apioption plotOptions.heatmap.rowsize
*/
/**
* Make the heatmap render its data points as an interpolated image.
*
* @sample highcharts/demo/heatmap-interpolation
* Interpolated heatmap image displaying user activity on a website
* @sample highcharts/series-heatmap/interpolation
* Interpolated heatmap toggle
*
*/
interpolation: false,
/**
* The color applied to null points. In styled mode, a general CSS class
* is applied instead.
*
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
*/
nullColor: "#f7f7f7" /* Palette.neutralColor3 */,
dataLabels: {
formatter: function () {
const { numberFormatter } = this.series.chart;
const { value } = this.point;
return isNumber(value) ? numberFormatter(value, -1) : '';
},
inside: true,
verticalAlign: 'middle',
crop: false,
/**
* @ignore-option
*/
overflow: 'allow',
padding: 0 // #3837
},
/**
* @excluding radius, enabledThreshold
* @since 8.1
*/
marker: {
/**
* A predefined shape or symbol for the marker. When undefined, the
* symbol is pulled from options.symbols. Other possible values are
* `'circle'`, `'square'`,`'diamond'`, `'triangle'`,
* `'triangle-down'`, `'rect'`, and `'ellipse'`.
*
* 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 {highcharts} highcharts/plotoptions/series-marker-symbol/
* Predefined, graphic and custom markers
* @sample {highstock} highcharts/plotoptions/series-marker-symbol/
* Predefined, graphic and custom markers
*/
symbol: 'rect',
/** @ignore-option */
radius: 0,
lineColor: void 0,
states: {
/**
* @excluding radius, radiusPlus
*/
hover: {
/**
* Set the marker's fixed width on hover state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption plotOptions.heatmap.marker.states.hover.width
*/
/**
* Set the marker's fixed height on hover state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption plotOptions.heatmap.marker.states.hover.height
*/
/**
* The number of pixels to increase the width of the
* selected point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* 20px greater width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption plotOptions.heatmap.marker.states.hover.widthPlus
*/
/**
* The number of pixels to increase the height of the
* selected point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* 20px greater width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption plotOptions.heatmap.marker.states.hover.heightPlus
*/
/**
* The additional line width for a hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-linewidthplus
* 5 pixels wider lineWidth on hover
* @sample {highmaps} maps/plotoptions/heatmap-marker-states-hover-linewidthplus
* 5 pixels wider lineWidth on hover
*/
lineWidthPlus: 0
},
/**
* @excluding radius
*/
select: {
/**
* Set the marker's fixed width on select state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption plotOptions.heatmap.marker.states.select.width
*/
/**
* Set the marker's fixed height on select state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption plotOptions.heatmap.marker.states.select.height
*/
/**
* The number of pixels to increase the width of the
* selected point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* 20px greater width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption plotOptions.heatmap.marker.states.select.widthPlus
*/
/**
* The number of pixels to increase the height of the
* selected point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* 20px greater width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption plotOptions.heatmap.marker.states.select.heightPlus
*/
}
}
},
clip: true,
/** @ignore-option */
pointRange: null, // Dynamically set to colsize by default
tooltip: {
pointFormat: '{point.x}, {point.y}: {point.value}<br/>'
},
states: {
hover: {
/** @ignore-option */
halo: false, // #3406, halo is disabled on heatmaps by default
/**
* How much to brighten the point on interaction. Requires the
* main color to be defined in hex or rgb(a) format.
*
* In styled mode, the hover brightening is by default replaced
* with a fill-opacity set in the `.highcharts-point:hover`
* rule.
*/
brightness: 0.2
}
},
legendSymbol: 'rectangle'
};
/**
* A `heatmap` series. If the [type](#series.heatmap.type) option is
* not specified, it is inherited from [chart.type](#chart.type).
*
* @productdesc {highcharts}
* Requires `modules/heatmap`.
*
* @extends series,plotOptions.heatmap
* @excluding cropThreshold, dataParser, dataURL, dragDrop ,pointRange, stack,
* @product highcharts highmaps
* @apioption series.heatmap
*/
/**
* An array of data points for the series. For the `heatmap` series
* type, points can be given in the following ways:
*
* 1. An array of arrays with 3 or 2 values. In this case, the values
* correspond to `x,y,value`. If the first value is a string, it is
* applied as the name of the point, and the `x` value is inferred.
* The `x` value can also be omitted, in which case the inner arrays
* should be of length 2\. Then the `x` value is automatically calculated,
* either starting at 0 and incremented by 1, or from `pointStart`
* and `pointInterval` given in the series options.
*
* ```js
* data: [
* [0, 9, 7],
* [1, 10, 4],
* [2, 6, 3]
* ]
* ```
*
* 2. An array of objects with named values. The following snippet shows only a
* few settings, see the complete options set below. If the total number of data
* points exceeds the series' [turboThreshold](#series.heatmap.turboThreshold),
* this option is not available.
*
* ```js
* data: [{
* x: 1,
* y: 3,
* value: 10,
* name: "Point2",
* color: "#00FF00"
* }, {
* x: 1,
* y: 7,
* value: 10,
* name: "Point1",
* color: "#FF00FF"
* }]
* ```
*
* @sample {highcharts} highcharts/chart/reflow-true/
* Numerical values
* @sample {highcharts} highcharts/series/data-array-of-arrays/
* Arrays of numeric x and y
* @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
* Arrays of datetime x and y
* @sample {highcharts} highcharts/series/data-array-of-name-value/
* Arrays of point.name and y
* @sample {highcharts} highcharts/series/data-array-of-objects/
* Config objects
*
* @type {Array<Array<number>|*>}
* @extends series.line.data
* @product highcharts highmaps
* @apioption series.heatmap.data
*/
/**
* The color of the point. In heat maps the point color is rarely set
* explicitly, as we use the color to denote the `value`. Options for
* this are set in the [colorAxis](#colorAxis) configuration.
*
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
* @product highcharts highmaps
* @apioption series.heatmap.data.color
*/
/**
* The value of the point, resulting in a color controlled by options
* as set in the [colorAxis](#colorAxis) configuration.
*
* @type {number}
* @product highcharts highmaps
* @apioption series.heatmap.data.value
*/
/**
* The x value of the point. For datetime axes,
* the X value is the timestamp in milliseconds since 1970.
*
* @type {number}
* @product highcharts highmaps
* @apioption series.heatmap.data.x
*/
/**
* The y value of the point.
*
* @type {number}
* @product highcharts highmaps
* @apioption series.heatmap.data.y
*/
/**
* Point padding for a single point.
*
* @sample maps/plotoptions/tilemap-pointpadding
* Point padding on tiles
*
* @type {number}
* @product highcharts highmaps
* @apioption series.heatmap.data.pointPadding
*/
/**
* @excluding radius, enabledThreshold
* @product highcharts highmaps
* @since 8.1
* @apioption series.heatmap.data.marker
*/
/**
* @excluding radius, enabledThreshold
* @product highcharts highmaps
* @since 8.1
* @apioption series.heatmap.marker
*/
/**
* @excluding radius, radiusPlus
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.hover
*/
/**
* @excluding radius
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.select
*/
/**
* @excluding radius, radiusPlus
* @product highcharts highmaps
* @apioption series.heatmap.data.marker.states.hover
*/
/**
* @excluding radius
* @product highcharts highmaps
* @apioption series.heatmap.data.marker.states.select
*/
/**
* Set the marker's fixed width on hover state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-linewidthplus
* 5 pixels wider lineWidth on hover
*
* @type {number|undefined}
* @default 0
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.hover.lineWidthPlus
*/
/**
* Set the marker's fixed width on hover state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.hover.width
*/
/**
* Set the marker's fixed height on hover state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.hover.height
*/
/**
* The number of pixels to increase the width of the
* hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* One day
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.hover.widthPlus
*/
/**
* The number of pixels to increase the height of the
* hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* One day
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.hover.heightPlus
*/
/**
* The number of pixels to increase the width of the
* hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* One day
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.select.widthPlus
*/
/**
* The number of pixels to increase the height of the
* hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* One day
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.marker.states.select.heightPlus
*/
/**
* Set the marker's fixed width on hover state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-linewidthplus
* 5 pixels wider lineWidth on hover
*
* @type {number|undefined}
* @default 0
* @product highcharts highmaps
* @apioption series.heatmap.data.marker.states.hover.lineWidthPlus
*/
/**
* Set the marker's fixed width on hover state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.data.marker.states.hover.width
*/
/**
* Set the marker's fixed height on hover state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.data.marker.states.hover.height
*/
/**
* The number of pixels to increase the width of the
* hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* One day
*
* @type {number|undefined}
* @default undefined
* @product highcharts highstock
* @apioption series.heatmap.data.marker.states.hover.widthPlus
*/
/**
* The number of pixels to increase the height of the
* hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* One day
*
* @type {number|undefined}
* @default undefined
* @product highcharts highstock
* @apioption series.heatmap.data.marker.states.hover.heightPlus
*/
/**
* Set the marker's fixed width on select state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.data.marker.states.select.width
*/
/**
* Set the marker's fixed height on select state.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-width
* 70px fixed marker's width and height on hover
*
* @type {number|undefined}
* @default undefined
* @product highcharts highmaps
* @apioption series.heatmap.data.marker.states.select.height
*/
/**
* The number of pixels to increase the width of the
* hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* One day
*
* @type {number|undefined}
* @default undefined
* @product highcharts highstock
* @apioption series.heatmap.data.marker.states.select.widthPlus
*/
/**
* The number of pixels to increase the height of the
* hovered point.
*
* @sample {highcharts} maps/plotoptions/heatmap-marker-states-hover-widthplus
* One day
*
* @type {number|undefined}
* @default undefined
* @product highcharts highstock
* @apioption series.heatmap.data.marker.states.select.heightPlus
*/
''; // Keeps doclets above separate
/* *
*
* Default Export
*
* */
/* harmony default export */ const Heatmap_HeatmapSeriesDefaults = (HeatmapSeriesDefaults);
;// external ["../highcharts.src.js","default","SVGRenderer"]
const external_highcharts_src_js_default_SVGRenderer_namespaceObject = __WEBPACK_EXTERNAL_MODULE__highcharts_src_js_8202131d__["default"].SVGRenderer;
var external_highcharts_src_js_default_SVGRenderer_default = /*#__PURE__*/__webpack_require__.n(external_highcharts_src_js_default_SVGRenderer_namespaceObject);
;// ./code/es-modules/Series/InterpolationUtilities.js
/* *
*
* (c) 2010-2025 Hubert Kozik
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
const { doc } = (external_highcharts_src_js_default_default());
const { defined: InterpolationUtilities_defined, pick: InterpolationUtilities_pick } = (external_highcharts_src_js_default_default());
/* *
*
* Functions
*
* */
/**
* Find color of point based on color axis.
*
* @function Highcharts.colorFromPoint
*
* @param {number | null} value
* Value to find corresponding color on the color axis.
*
* @param {Highcharts.Point} point
* Point to find it's color from color axis.
*
* @return {number[]}
* Color in RGBa array.
*/
function colorFromPoint(value, point) {
const colorAxis = point.series.colorAxis;
if (colorAxis) {
const rgba = (colorAxis.toColor(value || 0, point)
.split(')')[0]
.split('(')[1]
.split(',')
.map((s) => InterpolationUtilities_pick(parseFloat(s), parseInt(s, 10))));
rgba[3] = InterpolationUtilities_pick(rgba[3], 1.0) * 255;
if (!InterpolationUtilities_defined(value) || !point.visible) {
rgba[3] = 0;
}
return rgba;
}
return [0, 0, 0, 0];
}
/**
* Method responsible for creating a canvas for interpolation image.
* @private
*/
function getContext(series) {
const { canvas, context } = series;
if (canvas && context) {
context.clearRect(0, 0, canvas.width, canvas.height);
}
else {
series.canvas = doc.createElement('canvas');
series.context = series.canvas.getContext('2d', {
willReadFrequently: true
}) || void 0;
return series.context;
}
return context;
}
const InterpolationUtilities = {
colorFromPoint,
getContext
};
/* harmony default export */ const Series_InterpolationUtilities = (InterpolationUtilities);
;// ./code/es-modules/Series/Heatmap/HeatmapSeries.js
/* *
*
* (c) 2010-2025 Torstein Honsi
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
const { series: Series, seriesTypes: { column: ColumnSeries, scatter: ScatterSeries } } = (external_highcharts_src_js_default_SeriesRegistry_default());
const { prototype: { symbols } } = (external_highcharts_src_js_default_SVGRenderer_default());
const { addEvent: HeatmapSeries_addEvent, extend: HeatmapSeries_extend, fireEvent, isNumber: HeatmapSeries_isNumber, merge, pick: HeatmapSeries_pick } = (external_highcharts_src_js_default_default());
const { colorFromPoint: HeatmapSeries_colorFromPoint, getContext: HeatmapSeries_getContext } = Series_InterpolationUtilities;
/* *
*
* Class
*
* */
/**
* @private
* @class
* @name Highcharts.seriesTypes.heatmap
*
* @augments Highcharts.Series
*/
class HeatmapSeries extends ScatterSeries {
constructor() {
/* *
*
* Static Properties
*
* */
super(...arguments);
this.valueMax = NaN;
this.valueMin = NaN;
this.isDirtyCanvas = true;
/* eslint-enable valid-jsdoc */
}
/* *
*
* Functions
*
* */
/**
* @private
*/
drawPoints() {
const series = this, seriesOptions = series.options, interpolation = seriesOptions.interpolation, seriesMarkerOptions = seriesOptions.marker || {};
if (interpolation) {
const { image, chart, xAxis, yAxis } = series, { reversed: xRev = false, len: width } = xAxis, { reversed: yRev = false, len: height } = yAxis, dimensions = { width, height };
if (!image || series.isDirtyData || series.isDirtyCanvas) {
const ctx = HeatmapSeries_getContext(series), { canvas, options: { colsize = 1, rowsize = 1 }, points, points: { length } } = series, pointsLen = length - 1, colorAxis = (chart.colorAxis && chart.colorAxis[0]);
if (canvas && ctx && colorAxis) {
const { min: xMin, max: xMax } = xAxis.getExtremes(), { min: yMin, max: yMax } = yAxis.getExtremes(), xDelta = xMax - xMin, yDelta = yMax - yMin, imgMultiple = 8.0, lastX = Math.round(imgMultiple * ((xDelta / colsize) / imgMultiple)), lastY = Math.round(imgMultiple * ((yDelta / rowsize) / imgMultiple)), [transformX, transformY] = [
[lastX, lastX / xDelta, xRev, 'ceil'],
[lastY, lastY / yDelta, !yRev, 'floor']
].map(([last, scale, rev, rounding]) => (rev ?
(v) => (Math[rounding](last -
(scale * (v)))) :
(v) => (Math[rounding](scale * v)))), canvasWidth = canvas.width = lastX + 1, canvasHeight = canvas.height = lastY + 1, canvasArea = canvasWidth * canvasHeight, pixelToPointScale = pointsLen / canvasArea, pixelData = new Uint8ClampedArray(canvasArea * 4), pointInPixels = (x, y) => (Math.ceil((canvasWidth * transformY(y - yMin)) +
transformX(x - xMin)) * 4);
series.buildKDTree();
for (let i = 0; i < canvasArea; i++) {
const point = points[Math.ceil(pixelToPointScale * i)], { x, y } = point;
pixelData.set(HeatmapSeries_colorFromPoint(point.value, point), pointInPixels(x, y));
}
ctx.putImageData(new ImageData(pixelData, canvasWidth), 0, 0);
if (image) {
image.attr({
...dimensions,
href: canvas.toDataURL('image/png', 1)
});
}
else {
series.directTouch = false;
series.image = chart.renderer.image(canvas.toDataURL('image/png', 1))
.attr(dimensions)
.add(series.group);
}
}
series.isDirtyCanvas = false;
}
else if (image.width !== width || image.height !== height) {
image.attr(dimensions);
}
}
else if (seriesMarkerOptions.enabled || series._hasPointMarkers) {
Series.prototype.drawPoints.call(series);
series.points.forEach((point) => {
if (point.graphic) {
// In styled mode, use CSS, otherwise the fill used in
// the style sheet will take precedence over
// the fill attribute.
point.graphic[series.chart.styledMode ? 'css' : 'animate'](series.colorAttribs(point));
if (point.value === null) { // #15708
point.graphic.addClass('highcharts-null-point');
}
}
});
}
}
/**
* @private
*/
getExtremes() {
// Get the extremes from the value data
const { dataMin, dataMax } = Series.prototype.getExtremes
.call(this, this.getColumn('value'));
if (HeatmapSeries_isNumber(dataMin)) {
this.valueMin = dataMin;
}
if (HeatmapSeries_isNumber(dataMax)) {
this.valueMax = dataMax;
}
// Get the extremes from the y data
return Series.prototype.getExtremes.call(this);
}
/**
* Override to also allow null points, used when building the k-d-tree for
* tooltips in boost mode.
* @private
*/
getValidPoints(points, insideOnly) {
return Series.prototype.getValidPoints.call(this, points, insideOnly, true);
}
/**
* Define hasData function for non-cartesian series. Returns true if the
* series has points at all.
* @private
*/
hasData() {
return !!this.dataTable.rowCount;
}
/**
* Override the init method to add point ranges on both axes.
* @private
*/
init() {
super.init.apply(this, arguments);
const options = this.options;
// #3758, prevent resetting in setData
options.pointRange = HeatmapSeries_pick(options.pointRange, options.colsize || 1);
// General point range
this.yAxis.axisPointRange = options.rowsize || 1;
// Bind new symbol names
symbols.ellipse = symbols.circle;
// @todo
//
// Setting the border radius here is a workaround. It should be set in
// the shapeArgs or returned from `markerAttribs`. However,
// Series.drawPoints does not pick up markerAttribs to be passed over to
// `renderer.symbol`. Also, image symbols are not positioned by their
// top left corner like other symbols are. This should be refactored,
// then we could save ourselves some tests for .hasImage etc. And the
// evaluation of borderRadius would be moved to `markerAttribs`.
if (options.marker && HeatmapSeries_isNumber(options.borderRadius)) {
options.marker.r = options.borderRadius;
}
}
/**
* @private
*/
markerAttribs(point, state) {
const shapeArgs = point.shapeArgs || {};
if (point.hasImage) {
return {
x: point.plotX,
y: point.plotY
};
}
// Setting width and height attributes on image does not affect on its
// dimensions.
if (state && state !== 'normal') {
const pointMarkerOptions = point.options.marker || {}, seriesMarkerOptions = this.options.marker || {}, seriesStateOptions = (seriesMarkerOptions.states?.[state]) || {}, pointStateOptions = (pointMarkerOptions.states?.[state]) || {};
// Set new width and height basing on state options.
const width = (pointStateOptions.width ||
seriesStateOptions.width ||
shapeArgs.width ||
0) + (pointStateOptions.widthPlus ||
seriesStateOptions.widthPlus ||
0);
const height = (pointStateOptions.height ||
seriesStateOptions.height ||
shapeArgs.height ||
0) + (pointStateOptions.heightPlus ||
seriesStateOptions.heightPlus ||
0);
// Align marker by the new size.
const x = (shapeArgs.x || 0) + ((shapeArgs.width || 0) - width) / 2, y = (shapeArgs.y || 0) + ((shapeArgs.height || 0) - height) / 2;
return { x, y, width, height };
}
return shapeArgs;
}
/**
* @private
*/
pointAttribs(point, state) {
const series = this, attr = Series.prototype.pointAttribs.call(series, point, state), seriesOptions = series.options || {}, plotOptions = series.chart.options.plotOptions || {}, seriesPlotOptions = plotOptions.series || {}, heatmapPlotOptions = plotOptions.heatmap || {},
// Get old properties in order to keep backward compatibility
borderColor = point?.options.borderColor ||
seriesOptions.borderColor ||
heatmapPlotOptions.borderColor ||
seriesPlotOptions.borderColor, borderWidth = point?.options.borderWidth ||
seriesOptions.borderWidth ||
heatmapPlotOptions.borderWidth ||
seriesPlotOptions.borderWidth ||
attr['stroke-width'];
// Apply lineColor, or set it to default series color.
attr.stroke = (point?.marker?.lineColor ||
seriesOptions.marker?.lineColor ||
borderColor ||
this.color);
// Apply old borderWidth property if exists.
attr['stroke-width'] = borderWidth;
if (state && state !== 'normal') {
const stateOptions = merge(seriesOptions.states?.[state], seriesOptions.marker?.states?.[state], point?.options.states?.[state] || {});
attr.fill =
stateOptions.color ||
external_highcharts_src_js_default_Color_default().parse(attr.fill).brighten(stateOptions.brightness || 0).get();
attr.stroke = (stateOptions.lineColor || attr.stroke); // #17896
}
return attr;
}
/**
* @private
*/
translate() {
const series = this, options = series.options, { borderRadius, marker } = options, symbol = marker?.symbol || 'rect', shape = symbols[symbol] ? symbol : 'rect', hasRegularShape = ['circle', 'square'].indexOf(shape) !== -1;
series.generatePoints();
for (const point of series.points) {
const cellAttr = point.getCellAttributes();
let x = Math.min(cellAttr.x1, cellAttr.x2), y = Math.min(cellAttr.y1, cellAttr.y2), width = Math.max(Math.abs(cellAttr.x2 - cellAttr.x1), 0), height = Math.max(Math.abs(cellAttr.y2 - cellAttr.y1), 0);
point.hasImage = (point.marker?.symbol || symbol || '').indexOf('url') === 0;
// If marker shape is regular (square), find the shorter cell's
// side.
if (hasRegularShape) {
const sizeDiff = Math.abs(width - height);
x = Math.min(cellAttr.x1, cellAttr.x2) +
(width < height ? 0 : sizeDiff / 2);
y = Math.min(cellAttr.y1, cellAttr.y2) +
(width < height ? sizeDiff / 2 : 0);
width = height = Math.min(width, height);
}
if (point.hasImage) {
point.marker = { width, height };
}
point.plotX = point.clientX = (cellAttr.x1 + cellAttr.x2) / 2;
point.plotY = (cellAttr.y1 + cellAttr.y2) / 2;
point.shapeType = 'path';
point.shapeArgs = merge(true, { x, y, width, height }, {
d: symbols[shape](x, y, width, height, { r: HeatmapSeries_isNumber(borderRadius) ? borderRadius : 0 })
});
}
fireEvent(series, 'afterTranslate');
}
}
HeatmapSeries.defaultOptions = merge(ScatterSeries.defaultOptions, Heatmap_HeatmapSeriesDefaults);
HeatmapSeries_addEvent(HeatmapSeries, 'afterDataClassLegendClick', function () {
this.isDirtyCanvas = true;
this.drawPoints();
});
HeatmapSeries_extend(HeatmapSeries.prototype, {
axisTypes: Series_ColorMapComposition.seriesMembers.axisTypes,
colorKey: Series_ColorMapComposition.seriesMembers.colorKey,
directTouch: true,
getExtremesFromAll: true,
keysAffectYAxis: ['y'],
parallelArrays: Series_ColorMapComposition.seriesMembers.parallelArrays,
pointArrayMap: ['y', 'value'],
pointClass: Heatmap_HeatmapPoint,
specialGroup: 'group',
trackerGroups: Series_ColorMapComposition.seriesMembers.trackerGroups,
/**
* @private
*/
alignDataLabel: ColumnSeries.prototype.alignDataLabel,
colorAttribs: Series_ColorMapComposition.seriesMembers.colorAttribs,
getSymbol: Series.prototype.getSymbol
});
Series_ColorMapComposition.compose(HeatmapSeries);
external_highcharts_src_js_default_SeriesRegistry_default().registerSeriesType('heatmap', HeatmapSeries);
/* *
*
* Default Export
*
* */
/* harmony default export */ const Heatmap_HeatmapSeries = ((/* unused pure expression or super */ null && (HeatmapSeries)));
/* *
*
* API Declarations
*
* */
/**
* Heatmap series only. Padding between the points in the heatmap.
* @name Highcharts.Point#pointPadding
* @type {number|undefined}
*/
/**
* Heatmap series only. The value of the point, resulting in a color
* controlled by options as set in the colorAxis configuration.
* @name Highcharts.Point#value
* @type {number|null|undefined}
*/
/* *
* @interface Highcharts.PointOptionsObject in parts/Point.ts
*/ /**
* Heatmap series only. Point padding for a single point.
* @name Highcharts.PointOptionsObject#pointPadding
* @type {number|undefined}
*/ /**
* Heatmap series only. The value of the point, resulting in a color controlled
* by options as set in the colorAxis configuration.
* @name Highcharts.PointOptionsObject#value
* @type {number|null|undefined}
*/
''; // Detach doclets above
;// ./code/es-modules/masters/modules/heatmap.src.js
/* harmony default export */ const heatmap_src = ((external_highcharts_src_js_default_default()));
export { heatmap_src as default };