highcharts 12.0.1 → 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/Axis/Axis.js +1 -1
- 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 +11 -3
- package/es-modules/Core/Renderer/SVG/SVGLabel.js +8 -11
- package/es-modules/Core/Renderer/SVG/TextBuilder.js +1 -1
- 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/Tooltip.js +2 -1
- package/es-modules/Core/Utilities.js +54 -54
- 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/Boost/WGLRenderer.js +12 -4
- package/es-modules/Extensions/DragPanes/AxisResizer.js +1 -1
- package/es-modules/Extensions/Drilldown/Drilldown.js +3 -3
- package/es-modules/Extensions/SeriesLabel/SeriesLabelDefaults.js +7 -2
- package/es-modules/Series/Bubble/BubbleSeries.js +24 -0
- package/es-modules/Series/Line/LineSeries.js +2 -4
- 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 +69 -73
- 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 +5 -5
- package/highcharts-gantt.js +5 -5
- package/highcharts-gantt.src.js +162 -158
- package/highcharts-more.js +2 -2
- package/highcharts-more.src.js +29 -5
- package/highcharts.d.ts +281 -762
- package/highcharts.js +3 -3
- package/highcharts.src.d.ts +281 -762
- package/highcharts.src.js +78 -76
- package/highmaps.js +5 -5
- package/highmaps.src.js +105 -79
- package/highstock.js +5 -5
- package/highstock.src.js +162 -158
- package/indicators/acceleration-bands.js +2 -2
- package/indicators/acceleration-bands.src.js +5 -5
- package/indicators/accumulation-distribution.js +2 -2
- package/indicators/accumulation-distribution.src.js +5 -5
- package/indicators/ao.js +2 -2
- package/indicators/ao.src.js +5 -5
- package/indicators/apo.js +2 -2
- package/indicators/apo.src.js +5 -5
- package/indicators/aroon-oscillator.js +2 -2
- package/indicators/aroon-oscillator.src.js +5 -5
- package/indicators/aroon.js +2 -2
- package/indicators/aroon.src.js +5 -5
- package/indicators/atr.js +2 -2
- package/indicators/atr.src.js +5 -5
- package/indicators/bollinger-bands.js +2 -2
- package/indicators/bollinger-bands.src.js +5 -5
- package/indicators/cci.js +2 -2
- package/indicators/cci.src.js +5 -5
- package/indicators/chaikin.js +2 -2
- package/indicators/chaikin.src.js +5 -5
- package/indicators/cmf.js +2 -2
- package/indicators/cmf.src.js +5 -5
- package/indicators/cmo.js +2 -2
- package/indicators/cmo.src.js +5 -5
- package/indicators/dema.js +2 -2
- package/indicators/dema.src.js +5 -5
- package/indicators/disparity-index.js +2 -2
- package/indicators/disparity-index.src.js +5 -5
- package/indicators/dmi.js +2 -2
- package/indicators/dmi.src.js +5 -5
- package/indicators/dpo.js +2 -2
- package/indicators/dpo.src.js +5 -5
- package/indicators/ema.js +1 -1
- package/indicators/ema.src.js +4 -4
- package/indicators/ichimoku-kinko-hyo.js +2 -2
- package/indicators/ichimoku-kinko-hyo.src.js +5 -5
- package/indicators/indicators-all.js +2 -2
- package/indicators/indicators-all.src.js +10 -5
- package/indicators/indicators.js +2 -2
- package/indicators/indicators.src.js +5 -5
- package/indicators/keltner-channels.js +2 -2
- package/indicators/keltner-channels.src.js +5 -5
- package/indicators/klinger.js +2 -2
- package/indicators/klinger.src.js +5 -5
- package/indicators/macd.js +2 -2
- package/indicators/macd.src.js +5 -5
- package/indicators/mfi.js +2 -2
- package/indicators/mfi.src.js +5 -5
- package/indicators/momentum.js +2 -2
- package/indicators/momentum.src.js +5 -5
- package/indicators/natr.js +2 -2
- package/indicators/natr.src.js +5 -5
- package/indicators/obv.js +2 -2
- package/indicators/obv.src.js +5 -5
- package/indicators/pivot-points.js +2 -2
- package/indicators/pivot-points.src.js +5 -5
- package/indicators/ppo.js +2 -2
- package/indicators/ppo.src.js +5 -5
- package/indicators/price-channel.js +2 -2
- package/indicators/price-channel.src.js +5 -5
- package/indicators/price-envelopes.js +2 -2
- package/indicators/price-envelopes.src.js +5 -5
- package/indicators/psar.js +2 -2
- package/indicators/psar.src.js +5 -5
- package/indicators/regressions.js +2 -2
- package/indicators/regressions.src.js +5 -5
- package/indicators/roc.js +2 -2
- package/indicators/roc.src.js +5 -5
- package/indicators/rsi.js +2 -2
- package/indicators/rsi.src.js +5 -5
- package/indicators/slow-stochastic.js +2 -2
- package/indicators/slow-stochastic.src.js +5 -5
- package/indicators/stochastic.js +2 -2
- package/indicators/stochastic.src.js +5 -5
- package/indicators/supertrend.js +2 -2
- package/indicators/supertrend.src.js +5 -5
- package/indicators/tema.js +2 -2
- package/indicators/tema.src.js +5 -5
- package/indicators/trendline.js +2 -2
- package/indicators/trendline.src.js +5 -5
- package/indicators/trix.js +2 -2
- package/indicators/trix.src.js +5 -5
- package/indicators/volume-by-price.js +2 -2
- package/indicators/volume-by-price.src.js +6 -5
- package/indicators/vwap.js +2 -2
- package/indicators/vwap.src.js +5 -5
- package/indicators/williams-r.js +2 -2
- package/indicators/williams-r.src.js +5 -5
- package/indicators/wma.js +2 -2
- package/indicators/wma.src.js +5 -5
- package/indicators/zigzag.js +2 -2
- package/indicators/zigzag.src.js +5 -5
- package/modules/accessibility.js +2 -2
- package/modules/accessibility.src.js +7 -5
- package/modules/annotations-advanced.js +4 -4
- package/modules/annotations-advanced.src.js +8 -8
- package/modules/annotations.js +2 -2
- package/modules/annotations.src.js +7 -7
- package/modules/arc-diagram.js +2 -2
- package/modules/arc-diagram.src.js +5 -5
- package/modules/arrow-symbols.js +2 -2
- package/modules/arrow-symbols.src.js +5 -5
- package/modules/boost-canvas.js +2 -2
- package/modules/boost-canvas.src.js +30 -16
- package/modules/boost.js +2 -2
- package/modules/boost.src.js +30 -16
- package/modules/broken-axis.js +2 -2
- package/modules/broken-axis.src.js +5 -5
- package/modules/bullet.js +2 -2
- package/modules/bullet.src.js +5 -5
- package/modules/coloraxis.js +2 -2
- package/modules/coloraxis.src.js +5 -5
- package/modules/current-date-indicator.js +2 -2
- package/modules/current-date-indicator.src.js +5 -5
- package/modules/cylinder.js +2 -2
- package/modules/cylinder.src.js +5 -5
- package/modules/data-tools.js +2 -2
- package/modules/data-tools.src.js +40 -5
- package/modules/data.js +2 -2
- package/modules/data.src.js +5 -5
- package/modules/datagrouping.js +2 -2
- package/modules/datagrouping.src.js +5 -5
- package/modules/debugger.js +2 -2
- package/modules/debugger.src.js +5 -5
- package/modules/dependency-wheel.js +2 -2
- package/modules/dependency-wheel.src.js +5 -5
- package/modules/dotplot.js +2 -2
- package/modules/dotplot.src.js +5 -5
- package/modules/drag-panes.js +2 -2
- package/modules/drag-panes.src.js +6 -6
- package/modules/draggable-points.js +2 -2
- package/modules/draggable-points.src.js +5 -5
- package/modules/drilldown.js +2 -2
- package/modules/drilldown.src.js +8 -8
- package/modules/dumbbell.js +2 -2
- package/modules/dumbbell.src.js +5 -5
- package/modules/export-data.js +2 -2
- package/modules/export-data.src.js +5 -5
- package/modules/exporting.js +2 -2
- package/modules/exporting.src.js +5 -5
- package/modules/flowmap.js +2 -2
- package/modules/flowmap.src.js +5 -5
- package/modules/full-screen.js +2 -2
- package/modules/full-screen.src.js +5 -5
- package/modules/funnel.js +2 -2
- package/modules/funnel.src.js +5 -5
- package/modules/funnel3d.js +2 -2
- package/modules/funnel3d.src.js +5 -5
- package/modules/gantt.js +6 -6
- package/modules/gantt.src.js +87 -85
- package/modules/geoheatmap.js +2 -2
- package/modules/geoheatmap.src.js +5 -5
- package/modules/grid-axis.js +2 -2
- package/modules/grid-axis.src.js +5 -5
- package/modules/heatmap.js +3 -3
- package/modules/heatmap.src.js +6 -6
- package/modules/heikinashi.js +2 -2
- package/modules/heikinashi.src.js +5 -5
- package/modules/histogram-bellcurve.js +2 -2
- package/modules/histogram-bellcurve.src.js +5 -5
- package/modules/hollowcandlestick.js +2 -2
- package/modules/hollowcandlestick.src.js +5 -5
- package/modules/item-series.js +2 -2
- package/modules/item-series.src.js +5 -5
- package/modules/lollipop.js +2 -2
- package/modules/lollipop.src.js +5 -5
- package/modules/map.js +4 -4
- package/modules/map.src.js +30 -6
- package/modules/marker-clusters.js +2 -2
- package/modules/marker-clusters.src.js +5 -5
- package/modules/mouse-wheel-zoom.js +2 -2
- package/modules/mouse-wheel-zoom.src.js +5 -5
- package/modules/navigator.js +2 -2
- package/modules/navigator.src.js +5 -5
- package/modules/networkgraph.js +2 -2
- package/modules/networkgraph.src.js +5 -5
- package/modules/no-data-to-display.js +2 -2
- package/modules/no-data-to-display.src.js +5 -5
- package/modules/offline-exporting.js +2 -2
- package/modules/offline-exporting.src.js +6 -6
- package/modules/organization.js +2 -2
- package/modules/organization.src.js +8 -6
- package/modules/overlapping-datalabels.js +2 -2
- package/modules/overlapping-datalabels.src.js +5 -5
- package/modules/parallel-coordinates.js +2 -2
- package/modules/parallel-coordinates.src.js +5 -5
- package/modules/pareto.js +2 -2
- package/modules/pareto.src.js +5 -5
- package/modules/pathfinder.js +2 -2
- package/modules/pathfinder.src.js +5 -5
- package/modules/pattern-fill.js +2 -2
- package/modules/pattern-fill.src.js +5 -5
- package/modules/pictorial.js +2 -2
- package/modules/pictorial.src.js +5 -5
- package/modules/pointandfigure.js +2 -2
- package/modules/pointandfigure.src.js +5 -5
- package/modules/price-indicator.js +2 -2
- package/modules/price-indicator.src.js +5 -5
- package/modules/pyramid3d.js +2 -2
- package/modules/pyramid3d.src.js +5 -5
- package/modules/renko.js +2 -2
- package/modules/renko.src.js +5 -5
- package/modules/sankey.js +2 -2
- package/modules/sankey.src.js +5 -5
- package/modules/series-label.js +2 -2
- package/modules/series-label.src.js +12 -7
- package/modules/series-on-point.js +2 -2
- package/modules/series-on-point.src.js +5 -5
- package/modules/solid-gauge.js +2 -2
- package/modules/solid-gauge.src.js +5 -5
- package/modules/sonification.js +2 -2
- package/modules/sonification.src.js +5 -5
- package/modules/static-scale.js +2 -2
- package/modules/static-scale.src.js +5 -5
- package/modules/stock-tools.js +2 -2
- package/modules/stock-tools.src.js +7 -7
- package/modules/stock.js +6 -6
- package/modules/stock.src.js +87 -85
- package/modules/streamgraph.js +2 -2
- package/modules/streamgraph.src.js +5 -5
- package/modules/sunburst.js +2 -2
- package/modules/sunburst.src.js +294 -66
- package/modules/textpath.js +2 -2
- package/modules/textpath.src.js +5 -5
- package/modules/tiledwebmap.js +3 -3
- package/modules/tiledwebmap.src.js +5 -5
- package/modules/tilemap.js +2 -2
- package/modules/tilemap.src.js +5 -5
- package/modules/timeline.js +2 -2
- package/modules/timeline.src.js +8 -6
- package/modules/treegraph.js +2 -2
- package/modules/treegraph.src.js +8 -6
- package/modules/treegrid.js +2 -2
- package/modules/treegrid.src.js +5 -5
- package/modules/treemap.js +2 -2
- package/modules/treemap.src.js +292 -64
- package/modules/variable-pie.js +2 -2
- package/modules/variable-pie.src.js +5 -5
- package/modules/variwide.js +2 -2
- package/modules/variwide.src.js +5 -5
- package/modules/vector.js +2 -2
- package/modules/vector.src.js +5 -5
- package/modules/venn.js +2 -2
- package/modules/venn.src.js +5 -5
- package/modules/windbarb.js +2 -2
- package/modules/windbarb.src.js +5 -5
- package/modules/wordcloud.js +2 -2
- package/modules/wordcloud.src.js +5 -5
- package/modules/xrange.js +2 -2
- package/modules/xrange.src.js +5 -5
- 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 +79 -77
- package/themes/avocado.js +2 -2
- package/themes/avocado.src.js +5 -5
- package/themes/brand-dark.js +2 -2
- package/themes/brand-dark.src.js +5 -5
- package/themes/brand-light.js +2 -2
- package/themes/brand-light.src.js +5 -5
- package/themes/dark-blue.js +2 -2
- package/themes/dark-blue.src.js +5 -5
- package/themes/dark-green.js +2 -2
- package/themes/dark-green.src.js +5 -5
- package/themes/dark-unica.js +2 -2
- package/themes/dark-unica.src.js +5 -5
- package/themes/gray.js +2 -2
- package/themes/gray.src.js +5 -5
- package/themes/grid-light.js +2 -2
- package/themes/grid-light.src.js +5 -5
- package/themes/grid.js +2 -2
- package/themes/grid.src.js +5 -5
- package/themes/high-contrast-dark.js +2 -2
- package/themes/high-contrast-dark.src.js +5 -5
- package/themes/high-contrast-light.js +2 -2
- package/themes/high-contrast-light.src.js +5 -5
- package/themes/sand-signika.js +2 -2
- package/themes/sand-signika.src.js +5 -5
- package/themes/skies.js +2 -2
- package/themes/skies.src.js +5 -5
- package/themes/sunset.js +2 -2
- package/themes/sunset.src.js +5 -5
package/bower.json
CHANGED
|
@@ -266,6 +266,8 @@ const Options = {
|
|
|
266
266
|
/**
|
|
267
267
|
* When a series contains more points than this, we no longer expose
|
|
268
268
|
* information about individual points to screen readers.
|
|
269
|
+
* Note that the keyboard navigation remains functional, but points
|
|
270
|
+
* won't have accessible descriptions unless handled separately.
|
|
269
271
|
*
|
|
270
272
|
* Set to `false` to disable.
|
|
271
273
|
*
|
|
@@ -556,7 +556,7 @@ class Axis {
|
|
|
556
556
|
* Pixel position of the value on the chart or axis.
|
|
557
557
|
*/
|
|
558
558
|
toPixels(value, paneCoordinates) {
|
|
559
|
-
return this.translate(this.chart
|
|
559
|
+
return this.translate(this.chart?.time.parse(value) ?? NaN, false, !this.horiz, void 0, true) + (paneCoordinates ? 0 : this.pos);
|
|
560
560
|
}
|
|
561
561
|
/**
|
|
562
562
|
* Translate a pixel position along the axis to a value in terms of axis
|
|
@@ -192,18 +192,11 @@ class Color {
|
|
|
192
192
|
}
|
|
193
193
|
// Check for has alpha, because rgba colors perform worse due to
|
|
194
194
|
// lack of support in WebKit.
|
|
195
|
-
const hasAlpha = (toRgba[3] !== 1 || fromRgba[3] !== 1);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
',' +
|
|
201
|
-
Math.round(toRgba[2] + (fromRgba[2] - toRgba[2]) * (1 - pos)) +
|
|
202
|
-
(hasAlpha ?
|
|
203
|
-
(',' +
|
|
204
|
-
(toRgba[3] + (fromRgba[3] - toRgba[3]) * (1 - pos))) :
|
|
205
|
-
'') +
|
|
206
|
-
')';
|
|
195
|
+
const hasAlpha = (toRgba[3] !== 1 || fromRgba[3] !== 1), channel = (to, i) => to + (fromRgba[i] - to) * (1 - pos), rgba = toRgba.slice(0, 3).map(channel).map(Math.round);
|
|
196
|
+
if (hasAlpha) {
|
|
197
|
+
rgba.push(channel(toRgba[3], 3));
|
|
198
|
+
}
|
|
199
|
+
return (hasAlpha ? 'rgba(' : 'rgb(') + rgba.join(',') + ')';
|
|
207
200
|
}
|
|
208
201
|
}
|
|
209
202
|
/* *
|
|
@@ -251,7 +251,7 @@ class HTMLElement extends SVGElement {
|
|
|
251
251
|
textWidth,
|
|
252
252
|
this.textAlign
|
|
253
253
|
].join(','), parentPadding = (this.parentGroup?.padding * -1) || 0;
|
|
254
|
-
let baseline
|
|
254
|
+
let baseline;
|
|
255
255
|
// Update textWidth. Use the memoized textPxLength if possible, to
|
|
256
256
|
// avoid the getTextPxLength function using elem.offsetWidth.
|
|
257
257
|
// Calling offsetWidth affects rendering time as it forces layout
|
|
@@ -274,10 +274,8 @@ class HTMLElement extends SVGElement {
|
|
|
274
274
|
whiteSpace: whiteSpace || 'normal' // #3331
|
|
275
275
|
});
|
|
276
276
|
this.oldTextWidth = textWidth;
|
|
277
|
-
hasBoxWidthChanged = true; // #8159
|
|
278
277
|
}
|
|
279
278
|
}
|
|
280
|
-
this.hasBoxWidthChanged = hasBoxWidthChanged; // #8159
|
|
281
279
|
// Do the calculations and DOM access only if properties changed
|
|
282
280
|
if (currentTextTransform !== this.cTT) {
|
|
283
281
|
baseline = renderer.fontMetrics(element).b;
|
|
@@ -12,9 +12,9 @@ import A from '../../Animation/AnimationUtilities.js';
|
|
|
12
12
|
const { animate, animObject, stop } = A;
|
|
13
13
|
import Color from '../../Color/Color.js';
|
|
14
14
|
import H from '../../Globals.js';
|
|
15
|
-
const { deg2rad, doc, svg, SVG_NS, win } = H;
|
|
15
|
+
const { deg2rad, doc, svg, SVG_NS, win, isFirefox } = H;
|
|
16
16
|
import U from '../../Utilities.js';
|
|
17
|
-
const { addEvent, attr, createElement, crisp, css, defined, erase, extend, fireEvent, getAlignFactor, isArray, isFunction, isObject, isString, merge, objectEach, pick, pInt, pushUnique, replaceNested, syncTimeout, uniqueKey } = U;
|
|
17
|
+
const { addEvent, attr, createElement, crisp, css, defined, erase, extend, fireEvent, getAlignFactor, isArray, isFunction, isNumber, isObject, isString, merge, objectEach, pick, pInt, pushUnique, replaceNested, syncTimeout, uniqueKey } = U;
|
|
18
18
|
/* *
|
|
19
19
|
*
|
|
20
20
|
* Class
|
|
@@ -213,7 +213,9 @@ class SVGElement {
|
|
|
213
213
|
* @return {Highcharts.SVGElement} Returns the SVGElement for chaining.
|
|
214
214
|
*/
|
|
215
215
|
align(alignOptions, alignByTranslate, alignTo, redraw = true) {
|
|
216
|
-
const attribs = {
|
|
216
|
+
const attribs = {
|
|
217
|
+
'text-align': alignOptions?.align
|
|
218
|
+
}, renderer = this.renderer, alignedObjects = renderer.alignedObjects, initialAlignment = Boolean(alignOptions);
|
|
217
219
|
// First call on instanciate
|
|
218
220
|
if (alignOptions) {
|
|
219
221
|
this.alignOptions = alignOptions;
|
|
@@ -730,6 +732,12 @@ class SVGElement {
|
|
|
730
732
|
if (textWidth && (!svg && this.renderer.forExport)) {
|
|
731
733
|
delete styles.width;
|
|
732
734
|
}
|
|
735
|
+
const fontSize = isFirefox && styles.fontSize || null;
|
|
736
|
+
// Necessary in firefox to be able to set font-size, #22124
|
|
737
|
+
if (fontSize && (isNumber(fontSize) ||
|
|
738
|
+
/^\d+$/.test(fontSize))) {
|
|
739
|
+
styles.fontSize += 'px';
|
|
740
|
+
}
|
|
733
741
|
const stylesToApply = merge(styles);
|
|
734
742
|
if (elem.namespaceURI === this.SVG_NS) {
|
|
735
743
|
// These CSS properties are interpreted internally by the SVG
|
|
@@ -71,6 +71,7 @@ class SVGLabel extends SVGElement {
|
|
|
71
71
|
* */
|
|
72
72
|
alignSetter(value) {
|
|
73
73
|
const alignFactor = getAlignFactor(value);
|
|
74
|
+
this.textAlign = value;
|
|
74
75
|
if (alignFactor !== this.alignFactor) {
|
|
75
76
|
this.alignFactor = alignFactor;
|
|
76
77
|
// Bounding box exists, means we're dynamically changing
|
|
@@ -246,6 +247,7 @@ class SVGLabel extends SVGElement {
|
|
|
246
247
|
}
|
|
247
248
|
'text-alignSetter'(value) {
|
|
248
249
|
this.textAlign = value;
|
|
250
|
+
this.updateTextPadding();
|
|
249
251
|
}
|
|
250
252
|
textSetter(text) {
|
|
251
253
|
if (typeof text !== 'undefined') {
|
|
@@ -315,24 +317,19 @@ class SVGLabel extends SVGElement {
|
|
|
315
317
|
* is changed.
|
|
316
318
|
*/
|
|
317
319
|
updateTextPadding() {
|
|
318
|
-
const text = this.text;
|
|
320
|
+
const text = this.text, textAlign = text.styles.textAlign || this.textAlign;
|
|
319
321
|
if (!text.textPath) {
|
|
320
322
|
this.updateBoxSize();
|
|
321
323
|
// Determine y based on the baseline
|
|
322
324
|
const textY = this.baseline ? 0 : this.baselineOffset, textX = (this.paddingLeft ?? this.padding) +
|
|
323
325
|
// Compensate for alignment
|
|
324
|
-
((
|
|
325
|
-
getAlignFactor(this.textAlign) *
|
|
326
|
-
(this.widthSetting - this.bBox.width) :
|
|
327
|
-
0);
|
|
326
|
+
getAlignFactor(textAlign) * (this.widthSetting ?? this.bBox.width);
|
|
328
327
|
// Update if anything changed
|
|
329
328
|
if (textX !== text.x || textY !== text.y) {
|
|
330
|
-
text.attr(
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
this.bBox = text.getBBox(true);
|
|
335
|
-
}
|
|
329
|
+
text.attr({
|
|
330
|
+
align: textAlign,
|
|
331
|
+
x: textX
|
|
332
|
+
});
|
|
336
333
|
if (typeof textY !== 'undefined') {
|
|
337
334
|
text.attr('y', textY);
|
|
338
335
|
}
|
|
@@ -110,7 +110,9 @@ var DataLabel;
|
|
|
110
110
|
(unrotatedbBox.width - bBox.width);
|
|
111
111
|
dataLabel.alignAttr.y += getAlignFactor(options.verticalAlign) *
|
|
112
112
|
(unrotatedbBox.height - bBox.height);
|
|
113
|
-
dataLabel
|
|
113
|
+
dataLabel.attr({
|
|
114
|
+
'text-align': dataLabel.alignAttr['text-align'] || 'center'
|
|
115
|
+
})[dataLabel.placed ? 'animate' : 'attr']({
|
|
114
116
|
x: dataLabel.alignAttr.x +
|
|
115
117
|
(bBox.width - unrotatedbBox.width) / 2,
|
|
116
118
|
y: dataLabel.alignAttr.y +
|
|
@@ -2394,9 +2394,14 @@ class Series {
|
|
|
2394
2394
|
* @private
|
|
2395
2395
|
* @function Highcharts.Series#searchKDTree
|
|
2396
2396
|
*/
|
|
2397
|
-
searchKDTree(point, compareX, e) {
|
|
2397
|
+
searchKDTree(point, compareX, e, suppliedPointEvaluator, suppliedBSideCheckEvaluator) {
|
|
2398
2398
|
const series = this, [kdX, kdY] = this.kdAxisArray, kdComparer = compareX ? 'distX' : 'dist', kdDimensions = (series.options.findNearestPointBy || '')
|
|
2399
|
-
.indexOf('y') > -1 ? 2 : 1, useRadius = !!series.isBubble
|
|
2399
|
+
.indexOf('y') > -1 ? 2 : 1, useRadius = !!series.isBubble, pointEvaluator = suppliedPointEvaluator || ((p1, p2, comparisonProp) => [
|
|
2400
|
+
(p1[comparisonProp] || 0) < (p2[comparisonProp] || 0) ?
|
|
2401
|
+
p1 :
|
|
2402
|
+
p2,
|
|
2403
|
+
false
|
|
2404
|
+
]), bSideCheckEvaluator = suppliedBSideCheckEvaluator || ((a, b) => a < b);
|
|
2400
2405
|
/**
|
|
2401
2406
|
* Set the one and two dimensional distance on the point object.
|
|
2402
2407
|
* @private
|
|
@@ -2411,28 +2416,21 @@ class Series {
|
|
|
2411
2416
|
*/
|
|
2412
2417
|
function doSearch(search, tree, depth, dimensions) {
|
|
2413
2418
|
const point = tree.point, axis = series.kdAxisArray[depth % dimensions];
|
|
2414
|
-
let
|
|
2419
|
+
let ret = point, flip = false;
|
|
2415
2420
|
setDistance(search, point);
|
|
2416
2421
|
// Pick side based on distance to splitting point
|
|
2417
2422
|
const tdist = (search[axis] || 0) - (point[axis] || 0) +
|
|
2418
2423
|
(useRadius ? (point.marker?.radius || 0) : 0), sideA = tdist < 0 ? 'left' : 'right', sideB = tdist < 0 ? 'right' : 'left';
|
|
2419
2424
|
// End of tree
|
|
2420
2425
|
if (tree[sideA]) {
|
|
2421
|
-
|
|
2422
|
-
ret = (nPoint1[kdComparer] <
|
|
2423
|
-
ret[kdComparer] ?
|
|
2424
|
-
nPoint1 :
|
|
2425
|
-
point);
|
|
2426
|
+
[ret, flip] = pointEvaluator(point, doSearch(search, tree[sideA], depth + 1, dimensions), kdComparer);
|
|
2426
2427
|
}
|
|
2427
2428
|
if (tree[sideB]) {
|
|
2429
|
+
const sqrtTDist = Math.sqrt(tdist * tdist), retDist = ret[kdComparer];
|
|
2428
2430
|
// Compare distance to current best to splitting point to decide
|
|
2429
|
-
// whether to check side B or
|
|
2430
|
-
if (
|
|
2431
|
-
|
|
2432
|
-
ret = (nPoint2[kdComparer] <
|
|
2433
|
-
ret[kdComparer] ?
|
|
2434
|
-
nPoint2 :
|
|
2435
|
-
ret);
|
|
2431
|
+
// whether to check side B or no
|
|
2432
|
+
if (bSideCheckEvaluator(sqrtTDist, retDist, flip)) {
|
|
2433
|
+
ret = pointEvaluator(ret, doSearch(search, tree[sideB], depth + 1, dimensions), kdComparer)[0];
|
|
2436
2434
|
}
|
|
2437
2435
|
}
|
|
2438
2436
|
return ret;
|
|
@@ -13,7 +13,7 @@ const { defaultOptions, defaultTime } = D;
|
|
|
13
13
|
import G from './Globals.js';
|
|
14
14
|
const { doc } = G;
|
|
15
15
|
import U from './Utilities.js';
|
|
16
|
-
const { extend, getNestedProperty, isArray, isNumber, isObject, pick, ucfirst } = U;
|
|
16
|
+
const { extend, getNestedProperty, isArray, isNumber, isObject, isString, pick, ucfirst } = U;
|
|
17
17
|
const helpers = {
|
|
18
18
|
// Built-in helpers
|
|
19
19
|
add: (a, b) => a + b,
|
|
@@ -48,6 +48,8 @@ const numberFormatCache = {};
|
|
|
48
48
|
* Functions
|
|
49
49
|
*
|
|
50
50
|
* */
|
|
51
|
+
// Internal convenience function
|
|
52
|
+
const isQuotedString = (str) => /^["'].+["']$/.test(str);
|
|
51
53
|
/**
|
|
52
54
|
* Formats a JavaScript date timestamp (milliseconds since Jan 1st 1970) into a
|
|
53
55
|
* human readable date string. The format is a subset of the formats for PHP's
|
|
@@ -125,11 +127,11 @@ function dateFormat(format, timestamp, upperCaseFirst) {
|
|
|
125
127
|
* The formatted string.
|
|
126
128
|
*/
|
|
127
129
|
function format(str = '', ctx, chart) {
|
|
128
|
-
const regex = /\{([\p{L}\d:\.,;\-\/<>\[\]%_
|
|
130
|
+
const regex = /\{([\p{L}\d:\.,;\-\/<>\[\]%_@+"'’= #\(\)]+)\}/gu,
|
|
129
131
|
// The sub expression regex is the same as the top expression regex,
|
|
130
132
|
// but except parens and block helpers (#), and surrounded by parens
|
|
131
133
|
// instead of curly brackets.
|
|
132
|
-
subRegex = /\(([\p{L}\d:\.,;\-\/<>\[\]%_
|
|
134
|
+
subRegex = /\(([\p{L}\d:\.,;\-\/<>\[\]%_@+"'= ]+)\)/gu, matches = [], floatRegex = /f$/, decRegex = /\.(\d)/, lang = chart?.options.lang || defaultOptions.lang, time = chart && chart.time || defaultTime, numberFormatter = chart && chart.numberFormatter || numberFormat;
|
|
133
135
|
/*
|
|
134
136
|
* Get a literal or variable value inside a template expression. May be
|
|
135
137
|
* extended with other types like string or null if needed, but keep it
|
|
@@ -147,7 +149,7 @@ function format(str = '', ctx, chart) {
|
|
|
147
149
|
if ((n = Number(key)).toString() === key) {
|
|
148
150
|
return n;
|
|
149
151
|
}
|
|
150
|
-
if (
|
|
152
|
+
if (isQuotedString(key)) {
|
|
151
153
|
return key.slice(1, -1);
|
|
152
154
|
}
|
|
153
155
|
// Variables and constants
|
|
@@ -260,7 +262,8 @@ function format(str = '', ctx, chart) {
|
|
|
260
262
|
// Simple variable replacement
|
|
261
263
|
}
|
|
262
264
|
else {
|
|
263
|
-
const valueAndFormat = expression
|
|
265
|
+
const valueAndFormat = isQuotedString(expression) ?
|
|
266
|
+
[expression] : expression.split(':');
|
|
264
267
|
replacement = resolveProperty(valueAndFormat.shift() || '');
|
|
265
268
|
// Format the replacement
|
|
266
269
|
if (valueAndFormat.length && typeof replacement === 'number') {
|
|
@@ -273,13 +276,14 @@ function format(str = '', ctx, chart) {
|
|
|
273
276
|
}
|
|
274
277
|
else {
|
|
275
278
|
replacement = time.dateFormat(segment, replacement);
|
|
276
|
-
// Use string literal in order to be preserved in the outer
|
|
277
|
-
// expression
|
|
278
|
-
if (hasSub) {
|
|
279
|
-
replacement = `"${replacement}"`;
|
|
280
|
-
}
|
|
281
279
|
}
|
|
282
280
|
}
|
|
281
|
+
// Use string literal in order to be preserved in the outer
|
|
282
|
+
// expression
|
|
283
|
+
subRegex.lastIndex = 0;
|
|
284
|
+
if (subRegex.test(match.find) && isString(replacement)) {
|
|
285
|
+
replacement = `"${replacement}"`;
|
|
286
|
+
}
|
|
283
287
|
}
|
|
284
288
|
str = str.replace(match.find, pick(replacement, ''));
|
|
285
289
|
});
|
package/es-modules/Core/Time.js
CHANGED
|
@@ -91,7 +91,9 @@ class Time {
|
|
|
91
91
|
* Properties
|
|
92
92
|
*
|
|
93
93
|
* */
|
|
94
|
-
this.options = {
|
|
94
|
+
this.options = {
|
|
95
|
+
timezone: 'UTC'
|
|
96
|
+
};
|
|
95
97
|
this.variableTimezone = false;
|
|
96
98
|
this.Date = win.Date;
|
|
97
99
|
this.update(options);
|
|
@@ -113,12 +115,13 @@ class Time {
|
|
|
113
115
|
*
|
|
114
116
|
*/
|
|
115
117
|
update(options = {}) {
|
|
116
|
-
let timezone = options.timezone ?? 'UTC';
|
|
117
118
|
this.dTLCache = {};
|
|
118
119
|
this.options = options = merge(true, this.options, options);
|
|
119
120
|
const { timezoneOffset, useUTC } = options;
|
|
120
121
|
// Allow using a different Date class
|
|
121
122
|
this.Date = options.Date || win.Date || Date;
|
|
123
|
+
// Assign the time zone. Handle the legacy, deprecated `useUTC` option.
|
|
124
|
+
let timezone = options.timezone;
|
|
122
125
|
if (defined(useUTC)) {
|
|
123
126
|
timezone = useUTC ? 'UTC' : void 0;
|
|
124
127
|
}
|
|
@@ -561,7 +564,7 @@ class Time {
|
|
|
561
564
|
}
|
|
562
565
|
else if (isObject(format)) {
|
|
563
566
|
const tzHours = (this.getTimezoneOffset(timestamp) || 0) /
|
|
564
|
-
(60000 * 60), timeZone = this.
|
|
567
|
+
(60000 * 60), timeZone = this.timezone || ('Etc/GMT' + (tzHours >= 0 ? '+' : '') + tzHours), { prefix = '', suffix = '' } = format;
|
|
565
568
|
format = prefix + this.dateTimeFormat(extend({ timeZone }, format), timestamp) + suffix;
|
|
566
569
|
}
|
|
567
570
|
// Optionally sentence-case the string and return
|