highcharts
Version:
JavaScript charting framework
639 lines (638 loc) • 20.8 kB
JavaScript
/* *
*
* (c) 2010-2025 Torstein Honsi
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
'use strict';
import U from '../../Core/Utilities.js';
const { isNumber } = U;
/* *
*
* 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.
*
* 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
*
* */
export default HeatmapSeriesDefaults;