onesight-charts 1.4.8 → 1.5.0

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.
@@ -420,9 +420,9 @@ function CommonBar(props) {
420
420
  trigger: 'axis',
421
421
  enterable: true,
422
422
  padding: 0,
423
- showContent: true,
424
- alwaysShowContent: true,
425
- hideDelay: 1000000000,
423
+ // showContent: true,
424
+ // alwaysShowContent: true,
425
+ // hideDelay: 1000000000,
426
426
  position: function position(point, params, dom) {
427
427
  var tooltipHeight = (dom === null || dom === void 0 ? void 0 : dom.offsetHeight) || 0;
428
428
  var currentHeight = myDom.offsetHeight;
@@ -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
  };
@@ -520,6 +520,7 @@ function VerticalStackedBar(props) {
520
520
  return [x, yValue];
521
521
  },
522
522
  formatter: function formatter(res) {
523
+ var _res$;
523
524
  var total = null;
524
525
  res.forEach(function (v) {
525
526
  // 处理可能是对象格式的数据(包含 value 和 itemStyle)
@@ -561,7 +562,12 @@ function VerticalStackedBar(props) {
561
562
  });
562
563
  // 获取原始日期数据
563
564
  var originalDate = originalAxisDataRef.current && Array.isArray(originalAxisDataRef.current) && res[0].dataIndex !== undefined ? originalAxisDataRef.current[res[0].dataIndex] : res[0].name;
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) {
565
+ // 获取原始数据项,用于获取 platformIcon
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) {
565
571
  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>");
566
572
  }).join(''), "\n </div>\n <div class=\"triangle-down\"></div>\n </div>");
567
573
  }
@@ -392,9 +392,9 @@ function CommonBar(props) {
392
392
  trigger: "axis",
393
393
  enterable: true,
394
394
  padding: 0,
395
- showContent: true,
396
- alwaysShowContent: true,
397
- hideDelay: 1e9,
395
+ // showContent: true,
396
+ // alwaysShowContent: true,
397
+ // hideDelay: 1000000000,
398
398
  position: (point, params, dom) => {
399
399
  const tooltipHeight = (dom == null ? void 0 : dom.offsetHeight) || 0;
400
400
  const currentHeight = myDom.offsetHeight;
@@ -68,7 +68,12 @@ var createCustomTooltip = ({
68
68
  }
69
69
  return `
70
70
  <div>
71
- <div class='tooltip-head'>${item.name}</div>
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'>
@@ -468,6 +468,7 @@ function VerticalStackedBar(props) {
468
468
  return [x, yValue];
469
469
  },
470
470
  formatter: (res) => {
471
+ var _a2;
471
472
  let total = null;
472
473
  res.forEach((v) => {
473
474
  let dataValue = v.data;
@@ -502,10 +503,16 @@ function VerticalStackedBar(props) {
502
503
  });
503
504
  });
504
505
  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;
505
509
  return `<div style="position: relative;">
506
- <div class='tooltip-head'>${formatToolTipDate(
507
- originalDate
508
- )}</div>
510
+ <div class='tooltip-head' style="display: flex;align-items: center;">
511
+ ${(originalItem == null ? 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;">
512
+ <img src="${originalItem.platformIcon}" alt="">
513
+ </span>` : ""}
514
+ <span>${formatToolTipDate(originalDate)}</span>
515
+ </div>
509
516
  <div class='tooltip-body'>
510
517
  ${isTotalShow ? `<div class='total'>
511
518
  <div class='l'>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onesight-charts",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
4
4
  "private": false,
5
5
  "description": "OneSight前端图表公共组件库",
6
6
  "license": "MIT",