apexcharts 8.0.1 → 8.2.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/README.md +14 -8
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +2310 -2274
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.esm.js +1367 -1110
- package/dist/apexcharts.full.js +3880 -3531
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +3676 -3409
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +4114 -3591
- package/dist/area.common.js +2 -2
- package/dist/area.esm.js +25 -67
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +159 -163
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +125 -106
- package/dist/bubble.common.js +2 -2
- package/dist/bubble.esm.js +25 -67
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +125 -106
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +159 -163
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +2310 -2274
- package/dist/donut.common.js +2 -2
- package/dist/donut.esm.js +100 -78
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +192 -167
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +945 -640
- package/dist/features/annotations.common.js +2 -2
- package/dist/features/annotations.esm.js +46 -21
- package/dist/features/annotations.js +2 -2
- package/dist/features/context-menu.common.js +1 -1
- package/dist/features/context-menu.esm.js +1 -1
- package/dist/features/context-menu.js +1 -1
- package/dist/features/drilldown.common.js +2 -2
- package/dist/features/drilldown.esm.js +22 -2
- package/dist/features/drilldown.js +2 -2
- package/dist/features/dumbbell.common.js +2 -2
- package/dist/features/dumbbell.esm.js +34 -5
- package/dist/features/dumbbell.js +2 -2
- package/dist/features/exports.common.js +2 -2
- package/dist/features/exports.esm.js +203 -204
- package/dist/features/exports.js +2 -2
- package/dist/features/facet.common.js +1 -1
- package/dist/features/facet.esm.js +1 -1
- package/dist/features/facet.js +1 -1
- package/dist/features/highlight-filter.common.js +2 -2
- package/dist/features/highlight-filter.esm.js +97 -41
- package/dist/features/highlight-filter.js +2 -2
- package/dist/features/history.common.js +2 -2
- package/dist/features/history.esm.js +4 -3
- package/dist/features/history.js +2 -2
- package/dist/features/ink.common.js +1 -1
- package/dist/features/ink.esm.js +1 -1
- package/dist/features/ink.js +1 -1
- package/dist/features/keyboard.common.js +2 -2
- package/dist/features/keyboard.esm.js +20 -23
- package/dist/features/keyboard.js +2 -2
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +61 -41
- package/dist/features/legend.js +2 -2
- package/dist/features/link.common.js +2 -2
- package/dist/features/link.esm.js +8 -8
- package/dist/features/link.js +2 -2
- package/dist/features/marks.common.js +2 -2
- package/dist/features/marks.esm.js +1 -1
- package/dist/features/marks.js +1 -1
- package/dist/features/measure.common.js +1 -1
- package/dist/features/measure.esm.js +1 -1
- package/dist/features/measure.js +1 -1
- package/dist/features/morph.common.js +2 -2
- package/dist/features/morph.esm.js +260 -279
- package/dist/features/morph.js +2 -2
- package/dist/features/perspectives.common.js +2 -2
- package/dist/features/perspectives.esm.js +28 -19
- package/dist/features/perspectives.js +2 -2
- package/dist/features/raincloud.common.js +2 -2
- package/dist/features/raincloud.esm.js +54 -36
- package/dist/features/raincloud.js +2 -2
- package/dist/features/renderer-canvas.common.js +1 -1
- package/dist/features/renderer-canvas.esm.js +1 -1
- package/dist/features/renderer-canvas.js +1 -1
- package/dist/features/stats.common.js +2 -2
- package/dist/features/stats.esm.js +66 -18
- package/dist/features/stats.js +2 -2
- package/dist/features/storyboard.common.js +2 -2
- package/dist/features/storyboard.esm.js +24 -15
- package/dist/features/storyboard.js +2 -2
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +34 -5
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +211 -217
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +31 -19
- package/dist/features/trellis.js +2 -2
- package/dist/features/waterfall.common.js +2 -2
- package/dist/features/waterfall.esm.js +34 -5
- package/dist/features/waterfall.js +2 -2
- package/dist/features/weave.common.js +2 -2
- package/dist/features/weave.esm.js +290 -48
- package/dist/features/weave.js +2 -2
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +289 -150
- package/dist/heatmap.common.js +2 -2
- package/dist/heatmap.esm.js +48 -17
- package/dist/heatmap.js +2 -2
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +224 -180
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +1 -1
- package/dist/icicle.js +1 -1
- package/dist/line.common.js +2 -2
- package/dist/line.esm.js +25 -67
- package/dist/line.js +2 -2
- package/dist/pictograms.common.js +1 -1
- package/dist/pictograms.esm.js +1 -1
- package/dist/pictograms.js +1 -1
- package/dist/pie.common.js +2 -2
- package/dist/pie.esm.js +100 -78
- package/dist/pie.js +2 -2
- package/dist/polarArea.common.js +2 -2
- package/dist/polarArea.esm.js +100 -78
- package/dist/radar.common.js +2 -2
- package/dist/radar.esm.js +8 -5
- package/dist/radar.js +2 -2
- package/dist/radialBar.common.js +2 -2
- package/dist/radialBar.esm.js +166 -133
- package/dist/radialBar.js +2 -2
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +55 -42
- package/dist/rangeArea.common.js +2 -2
- package/dist/rangeArea.esm.js +25 -67
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +159 -163
- package/dist/scatter.common.js +2 -2
- package/dist/scatter.esm.js +25 -67
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +58 -71
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +1 -1
- package/dist/sunburst.js +1 -1
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +28 -90
- package/dist/treemap.js +2 -2
- package/dist/unit-shapes.common.js +2 -2
- package/dist/unit-shapes.esm.js +1 -1
- package/dist/unit-shapes.js +1 -1
- package/dist/unit.common.js +2 -2
- package/dist/unit.esm.js +30 -6
- package/dist/unit.js +2 -2
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +2 -7
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +192 -167
- package/package.json +3 -1
- package/src/apexcharts.js +260 -201
- package/src/charts/Bar.js +16 -5
- package/src/charts/BarStacked.js +42 -88
- package/src/charts/BoxCandleStick.js +1 -7
- package/src/charts/HeatMap.js +73 -16
- package/src/charts/Line.js +21 -71
- package/src/charts/Pie.js +142 -89
- package/src/charts/Radar.js +4 -1
- package/src/charts/Radial.js +91 -63
- package/src/charts/RangeBar.js +1 -7
- package/src/charts/Treemap.js +25 -78
- package/src/charts/Unit.js +28 -10
- package/src/charts/Violin.js +1 -7
- package/src/charts/common/Hierarchy.js +0 -22
- package/src/charts/common/OuterLabels.js +12 -5
- package/src/charts/common/Stats.js +55 -28
- package/src/charts/common/bar/DataLabels.js +94 -83
- package/src/charts/common/bar/Helpers.js +34 -57
- package/src/charts/common/circle/Helpers.js +5 -2
- package/src/charts/common/treemap/Helpers.js +1 -1
- package/src/entries/full.js +0 -17
- package/src/features/link.js +9 -10
- package/src/features/perspectives.js +20 -19
- package/src/features/raincloud.js +51 -53
- package/src/features/stats.js +23 -35
- package/src/libs/Treemap-squared.js +7 -47
- package/src/modules/Animations.js +55 -73
- package/src/modules/Base.js +3 -2
- package/src/modules/ChartFactory.js +6 -1
- package/src/modules/Core.js +57 -30
- package/src/modules/CoreUtils.js +32 -33
- package/src/modules/Crosshairs.js +29 -11
- package/src/modules/Data.js +279 -153
- package/src/modules/DataLabels.js +18 -2
- package/src/modules/Events.js +1 -4
- package/src/modules/Exports.js +284 -305
- package/src/modules/Fill.js +23 -10
- package/src/modules/Formatters.js +14 -3
- package/src/modules/Graphics.js +8 -14
- package/src/modules/MorphPieces.js +4 -2
- package/src/modules/MorphTypeChange.js +332 -316
- package/src/modules/Range.js +56 -99
- package/src/modules/Responsive.js +186 -61
- package/src/modules/Scales.js +4 -47
- package/src/modules/Series.js +14 -45
- package/src/modules/Theme.js +108 -57
- package/src/modules/Toolbar.js +7 -13
- package/src/modules/accessibility/KeyboardNavigation.js +29 -28
- package/src/modules/animations/AxisTransition.js +54 -16
- package/src/modules/animations/CircleTransition.js +1 -4
- package/src/modules/animations/DataLabelTransition.js +15 -10
- package/src/modules/animations/StreamScroll.js +6 -4
- package/src/modules/annotations/Annotations.js +18 -17
- package/src/modules/annotations/Helpers.js +41 -17
- package/src/modules/axes/XAxis.js +4 -4
- package/src/modules/axes/YAxis.js +1 -6
- package/src/modules/dimensions/Dimensions.js +12 -7
- package/src/modules/dimensions/Grid.js +15 -3
- package/src/modules/dimensions/YAxis.js +7 -6
- package/src/modules/drilldown/Drilldown.js +22 -1
- package/src/modules/dumbbell/DumbbellData.js +3 -5
- package/src/modules/helpers/Destroy.js +10 -1
- package/src/modules/helpers/InitCtxVariables.js +19 -16
- package/src/modules/helpers/RawStash.js +51 -0
- package/src/modules/helpers/UpdateHelpers.js +95 -30
- package/src/modules/highlightFilter/HighlightFilter.js +107 -52
- package/src/modules/highlightFilter/PiePart.js +1 -1
- package/src/modules/highlightFilter/RadialPart.js +1 -1
- package/src/modules/history/History.js +7 -2
- package/src/modules/legend/Legend.js +100 -62
- package/src/modules/license/LicenseEnforcer.js +6 -1
- package/src/modules/settings/Config.js +60 -153
- package/src/modules/settings/Defaults.js +352 -58
- package/src/modules/settings/Globals.js +23 -5
- package/src/modules/settings/Options.js +19 -5
- package/src/modules/settings/TypeAliases.js +3 -6
- package/src/modules/streamgraph/StreamData.js +3 -5
- package/src/modules/tooltip/AxesTooltip.js +33 -41
- package/src/modules/tooltip/Intersect.js +50 -43
- package/src/modules/tooltip/Labels.js +62 -23
- package/src/modules/tooltip/Marker.js +6 -7
- package/src/modules/tooltip/Position.js +31 -35
- package/src/modules/tooltip/Tooltip.js +107 -119
- package/src/modules/tooltip/Utils.js +94 -159
- package/src/modules/trellis/TrellisExports.js +21 -9
- package/src/modules/trellis/TrellisTooltip.js +18 -8
- package/src/modules/waterfall/WaterfallData.js +3 -5
- package/src/modules/weave/Claims.js +14 -3
- package/src/modules/weave/Highlights.js +209 -0
- package/src/modules/weave/PluginAPI.js +64 -3
- package/src/modules/weave/WeaveHost.js +215 -51
- package/src/ssr/BrowserAPIs.js +5 -3
- package/src/ssr/DOMShim.js +6 -30
- package/src/ssr/Hydration.js +5 -36
- package/src/ssr/RenderShim.js +333 -0
- package/src/ssr/SSRRenderer.js +81 -36
- package/src/svg/SVGAnimation.js +10 -7
- package/src/types/internal.d.ts +37 -7
- package/src/utils/Constants.js +7 -8
- package/src/utils/DateTime.js +21 -195
- package/src/utils/MissingFeature.js +7 -9
- package/src/utils/Resize.js +4 -0
- package/src/utils/Utils.js +102 -171
- package/types/apexcharts.d.ts +57 -7
package/src/charts/Bar.js
CHANGED
|
@@ -133,6 +133,21 @@ class Bar {
|
|
|
133
133
|
this.barHelpers = new BarHelpers(this)
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Point the per-series axis state at this series' y axis. Every bar-family
|
|
138
|
+
* renderer calls it before initialPositions, which reads the baseline by
|
|
139
|
+
* this.translationsIndex.
|
|
140
|
+
* @param {number} realIndex
|
|
141
|
+
* @return {number} translationsIndex
|
|
142
|
+
*/
|
|
143
|
+
setSeriesAxis(realIndex) {
|
|
144
|
+
if (this.yRatio.length > 1) {
|
|
145
|
+
this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex]
|
|
146
|
+
this.translationsIndex = realIndex
|
|
147
|
+
}
|
|
148
|
+
return this.translationsIndex
|
|
149
|
+
}
|
|
150
|
+
|
|
136
151
|
/** primary draw method which is called on bar object
|
|
137
152
|
* @memberof Bar
|
|
138
153
|
* @param {any[]} series - user supplied series values
|
|
@@ -193,11 +208,7 @@ class Bar {
|
|
|
193
208
|
this.visibleI = this.visibleI + 1
|
|
194
209
|
}
|
|
195
210
|
|
|
196
|
-
|
|
197
|
-
this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex]
|
|
198
|
-
this.translationsIndex = realIndex
|
|
199
|
-
}
|
|
200
|
-
const translationsIndex = this.translationsIndex
|
|
211
|
+
const translationsIndex = this.setSeriesAxis(realIndex)
|
|
201
212
|
|
|
202
213
|
this.isReversed =
|
|
203
214
|
w.config.yaxis[this.yaxisIndex] &&
|
package/src/charts/BarStacked.js
CHANGED
|
@@ -22,7 +22,6 @@ class BarStacked extends Bar {
|
|
|
22
22
|
draw(series, seriesIndex) {
|
|
23
23
|
const w = this.w
|
|
24
24
|
this.graphics = new Graphics(this.w)
|
|
25
|
-
this.bar = new Bar(this.w, this.ctx, this.xyRatios)
|
|
26
25
|
|
|
27
26
|
const coreUtils = new CoreUtils(this.w)
|
|
28
27
|
series = coreUtils.getLogSeries(series)
|
|
@@ -68,20 +67,12 @@ class BarStacked extends Bar {
|
|
|
68
67
|
: i
|
|
69
68
|
const { groupIndex, columnGroupIndex } =
|
|
70
69
|
this.barHelpers.getGroupIndex(realIndex)
|
|
71
|
-
this.groupCtx = /** @type {any} */ (this)[
|
|
72
|
-
/** @type {any} */ (w.labelData.seriesGroups[groupIndex])
|
|
73
|
-
]
|
|
70
|
+
this.groupCtx = /** @type {any} */ (this).stacks[groupIndex]
|
|
74
71
|
|
|
75
72
|
const xArrValues = []
|
|
76
73
|
const yArrValues = []
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
if (this.yRatio.length > 1) {
|
|
80
|
-
this.yaxisIndex = /** @type {any} */ (
|
|
81
|
-
w.globals.seriesYAxisReverseMap[realIndex]
|
|
82
|
-
)[0]
|
|
83
|
-
translationsIndex = realIndex
|
|
84
|
-
}
|
|
75
|
+
const translationsIndex = this.setSeriesAxis(realIndex)
|
|
85
76
|
|
|
86
77
|
this.isReversed =
|
|
87
78
|
w.config.yaxis[this.yaxisIndex] &&
|
|
@@ -164,7 +155,6 @@ class BarStacked extends Bar {
|
|
|
164
155
|
y,
|
|
165
156
|
elSeries,
|
|
166
157
|
columnGroupIndex,
|
|
167
|
-
seriesGroup: w.labelData.seriesGroups[groupIndex],
|
|
168
158
|
}
|
|
169
159
|
let paths = /** @type {any} */ (null)
|
|
170
160
|
if (this.isHorizontal) {
|
|
@@ -445,7 +435,7 @@ class BarStacked extends Bar {
|
|
|
445
435
|
}
|
|
446
436
|
}
|
|
447
437
|
|
|
448
|
-
/** @param {{indexes: any, barHeight: any, strokeWidth: any, zeroW: any, x: any, y: any, columnGroupIndex: any,
|
|
438
|
+
/** @param {{indexes: any, barHeight: any, strokeWidth: any, zeroW: any, x: any, y: any, columnGroupIndex: any, yDivision: any, elSeries: any}} opts */
|
|
449
439
|
drawStackedBarPaths({
|
|
450
440
|
indexes,
|
|
451
441
|
barHeight,
|
|
@@ -454,7 +444,6 @@ class BarStacked extends Bar {
|
|
|
454
444
|
x,
|
|
455
445
|
y,
|
|
456
446
|
columnGroupIndex,
|
|
457
|
-
seriesGroup,
|
|
458
447
|
yDivision,
|
|
459
448
|
elSeries,
|
|
460
449
|
}) {
|
|
@@ -522,7 +511,6 @@ class BarStacked extends Bar {
|
|
|
522
511
|
isReversed: this.isReversed,
|
|
523
512
|
series: this.series,
|
|
524
513
|
realIndex: indexes.realIndex,
|
|
525
|
-
seriesGroup,
|
|
526
514
|
i,
|
|
527
515
|
j,
|
|
528
516
|
w,
|
|
@@ -556,7 +544,7 @@ class BarStacked extends Bar {
|
|
|
556
544
|
}
|
|
557
545
|
}
|
|
558
546
|
|
|
559
|
-
/** @param {{indexes: any, x: any, y: any, xDivision: any, barWidth: any, zeroH: any, columnGroupIndex: any,
|
|
547
|
+
/** @param {{indexes: any, x: any, y: any, xDivision: any, barWidth: any, zeroH: any, columnGroupIndex: any, elSeries: any}} opts */
|
|
560
548
|
drawStackedColumnPaths({
|
|
561
549
|
indexes,
|
|
562
550
|
x,
|
|
@@ -565,7 +553,6 @@ class BarStacked extends Bar {
|
|
|
565
553
|
barWidth,
|
|
566
554
|
zeroH,
|
|
567
555
|
columnGroupIndex,
|
|
568
|
-
seriesGroup,
|
|
569
556
|
elSeries,
|
|
570
557
|
}) {
|
|
571
558
|
const w = this.w
|
|
@@ -587,64 +574,29 @@ class BarStacked extends Bar {
|
|
|
587
574
|
const barXPosition = x + columnGroupIndex * barWidth
|
|
588
575
|
let barYPosition
|
|
589
576
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
// Reading the position out of seriesGroup counted every member of the
|
|
603
|
-
// group, line and area series included, so in a mixed chart every bar
|
|
604
|
-
// that followed a non-bar series looked past the end of prevY, found no
|
|
605
|
-
// previous layer and restarted its stack from the axis (#5105).
|
|
606
|
-
const gsi = this.groupCtx.prevY.length
|
|
607
|
-
if (
|
|
608
|
-
(gsi > 0 && !w.axisFlags.isXNumeric) ||
|
|
609
|
-
(gsi > 0 &&
|
|
610
|
-
w.axisFlags.isXNumeric &&
|
|
611
|
-
w.seriesData.seriesX[realIndex - 1][j] ===
|
|
612
|
-
w.seriesData.seriesX[realIndex][j])
|
|
613
|
-
) {
|
|
577
|
+
// The layer below is found by x identity, as stacked lines do (#4886): on
|
|
578
|
+
// a numeric or datetime axis each series carries its own x values, so one
|
|
579
|
+
// ordinal can be another date in the series below, or a series of another
|
|
580
|
+
// type. `tops` holds, per x, the top and value of the last segment drawn
|
|
581
|
+
// there, the summed heights and raw values of every segment drawn there so
|
|
582
|
+
// far (the total label's value) and the extreme tops below that segment
|
|
583
|
+
// (its position). A series without this x leaves it as it was, as a 0.
|
|
584
|
+
const g = this.groupCtx
|
|
585
|
+
const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j
|
|
586
|
+
const top = g.tops.get(key)
|
|
587
|
+
if (top) {
|
|
588
|
+
const [prevYValue, prevVal, prevBarH] = top
|
|
614
589
|
let bYP
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
) {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
prevYValue
|
|
625
|
-
// if found it, break the loop
|
|
626
|
-
break
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
for (let ii = 1; ii < p; ii++) {
|
|
632
|
-
// find the previous available value(non-NaN) to give bYP
|
|
633
|
-
if (this.groupCtx.prevYVal[gsi - ii]?.[j] < 0) {
|
|
634
|
-
bYP =
|
|
635
|
-
/** @type {any} */ (this.series)[i]?.[j] >= 0
|
|
636
|
-
? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2
|
|
637
|
-
: prevYValue
|
|
638
|
-
// found it? break the loop
|
|
639
|
-
break
|
|
640
|
-
} else if (this.groupCtx.prevYVal[gsi - ii]?.[j] >= 0) {
|
|
641
|
-
bYP =
|
|
642
|
-
/** @type {any} */ (this.series)[i]?.[j] >= 0
|
|
643
|
-
? prevYValue
|
|
644
|
-
: prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2
|
|
645
|
-
// found it? break the loop
|
|
646
|
-
break
|
|
647
|
-
}
|
|
590
|
+
if (prevVal < 0) {
|
|
591
|
+
bYP =
|
|
592
|
+
/** @type {any} */ (this.series)[i]?.[j] >= 0
|
|
593
|
+
? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2
|
|
594
|
+
: prevYValue
|
|
595
|
+
} else if (prevVal >= 0) {
|
|
596
|
+
bYP =
|
|
597
|
+
/** @type {any} */ (this.series)[i]?.[j] >= 0
|
|
598
|
+
? prevYValue
|
|
599
|
+
: prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2
|
|
648
600
|
}
|
|
649
601
|
|
|
650
602
|
if (typeof bYP === 'undefined') bYP = w.layout.gridHeight
|
|
@@ -652,16 +604,9 @@ class BarStacked extends Bar {
|
|
|
652
604
|
// if this.prevYF[0] is all 0 resulted from line #486
|
|
653
605
|
// AND every arr starting from the second only contains NaN
|
|
654
606
|
if (
|
|
655
|
-
/**
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
this.groupCtx.prevYF[0]?.every((/** @type {any} */ val) => val === 0) &&
|
|
659
|
-
this.groupCtx.prevYF
|
|
660
|
-
.slice(1, gsi)
|
|
661
|
-
/**
|
|
662
|
-
* @param {any[]} arr
|
|
663
|
-
* @param {number} val
|
|
664
|
-
*/
|
|
607
|
+
g.prevYF[0]?.every((/** @type {any} */ val) => val === 0) &&
|
|
608
|
+
g.prevYF
|
|
609
|
+
.slice(1)
|
|
665
610
|
.every((/** @type {any} */ arr) =>
|
|
666
611
|
arr.every((/** @type {any} */ val) => isNaN(val)),
|
|
667
612
|
)
|
|
@@ -672,9 +617,7 @@ class BarStacked extends Bar {
|
|
|
672
617
|
barYPosition = bYP
|
|
673
618
|
}
|
|
674
619
|
} else {
|
|
675
|
-
//
|
|
676
|
-
// series X doesn't matches the current index's series X, then start from
|
|
677
|
-
// zero
|
|
620
|
+
// nothing is stacked at this x yet
|
|
678
621
|
barYPosition = zeroH
|
|
679
622
|
}
|
|
680
623
|
|
|
@@ -702,13 +645,24 @@ class BarStacked extends Bar {
|
|
|
702
645
|
strokeWidth: this.strokeWidth,
|
|
703
646
|
isReversed: this.isReversed,
|
|
704
647
|
series: this.series,
|
|
705
|
-
seriesGroup,
|
|
706
648
|
realIndex: indexes.realIndex,
|
|
707
649
|
i,
|
|
708
650
|
j,
|
|
709
651
|
w,
|
|
710
652
|
})
|
|
711
653
|
|
|
654
|
+
const t = g.yArrj[j]
|
|
655
|
+
if (!isNaN(t)) {
|
|
656
|
+
g.tops.set(key, [
|
|
657
|
+
t,
|
|
658
|
+
g.yArrjVal[j],
|
|
659
|
+
(top ? top[2] : 0) + g.yArrjF[j],
|
|
660
|
+
(top ? top[3] : 0) + (w.seriesData.series[realIndex][j] || 0),
|
|
661
|
+
top ? Math.min(top[0], top[4]) : 1 / 0,
|
|
662
|
+
top ? Math.max(top[0], top[5]) : -1 / 0,
|
|
663
|
+
])
|
|
664
|
+
}
|
|
665
|
+
|
|
712
666
|
this.barHelpers.barBackground({
|
|
713
667
|
bc,
|
|
714
668
|
j,
|
|
@@ -152,13 +152,7 @@ class BoxCandleStick extends Bar {
|
|
|
152
152
|
this.visibleI = this.visibleI + 1
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
if (this.yRatio.length > 1) {
|
|
157
|
-
this.yaxisIndex = /** @type {any} */ (
|
|
158
|
-
w.globals.seriesYAxisReverseMap[realIndex]
|
|
159
|
-
)[0]
|
|
160
|
-
translationsIndex = realIndex
|
|
161
|
-
}
|
|
155
|
+
const translationsIndex = this.setSeriesAxis(realIndex)
|
|
162
156
|
|
|
163
157
|
const initPositions = this.barHelpers.initialPositions(realIndex)
|
|
164
158
|
const {
|
package/src/charts/HeatMap.js
CHANGED
|
@@ -14,6 +14,35 @@ import { seriesEmitter } from '../renderers/Renderer'
|
|
|
14
14
|
import { BrowserAPIs } from '../ssr/BrowserAPIs.js'
|
|
15
15
|
import { SVGNS } from '../svg/math'
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* The x span, in axis units, of one cell of a numeric or datetime heatmap,
|
|
19
|
+
* which centres each cell on its own x. 0 when there is no usable gap.
|
|
20
|
+
* Reads `minXDiff`, so it needs Range._getMinXDiff to have run.
|
|
21
|
+
*
|
|
22
|
+
* @param {import('../types/internal').ChartStateW} w
|
|
23
|
+
* @returns {number}
|
|
24
|
+
*/
|
|
25
|
+
function cellSpan(w) {
|
|
26
|
+
const gl = w.globals
|
|
27
|
+
let diff = gl.minXDiff
|
|
28
|
+
// With no series holding two x values, minXDiff is a 0.5 sentinel (half
|
|
29
|
+
// a millisecond on a datetime axis). Take the gap between the series'
|
|
30
|
+
// lone x values instead. A single column has none, and its axis is
|
|
31
|
+
// padded two units either side, so it takes one unit, as bars do.
|
|
32
|
+
if (!w.seriesData.series.some((s) => s.length > 1)) {
|
|
33
|
+
const xs = w.seriesData.seriesX
|
|
34
|
+
.map((s) => s && s[0])
|
|
35
|
+
.filter(Number.isFinite)
|
|
36
|
+
.sort((a, b) => a - b)
|
|
37
|
+
diff = Infinity
|
|
38
|
+
for (let k = 1; k < xs.length; k++) {
|
|
39
|
+
if (xs[k] > xs[k - 1]) diff = Math.min(diff, xs[k] - xs[k - 1])
|
|
40
|
+
}
|
|
41
|
+
if (diff === Infinity) diff = (gl.maxX - gl.minX) / 4
|
|
42
|
+
}
|
|
43
|
+
return Number.isFinite(diff) && diff > 0 ? diff : 0
|
|
44
|
+
}
|
|
45
|
+
|
|
17
46
|
/**
|
|
18
47
|
* ApexCharts HeatMap Class.
|
|
19
48
|
* @module HeatMap
|
|
@@ -42,6 +71,42 @@ export default class HeatMap {
|
|
|
42
71
|
: 0
|
|
43
72
|
}
|
|
44
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Called by Range.setXRange, off the prototype, before it builds the x
|
|
76
|
+
* scale. A numeric or datetime heatmap centres each cell on its x, so an
|
|
77
|
+
* axis ending at the first and last x left the outer half of both edge
|
|
78
|
+
* columns outside the plot, where gridRectMask clipped it. Reach half a
|
|
79
|
+
* cell past the data unless the user pinned the axis. The zoom
|
|
80
|
+
* clamps (initialMinX/MaxX) always take the padded extent, so zooming all
|
|
81
|
+
* the way out lands on the same view.
|
|
82
|
+
*
|
|
83
|
+
* @param {any} range the Range instance
|
|
84
|
+
*/
|
|
85
|
+
padXRange(range) {
|
|
86
|
+
const { w } = range
|
|
87
|
+
const gl = w.globals
|
|
88
|
+
const x = w.config.xaxis
|
|
89
|
+
// (a heatmap never converts categories to numbers: it does not zoom)
|
|
90
|
+
if (
|
|
91
|
+
(x.type === 'numeric' || x.type === 'datetime') &&
|
|
92
|
+
gl.initialMinX < gl.initialMaxX
|
|
93
|
+
) {
|
|
94
|
+
range._getMinXDiff()
|
|
95
|
+
const half = cellSpan(w) / 2
|
|
96
|
+
gl.initialMinX -= half
|
|
97
|
+
gl.initialMaxX += half
|
|
98
|
+
if (x.min == null && x.max == null && x.range == null) {
|
|
99
|
+
gl.minX -= half
|
|
100
|
+
gl.maxX += half
|
|
101
|
+
// One tick per point puts a label on each cell centre, which cannot
|
|
102
|
+
// span the padded axis evenly: take one per cell edge instead.
|
|
103
|
+
if (!x.tickAmount && gl.xTickAmount === gl.dataPoints - 1) {
|
|
104
|
+
gl.xTickAmount = gl.dataPoints
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
45
110
|
/**
|
|
46
111
|
* @param {any[]} series
|
|
47
112
|
*/
|
|
@@ -67,10 +132,12 @@ export default class HeatMap {
|
|
|
67
132
|
w.config.xaxis.type === 'datetime') &&
|
|
68
133
|
w.axisFlags.isXNumeric &&
|
|
69
134
|
this.xRatio > 0
|
|
135
|
+
// The x axis already reaches half a cell past the first and last x
|
|
136
|
+
// (padXRange), so the edge columns sit inside the plot.
|
|
70
137
|
let binPx = xDivision
|
|
71
138
|
if (isContinuousX) {
|
|
72
|
-
const
|
|
73
|
-
|
|
139
|
+
const span = cellSpan(w)
|
|
140
|
+
if (span) binPx = span / this.xRatio
|
|
74
141
|
}
|
|
75
142
|
|
|
76
143
|
// Cell shape. 'hexagon' is a layout, not just a path: it only tessellates
|
|
@@ -183,8 +250,10 @@ export default class HeatMap {
|
|
|
183
250
|
}
|
|
184
251
|
}
|
|
185
252
|
|
|
186
|
-
// Stop loop if index is out of array length
|
|
187
|
-
|
|
253
|
+
// Stop loop if index is out of array length. `i` is the series index
|
|
254
|
+
// in both orders, so bound by series[i]: the reversed heatSeries[i]
|
|
255
|
+
// is the mirrored row.
|
|
256
|
+
if (j >= series[i].length) break
|
|
188
257
|
|
|
189
258
|
// Cell width and left edge: value-based when continuous, else index.
|
|
190
259
|
const cellW = isContinuousX ? binPx : xDivision
|
|
@@ -418,7 +487,6 @@ export default class HeatMap {
|
|
|
418
487
|
i,
|
|
419
488
|
j,
|
|
420
489
|
colorProps: heatColorProps,
|
|
421
|
-
series: heatSeries,
|
|
422
490
|
})
|
|
423
491
|
if (dataLabels !== null) {
|
|
424
492
|
elSeries.add(dataLabels)
|
|
@@ -434,17 +502,6 @@ export default class HeatMap {
|
|
|
434
502
|
ret.add(elSeries)
|
|
435
503
|
}
|
|
436
504
|
|
|
437
|
-
// adjust yaxis labels for heatmap
|
|
438
|
-
const yAxisScale = /** @type {any[]} */ (
|
|
439
|
-
w.globals.yAxisScale[0].result.slice()
|
|
440
|
-
)
|
|
441
|
-
if (w.config.yaxis[0].reversed) {
|
|
442
|
-
yAxisScale.unshift('')
|
|
443
|
-
} else {
|
|
444
|
-
yAxisScale.push('')
|
|
445
|
-
}
|
|
446
|
-
w.globals.yAxisScale[0].result = yAxisScale
|
|
447
|
-
|
|
448
505
|
return ret
|
|
449
506
|
}
|
|
450
507
|
|
package/src/charts/Line.js
CHANGED
|
@@ -106,7 +106,7 @@ class Line {
|
|
|
106
106
|
this.xRatio = this.xyRatios.xRatio
|
|
107
107
|
this.baseLineY = this.xyRatios.baseLineY
|
|
108
108
|
|
|
109
|
-
series = coreUtils.getLogSeries(series)
|
|
109
|
+
series = coreUtils.getLogSeries(series, /** @type {any} */ (seriesIndex))
|
|
110
110
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio)
|
|
111
111
|
// We call draw() for each series group
|
|
112
112
|
this.prevSeriesY = []
|
|
@@ -241,7 +241,6 @@ class Line {
|
|
|
241
241
|
|
|
242
242
|
const pX = x
|
|
243
243
|
let pY2
|
|
244
|
-
const prevX = pX
|
|
245
244
|
let prevY = this.zeroY
|
|
246
245
|
let prevY2 = this.zeroY
|
|
247
246
|
const lineYPosition = 0
|
|
@@ -282,16 +281,7 @@ class Line {
|
|
|
282
281
|
y2Arrj.push(yArrj[0] !== null ? prevY2 : null)
|
|
283
282
|
}
|
|
284
283
|
|
|
285
|
-
const pathsFrom = this._calculatePathsFrom(
|
|
286
|
-
type,
|
|
287
|
-
series,
|
|
288
|
-
i,
|
|
289
|
-
realIndex,
|
|
290
|
-
translationsIndex,
|
|
291
|
-
prevX,
|
|
292
|
-
prevY,
|
|
293
|
-
prevY2,
|
|
294
|
-
})
|
|
284
|
+
const pathsFrom = this._calculatePathsFrom(realIndex, prevY)
|
|
295
285
|
|
|
296
286
|
// RangeArea will resume with these for the upper path creation
|
|
297
287
|
const rYArrj = [yArrj[0]]
|
|
@@ -325,13 +315,7 @@ class Line {
|
|
|
325
315
|
})
|
|
326
316
|
|
|
327
317
|
if (type === 'rangeArea') {
|
|
328
|
-
const pathsFrom2 = this._calculatePathsFrom(
|
|
329
|
-
series: seriesRangeEnd,
|
|
330
|
-
i,
|
|
331
|
-
realIndex,
|
|
332
|
-
prevX,
|
|
333
|
-
prevY: prevY2,
|
|
334
|
-
})
|
|
318
|
+
const pathsFrom2 = this._calculatePathsFrom(realIndex, prevY2)
|
|
335
319
|
const rangePaths = this._iterateOverDataPoints({
|
|
336
320
|
...iteratingOpts,
|
|
337
321
|
series: seriesRangeEnd,
|
|
@@ -527,48 +511,20 @@ class Line {
|
|
|
527
511
|
this.appendPathFrom = true
|
|
528
512
|
}
|
|
529
513
|
|
|
530
|
-
/**
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
prevY,
|
|
539
|
-
prevY2,
|
|
540
|
-
}) {
|
|
541
|
-
const w = this.w
|
|
514
|
+
/**
|
|
515
|
+
* The baseline pathFrom a series grows from on mount, or the previous
|
|
516
|
+
* render's paths when there are any. `prevY` rides along for the first
|
|
517
|
+
* point's marker.
|
|
518
|
+
* @param {number} realIndex
|
|
519
|
+
* @param {number} prevY
|
|
520
|
+
*/
|
|
521
|
+
_calculatePathsFrom(realIndex, prevY) {
|
|
542
522
|
const graphics = new Graphics(this.w)
|
|
543
|
-
let
|
|
544
|
-
|
|
545
|
-
if (series[i][0] === null) {
|
|
546
|
-
// when the first value itself is null, we need to move the pointer to a location where a null value is not found
|
|
547
|
-
for (let s = 0; s < series[i].length; s++) {
|
|
548
|
-
if (series[i][s] !== null) {
|
|
549
|
-
prevX = this.xDivision * s
|
|
550
|
-
prevY = this.zeroY - series[i][s] / this.yRatio[translationsIndex]
|
|
551
|
-
linePath = graphics.move(prevX, prevY)
|
|
552
|
-
areaPath = graphics.move(prevX, this.areaBottomY)
|
|
553
|
-
break
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
} else {
|
|
557
|
-
linePath = graphics.move(prevX, prevY)
|
|
558
|
-
|
|
559
|
-
if (type === 'rangeArea') {
|
|
560
|
-
linePath = graphics.move(prevX, prevY2) + graphics.line(prevX, prevY)
|
|
561
|
-
}
|
|
562
|
-
areaPath =
|
|
563
|
-
graphics.move(prevX, this.areaBottomY) + graphics.line(prevX, prevY)
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
pathFromLine =
|
|
567
|
-
graphics.move(0, this.areaBottomY) + graphics.line(0, this.areaBottomY)
|
|
568
|
-
pathFromArea =
|
|
523
|
+
let pathFromLine =
|
|
569
524
|
graphics.move(0, this.areaBottomY) + graphics.line(0, this.areaBottomY)
|
|
525
|
+
let pathFromArea = pathFromLine
|
|
570
526
|
|
|
571
|
-
if (w.globals.previousPaths.length > 0) {
|
|
527
|
+
if (this.w.globals.previousPaths.length > 0) {
|
|
572
528
|
const pathFrom = this.lineHelpers.checkPreviousPaths({
|
|
573
529
|
pathFromLine,
|
|
574
530
|
pathFromArea,
|
|
@@ -578,14 +534,7 @@ class Line {
|
|
|
578
534
|
pathFromArea = pathFrom.pathFromArea
|
|
579
535
|
}
|
|
580
536
|
|
|
581
|
-
return {
|
|
582
|
-
prevX,
|
|
583
|
-
prevY,
|
|
584
|
-
linePath,
|
|
585
|
-
areaPath,
|
|
586
|
-
pathFromLine,
|
|
587
|
-
pathFromArea,
|
|
588
|
-
}
|
|
537
|
+
return { prevY, pathFromLine, pathFromArea }
|
|
589
538
|
}
|
|
590
539
|
|
|
591
540
|
/**
|
|
@@ -981,7 +930,12 @@ class Line {
|
|
|
981
930
|
const w = this.w
|
|
982
931
|
const graphics = new Graphics(this.w)
|
|
983
932
|
const yRatio = this.yRatio
|
|
984
|
-
|
|
933
|
+
const prevY = pathsFrom.prevY
|
|
934
|
+
let { pathFromLine, pathFromArea } = pathsFrom
|
|
935
|
+
/** @type {any} */
|
|
936
|
+
let linePath
|
|
937
|
+
/** @type {any} */
|
|
938
|
+
let areaPath
|
|
985
939
|
|
|
986
940
|
const minY = Utils.isNumber(w.globals.minYArr[realIndex])
|
|
987
941
|
? w.globals.minYArr[realIndex]
|
|
@@ -1264,8 +1218,6 @@ class Line {
|
|
|
1264
1218
|
areaPaths,
|
|
1265
1219
|
pathFromLine,
|
|
1266
1220
|
linePaths,
|
|
1267
|
-
linePath,
|
|
1268
|
-
areaPath,
|
|
1269
1221
|
}
|
|
1270
1222
|
}
|
|
1271
1223
|
|
|
@@ -1513,8 +1465,6 @@ class Line {
|
|
|
1513
1465
|
areaPaths,
|
|
1514
1466
|
pathFromLine,
|
|
1515
1467
|
linePaths,
|
|
1516
|
-
linePath,
|
|
1517
|
-
areaPath,
|
|
1518
1468
|
numericXY: nxs ? { xs: nxs, ys: nys, areaCloseY: bottomY } : undefined,
|
|
1519
1469
|
}
|
|
1520
1470
|
}
|