|
1 | 1 | /*!
|
2 |
| - * ApexCharts v3.23.0 |
| 2 | + * ApexCharts v3.23.1 |
3 | 3 | * (c) 2018-2020 Juned Chhipa
|
4 | 4 | * Released under the MIT License.
|
5 | 5 | */
|
|
430 | 430 | key: "getDimensions",
|
431 | 431 | value: function getDimensions(el) {
|
432 | 432 | var computedStyle = getComputedStyle(el, null);
|
433 |
| - var height = parseFloat(computedStyle.height); |
434 |
| - var width = parseFloat(computedStyle.width); |
435 |
| - return [width, height]; |
| 433 | + var elementHeight = el.clientHeight; |
| 434 | + var elementWidth = el.clientWidth; |
| 435 | + elementHeight -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom); |
| 436 | + elementWidth -= parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight); |
| 437 | + return [elementWidth, elementHeight]; |
436 | 438 | }
|
437 | 439 | }, {
|
438 | 440 | key: "getBoundingClientRect",
|
|
5559 | 5561 | }();
|
5560 | 5562 |
|
5561 | 5563 | /**
|
5562 |
| - * ApexCharts Series Class for interation with the Series of the chart. |
| 5564 | + * ApexCharts Series Class for interaction with the Series of the chart. |
5563 | 5565 | *
|
5564 | 5566 | * @module Series
|
5565 | 5567 | **/
|
|
6737 | 6739 | strokeWidth = _ref3.strokeWidth,
|
6738 | 6740 | elSeries = _ref3.elSeries;
|
6739 | 6741 | var w = this.w;
|
| 6742 | + var realIndex = indexes.realIndex; |
6740 | 6743 | var i = indexes.i;
|
6741 | 6744 | var j = indexes.j;
|
6742 | 6745 | var bc = indexes.bc;
|
6743 | 6746 |
|
6744 | 6747 | if (w.globals.isXNumeric) {
|
6745 |
| - var sxI = i; |
| 6748 | + var sxI = realIndex; |
6746 | 6749 |
|
6747 |
| - if (!w.globals.seriesX[i].length) { |
| 6750 | + if (!w.globals.seriesX[realIndex].length) { |
6748 | 6751 | sxI = w.globals.maxValsInArrayIndex;
|
6749 | 6752 | }
|
6750 | 6753 |
|
|
9862 | 9865 | if (!Utils.isIE11()) {
|
9863 | 9866 | // not IE11 - noop
|
9864 | 9867 | return svgData;
|
9865 |
| - } // replace second occurence of "xmlns" attribute with "xmlns:xlink" with correct url + add xmlns:svgjs |
| 9868 | + } // replace second occurrence of "xmlns" attribute with "xmlns:xlink" with correct url + add xmlns:svgjs |
9866 | 9869 |
|
9867 | 9870 |
|
9868 | 9871 | var nXmlnsSeen = 0;
|
|
10465 | 10468 |
|
10466 | 10469 | if (w.config.xaxis.axisTicks.show) {
|
10467 | 10470 | var graphics = new Graphics(this.ctx);
|
10468 |
| - var line = graphics.drawLine(x1 + w.config.xaxis.axisTicks.offsetX, y1 + w.config.xaxis.offsetY, x2 + w.config.xaxis.axisTicks.offsetX, y2 + w.config.xaxis.offsetY, w.config.xaxis.axisTicks.color); // we are not returning anything, but appending directly to the element pased in param |
| 10471 | + var line = graphics.drawLine(x1 + w.config.xaxis.axisTicks.offsetX, y1 + w.config.xaxis.offsetY, x2 + w.config.xaxis.axisTicks.offsetX, y2 + w.config.xaxis.offsetY, w.config.xaxis.axisTicks.color); // we are not returning anything, but appending directly to the element passed in param |
10469 | 10472 |
|
10470 | 10473 | appendToElement.add(line);
|
10471 | 10474 | line.node.classList.add('apexcharts-xaxis-tick');
|
|
11731 | 11734 | ) {
|
11732 | 11735 | var diff = gl.maxY - lowestYInAllSeries;
|
11733 | 11736 |
|
11734 |
| - if (lowestYInAllSeries >= 0 && lowestYInAllSeries <= 10) { |
| 11737 | + if (lowestYInAllSeries >= 0 && lowestYInAllSeries <= 10 || cnf.yaxis[0].min !== undefined || cnf.yaxis[0].max !== undefined) { |
11735 | 11738 | // if minY is already 0/low value, we don't want to go negatives here - so this check is essential.
|
11736 | 11739 | diff = 0;
|
11737 | 11740 | }
|
|
12205 | 12208 | }
|
12206 | 12209 |
|
12207 | 12210 | return elYaxis;
|
12208 |
| - } // This actually becomes horizonal axis (for bar charts) |
| 12211 | + } // This actually becomes horizontal axis (for bar charts) |
12209 | 12212 |
|
12210 | 12213 | }, {
|
12211 | 12214 | key: "drawYaxisInversed",
|
|
12915 | 12918 | return c;
|
12916 | 12919 | });
|
12917 | 12920 | }
|
12918 |
| - } // user defined colors in series aray |
| 12921 | + } // user defined colors in series array |
12919 | 12922 |
|
12920 | 12923 |
|
12921 | 12924 | w.globals.seriesColors.map(function (c, i) {
|
|
12954 | 12957 | w.globals.colors = monoArr.slice();
|
12955 | 12958 | }
|
12956 | 12959 |
|
12957 |
| - var defaultColors = w.globals.colors.slice(); // if user specfied less colors than no. of series, push the same colors again |
| 12960 | + var defaultColors = w.globals.colors.slice(); // if user specified fewer colors than no. of series, push the same colors again |
12958 | 12961 |
|
12959 | 12962 | this.pushExtraColors(w.globals.colors);
|
12960 | 12963 | var colorTypes = ['fill', 'stroke'];
|
|
13638 | 13641 | padForLabelTitle(yTitleCoord, index);
|
13639 | 13642 | });
|
13640 | 13643 |
|
13641 |
| - if (w.globals.isBarHorizontal) { |
| 13644 | + if (w.globals.isBarHorizontal && !w.config.yaxis[0].floating) { |
13642 | 13645 | yAxisWidth = w.globals.yLabelsCoords[0].width + w.globals.yTitleCoords[0].width + 15;
|
13643 | 13646 | }
|
13644 | 13647 |
|
|
15704 | 15707 | x: me.clientX,
|
15705 | 15708 | y: me.clientY
|
15706 | 15709 | };
|
15707 |
| - var xLowestValue = w.globals.minX; |
15708 |
| - var xHighestValue = w.globals.maxX; // on a category, we don't pan continuosly as it causes bugs |
| 15710 | + var xLowestValue = w.globals.isTimelineBar ? w.globals.minY : w.globals.minX; |
| 15711 | + var xHighestValue = w.globals.isTimelineBar ? w.globals.maxY : w.globals.maxX; // on a category, we don't pan continuosly as it causes bugs |
15709 | 15712 |
|
15710 | 15713 | if (!w.config.xaxis.convertedCatToNumeric) {
|
15711 | 15714 | me.panScrolled(xLowestValue, xHighestValue);
|
@@ -15742,18 +15745,29 @@
|
15742 | 15745 | var w = this.w;
|
15743 | 15746 | var xyRatios = this.xyRatios;
|
15744 | 15747 | var yaxis = Utils.clone(w.globals.initialConfig.yaxis);
|
| 15748 | + var xRatio = xyRatios.xRatio; |
| 15749 | + var minX = w.globals.minX; |
| 15750 | + var maxX = w.globals.maxX; |
| 15751 | + |
| 15752 | + if (w.globals.isTimelineBar) { |
| 15753 | + xRatio = xyRatios.invertedYRatio; |
| 15754 | + minX = w.globals.minY; |
| 15755 | + maxX = w.globals.maxY; |
| 15756 | + } |
15745 | 15757 |
|
15746 | 15758 | if (this.moveDirection === 'left') {
|
15747 |
| - xLowestValue = w.globals.minX + w.globals.gridWidth / 15 * xyRatios.xRatio; |
15748 |
| - xHighestValue = w.globals.maxX + w.globals.gridWidth / 15 * xyRatios.xRatio; |
| 15759 | + xLowestValue = minX + w.globals.gridWidth / 15 * xRatio; |
| 15760 | + xHighestValue = maxX + w.globals.gridWidth / 15 * xRatio; |
15749 | 15761 | } else if (this.moveDirection === 'right') {
|
15750 |
| - xLowestValue = w.globals.minX - w.globals.gridWidth / 15 * xyRatios.xRatio; |
15751 |
| - xHighestValue = w.globals.maxX - w.globals.gridWidth / 15 * xyRatios.xRatio; |
| 15762 | + xLowestValue = minX - w.globals.gridWidth / 15 * xRatio; |
| 15763 | + xHighestValue = maxX - w.globals.gridWidth / 15 * xRatio; |
15752 | 15764 | }
|
15753 | 15765 |
|
15754 |
| - if (xLowestValue < w.globals.initialMinX || xHighestValue > w.globals.initialMaxX) { |
15755 |
| - xLowestValue = w.globals.minX; |
15756 |
| - xHighestValue = w.globals.maxX; |
| 15766 | + if (!w.globals.isTimelineBar) { |
| 15767 | + if (xLowestValue < w.globals.initialMinX || xHighestValue > w.globals.initialMaxX) { |
| 15768 | + xLowestValue = minX; |
| 15769 | + xHighestValue = maxX; |
| 15770 | + } |
15757 | 15771 | }
|
15758 | 15772 |
|
15759 | 15773 | var xaxis = {
|
|
18098 | 18112 | var y = w.globals.clientY - seriesBound.top - tooltipRect.ttHeight - 10;
|
18099 | 18113 | tooltipEl.style.left = x + 'px';
|
18100 | 18114 | tooltipEl.style.top = y + 'px';
|
| 18115 | + |
| 18116 | + if (w.config.legend.tooltipHoverFormatter) { |
| 18117 | + var legendFormatter = w.config.legend.tooltipHoverFormatter; |
| 18118 | + var i = rel - 1; |
| 18119 | + var legendName = this.legendLabels[i].getAttribute('data:default-text'); |
| 18120 | + var text = legendFormatter(legendName, { |
| 18121 | + seriesIndex: i, |
| 18122 | + dataPointIndex: i, |
| 18123 | + w: w |
| 18124 | + }); |
| 18125 | + this.legendLabels[i].innerHTML = text; |
| 18126 | + } |
18101 | 18127 | } else if (e.type === 'mouseout' || e.type === 'touchend') {
|
18102 | 18128 | tooltipEl.classList.remove('apexcharts-active');
|
| 18129 | + |
| 18130 | + if (w.config.legend.tooltipHoverFormatter) { |
| 18131 | + this.legendLabels.forEach(function (l) { |
| 18132 | + var defaultText = l.getAttribute('data:default-text'); |
| 18133 | + l.innerHTML = decodeURIComponent(defaultText); |
| 18134 | + }); |
| 18135 | + } |
18103 | 18136 | }
|
18104 | 18137 | }
|
18105 | 18138 | }, {
|
|
19603 | 19636 | seriesNumber: i,
|
19604 | 19637 | size: this.sliceSizes[i],
|
19605 | 19638 | value: series[i]
|
19606 |
| - }); // additionaly, pass size for gradient drawing in the fillPath function |
| 19639 | + }); // additionally, pass size for gradient drawing in the fillPath function |
19607 | 19640 |
|
19608 | 19641 | var path = this.getChangedPath(prevStartAngle, prevEndAngle);
|
19609 | 19642 | var elPath = graphics.drawPath({
|
|
19618 | 19651 | index: 0,
|
19619 | 19652 | j: i
|
19620 | 19653 | });
|
| 19654 | + filters.setSelectionFilter(elPath, 0, i); |
19621 | 19655 |
|
19622 | 19656 | if (w.config.chart.dropShadow.enabled) {
|
19623 | 19657 | var shadow = w.config.chart.dropShadow;
|
|
19685 | 19719 | elPath.click(this.pieClicked.bind(this, i));
|
19686 | 19720 | }
|
19687 | 19721 |
|
| 19722 | + if (typeof w.globals.selectedDataPoints[0] !== 'undefined' && w.globals.selectedDataPoints[0].indexOf(i) > -1) { |
| 19723 | + this.pieClicked(i); |
| 19724 | + } |
| 19725 | + |
19688 | 19726 | if (w.config.dataLabels.enabled) {
|
19689 | 19727 | var xPos = labelPosition.x;
|
19690 | 19728 | var yPos = labelPosition.y;
|
|
20960 | 20998 | filters.dropShadow(elPath, _shadow, i);
|
20961 | 20999 | }
|
20962 | 21000 |
|
| 21001 | + filters.setSelectionFilter(elPath, 0, i); |
20963 | 21002 | this.addListeners(elPath, this.radialDataLabels);
|
20964 | 21003 | elRadialBarArc.add(elPath);
|
20965 | 21004 | elPath.attr({
|
|
22281 | 22320 | // the font size should be proportional to the size of the box (and the value)
|
22282 | 22321 | // otherwise you can end up creating a visual distortion where two boxes of identical
|
22283 | 22322 | // size have different sized labels, and thus make it look as if the two boxes
|
22284 |
| - // represent diffferent sizes |
| 22323 | + // represent different sizes |
22285 | 22324 | var area = width * height;
|
22286 | 22325 | var arearoot = Math.pow(area, 0.5);
|
22287 | 22326 | return Math.min(arearoot / averagelabelsize, parseInt(w.config.dataLabels.style.fontSize, 10));
|
|
23255 | 23294 | candlestickSeries.i.push(st);
|
23256 | 23295 | } else {
|
23257 | 23296 | // user has specified type, but it is not valid (other than line/area/column)
|
23258 |
| - console.warn('You have specified an unrecognized chart type. Available types for this propery are line/area/column/bar/scatter/bubble'); |
| 23297 | + console.warn('You have specified an unrecognized chart type. Available types for this property are line/area/column/bar/scatter/bubble'); |
23259 | 23298 | }
|
23260 | 23299 |
|
23261 | 23300 | gl.comboCharts = true;
|
|
29994 | 30033 | this.formatters.setLabelFormatters();
|
29995 | 30034 | }
|
29996 | 30035 | } // we need to generate yaxis for heatmap separately as we are not showing numerics there, but seriesNames. There are some tweaks which are required for heatmap to align labels correctly which are done in below function
|
29997 |
| - // Also we need to do this before calcuting Dimentions plotCoords() method of Dimensions |
| 30036 | + // Also we need to do this before calculating Dimensions plotCoords() method of Dimensions |
29998 | 30037 |
|
29999 | 30038 |
|
30000 | 30039 | this.formatters.heatmapLabelFormatters(); // We got plottable area here, next task would be to calculate axis areas
|
|
30559 | 30598 | }
|
30560 | 30599 | /**
|
30561 | 30600 | * This static method allows users to call chart methods without necessarily from the
|
30562 |
| - * instance of the chart in case user has assigned chartID to the targetted chart. |
| 30601 | + * instance of the chart in case user has assigned chartID to the targeted chart. |
30563 | 30602 | * The chartID is used for mapping the instance stored in Apex._chartInstances global variable
|
30564 | 30603 | *
|
30565 | 30604 | * This is helpful in cases when you don't have reference of the chart instance
|
|
0 commit comments