Skip to content

Commit 5c65d4a

Browse files
committed
build - 3.35.1
1 parent f73a6b0 commit 5c65d4a

File tree

5 files changed

+186
-59
lines changed

5 files changed

+186
-59
lines changed

dist/apexcharts.amd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apexcharts.common.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apexcharts.esm.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apexcharts.js

Lines changed: 173 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* ApexCharts v3.35.0
2+
* ApexCharts v3.35.1
33
* (c) 2018-2022 ApexCharts
44
* Released under the MIT License.
55
*/
@@ -1613,23 +1613,44 @@
16131613
return g;
16141614
}
16151615
}, {
1616-
key: "drawText",
1617-
value: function drawText(_ref3) {
1618-
var x = _ref3.x,
1619-
y = _ref3.y,
1620-
text = _ref3.text,
1621-
textAnchor = _ref3.textAnchor,
1616+
key: "getTextBasedOnMaxWidth",
1617+
value: function getTextBasedOnMaxWidth(_ref3) {
1618+
var text = _ref3.text,
1619+
maxWidth = _ref3.maxWidth,
16221620
fontSize = _ref3.fontSize,
1623-
fontFamily = _ref3.fontFamily,
1624-
fontWeight = _ref3.fontWeight,
1625-
foreColor = _ref3.foreColor,
1626-
opacity = _ref3.opacity,
1627-
_ref3$cssClass = _ref3.cssClass,
1628-
cssClass = _ref3$cssClass === void 0 ? '' : _ref3$cssClass,
1629-
_ref3$isPlainText = _ref3.isPlainText,
1630-
isPlainText = _ref3$isPlainText === void 0 ? true : _ref3$isPlainText;
1621+
fontFamily = _ref3.fontFamily;
1622+
var tRects = this.getTextRects(text, fontSize, fontFamily);
1623+
var wordWidth = tRects.width / text.length;
1624+
var wordsBasedOnWidth = Math.floor(maxWidth / wordWidth);
1625+
1626+
if (maxWidth < tRects.width) {
1627+
return text.slice(0, wordsBasedOnWidth - 3) + '...';
1628+
}
1629+
1630+
return text;
1631+
}
1632+
}, {
1633+
key: "drawText",
1634+
value: function drawText(_ref4) {
1635+
var _this = this;
1636+
1637+
var x = _ref4.x,
1638+
y = _ref4.y,
1639+
text = _ref4.text,
1640+
textAnchor = _ref4.textAnchor,
1641+
fontSize = _ref4.fontSize,
1642+
fontFamily = _ref4.fontFamily,
1643+
fontWeight = _ref4.fontWeight,
1644+
foreColor = _ref4.foreColor,
1645+
opacity = _ref4.opacity,
1646+
maxWidth = _ref4.maxWidth,
1647+
_ref4$cssClass = _ref4.cssClass,
1648+
cssClass = _ref4$cssClass === void 0 ? '' : _ref4$cssClass,
1649+
_ref4$isPlainText = _ref4.isPlainText,
1650+
isPlainText = _ref4$isPlainText === void 0 ? true : _ref4$isPlainText;
16311651
var w = this.w;
16321652
if (typeof text === 'undefined') text = '';
1653+
var truncatedText = text;
16331654

16341655
if (!textAnchor) {
16351656
textAnchor = 'start';
@@ -1640,18 +1661,36 @@
16401661
}
16411662

16421663
fontFamily = fontFamily || w.config.chart.fontFamily;
1664+
fontSize = fontSize || '11px';
16431665
fontWeight = fontWeight || 'regular';
1666+
var commonProps = {
1667+
maxWidth: maxWidth,
1668+
fontSize: fontSize,
1669+
fontFamily: fontFamily
1670+
};
16441671
var elText;
16451672

16461673
if (Array.isArray(text)) {
16471674
elText = w.globals.dom.Paper.text(function (add) {
16481675
for (var i = 0; i < text.length; i++) {
1649-
i === 0 ? add.tspan(text[i]) : add.tspan(text[i]).newLine();
1676+
if (maxWidth) {
1677+
truncatedText = _this.getTextBasedOnMaxWidth(_objectSpread2({
1678+
text: text[i]
1679+
}, commonProps));
1680+
}
1681+
1682+
i === 0 ? add.tspan(truncatedText) : add.tspan(truncatedText).newLine();
16501683
}
16511684
});
16521685
} else {
1686+
if (maxWidth) {
1687+
truncatedText = this.getTextBasedOnMaxWidth(_objectSpread2({
1688+
text: text
1689+
}, commonProps));
1690+
}
1691+
16531692
elText = isPlainText ? w.globals.dom.Paper.plain(text) : w.globals.dom.Paper.text(function (add) {
1654-
return add.tspan(text);
1693+
return add.tspan(truncatedText);
16551694
});
16561695
}
16571696

@@ -1836,10 +1875,24 @@
18361875

18371876
if (activeFilter !== 'none') {
18381877
filters.applyFilter(path, i, activeFilter.type, activeFilter.value);
1878+
} else {
1879+
// Reapply the hover filter in case it was removed by `deselect`when there is no active filter and it is not a touch device
1880+
if (w.config.states.hover.filter !== 'none') {
1881+
if (!w.globals.isTouchDevice) {
1882+
var hoverFilter = w.config.states.hover.filter;
1883+
filters.applyFilter(path, i, hoverFilter.type, hoverFilter.value);
1884+
}
1885+
}
18391886
}
18401887
} else {
1888+
// If the item was deselected, apply hover state filter if it is not a touch device
18411889
if (w.config.states.active.filter.type !== 'none') {
1842-
filters.getDefaultFilter(path, i);
1890+
if (w.config.states.hover.filter.type !== 'none' && !w.globals.isTouchDevice) {
1891+
var hoverFilter = w.config.states.hover.filter;
1892+
filters.applyFilter(path, i, hoverFilter.type, hoverFilter.value);
1893+
} else {
1894+
filters.getDefaultFilter(path, i);
1895+
}
18431896
}
18441897
}
18451898

@@ -3826,8 +3879,25 @@
38263879
width: 2,
38273880
colors: undefined,
38283881
// array of colors
3829-
dashArray: 0 // single value or array of values
3830-
3882+
dashArray: 0,
3883+
// single value or array of values
3884+
fill: {
3885+
type: 'solid',
3886+
colors: undefined,
3887+
// array of colors
3888+
opacity: 0.85,
3889+
gradient: {
3890+
shade: 'dark',
3891+
type: 'horizontal',
3892+
shadeIntensity: 0.5,
3893+
gradientToColors: undefined,
3894+
inverseColors: true,
3895+
opacityFrom: 1,
3896+
opacityTo: 1,
3897+
stops: [0, 50, 100],
3898+
colorStops: []
3899+
}
3900+
}
38313901
},
38323902
tooltip: {
38333903
enabled: true,
@@ -3921,16 +3991,16 @@
39213991
hour: 'HH:mm',
39223992
minute: 'HH:mm:ss',
39233993
second: 'HH:mm:ss'
3924-
},
3925-
group: {
3926-
groups: [],
3927-
style: {
3928-
colors: [],
3929-
fontSize: '12px',
3930-
fontWeight: 400,
3931-
fontFamily: undefined,
3932-
cssClass: ''
3933-
}
3994+
}
3995+
},
3996+
group: {
3997+
groups: [],
3998+
style: {
3999+
colors: [],
4000+
fontSize: '12px',
4001+
fontWeight: 400,
4002+
fontFamily: undefined,
4003+
cssClass: ''
39344004
}
39354005
},
39364006
axisBorder: {
@@ -8130,7 +8200,18 @@
81308200
value: function area() {
81318201
return {
81328202
stroke: {
8133-
width: 4
8203+
width: 4,
8204+
fill: {
8205+
type: 'solid',
8206+
gradient: {
8207+
inverseColors: false,
8208+
shade: 'light',
8209+
type: 'vertical',
8210+
opacityFrom: 0.65,
8211+
opacityTo: 0.5,
8212+
stops: [0, 100, 100]
8213+
}
8214+
}
81348215
},
81358216
fill: {
81368217
type: 'gradient',
@@ -9573,7 +9654,7 @@
95739654
var dt = new DateTime(ctx);
95749655
var xlabels = cnf.labels.length > 0 ? cnf.labels.slice() : cnf.xaxis.categories.slice();
95759656
gl.isRangeBar = cnf.chart.type === 'rangeBar' && gl.isBarHorizontal;
9576-
gl.hasGroups = cnf.xaxis.type === 'category' && typeof cnf.xaxis.group !== 'undefined' && typeof cnf.xaxis.group.groups !== 'undefined' && cnf.xaxis.group.groups.length > 0;
9657+
gl.hasGroups = cnf.xaxis.type === 'category' && cnf.xaxis.group.groups.length > 0;
95779658

95789659
if (gl.hasGroups) {
95799660
gl.groups = cnf.xaxis.group.groups;
@@ -11065,7 +11146,7 @@
1106511146

1106611147

1106711148
for (var _xat2 = 0; _xat2 < xAxisTextsInversed.length; _xat2++) {
11068-
graphics.placeTextWithEllipsis(xAxisTextsInversed[_xat2], xAxisTextsInversed[_xat2].textContent, w.config.yaxis[0].labels.maxWidth - parseFloat(w.config.yaxis[0].title.style.fontSize) * 2 - 20);
11149+
graphics.placeTextWithEllipsis(xAxisTextsInversed[_xat2], xAxisTextsInversed[_xat2].textContent, w.config.yaxis[0].labels.maxWidth - (w.config.yaxis[0].title.text ? parseFloat(w.config.yaxis[0].title.style.fontSize) * 2 : 0) - 15);
1106911150
}
1107011151
}
1107111152
} // renderXAxisBands() {
@@ -11229,7 +11310,7 @@
1122911310

1123011311
var y_2 = 0;
1123111312

11232-
if (w.globals.hasGroups && (typeof w.config.xaxis.tickAmount === 'undefined' || w.config.xaxis.tickAmount === 'dataPoints') && w.config.xaxis.tickPlacement === 'between') {
11313+
if (w.globals.hasGroups && w.config.xaxis.tickPlacement === 'between') {
1123311314
var groups = w.globals.groups;
1123411315

1123511316
if (groups) {
@@ -11324,7 +11405,7 @@
1132411405
x2 = _ref6.x2,
1132511406
y2 = _ref6.y2;
1132611407

11327-
if (typeof w.config.xaxis.tickAmount !== 'undefined' && w.config.xaxis.tickAmount !== 'dataPoints') {
11408+
if (typeof w.config.xaxis.tickAmount !== 'undefined' && w.config.xaxis.tickAmount !== 'dataPoints' && w.config.xaxis.tickPlacement === 'on') {
1132811409
// user has specified tickamount in a category x-axis chart
1132911410
var visibleLabels = w.globals.dom.baseEl.querySelectorAll('.apexcharts-text.apexcharts-xaxis-label tspan:not(:empty)');
1133011411
visibleLabels.forEach(function (d, i) {
@@ -11766,17 +11847,18 @@
1176611847
};
1176711848
}
1176811849
}, {
11769-
key: "logarithmicScale",
11770-
value: function logarithmicScale(yMin, yMax, base) {
11850+
key: "logarithmicScaleNice",
11851+
value: function logarithmicScaleNice(yMin, yMax, base) {
11852+
// Basic validation to avoid for loop starting at -inf.
11853+
if (yMax <= 0) yMax = Math.max(yMin, base);
11854+
if (yMin <= 0) yMin = Math.min(yMax, base);
1177111855
var logs = [];
11772-
var ticks = Math.ceil(Math.log(yMax) / Math.log(base)) + 1; // Get powers of base up to our max, and then one more
11856+
var logMax = Math.ceil(Math.log(yMax) / Math.log(base) + 1); // Get powers of base for our max and min
1177311857

11774-
for (var i = 0; i < ticks; i++) {
11775-
logs.push(Math.pow(base, i));
11776-
}
11858+
var logMin = Math.floor(Math.log(yMin) / Math.log(base));
1177711859

11778-
if (yMin === 0) {
11779-
logs.unshift(yMin);
11860+
for (var i = logMin; i < logMax; i++) {
11861+
logs.push(Math.pow(base, i));
1178011862
}
1178111863

1178211864
return {
@@ -11785,6 +11867,38 @@
1178511867
niceMax: logs[logs.length - 1]
1178611868
};
1178711869
}
11870+
}, {
11871+
key: "logarithmicScale",
11872+
value: function logarithmicScale(yMin, yMax, base) {
11873+
// Basic validation to avoid for loop starting at -inf.
11874+
if (yMax <= 0) yMax = Math.max(yMin, base);
11875+
if (yMin <= 0) yMin = Math.min(yMax, base);
11876+
var logs = []; // Get the logarithmic range.
11877+
11878+
var logMax = Math.log(yMax) / Math.log(base);
11879+
var logMin = Math.log(yMin) / Math.log(base); // Get the exact logarithmic range.
11880+
// (This is the exact number of multiples of the base there are between yMin and yMax).
11881+
11882+
var logRange = logMax - logMin; // Round the logarithmic range to get the number of ticks we will create.
11883+
// If the chosen min/max values are multiples of each other WRT the base, this will be neat.
11884+
// If the chosen min/max aren't, we will at least still provide USEFUL ticks.
11885+
11886+
var ticks = Math.round(logRange); // Get the logarithmic spacing between ticks.
11887+
11888+
var logTickSpacing = logRange / ticks; // Create as many ticks as there is range in the logs.
11889+
11890+
for (var i = 0, logTick = logMin; i < ticks; i++, logTick += logTickSpacing) {
11891+
logs.push(Math.pow(base, logTick));
11892+
} // Add a final tick at the yMax.
11893+
11894+
11895+
logs.push(Math.pow(base, logMax));
11896+
return {
11897+
result: logs,
11898+
niceMin: yMin,
11899+
niceMax: yMax
11900+
};
11901+
}
1178811902
}, {
1178911903
key: "_adjustTicksForSmallRange",
1179011904
value: function _adjustTicksForSmallRange(ticks, index, range) {
@@ -11820,6 +11934,7 @@
1182011934
if (y.logarithmic && diff > 5) {
1182111935
gl.allSeriesCollapsed = false;
1182211936
gl.yAxisScale[index] = this.logarithmicScale(minY, maxY, y.logBase);
11937+
gl.yAxisScale[index] = y.forceNiceScale ? this.logarithmicScaleNice(minY, maxY, y.logBase) : this.logarithmicScale(minY, maxY, y.logBase);
1182311938
} else {
1182411939
if (maxY === -Number.MAX_VALUE || !Utils$1.isNumber(maxY)) {
1182511940
// no data in the chart. Either all series collapsed or user passed a blank array
@@ -12725,6 +12840,7 @@
1272512840
fontSize: yaxisFontSize,
1272612841
fontFamily: yaxisFontFamily,
1272712842
fontWeight: yaxisFontWeight,
12843+
maxWidth: w.config.yaxis[realIndex].labels.maxWidth,
1272812844
foreColor: getForeColor(),
1272912845
isPlainText: false,
1273012846
cssClass: 'apexcharts-yaxis-label ' + yaxisStyle.cssClass
@@ -16797,7 +16913,9 @@
1679716913
var markersWraps = this.w.globals.dom.baseEl.querySelectorAll('.apexcharts-series-markers-wrap');
1679816914
markersWraps = _toConsumableArray(markersWraps);
1679916915
markersWraps.sort(function (a, b) {
16800-
return Number(b.getAttribute('data:realIndex')) < Number(a.getAttribute('data:realIndex')) ? 0 : -1;
16916+
var indexA = Number(a.getAttribute('data:realIndex'));
16917+
var indexB = Number(b.getAttribute('data:realIndex'));
16918+
return indexB < indexA ? 1 : indexB > indexA ? -1 : 0;
1680116919
});
1680216920
var markers = [];
1680316921
markersWraps.forEach(function (m) {
@@ -22541,11 +22659,18 @@
2254122659
var lineFill = null;
2254222660

2254322661
if (type === 'line') {
22544-
// fillable lines only for lineChart
2254522662
lineFill = fill.fillPath({
2254622663
seriesNumber: realIndex,
2254722664
i: i
2254822665
});
22666+
} else if (w.config.stroke.fill) {
22667+
var prevFill = w.config.fill;
22668+
w.config.fill = w.config.stroke.fill;
22669+
lineFill = fill.fillPath({
22670+
seriesNumber: realIndex,
22671+
i: i
22672+
});
22673+
w.config.fill = prevFill;
2254922674
} else {
2255022675
lineFill = w.globals.stroke.colors[realIndex];
2255122676
}
@@ -24668,8 +24793,10 @@
2466824793

2466924794
if (gl.dom.elLegendForeign) {
2467024795
gl.dom.elLegendForeign.setAttribute('height', newHeight);
24671-
}
24796+
} // fix apexcharts/apexcharts.js/issues/3105 (when % is provided in height, it keeps increasing)
24797+
2467224798

24799+
if (w.config.chart.height && String(w.config.chart.height).indexOf('%') > 0) return;
2467324800
gl.dom.elWrap.style.height = newHeight + 'px';
2467424801
Graphics.setAttrs(gl.dom.Paper.node, {
2467524802
height: newHeight

dist/apexcharts.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)