highcharts 12.0.2 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bower.json +1 -1
- package/es-modules/Accessibility/Options/A11yDefaults.js +2 -0
- package/es-modules/Core/Color/Color.js +5 -12
- package/es-modules/Core/Renderer/HTML/HTMLElement.js +1 -3
- package/es-modules/Core/Renderer/SVG/SVGElement.js +3 -1
- package/es-modules/Core/Renderer/SVG/SVGLabel.js +8 -11
- package/es-modules/Core/Series/DataLabel.js +3 -1
- package/es-modules/Core/Series/Series.js +13 -15
- package/es-modules/Core/Templating.js +14 -10
- package/es-modules/Core/Time.js +6 -3
- package/es-modules/Core/Utilities.js +1 -1
- package/es-modules/Data/Converters/CSVConverter.js +1 -0
- package/es-modules/Data/Converters/DataConverter.js +31 -0
- package/es-modules/Data/Converters/GoogleSheetsConverter.js +1 -0
- package/es-modules/Data/Converters/HTMLTableConverter.js +1 -0
- package/es-modules/Data/Converters/JSONConverter.js +1 -0
- package/es-modules/Extensions/Boost/BoostSeries.js +13 -7
- package/es-modules/Extensions/DragPanes/AxisResizer.js +1 -1
- package/es-modules/Extensions/SeriesLabel/SeriesLabelDefaults.js +7 -2
- package/es-modules/Series/Bubble/BubbleSeries.js +24 -0
- package/es-modules/Series/Organization/OrganizationSeriesDefaults.js +3 -1
- package/es-modules/Series/Timeline/TimelineSeriesDefaults.js +3 -1
- package/es-modules/Series/Treegraph/TreegraphSeriesDefaults.js +3 -1
- package/es-modules/Series/Treemap/TreemapPoint.js +7 -2
- package/es-modules/Series/Treemap/TreemapSeries.js +154 -53
- package/es-modules/Series/Treemap/TreemapSeriesDefaults.js +126 -4
- package/es-modules/Stock/Indicators/VBP/VBPIndicator.js +1 -0
- package/es-modules/Stock/RangeSelector/RangeSelector.js +68 -72
- package/es-modules/Stock/RangeSelector/RangeSelectorDefaults.js +10 -4
- package/es-modules/masters/indicators/indicators-all.src.js +4 -0
- package/es-modules/tsconfig.tsbuildinfo +1 -1
- package/highcharts-3d.js +2 -2
- package/highcharts-3d.src.js +1 -1
- package/highcharts-gantt.js +5 -5
- package/highcharts-gantt.src.js +140 -141
- package/highcharts-more.js +2 -2
- package/highcharts-more.src.js +25 -1
- package/highcharts.d.ts +281 -762
- package/highcharts.js +3 -3
- package/highcharts.src.d.ts +281 -762
- package/highcharts.src.js +57 -60
- package/highmaps.js +5 -5
- package/highmaps.src.js +84 -63
- package/highstock.js +5 -5
- package/highstock.src.js +140 -141
- package/indicators/acceleration-bands.js +2 -2
- package/indicators/acceleration-bands.src.js +1 -1
- package/indicators/accumulation-distribution.js +2 -2
- package/indicators/accumulation-distribution.src.js +1 -1
- package/indicators/ao.js +2 -2
- package/indicators/ao.src.js +1 -1
- package/indicators/apo.js +2 -2
- package/indicators/apo.src.js +1 -1
- package/indicators/aroon-oscillator.js +2 -2
- package/indicators/aroon-oscillator.src.js +1 -1
- package/indicators/aroon.js +2 -2
- package/indicators/aroon.src.js +1 -1
- package/indicators/atr.js +2 -2
- package/indicators/atr.src.js +1 -1
- package/indicators/bollinger-bands.js +2 -2
- package/indicators/bollinger-bands.src.js +1 -1
- package/indicators/cci.js +2 -2
- package/indicators/cci.src.js +1 -1
- package/indicators/chaikin.js +2 -2
- package/indicators/chaikin.src.js +1 -1
- package/indicators/cmf.js +2 -2
- package/indicators/cmf.src.js +1 -1
- package/indicators/cmo.js +2 -2
- package/indicators/cmo.src.js +1 -1
- package/indicators/dema.js +2 -2
- package/indicators/dema.src.js +1 -1
- package/indicators/disparity-index.js +2 -2
- package/indicators/disparity-index.src.js +1 -1
- package/indicators/dmi.js +2 -2
- package/indicators/dmi.src.js +1 -1
- package/indicators/dpo.js +2 -2
- package/indicators/dpo.src.js +1 -1
- package/indicators/ema.js +1 -1
- package/indicators/ichimoku-kinko-hyo.js +2 -2
- package/indicators/ichimoku-kinko-hyo.src.js +1 -1
- package/indicators/indicators-all.js +2 -2
- package/indicators/indicators-all.src.js +6 -1
- package/indicators/indicators.js +2 -2
- package/indicators/indicators.src.js +1 -1
- package/indicators/keltner-channels.js +2 -2
- package/indicators/keltner-channels.src.js +1 -1
- package/indicators/klinger.js +2 -2
- package/indicators/klinger.src.js +1 -1
- package/indicators/macd.js +2 -2
- package/indicators/macd.src.js +1 -1
- package/indicators/mfi.js +2 -2
- package/indicators/mfi.src.js +1 -1
- package/indicators/momentum.js +2 -2
- package/indicators/momentum.src.js +1 -1
- package/indicators/natr.js +2 -2
- package/indicators/natr.src.js +1 -1
- package/indicators/obv.js +2 -2
- package/indicators/obv.src.js +1 -1
- package/indicators/pivot-points.js +2 -2
- package/indicators/pivot-points.src.js +1 -1
- package/indicators/ppo.js +2 -2
- package/indicators/ppo.src.js +1 -1
- package/indicators/price-channel.js +2 -2
- package/indicators/price-channel.src.js +1 -1
- package/indicators/price-envelopes.js +2 -2
- package/indicators/price-envelopes.src.js +1 -1
- package/indicators/psar.js +2 -2
- package/indicators/psar.src.js +1 -1
- package/indicators/regressions.js +2 -2
- package/indicators/regressions.src.js +1 -1
- package/indicators/roc.js +2 -2
- package/indicators/roc.src.js +1 -1
- package/indicators/rsi.js +2 -2
- package/indicators/rsi.src.js +1 -1
- package/indicators/slow-stochastic.js +2 -2
- package/indicators/slow-stochastic.src.js +1 -1
- package/indicators/stochastic.js +2 -2
- package/indicators/stochastic.src.js +1 -1
- package/indicators/supertrend.js +2 -2
- package/indicators/supertrend.src.js +1 -1
- package/indicators/tema.js +2 -2
- package/indicators/tema.src.js +1 -1
- package/indicators/trendline.js +2 -2
- package/indicators/trendline.src.js +1 -1
- package/indicators/trix.js +2 -2
- package/indicators/trix.src.js +1 -1
- package/indicators/volume-by-price.js +2 -2
- package/indicators/volume-by-price.src.js +2 -1
- package/indicators/vwap.js +2 -2
- package/indicators/vwap.src.js +1 -1
- package/indicators/williams-r.js +2 -2
- package/indicators/williams-r.src.js +1 -1
- package/indicators/wma.js +2 -2
- package/indicators/wma.src.js +1 -1
- package/indicators/zigzag.js +2 -2
- package/indicators/zigzag.src.js +1 -1
- package/modules/accessibility.js +2 -2
- package/modules/accessibility.src.js +3 -1
- package/modules/annotations-advanced.js +3 -3
- package/modules/annotations-advanced.src.js +4 -4
- package/modules/annotations.js +2 -2
- package/modules/annotations.src.js +3 -3
- package/modules/arc-diagram.js +2 -2
- package/modules/arc-diagram.src.js +1 -1
- package/modules/arrow-symbols.js +2 -2
- package/modules/arrow-symbols.src.js +1 -1
- package/modules/boost-canvas.js +2 -2
- package/modules/boost-canvas.src.js +14 -11
- package/modules/boost.js +2 -2
- package/modules/boost.src.js +14 -11
- package/modules/broken-axis.js +2 -2
- package/modules/broken-axis.src.js +1 -1
- package/modules/bullet.js +2 -2
- package/modules/bullet.src.js +1 -1
- package/modules/coloraxis.js +2 -2
- package/modules/coloraxis.src.js +1 -1
- package/modules/current-date-indicator.js +2 -2
- package/modules/current-date-indicator.src.js +1 -1
- package/modules/cylinder.js +2 -2
- package/modules/cylinder.src.js +1 -1
- package/modules/data-tools.js +2 -2
- package/modules/data-tools.src.js +36 -1
- package/modules/data.js +2 -2
- package/modules/data.src.js +1 -1
- package/modules/datagrouping.js +2 -2
- package/modules/datagrouping.src.js +1 -1
- package/modules/debugger.js +2 -2
- package/modules/debugger.src.js +1 -1
- package/modules/dependency-wheel.js +2 -2
- package/modules/dependency-wheel.src.js +1 -1
- package/modules/dotplot.js +2 -2
- package/modules/dotplot.src.js +1 -1
- package/modules/drag-panes.js +2 -2
- package/modules/drag-panes.src.js +2 -2
- package/modules/draggable-points.js +2 -2
- package/modules/draggable-points.src.js +1 -1
- package/modules/drilldown.js +2 -2
- package/modules/drilldown.src.js +1 -1
- package/modules/dumbbell.js +2 -2
- package/modules/dumbbell.src.js +1 -1
- package/modules/export-data.js +2 -2
- package/modules/export-data.src.js +1 -1
- package/modules/exporting.js +2 -2
- package/modules/exporting.src.js +1 -1
- package/modules/flowmap.js +2 -2
- package/modules/flowmap.src.js +1 -1
- package/modules/full-screen.js +2 -2
- package/modules/full-screen.src.js +1 -1
- package/modules/funnel.js +2 -2
- package/modules/funnel.src.js +1 -1
- package/modules/funnel3d.js +2 -2
- package/modules/funnel3d.src.js +1 -1
- package/modules/gantt.js +6 -6
- package/modules/gantt.src.js +82 -80
- package/modules/geoheatmap.js +2 -2
- package/modules/geoheatmap.src.js +1 -1
- package/modules/grid-axis.js +2 -2
- package/modules/grid-axis.src.js +1 -1
- package/modules/heatmap.js +3 -3
- package/modules/heatmap.src.js +2 -2
- package/modules/heikinashi.js +2 -2
- package/modules/heikinashi.src.js +1 -1
- package/modules/histogram-bellcurve.js +2 -2
- package/modules/histogram-bellcurve.src.js +1 -1
- package/modules/hollowcandlestick.js +2 -2
- package/modules/hollowcandlestick.src.js +1 -1
- package/modules/item-series.js +2 -2
- package/modules/item-series.src.js +1 -1
- package/modules/lollipop.js +2 -2
- package/modules/lollipop.src.js +1 -1
- package/modules/map.js +4 -4
- package/modules/map.src.js +26 -2
- package/modules/marker-clusters.js +2 -2
- package/modules/marker-clusters.src.js +1 -1
- package/modules/mouse-wheel-zoom.js +2 -2
- package/modules/mouse-wheel-zoom.src.js +1 -1
- package/modules/navigator.js +2 -2
- package/modules/navigator.src.js +1 -1
- package/modules/networkgraph.js +2 -2
- package/modules/networkgraph.src.js +1 -1
- package/modules/no-data-to-display.js +2 -2
- package/modules/no-data-to-display.src.js +1 -1
- package/modules/offline-exporting.js +2 -2
- package/modules/offline-exporting.src.js +2 -2
- package/modules/organization.js +2 -2
- package/modules/organization.src.js +4 -2
- package/modules/overlapping-datalabels.js +2 -2
- package/modules/overlapping-datalabels.src.js +1 -1
- package/modules/parallel-coordinates.js +2 -2
- package/modules/parallel-coordinates.src.js +1 -1
- package/modules/pareto.js +2 -2
- package/modules/pareto.src.js +1 -1
- package/modules/pathfinder.js +2 -2
- package/modules/pathfinder.src.js +1 -1
- package/modules/pattern-fill.js +2 -2
- package/modules/pattern-fill.src.js +1 -1
- package/modules/pictorial.js +2 -2
- package/modules/pictorial.src.js +1 -1
- package/modules/pointandfigure.js +2 -2
- package/modules/pointandfigure.src.js +1 -1
- package/modules/price-indicator.js +2 -2
- package/modules/price-indicator.src.js +1 -1
- package/modules/pyramid3d.js +2 -2
- package/modules/pyramid3d.src.js +1 -1
- package/modules/renko.js +2 -2
- package/modules/renko.src.js +1 -1
- package/modules/sankey.js +2 -2
- package/modules/sankey.src.js +1 -1
- package/modules/series-label.js +2 -2
- package/modules/series-label.src.js +8 -3
- package/modules/series-on-point.js +2 -2
- package/modules/series-on-point.src.js +1 -1
- package/modules/solid-gauge.js +2 -2
- package/modules/solid-gauge.src.js +1 -1
- package/modules/sonification.js +2 -2
- package/modules/sonification.src.js +1 -1
- package/modules/static-scale.js +2 -2
- package/modules/static-scale.src.js +1 -1
- package/modules/stock-tools.js +2 -2
- package/modules/stock-tools.src.js +3 -3
- package/modules/stock.js +6 -6
- package/modules/stock.src.js +82 -80
- package/modules/streamgraph.js +2 -2
- package/modules/streamgraph.src.js +1 -1
- package/modules/sunburst.js +2 -2
- package/modules/sunburst.src.js +290 -62
- package/modules/textpath.js +2 -2
- package/modules/textpath.src.js +1 -1
- package/modules/tiledwebmap.js +3 -3
- package/modules/tiledwebmap.src.js +1 -1
- package/modules/tilemap.js +2 -2
- package/modules/tilemap.src.js +1 -1
- package/modules/timeline.js +2 -2
- package/modules/timeline.src.js +4 -2
- package/modules/treegraph.js +2 -2
- package/modules/treegraph.src.js +4 -2
- package/modules/treegrid.js +2 -2
- package/modules/treegrid.src.js +1 -1
- package/modules/treemap.js +2 -2
- package/modules/treemap.src.js +288 -60
- package/modules/variable-pie.js +2 -2
- package/modules/variable-pie.src.js +1 -1
- package/modules/variwide.js +2 -2
- package/modules/variwide.src.js +1 -1
- package/modules/vector.js +2 -2
- package/modules/vector.src.js +1 -1
- package/modules/venn.js +2 -2
- package/modules/venn.src.js +1 -1
- package/modules/windbarb.js +2 -2
- package/modules/windbarb.src.js +1 -1
- package/modules/wordcloud.js +2 -2
- package/modules/wordcloud.src.js +1 -1
- package/modules/xrange.js +2 -2
- package/modules/xrange.src.js +1 -1
- package/options/treegraph.d.ts +559 -70
- package/options/treegraph.src.d.ts +559 -70
- package/options/treemap.d.ts +314 -160
- package/options/treemap.src.d.ts +314 -160
- package/options/vbp.d.ts +1 -1
- package/options/vbp.src.d.ts +1 -1
- package/package.json +1 -1
- package/standalone-navigator.js +3 -3
- package/standalone-navigator.src.js +58 -61
- package/themes/avocado.js +2 -2
- package/themes/avocado.src.js +1 -1
- package/themes/brand-dark.js +2 -2
- package/themes/brand-dark.src.js +1 -1
- package/themes/brand-light.js +2 -2
- package/themes/brand-light.src.js +1 -1
- package/themes/dark-blue.js +2 -2
- package/themes/dark-blue.src.js +1 -1
- package/themes/dark-green.js +2 -2
- package/themes/dark-green.src.js +1 -1
- package/themes/dark-unica.js +2 -2
- package/themes/dark-unica.src.js +1 -1
- package/themes/gray.js +2 -2
- package/themes/gray.src.js +1 -1
- package/themes/grid-light.js +2 -2
- package/themes/grid-light.src.js +1 -1
- package/themes/grid.js +2 -2
- package/themes/grid.src.js +1 -1
- package/themes/high-contrast-dark.js +2 -2
- package/themes/high-contrast-dark.src.js +1 -1
- package/themes/high-contrast-light.js +2 -2
- package/themes/high-contrast-light.src.js +1 -1
- package/themes/sand-signika.js +2 -2
- package/themes/sand-signika.src.js +1 -1
- package/themes/skies.js +2 -2
- package/themes/skies.src.js +1 -1
- package/themes/sunset.js +2 -2
- package/themes/sunset.src.js +1 -1
|
@@ -26,7 +26,7 @@ import TreemapUtilities from './TreemapUtilities.js';
|
|
|
26
26
|
import TU from '../TreeUtilities.js';
|
|
27
27
|
const { getColor, getLevelOptions, updateRootId } = TU;
|
|
28
28
|
import U from '../../Core/Utilities.js';
|
|
29
|
-
const { addEvent, correctFloat, crisp, defined, error, extend, fireEvent, isArray, isObject, isString, merge, pick, pushUnique, stableSort } = U;
|
|
29
|
+
const { addEvent, correctFloat, crisp, defined, error, extend, fireEvent, isArray, isObject, isString, merge, pick, pushUnique, splat, stableSort } = U;
|
|
30
30
|
/* *
|
|
31
31
|
*
|
|
32
32
|
* Constants
|
|
@@ -183,7 +183,9 @@ class TreemapSeries extends ScatterSeries {
|
|
|
183
183
|
x: pX,
|
|
184
184
|
y: pY,
|
|
185
185
|
width: pW,
|
|
186
|
-
height: pH
|
|
186
|
+
height: pH,
|
|
187
|
+
direction: 0,
|
|
188
|
+
val: 0
|
|
187
189
|
});
|
|
188
190
|
if (directionChange) {
|
|
189
191
|
direction = 1 - direction;
|
|
@@ -220,28 +222,93 @@ class TreemapSeries extends ScatterSeries {
|
|
|
220
222
|
* Over the alignment method by setting z index.
|
|
221
223
|
* @private
|
|
222
224
|
*/
|
|
223
|
-
alignDataLabel(point,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
// long sequence of characters without a whitespace.
|
|
229
|
-
if (style &&
|
|
230
|
-
!defined(style.textOverflow) &&
|
|
231
|
-
dataLabel.text &&
|
|
232
|
-
dataLabel.getBBox().width > (dataLabel.text.textWidth || 0)) {
|
|
233
|
-
dataLabel.css({
|
|
234
|
-
textOverflow: 'ellipsis',
|
|
235
|
-
// Unit (px) is required when useHTML is true
|
|
236
|
-
width: style.width += 'px'
|
|
237
|
-
});
|
|
238
|
-
}
|
|
225
|
+
alignDataLabel(point,
|
|
226
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
227
|
+
dataLabel,
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
229
|
+
labelOptions) {
|
|
239
230
|
ColumnSeries.prototype.alignDataLabel.apply(this, arguments);
|
|
240
231
|
if (point.dataLabel) {
|
|
241
232
|
// `point.node.zIndex` could be undefined (#6956)
|
|
242
233
|
point.dataLabel.attr({ zIndex: (point.node.zIndex || 0) + 1 });
|
|
243
234
|
}
|
|
244
235
|
}
|
|
236
|
+
applyTreeGrouping() {
|
|
237
|
+
const series = this, parentList = series.parentList || {}, { cluster } = series.options, minimumClusterSize = cluster?.minimumClusterSize || 5;
|
|
238
|
+
if (cluster?.enabled) {
|
|
239
|
+
const parentGroups = {};
|
|
240
|
+
const checkIfHide = (node) => {
|
|
241
|
+
if (node?.point?.shapeArgs) {
|
|
242
|
+
const { width = 0, height = 0 } = node.point.shapeArgs, area = width * height;
|
|
243
|
+
const { pixelWidth = 0, pixelHeight = 0 } = cluster, compareHeight = defined(pixelHeight), thresholdArea = pixelHeight ?
|
|
244
|
+
pixelWidth * pixelHeight :
|
|
245
|
+
pixelWidth * pixelWidth;
|
|
246
|
+
if (width < pixelWidth ||
|
|
247
|
+
height < (compareHeight ? pixelHeight : pixelWidth) ||
|
|
248
|
+
area < thresholdArea) {
|
|
249
|
+
if (!node.isGroup && defined(node.parent)) {
|
|
250
|
+
if (!parentGroups[node.parent]) {
|
|
251
|
+
parentGroups[node.parent] = [];
|
|
252
|
+
}
|
|
253
|
+
parentGroups[node.parent].push(node);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
node?.children.forEach((child) => {
|
|
258
|
+
checkIfHide(child);
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
checkIfHide(series.tree);
|
|
262
|
+
for (const parent in parentGroups) {
|
|
263
|
+
if (parentGroups[parent]) {
|
|
264
|
+
if (parentGroups[parent].length > minimumClusterSize) {
|
|
265
|
+
parentGroups[parent].forEach((node) => {
|
|
266
|
+
const index = parentList[parent].indexOf(node.i);
|
|
267
|
+
if (index !== -1) {
|
|
268
|
+
parentList[parent].splice(index, 1);
|
|
269
|
+
const id = `highcharts-grouped-treemap-points-${node.parent || 'root'}`;
|
|
270
|
+
let groupPoint = series.points
|
|
271
|
+
.find((p) => p.id === id);
|
|
272
|
+
if (!groupPoint) {
|
|
273
|
+
const PointClass = series.pointClass, pointIndex = series.points.length;
|
|
274
|
+
groupPoint = new PointClass(series, {
|
|
275
|
+
className: cluster.className,
|
|
276
|
+
color: cluster.color,
|
|
277
|
+
id,
|
|
278
|
+
index: pointIndex,
|
|
279
|
+
isGroup: true,
|
|
280
|
+
value: 0
|
|
281
|
+
});
|
|
282
|
+
extend(groupPoint, {
|
|
283
|
+
formatPrefix: 'cluster'
|
|
284
|
+
});
|
|
285
|
+
series.points.push(groupPoint);
|
|
286
|
+
parentList[parent].push(pointIndex);
|
|
287
|
+
parentList[id] = [];
|
|
288
|
+
}
|
|
289
|
+
const amount = groupPoint.groupedPointsAmount + 1, val = series.points[groupPoint.index]
|
|
290
|
+
.options.value || 0, name = cluster.name ||
|
|
291
|
+
`+ ${amount}`;
|
|
292
|
+
// Update the point directly in points array to
|
|
293
|
+
// prevent wrong instance update
|
|
294
|
+
series.points[groupPoint.index]
|
|
295
|
+
.groupedPointsAmount = amount;
|
|
296
|
+
series.points[groupPoint.index].options.value =
|
|
297
|
+
val + (node.point.value || 0);
|
|
298
|
+
series.points[groupPoint.index].name = name;
|
|
299
|
+
parentList[id].push(node.point.index);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
series.nodeMap = {};
|
|
306
|
+
series.nodeList = [];
|
|
307
|
+
series.parentList = parentList;
|
|
308
|
+
const tree = series.buildTree('', -1, 0, series.parentList);
|
|
309
|
+
series.translate(tree);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
245
312
|
/**
|
|
246
313
|
* Recursive function which calculates the area for all children of a
|
|
247
314
|
* node.
|
|
@@ -256,10 +323,14 @@ class TreemapSeries extends ScatterSeries {
|
|
|
256
323
|
* The rectangular area of the parent.
|
|
257
324
|
*/
|
|
258
325
|
calculateChildrenAreas(parent, area) {
|
|
259
|
-
const series = this, options = series.options, mapOptionsToLevel = series.mapOptionsToLevel, level = mapOptionsToLevel[parent.level + 1], algorithm = pick((
|
|
260
|
-
level
|
|
326
|
+
const series = this, options = series.options, mapOptionsToLevel = series.mapOptionsToLevel, level = mapOptionsToLevel[parent.level + 1], algorithm = pick((level?.layoutAlgorithm &&
|
|
327
|
+
series[level?.layoutAlgorithm] &&
|
|
328
|
+
level.layoutAlgorithm), series.options.layoutAlgorithm), alternate = options.alternateStartingDirection,
|
|
261
329
|
// Collect all children which should be included
|
|
262
|
-
children = parent.children.filter((n) => !n.ignore);
|
|
330
|
+
children = parent.children.filter((n) => parent.isGroup || !n.ignore);
|
|
331
|
+
if (!algorithm) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
263
334
|
let childrenValues = [];
|
|
264
335
|
if (level && level.layoutStartingDirection) {
|
|
265
336
|
area.direction = level.layoutStartingDirection === 'vertical' ?
|
|
@@ -336,15 +407,18 @@ class TreemapSeries extends ScatterSeries {
|
|
|
336
407
|
*/
|
|
337
408
|
drawDataLabels() {
|
|
338
409
|
const series = this, mapOptionsToLevel = series.mapOptionsToLevel, points = series.points.filter(function (n) {
|
|
339
|
-
return n.node.visible;
|
|
340
|
-
});
|
|
410
|
+
return n.node.visible || defined(n.dataLabel);
|
|
411
|
+
}), padding = splat(series.options.dataLabels || {})[0]?.padding;
|
|
341
412
|
let options, level;
|
|
342
413
|
for (const point of points) {
|
|
343
414
|
level = mapOptionsToLevel[point.node.level];
|
|
344
415
|
// Set options to new object to avoid problems with scope
|
|
345
416
|
options = { style: {} };
|
|
346
417
|
// If not a leaf, then label should be disabled as default
|
|
347
|
-
if (!point.node.isLeaf
|
|
418
|
+
if (!point.node.isLeaf &&
|
|
419
|
+
!point.node.isGroup ||
|
|
420
|
+
(point.node.isGroup &&
|
|
421
|
+
point.node.level <= series.nodeMap[series.rootNode].level)) {
|
|
348
422
|
options.enabled = false;
|
|
349
423
|
}
|
|
350
424
|
// If options for level exists, include them as well
|
|
@@ -352,10 +426,12 @@ class TreemapSeries extends ScatterSeries {
|
|
|
352
426
|
options = merge(options, level.dataLabels);
|
|
353
427
|
series.hasDataLabels = () => true;
|
|
354
428
|
}
|
|
355
|
-
// Set dataLabel width to the width of the point shape
|
|
429
|
+
// Set dataLabel width to the width of the point shape minus the
|
|
430
|
+
// padding
|
|
356
431
|
if (point.shapeArgs) {
|
|
357
432
|
const css = {
|
|
358
|
-
width:
|
|
433
|
+
width: ((point.shapeArgs.width || 0) -
|
|
434
|
+
2 * (options.padding || padding || 0)) + 'px',
|
|
359
435
|
lineClamp: Math.floor((point.shapeArgs.height || 0) / 16)
|
|
360
436
|
};
|
|
361
437
|
extend(options.style, css);
|
|
@@ -364,7 +440,7 @@ class TreemapSeries extends ScatterSeries {
|
|
|
364
440
|
// Merge custom options with point options
|
|
365
441
|
point.dlOptions = merge(options, point.options.dataLabels);
|
|
366
442
|
}
|
|
367
|
-
super.drawDataLabels();
|
|
443
|
+
super.drawDataLabels(points);
|
|
368
444
|
}
|
|
369
445
|
/**
|
|
370
446
|
* Override drawPoints
|
|
@@ -435,7 +511,8 @@ class TreemapSeries extends ScatterSeries {
|
|
|
435
511
|
*/
|
|
436
512
|
drillToByGroup(point) {
|
|
437
513
|
let drillId = false;
|
|
438
|
-
if (!point.node.isLeaf
|
|
514
|
+
if ((!point.node.isLeaf ||
|
|
515
|
+
point.node.isGroup) &&
|
|
439
516
|
(point.node.level - this.nodeMap[this.rootNode].level) === 1) {
|
|
440
517
|
drillId = point.id;
|
|
441
518
|
}
|
|
@@ -535,10 +612,11 @@ class TreemapSeries extends ScatterSeries {
|
|
|
535
612
|
getTree() {
|
|
536
613
|
const series = this, allIds = this.data.map(function (d) {
|
|
537
614
|
return d.id;
|
|
538
|
-
})
|
|
615
|
+
});
|
|
616
|
+
series.parentList = series.getListOfParents(this.data, allIds);
|
|
539
617
|
series.nodeMap = {};
|
|
540
618
|
series.nodeList = [];
|
|
541
|
-
return series.buildTree('', -1, 0, parentList);
|
|
619
|
+
return series.buildTree('', -1, 0, series.parentList || {});
|
|
542
620
|
}
|
|
543
621
|
buildTree(id, index, level, list, parent) {
|
|
544
622
|
const series = this, children = [], point = series.points[index];
|
|
@@ -843,16 +921,23 @@ class TreemapSeries extends ScatterSeries {
|
|
|
843
921
|
// Sort the children
|
|
844
922
|
stableSort(children, (a, b) => ((a.sortIndex || 0) - (b.sortIndex || 0)));
|
|
845
923
|
// Set the values
|
|
846
|
-
|
|
924
|
+
let val = pick(point && point.options.value, childrenTotal);
|
|
847
925
|
if (point) {
|
|
848
926
|
point.value = val;
|
|
849
927
|
}
|
|
928
|
+
if (point?.isGroup && options.cluster?.reductionFactor) {
|
|
929
|
+
val /= options.cluster.reductionFactor;
|
|
930
|
+
}
|
|
931
|
+
if (tree.parentNode?.point?.isGroup && series.rootNode !== tree.parent) {
|
|
932
|
+
tree.visible = false;
|
|
933
|
+
}
|
|
850
934
|
extend(tree, {
|
|
851
935
|
children: children,
|
|
852
936
|
childrenTotal: childrenTotal,
|
|
853
937
|
// Ignore this node if point is not visible
|
|
854
938
|
ignore: !(pick(point && point.visible, true) && (val > 0)),
|
|
855
939
|
isLeaf: tree.visible && !childrenTotal,
|
|
940
|
+
isGroup: point?.isGroup,
|
|
856
941
|
levelDynamic: (tree.level - (levelIsConstant ? 0 : nodeRoot.level)),
|
|
857
942
|
name: pick(point && point.name, ''),
|
|
858
943
|
sortIndex: pick(point && point.sortIndex, -val),
|
|
@@ -872,30 +957,41 @@ class TreemapSeries extends ScatterSeries {
|
|
|
872
957
|
stripes(parent, children) {
|
|
873
958
|
return this.algorithmFill(false, parent, children);
|
|
874
959
|
}
|
|
875
|
-
translate() {
|
|
876
|
-
const series = this, options = series.options;
|
|
960
|
+
translate(tree) {
|
|
961
|
+
const series = this, options = series.options, applyGrouping = !tree;
|
|
877
962
|
let // NOTE: updateRootId modifies series.
|
|
878
963
|
rootId = updateRootId(series), rootNode, pointValues, seriesArea, val;
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
964
|
+
if (!tree && !rootId.startsWith('highcharts-grouped-treemap-points-')) {
|
|
965
|
+
// Group points are removed, but not destroyed during generatePoints
|
|
966
|
+
(this.points || []).forEach((point) => {
|
|
967
|
+
if (point.isGroup) {
|
|
968
|
+
point.destroy();
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
// Call prototype function
|
|
972
|
+
super.translate();
|
|
973
|
+
// @todo Only if series.isDirtyData is true
|
|
974
|
+
tree = series.getTree();
|
|
975
|
+
}
|
|
976
|
+
// Ensure `tree` and `series.tree` are synchronized
|
|
977
|
+
series.tree = tree = tree || series.tree;
|
|
883
978
|
rootNode = series.nodeMap[rootId];
|
|
884
|
-
if (rootId !== '' &&
|
|
885
|
-
(!rootNode)) {
|
|
979
|
+
if (rootId !== '' && !rootNode) {
|
|
886
980
|
series.setRootNode('', false);
|
|
887
981
|
rootId = series.rootNode;
|
|
888
982
|
rootNode = series.nodeMap[rootId];
|
|
889
983
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
984
|
+
if (!rootNode.point?.isGroup) {
|
|
985
|
+
series.mapOptionsToLevel = getLevelOptions({
|
|
986
|
+
from: rootNode.level + 1,
|
|
987
|
+
levels: options.levels,
|
|
988
|
+
to: tree.height,
|
|
989
|
+
defaults: {
|
|
990
|
+
levelIsConstant: series.options.levelIsConstant,
|
|
991
|
+
colorByPoint: options.colorByPoint
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
}
|
|
899
995
|
// Parents of the root node is by default visible
|
|
900
996
|
TreemapUtilities.recursive(series.nodeMap[series.rootNode], (node) => {
|
|
901
997
|
const p = node.parent;
|
|
@@ -939,14 +1035,19 @@ class TreemapSeries extends ScatterSeries {
|
|
|
939
1035
|
}
|
|
940
1036
|
// Update axis extremes according to the root node.
|
|
941
1037
|
if (options.allowTraversingTree) {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1038
|
+
if (rootNode.pointValues) {
|
|
1039
|
+
val = rootNode.pointValues;
|
|
1040
|
+
series.xAxis.setExtremes(val.x, val.x + val.width, false);
|
|
1041
|
+
series.yAxis.setExtremes(val.y, val.y + val.height, false);
|
|
1042
|
+
series.xAxis.setScale();
|
|
1043
|
+
series.yAxis.setScale();
|
|
1044
|
+
}
|
|
947
1045
|
}
|
|
948
1046
|
// Assign values to points.
|
|
949
1047
|
series.setPointValues();
|
|
1048
|
+
if (applyGrouping) {
|
|
1049
|
+
series.applyTreeGrouping();
|
|
1050
|
+
}
|
|
950
1051
|
}
|
|
951
1052
|
}
|
|
952
1053
|
/* *
|
|
@@ -26,7 +26,7 @@ const { isString } = U;
|
|
|
26
26
|
* Treemap
|
|
27
27
|
*
|
|
28
28
|
* @extends plotOptions.scatter
|
|
29
|
-
* @excluding
|
|
29
|
+
* @excluding connectEnds, connectNulls, dataSorting, dragDrop, jitter, marker
|
|
30
30
|
* @product highcharts
|
|
31
31
|
* @requires modules/treemap
|
|
32
32
|
* @optionparent plotOptions.treemap
|
|
@@ -53,6 +53,8 @@ const TreemapSeriesDefaults = {
|
|
|
53
53
|
*
|
|
54
54
|
* @sample {highcharts} highcharts/plotoptions/treemap-allowtraversingtree/
|
|
55
55
|
* Enabled
|
|
56
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-grouping-traversing/
|
|
57
|
+
* Traversing to Grouped Points node
|
|
56
58
|
*
|
|
57
59
|
* @since 7.0.3
|
|
58
60
|
* @product highcharts
|
|
@@ -175,11 +177,28 @@ const TreemapSeriesDefaults = {
|
|
|
175
177
|
return name;
|
|
176
178
|
},
|
|
177
179
|
inside: true,
|
|
178
|
-
|
|
180
|
+
padding: 2,
|
|
181
|
+
verticalAlign: 'middle',
|
|
182
|
+
style: {
|
|
183
|
+
textOverflow: 'ellipsis'
|
|
184
|
+
}
|
|
179
185
|
},
|
|
180
186
|
tooltip: {
|
|
181
187
|
headerFormat: '',
|
|
182
|
-
pointFormat: '<b>{point.name}</b>: {point.value}<br/>'
|
|
188
|
+
pointFormat: '<b>{point.name}</b>: {point.value}<br/>',
|
|
189
|
+
/**
|
|
190
|
+
* The HTML of the grouped point's nodes in the tooltip. Works only for
|
|
191
|
+
* Treemap series grouping and analogously to
|
|
192
|
+
* [pointFormat](#tooltip.pointFormat).
|
|
193
|
+
*
|
|
194
|
+
* The grouped nodes point tooltip can be also formatted using
|
|
195
|
+
* `tooltip.formatter` callback function and `point.isGroupNode` flag.
|
|
196
|
+
*
|
|
197
|
+
* @type {string}
|
|
198
|
+
* @default '+ {point.groupedPointsAmount} more...'
|
|
199
|
+
* @apioption tooltip.clusterFormat
|
|
200
|
+
*/
|
|
201
|
+
clusterFormat: '+ {point.groupedPointsAmount} more...<br/>'
|
|
183
202
|
},
|
|
184
203
|
/**
|
|
185
204
|
* Whether to ignore hidden points when the layout algorithm runs.
|
|
@@ -473,7 +492,110 @@ const TreemapSeriesDefaults = {
|
|
|
473
492
|
*
|
|
474
493
|
* @product highcharts
|
|
475
494
|
*/
|
|
476
|
-
traverseToLeaf: false
|
|
495
|
+
traverseToLeaf: false,
|
|
496
|
+
/**
|
|
497
|
+
* An option to optimize treemap series rendering by grouping smaller leaf
|
|
498
|
+
* nodes below a certain square area threshold in pixels. If the square area
|
|
499
|
+
* of a point becomes smaller than the specified threshold, determined by
|
|
500
|
+
* the `pixelWidth` and/or `pixelHeight` options, then this point is moved
|
|
501
|
+
* into one group point per series.
|
|
502
|
+
*
|
|
503
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-grouping-simple
|
|
504
|
+
* Simple demo of Treemap grouping
|
|
505
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-grouping-multiple-parents
|
|
506
|
+
* Treemap grouping with multiple parents
|
|
507
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-grouping-advanced
|
|
508
|
+
* Advanced demo of Treemap grouping
|
|
509
|
+
*
|
|
510
|
+
* @since 12.1.0
|
|
511
|
+
*
|
|
512
|
+
* @excluding allowOverlap, animation, dataLabels, drillToCluster, events,
|
|
513
|
+
* layoutAlgorithm, marker, states, zones
|
|
514
|
+
*
|
|
515
|
+
* @product highcharts
|
|
516
|
+
*/
|
|
517
|
+
cluster: {
|
|
518
|
+
/**
|
|
519
|
+
* An additional, individual class name for the grouped point's graphic
|
|
520
|
+
* representation.
|
|
521
|
+
*
|
|
522
|
+
* @type string
|
|
523
|
+
* @product highcharts
|
|
524
|
+
*/
|
|
525
|
+
className: void 0,
|
|
526
|
+
/**
|
|
527
|
+
* Individual color for the grouped point. By default the color is
|
|
528
|
+
* pulled from the parent color.
|
|
529
|
+
*
|
|
530
|
+
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
|
|
531
|
+
* @product highcharts
|
|
532
|
+
*/
|
|
533
|
+
color: void 0,
|
|
534
|
+
/**
|
|
535
|
+
* Enable or disable Treemap grouping.
|
|
536
|
+
*
|
|
537
|
+
* @type {boolean}
|
|
538
|
+
* @since 12.1.0
|
|
539
|
+
* @product highcharts
|
|
540
|
+
*/
|
|
541
|
+
enabled: false,
|
|
542
|
+
/**
|
|
543
|
+
* The pixel threshold width of area, which is used in Treemap grouping.
|
|
544
|
+
*
|
|
545
|
+
* @type {number}
|
|
546
|
+
* @since 12.1.0
|
|
547
|
+
* @product highcharts
|
|
548
|
+
*/
|
|
549
|
+
pixelWidth: void 0,
|
|
550
|
+
/**
|
|
551
|
+
* The pixel threshold height of area, which is used in Treemap
|
|
552
|
+
* grouping.
|
|
553
|
+
*
|
|
554
|
+
* @type {number}
|
|
555
|
+
* @since 12.1.0
|
|
556
|
+
* @product highcharts
|
|
557
|
+
*/
|
|
558
|
+
pixelHeight: void 0,
|
|
559
|
+
/**
|
|
560
|
+
* The name of the point of grouped nodes shown in the tooltip,
|
|
561
|
+
* dataLabels, etc. By default it is set to '+ n', where n is number of
|
|
562
|
+
* grouped points.
|
|
563
|
+
*
|
|
564
|
+
* @type {string}
|
|
565
|
+
* @since 12.1.0
|
|
566
|
+
* @product highcharts
|
|
567
|
+
*/
|
|
568
|
+
name: void 0,
|
|
569
|
+
/**
|
|
570
|
+
* A configuration property that specifies the factor by which the value
|
|
571
|
+
* and size of a grouped node are reduced. This can be particularly
|
|
572
|
+
* useful when a grouped node occupies a disproportionately large
|
|
573
|
+
* portion of the graph, ensuring better visual balance and readability.
|
|
574
|
+
*
|
|
575
|
+
* @type {number}
|
|
576
|
+
* @since 12.1.0
|
|
577
|
+
* @product highcharts
|
|
578
|
+
*/
|
|
579
|
+
reductionFactor: void 0,
|
|
580
|
+
/**
|
|
581
|
+
* Defines the minimum number of child nodes required to create a group
|
|
582
|
+
* of small nodes.
|
|
583
|
+
*
|
|
584
|
+
* @type {number}
|
|
585
|
+
* @since 12.1.0
|
|
586
|
+
* @product highcharts
|
|
587
|
+
*/
|
|
588
|
+
minimumClusterSize: 5,
|
|
589
|
+
layoutAlgorithm: {
|
|
590
|
+
distance: 0,
|
|
591
|
+
gridSize: 0,
|
|
592
|
+
kmeansThreshold: 0
|
|
593
|
+
},
|
|
594
|
+
marker: {
|
|
595
|
+
lineWidth: 0,
|
|
596
|
+
radius: 0
|
|
597
|
+
}
|
|
598
|
+
}
|
|
477
599
|
};
|
|
478
600
|
/**
|
|
479
601
|
* A `treemap` series. If the [type](#series.treemap.type) option is
|