|
1 | 1 | /*!
|
2 |
| - * ApexCharts v3.39.0 |
| 2 | + * ApexCharts v3.40.0 |
3 | 3 | * (c) 2018-2023 ApexCharts
|
4 | 4 | * Released under the MIT License.
|
5 | 5 | */
|
|
1218 | 1218 | _createClass(Graphics, [{
|
1219 | 1219 | key: "roundPathCorners",
|
1220 | 1220 | value: function roundPathCorners(pathString, radius) {
|
| 1221 | + if (pathString.indexOf('NaN') > -1) pathString = ''; |
| 1222 | + |
1221 | 1223 | function moveTowardsLength(movingPoint, targetPoint, amount) {
|
1222 | 1224 | var width = targetPoint.x - movingPoint.x;
|
1223 | 1225 | var height = targetPoint.y - movingPoint.y;
|
|
3583 | 3585 | rangeBarOverlap: true,
|
3584 | 3586 | rangeBarGroupRows: false,
|
3585 | 3587 | hideZeroBarsWhenGrouped: false,
|
| 3588 | + isDumbbell: false, |
| 3589 | + dumbbellColors: undefined, |
3586 | 3590 | colors: {
|
3587 | 3591 | ranges: [],
|
3588 | 3592 | backgroundBarColors: [],
|
|
5414 | 5418 | };
|
5415 | 5419 |
|
5416 | 5420 | return {
|
| 5421 | + chart: { |
| 5422 | + animations: { |
| 5423 | + animateGradually: false |
| 5424 | + } |
| 5425 | + }, |
5417 | 5426 | stroke: {
|
5418 | 5427 | width: 0,
|
5419 | 5428 | lineCap: 'square'
|
|
5457 | 5466 | colors: ['#fff']
|
5458 | 5467 | }
|
5459 | 5468 | },
|
| 5469 | + markers: { |
| 5470 | + size: 10 |
| 5471 | + }, |
5460 | 5472 | tooltip: {
|
5461 | 5473 | shared: false,
|
5462 | 5474 | followCursor: true,
|
|
5481 | 5493 | }
|
5482 | 5494 | };
|
5483 | 5495 | }
|
| 5496 | + }, { |
| 5497 | + key: "dumbbell", |
| 5498 | + value: function dumbbell(opts) { |
| 5499 | + var _opts$plotOptions$bar, _opts$plotOptions$bar2; |
| 5500 | + |
| 5501 | + if (!((_opts$plotOptions$bar = opts.plotOptions.bar) !== null && _opts$plotOptions$bar !== void 0 && _opts$plotOptions$bar.barHeight)) { |
| 5502 | + opts.plotOptions.bar.barHeight = 2; |
| 5503 | + } |
| 5504 | + |
| 5505 | + if (!((_opts$plotOptions$bar2 = opts.plotOptions.bar) !== null && _opts$plotOptions$bar2 !== void 0 && _opts$plotOptions$bar2.columnWidth)) { |
| 5506 | + opts.plotOptions.bar.columnWidth = 2; |
| 5507 | + } |
| 5508 | + |
| 5509 | + return opts; |
| 5510 | + } |
5484 | 5511 | }, {
|
5485 | 5512 | key: "area",
|
5486 | 5513 | value: function area() {
|
|
6082 | 6109 | var newDefaults = {};
|
6083 | 6110 |
|
6084 | 6111 | if (opts && _typeof(opts) === 'object') {
|
| 6112 | + var _opts$chart$brush, _opts$plotOptions, _opts$plotOptions$bar, _opts$chart$sparkline, _window$Apex$chart, _window$Apex$chart$sp; |
| 6113 | + |
6085 | 6114 | var chartDefaults = {};
|
6086 | 6115 | var chartTypes = ['line', 'area', 'bar', 'candlestick', 'boxPlot', 'rangeBar', 'rangeArea', 'bubble', 'scatter', 'heatmap', 'treemap', 'pie', 'polarArea', 'donut', 'radar', 'radialBar'];
|
6087 | 6116 |
|
|
6095 | 6124 | chartDefaults = defaults.stackedBars();
|
6096 | 6125 | }
|
6097 | 6126 |
|
6098 |
| - if (opts.chart.brush && opts.chart.brush.enabled) { |
| 6127 | + if ((_opts$chart$brush = opts.chart.brush) !== null && _opts$chart$brush !== void 0 && _opts$chart$brush.enabled) { |
6099 | 6128 | chartDefaults = defaults.brush(chartDefaults);
|
6100 | 6129 | }
|
6101 | 6130 |
|
6102 | 6131 | if (opts.chart.stacked && opts.chart.stackType === '100%') {
|
6103 | 6132 | opts = defaults.stacked100(opts);
|
| 6133 | + } |
| 6134 | + |
| 6135 | + if ((_opts$plotOptions = opts.plotOptions) !== null && _opts$plotOptions !== void 0 && (_opts$plotOptions$bar = _opts$plotOptions.bar) !== null && _opts$plotOptions$bar !== void 0 && _opts$plotOptions$bar.isDumbbell) { |
| 6136 | + opts = defaults.dumbbell(opts); |
6104 | 6137 | } // If user has specified a dark theme, make the tooltip dark too
|
6105 | 6138 |
|
6106 | 6139 |
|
|
6117 | 6150 |
|
6118 | 6151 | opts = this.checkForCatToNumericXAxis(this.chartType, chartDefaults, opts);
|
6119 | 6152 |
|
6120 |
| - if (opts.chart.sparkline && opts.chart.sparkline.enabled || window.Apex.chart && window.Apex.chart.sparkline && window.Apex.chart.sparkline.enabled) { |
| 6153 | + if ((_opts$chart$sparkline = opts.chart.sparkline) !== null && _opts$chart$sparkline !== void 0 && _opts$chart$sparkline.enabled || (_window$Apex$chart = window.Apex.chart) !== null && _window$Apex$chart !== void 0 && (_window$Apex$chart$sp = _window$Apex$chart.sparkline) !== null && _window$Apex$chart$sp !== void 0 && _window$Apex$chart$sp.enabled) { |
6121 | 6154 | chartDefaults = defaults.sparkline(chartDefaults);
|
6122 | 6155 | }
|
6123 | 6156 |
|
|
6137 | 6170 | }, {
|
6138 | 6171 | key: "checkForCatToNumericXAxis",
|
6139 | 6172 | value: function checkForCatToNumericXAxis(chartType, chartDefaults, opts) {
|
| 6173 | + var _opts$plotOptions2, _opts$plotOptions2$ba; |
| 6174 | + |
6140 | 6175 | var defaults = new Defaults(opts);
|
6141 |
| - var isBarHorizontal = (chartType === 'bar' || chartType === 'boxPlot') && opts.plotOptions && opts.plotOptions.bar && opts.plotOptions.bar.horizontal; |
| 6176 | + var isBarHorizontal = (chartType === 'bar' || chartType === 'boxPlot') && ((_opts$plotOptions2 = opts.plotOptions) === null || _opts$plotOptions2 === void 0 ? void 0 : (_opts$plotOptions2$ba = _opts$plotOptions2.bar) === null || _opts$plotOptions2$ba === void 0 ? void 0 : _opts$plotOptions2$ba.horizontal); |
6142 | 6177 | var unsupportedZoom = chartType === 'pie' || chartType === 'polarArea' || chartType === 'donut' || chartType === 'radar' || chartType === 'radialBar' || chartType === 'heatmap';
|
6143 | 6178 | var notNumericXAxis = opts.xaxis.type !== 'datetime' && opts.xaxis.type !== 'numeric';
|
6144 | 6179 | var tickPlacement = opts.xaxis.tickPlacement ? opts.xaxis.tickPlacement : chartDefaults.xaxis && chartDefaults.xaxis.tickPlacement;
|
|
9556 | 9591 | var offX = w.globals.barPadForNumericAxis;
|
9557 | 9592 | var elHorzLine = graphics.drawLine(w.globals.padHorizontal + w.config.xaxis.axisBorder.offsetX - offX, this.offY, this.xaxisBorderWidth + offX, this.offY, w.config.xaxis.axisBorder.color, 0, this.xaxisBorderHeight);
|
9558 | 9593 |
|
9559 |
| - if (this.elgrid && this.elgrid.elGridBorders) { |
| 9594 | + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { |
9560 | 9595 | this.elgrid.elGridBorders.add(elHorzLine);
|
9561 | 9596 | } else {
|
9562 | 9597 | elXaxis.add(elHorzLine);
|
|
9824 | 9859 | if (axisBorder.show) {
|
9825 | 9860 | var elVerticalLine = graphics.drawLine(w.globals.padHorizontal + axisBorder.offsetX + offX, 1 + axisBorder.offsetY, w.globals.padHorizontal + axisBorder.offsetX + offX, w.globals.gridHeight + axisBorder.offsetY, axisBorder.color, 0);
|
9826 | 9861 |
|
9827 |
| - if (this.elgrid && this.elgrid.elGridBorders) { |
| 9862 | + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { |
9828 | 9863 | this.elgrid.elGridBorders.add(elVerticalLine);
|
9829 | 9864 | } else {
|
9830 | 9865 | elYaxis.add(elVerticalLine);
|
|
10166 | 10201 | var line = graphics.drawLine(x1 - (isHorzLine ? offX : 0), y1, x2 + (isHorzLine ? offX : 0), y2, w.config.grid.borderColor, strokeDashArray);
|
10167 | 10202 | line.node.classList.add('apexcharts-gridline');
|
10168 | 10203 |
|
10169 |
| - if (excludeBorders) { |
| 10204 | + if (excludeBorders && w.config.grid.show) { |
10170 | 10205 | this.elGridBorders.add(line);
|
10171 | 10206 | } else {
|
10172 | 10207 | parent.add(line);
|
|
10408 | 10443 | xCount = this.xaxisLabels.length;
|
10409 | 10444 |
|
10410 | 10445 | if (this.isRangeBar) {
|
| 10446 | + xCount--; |
10411 | 10447 | yTickAmount = w.globals.labels.length;
|
10412 | 10448 |
|
10413 | 10449 | if (w.config.xaxis.tickAmount && w.config.xaxis.labels.formatter) {
|
|
11858 | 11894 |
|
11859 | 11895 | var elHorzLine = graphics.drawLine(w.globals.padHorizontal + lineCorrection + axisBorder.offsetX, this.xAxisoffX, w.globals.gridWidth, this.xAxisoffX, axisBorder.color, 0, axisBorder.height); // in horizontal bars, we append axisBorder to elGridBorders element to avoid z-index issues
|
11860 | 11896 |
|
11861 |
| - if (this.elgrid && this.elgrid.elGridBorders) { |
| 11897 | + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { |
11862 | 11898 | this.elgrid.elGridBorders.add(elHorzLine);
|
11863 | 11899 | } else {
|
11864 | 11900 | parent.add(elHorzLine);
|
|
18813 | 18849 | }
|
18814 | 18850 |
|
18815 | 18851 | barHeight = barHeight * parseInt(this.barCtx.barOptions.barHeight, 10) / 100;
|
| 18852 | + |
| 18853 | + if (String(this.barCtx.barOptions.barHeight).indexOf('%') === -1) { |
| 18854 | + barHeight = parseInt(this.barCtx.barOptions.barHeight, 10); |
| 18855 | + } |
| 18856 | + |
18816 | 18857 | zeroW = this.barCtx.baseLineInvertedY + w.globals.padHorizontal + (this.barCtx.isReversed ? w.globals.gridWidth : 0) - (this.barCtx.isReversed ? this.barCtx.baseLineInvertedY * 2 : 0);
|
18817 | 18858 | y = (yDivision - barHeight * this.barCtx.seriesLen) / 2;
|
18818 | 18859 | } else {
|
|
18844 | 18885 | }
|
18845 | 18886 | }
|
18846 | 18887 |
|
| 18888 | + if (String(this.barCtx.barOptions.columnWidth).indexOf('%') === -1) { |
| 18889 | + barWidth = parseInt(this.barCtx.barOptions.columnWidth, 10); |
| 18890 | + } |
| 18891 | + |
18847 | 18892 | zeroH = w.globals.gridHeight - this.barCtx.baseLineY[this.barCtx.yaxisIndex] - (this.barCtx.isReversed ? w.globals.gridHeight : 0) + (this.barCtx.isReversed ? this.barCtx.baseLineY[this.barCtx.yaxisIndex] * 2 : 0);
|
18848 | 18893 | x = w.globals.padHorizontal + (xDivision - barWidth * this.barCtx.seriesLen) / 2;
|
18849 | 18894 | }
|
@@ -19200,14 +19245,33 @@
|
19200 | 19245 | var w = this.w;
|
19201 | 19246 | var goals = [];
|
19202 | 19247 |
|
| 19248 | + var pushGoal = function pushGoal(value, attrs) { |
| 19249 | + var _goals$push; |
| 19250 | + |
| 19251 | + goals.push((_goals$push = {}, _defineProperty(_goals$push, type, type === 'x' ? _this.getXForValue(value, zeroW, false) : _this.getYForValue(value, zeroH, false)), _defineProperty(_goals$push, "attrs", attrs), _goals$push)); |
| 19252 | + }; |
| 19253 | + |
19203 | 19254 | if (w.globals.seriesGoals[i] && w.globals.seriesGoals[i][j] && Array.isArray(w.globals.seriesGoals[i][j])) {
|
19204 | 19255 | w.globals.seriesGoals[i][j].forEach(function (goal) {
|
19205 |
| - var _goals$push; |
19206 |
| - |
19207 |
| - goals.push((_goals$push = {}, _defineProperty(_goals$push, type, type === 'x' ? _this.getXForValue(goal.value, zeroW, false) : _this.getYForValue(goal.value, zeroH, false)), _defineProperty(_goals$push, "attrs", goal), _goals$push)); |
| 19256 | + pushGoal(goal.value, goal); |
19208 | 19257 | });
|
19209 | 19258 | }
|
19210 | 19259 |
|
| 19260 | + if (this.barCtx.barOptions.isDumbbell && w.globals.seriesRange.length) { |
| 19261 | + var colors = this.barCtx.barOptions.dumbbellColors ? this.barCtx.barOptions.dumbbellColors : w.globals.colors; |
| 19262 | + var commonAttrs = { |
| 19263 | + strokeHeight: type === 'x' ? 0 : w.globals.markers.size[i], |
| 19264 | + strokeWidth: type === 'x' ? w.globals.markers.size[i] : 0, |
| 19265 | + strokeDashArray: 0, |
| 19266 | + strokeLineCap: 'round', |
| 19267 | + strokeColor: Array.isArray(colors[i]) ? colors[i][0] : colors[i] |
| 19268 | + }; |
| 19269 | + pushGoal(w.globals.seriesRangeStart[i][j], commonAttrs); |
| 19270 | + pushGoal(w.globals.seriesRangeEnd[i][j], _objectSpread2(_objectSpread2({}, commonAttrs), {}, { |
| 19271 | + strokeColor: Array.isArray(colors[i]) ? colors[i][1] : colors[i] |
| 19272 | + })); |
| 19273 | + } |
| 19274 | + |
19211 | 19275 | return goals;
|
19212 | 19276 | }
|
19213 | 19277 | }, {
|
|
19223 | 19287 | var lineGroup = graphics.group({
|
19224 | 19288 | className: 'apexcharts-bar-goals-groups'
|
19225 | 19289 | });
|
| 19290 | + lineGroup.node.classList.add('apexcharts-element-hidden'); |
| 19291 | + this.barCtx.w.globals.delayedElements.push({ |
| 19292 | + el: lineGroup.node |
| 19293 | + }); |
| 19294 | + lineGroup.attr('clip-path', "url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid, ")")); |
19226 | 19295 | var line = null;
|
19227 | 19296 |
|
19228 | 19297 | if (this.barCtx.isHorizontal) {
|
@@ -20007,20 +20076,31 @@
|
20007 | 20076 | }, {
|
20008 | 20077 | key: "initialPositions",
|
20009 | 20078 | value: function initialPositions(x, y, xDivision, yDivision, zeroH, zeroW) {
|
20010 |
| - var _w$globals$seriesGrou, _w$globals$seriesGrou2; |
20011 |
| - |
20012 | 20079 | var w = this.w;
|
20013 | 20080 | var barHeight, barWidth;
|
20014 | 20081 |
|
20015 | 20082 | if (this.isHorizontal) {
|
| 20083 | + var _w$globals$seriesGrou; |
| 20084 | + |
20016 | 20085 | // height divided into equal parts
|
20017 | 20086 | yDivision = w.globals.gridHeight / w.globals.dataPoints;
|
20018 | 20087 | barHeight = yDivision;
|
20019 | 20088 | barHeight = barHeight * parseInt(w.config.plotOptions.bar.barHeight, 10) / 100;
|
| 20089 | + |
| 20090 | + if ((_w$globals$seriesGrou = w.globals.seriesGroups) !== null && _w$globals$seriesGrou !== void 0 && _w$globals$seriesGrou.length) { |
| 20091 | + barHeight = barHeight / w.globals.seriesGroups.length; |
| 20092 | + } |
| 20093 | + |
| 20094 | + if (String(w.config.plotOptions.bar.barHeight).indexOf('%') === -1) { |
| 20095 | + barHeight = parseInt(w.config.plotOptions.bar.barHeight, 10); |
| 20096 | + } |
| 20097 | + |
20020 | 20098 | zeroW = this.baseLineInvertedY + w.globals.padHorizontal + (this.isReversed ? w.globals.gridWidth : 0) - (this.isReversed ? this.baseLineInvertedY * 2 : 0); // initial y position is half of barHeight * half of number of Bars
|
20021 | 20099 |
|
20022 | 20100 | y = (yDivision - barHeight) / 2;
|
20023 | 20101 | } else {
|
| 20102 | + var _w$globals$seriesGrou2; |
| 20103 | + |
20024 | 20104 | // width divided into equal parts
|
20025 | 20105 | xDivision = w.globals.gridWidth / w.globals.dataPoints;
|
20026 | 20106 | barWidth = xDivision;
|
|
20033 | 20113 | barWidth = barWidth * parseInt(w.config.plotOptions.bar.columnWidth, 10) / 100;
|
20034 | 20114 | }
|
20035 | 20115 |
|
| 20116 | + if ((_w$globals$seriesGrou2 = w.globals.seriesGroups) !== null && _w$globals$seriesGrou2 !== void 0 && _w$globals$seriesGrou2.length) { |
| 20117 | + barWidth = barWidth / w.globals.seriesGroups.length; |
| 20118 | + } |
| 20119 | + |
| 20120 | + if (String(w.config.plotOptions.bar.columnWidth).indexOf('%') === -1) { |
| 20121 | + barWidth = parseInt(w.config.plotOptions.bar.columnWidth, 10); |
| 20122 | + } |
| 20123 | + |
20036 | 20124 | zeroH = w.globals.gridHeight - this.baseLineY[this.yaxisIndex] - (this.isReversed ? w.globals.gridHeight : 0) + (this.isReversed ? this.baseLineY[this.yaxisIndex] * 2 : 0); // initial x position is one third of barWidth
|
20037 | 20125 |
|
20038 | 20126 | x = w.globals.padHorizontal + (xDivision - barWidth) / 2;
|
|
20043 | 20131 | y: y,
|
20044 | 20132 | yDivision: yDivision,
|
20045 | 20133 | xDivision: xDivision,
|
20046 |
| - barHeight: (_w$globals$seriesGrou = w.globals.seriesGroups) !== null && _w$globals$seriesGrou !== void 0 && _w$globals$seriesGrou.length ? barHeight / w.globals.seriesGroups.length : barHeight, |
20047 |
| - barWidth: (_w$globals$seriesGrou2 = w.globals.seriesGroups) !== null && _w$globals$seriesGrou2 !== void 0 && _w$globals$seriesGrou2.length ? barWidth / w.globals.seriesGroups.length : barWidth, |
| 20134 | + barHeight: barHeight, |
| 20135 | + barWidth: barWidth, |
20048 | 20136 | zeroH: zeroH,
|
20049 | 20137 | zeroW: zeroW
|
20050 | 20138 | };
|
|
0 commit comments