onesight-charts 1.4.9 → 1.5.1
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.
|
@@ -37,7 +37,7 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
|
|
|
37
37
|
num_wrap = '';
|
|
38
38
|
per_wrap = "<span class='pie-tooltip-text2'>".concat(computeFloatNull(item.percentage, 1), "</span>");
|
|
39
39
|
}
|
|
40
|
-
return "\n <div>\n <div class='tooltip-head'>".concat(item.name, "</div>\n ").concat(item !== null && item !== void 0 && item.currentTime ? "<div class=\"tooltip-time\">".concat(item.currentTime, "</div>") : '', "\n <div class='tooltip-body'>\n <div class='tooltip-body-c-1'>\n <span style=\"background: ").concat(bg_color, "\"></span>\n <strong>").concat(tooltipName, "</strong>\n </div>\n <div class='tooltip-body-c-2'>\n ").concat(per_wrap, "\n ").concat(num_wrap, "\n </div>\n </div>\n </div>\n ");
|
|
40
|
+
return "\n <div>\n <div class='tooltip-head' style=\"display: flex;align-items: center;\">\n ".concat(item !== null && item !== void 0 && item.platformIcon ? "<span class=\"icon\" style=\"width: 16px !important;height: 16px !important;line-height: 1 !important;margin-right: 4px !important;margin-top: -2px !important;\">\n <img src=\"".concat(item.platformIcon, "\" alt=\"\">\n </span>") : '', "\n <span>").concat(item.name, "</span>\n </div>\n ").concat(item !== null && item !== void 0 && item.currentTime ? "<div class=\"tooltip-time\">".concat(item.currentTime, "</div>") : '', "\n <div class='tooltip-body'>\n <div class='tooltip-body-c-1'>\n <span style=\"background: ").concat(bg_color, "\"></span>\n <strong>").concat(tooltipName, "</strong>\n </div>\n <div class='tooltip-body-c-2'>\n ").concat(per_wrap, "\n ").concat(num_wrap, "\n </div>\n </div>\n </div>\n ");
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
};
|
|
@@ -465,7 +465,7 @@ function StackedBar(props) {
|
|
|
465
465
|
}
|
|
466
466
|
},
|
|
467
467
|
formatter: function formatter(res) {
|
|
468
|
-
var _series$2;
|
|
468
|
+
var _series$2, _series$3;
|
|
469
469
|
if (!res.some(function (i) {
|
|
470
470
|
return i.value !== undefined && i.value !== null;
|
|
471
471
|
})) {
|
|
@@ -515,7 +515,9 @@ function StackedBar(props) {
|
|
|
515
515
|
// 获取 currentTime(从第一个 series 的 data 中获取,因为同一行的所有 series 应该有相同的 currentTime)
|
|
516
516
|
var dataIndex = res[0].dataIndex;
|
|
517
517
|
var currentTime = ((_series$2 = series[0]) === null || _series$2 === void 0 || (_series$2 = _series$2.data) === null || _series$2 === void 0 || (_series$2 = _series$2[dataIndex]) === null || _series$2 === void 0 ? void 0 : _series$2.currentTime) || null;
|
|
518
|
-
|
|
518
|
+
// 获取 platformIcon(从第一个 series 的 data 中获取,因为同一行的所有 series 应该有相同的 platformIcon)
|
|
519
|
+
var platformIcon = ((_series$3 = series[0]) === null || _series$3 === void 0 || (_series$3 = _series$3.data) === null || _series$3 === void 0 || (_series$3 = _series$3[dataIndex]) === null || _series$3 === void 0 ? void 0 : _series$3.platformIcon) || null;
|
|
520
|
+
return "<div style=\"width:278px;position: relative;\">\n <div class='tooltip-head' style=\"display: flex;align-items: center;\">\n ".concat(platformIcon ? "<span class=\"icon\" style=\"width: 16px !important;height: 16px !important;line-height: 1 !important;margin-right: 4px !important;margin-top: -2px !important;\">\n <img src=\"".concat(platformIcon, "\" alt=\"\">\n </span>") : '', "\n <span>").concat(res[0].name, "</span>\n </div>\n ").concat(currentTime ? "<div class=\"tooltip-time\">".concat(currentTime, "</div>") : '', "\n <div class='tooltip-body'>\n ").concat(isTotalShow ? "<div class='total'>\n <div class='l'>\n ".concat(tooltipTotalName, "\n </div>\n <div class='r'>").concat(changeDataTypeEn(total), "</div>\n </div>") : '', "\n ").concat(dataArr.map(function (item) {
|
|
519
521
|
return "<div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span style=\"display:inline-block;width: 14px;vertical-align: middle;height: 14px;background-color:").concat(item.color, ";border-radius: 4px;margin-bottom: 2px;margin-right:6px\"></span>\n <span>").concat(item.seriesName, "\n </span>\n </div>\n <div class='r' style=\"padding-left:6px;\">\n ").concat(dataArr.length > 0 && isRateShow ? "<span class='rate'>".concat(computeFloatNull(item.proportion), "</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div>\n </div>");
|
|
520
522
|
}).join(''), "\n </div>\n <div class='triangle-down' style='width:").concat(triangleWidth, "px'></div>\n </div>");
|
|
521
523
|
}
|
|
@@ -68,7 +68,12 @@ var createCustomTooltip = ({
|
|
|
68
68
|
}
|
|
69
69
|
return `
|
|
70
70
|
<div>
|
|
71
|
-
<div class='tooltip-head'
|
|
71
|
+
<div class='tooltip-head' style="display: flex;align-items: center;">
|
|
72
|
+
${(item == null ? void 0 : item.platformIcon) ? `<span class="icon" style="width: 16px !important;height: 16px !important;line-height: 1 !important;margin-right: 4px !important;margin-top: -2px !important;">
|
|
73
|
+
<img src="${item.platformIcon}" alt="">
|
|
74
|
+
</span>` : ""}
|
|
75
|
+
<span>${item.name}</span>
|
|
76
|
+
</div>
|
|
72
77
|
${(item == null ? void 0 : item.currentTime) ? `<div class="tooltip-time">${item.currentTime}</div>` : ""}
|
|
73
78
|
<div class='tooltip-body'>
|
|
74
79
|
<div class='tooltip-body-c-1'>
|
|
@@ -414,7 +414,7 @@ function StackedBar(props) {
|
|
|
414
414
|
}
|
|
415
415
|
},
|
|
416
416
|
formatter: (res) => {
|
|
417
|
-
var _a2, _b2, _c2;
|
|
417
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
418
418
|
if (!res.some((i) => i.value !== void 0 && i.value !== null)) {
|
|
419
419
|
return "";
|
|
420
420
|
}
|
|
@@ -456,8 +456,14 @@ function StackedBar(props) {
|
|
|
456
456
|
}
|
|
457
457
|
const dataIndex = res[0].dataIndex;
|
|
458
458
|
const currentTime = ((_c2 = (_b2 = (_a2 = series[0]) == null ? void 0 : _a2.data) == null ? void 0 : _b2[dataIndex]) == null ? void 0 : _c2.currentTime) || null;
|
|
459
|
+
const platformIcon = ((_f = (_e = (_d = series[0]) == null ? void 0 : _d.data) == null ? void 0 : _e[dataIndex]) == null ? void 0 : _f.platformIcon) || null;
|
|
459
460
|
return `<div style="width:278px;position: relative;">
|
|
460
|
-
<div class='tooltip-head'
|
|
461
|
+
<div class='tooltip-head' style="display: flex;align-items: center;">
|
|
462
|
+
${platformIcon ? `<span class="icon" style="width: 16px !important;height: 16px !important;line-height: 1 !important;margin-right: 4px !important;margin-top: -2px !important;">
|
|
463
|
+
<img src="${platformIcon}" alt="">
|
|
464
|
+
</span>` : ""}
|
|
465
|
+
<span>${res[0].name}</span>
|
|
466
|
+
</div>
|
|
461
467
|
${currentTime ? `<div class="tooltip-time">${currentTime}</div>` : ""}
|
|
462
468
|
<div class='tooltip-body'>
|
|
463
469
|
${isTotalShow ? `<div class='total'>
|