onesight-charts 1.5.0 → 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.
|
@@ -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
|
}
|
|
@@ -520,7 +520,6 @@ function VerticalStackedBar(props) {
|
|
|
520
520
|
return [x, yValue];
|
|
521
521
|
},
|
|
522
522
|
formatter: function formatter(res) {
|
|
523
|
-
var _res$;
|
|
524
523
|
var total = null;
|
|
525
524
|
res.forEach(function (v) {
|
|
526
525
|
// 处理可能是对象格式的数据(包含 value 和 itemStyle)
|
|
@@ -562,12 +561,7 @@ function VerticalStackedBar(props) {
|
|
|
562
561
|
});
|
|
563
562
|
// 获取原始日期数据
|
|
564
563
|
var originalDate = originalAxisDataRef.current && Array.isArray(originalAxisDataRef.current) && res[0].dataIndex !== undefined ? originalAxisDataRef.current[res[0].dataIndex] : res[0].name;
|
|
565
|
-
|
|
566
|
-
var dataIndex = (_res$ = res[0]) === null || _res$ === void 0 ? void 0 : _res$.dataIndex;
|
|
567
|
-
var useSeriesMode = Array.isArray(seriesData) && seriesData.length > 0;
|
|
568
|
-
var originalItem = useSeriesMode ? null // seriesMode 模式下,platformIcon 在 seriesData 中,不在时间点数据中
|
|
569
|
-
: data && dataIndex !== undefined && Array.isArray(data) && data[dataIndex] ? data[dataIndex] : null;
|
|
570
|
-
return "<div style=\"position: relative;\">\n <div class='tooltip-head' style=\"display: flex;align-items: center;\">\n ".concat(originalItem !== null && originalItem !== void 0 && originalItem.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(originalItem.platformIcon, "\" alt=\"\">\n </span>") : '', "\n <span>").concat(formatToolTipDate(originalDate), "</span>\n </div>\n <div class='tooltip-body'>\n ").concat(isTotalShow ? "<div class='total'>\n <div class='l'>\n ".concat(totalName, "\n </div>\n <div class='r'>").concat(total === null || total === undefined || isNaN(total) ? '-' : changeDataTypeEn(total), "</div>\n </div>") : '', "\n ").concat(dataArr.map(function (item) {
|
|
564
|
+
return "<div style=\"position: relative;\">\n <div class='tooltip-head'>".concat(formatToolTipDate(originalDate), "</div>\n <div class='tooltip-body'>\n ").concat(isTotalShow ? "<div class='total'>\n <div class='l'>\n ".concat(totalName, "\n </div>\n <div class='r'>").concat(total === null || total === undefined || isNaN(total) ? '-' : changeDataTypeEn(total), "</div>\n </div>") : '', "\n ").concat(dataArr.map(function (item) {
|
|
571
565
|
return "<div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.name, "'>\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.name, "\n </span>\n </div>\n <div class='r' style=\"padding-left:6px;\">\n <span class='num'>\n ").concat(item.value === null || item.value === undefined || isNaN(item.value) ? '-' : changeDataTypeEn(item.value), "\n </span>\n </div>\n </div>");
|
|
572
566
|
}).join(''), "\n </div>\n <div class=\"triangle-down\"></div>\n </div>");
|
|
573
567
|
}
|
|
@@ -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'>
|
|
@@ -468,7 +468,6 @@ function VerticalStackedBar(props) {
|
|
|
468
468
|
return [x, yValue];
|
|
469
469
|
},
|
|
470
470
|
formatter: (res) => {
|
|
471
|
-
var _a2;
|
|
472
471
|
let total = null;
|
|
473
472
|
res.forEach((v) => {
|
|
474
473
|
let dataValue = v.data;
|
|
@@ -503,16 +502,10 @@ function VerticalStackedBar(props) {
|
|
|
503
502
|
});
|
|
504
503
|
});
|
|
505
504
|
const originalDate = originalAxisDataRef.current && Array.isArray(originalAxisDataRef.current) && res[0].dataIndex !== void 0 ? originalAxisDataRef.current[res[0].dataIndex] : res[0].name;
|
|
506
|
-
const dataIndex = (_a2 = res[0]) == null ? void 0 : _a2.dataIndex;
|
|
507
|
-
const useSeriesMode = Array.isArray(seriesData) && seriesData.length > 0;
|
|
508
|
-
const originalItem = useSeriesMode ? null : data && dataIndex !== void 0 && Array.isArray(data) && data[dataIndex] ? data[dataIndex] : null;
|
|
509
505
|
return `<div style="position: relative;">
|
|
510
|
-
<div class='tooltip-head'
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
</span>` : ""}
|
|
514
|
-
<span>${formatToolTipDate(originalDate)}</span>
|
|
515
|
-
</div>
|
|
506
|
+
<div class='tooltip-head'>${formatToolTipDate(
|
|
507
|
+
originalDate
|
|
508
|
+
)}</div>
|
|
516
509
|
<div class='tooltip-body'>
|
|
517
510
|
${isTotalShow ? `<div class='total'>
|
|
518
511
|
<div class='l'>
|