tvcharts 0.7.60 → 0.7.62

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.
package/dist/echarts.js CHANGED
@@ -222,7 +222,7 @@ __export(util_exports, {
222
222
 
223
223
  // node_modules/tvrender/src/core/platform.ts
224
224
  var DEFAULT_FONT_SIZE = 12;
225
- var DEFAULT_FONT_FAMILY = "sans-serif";
225
+ var DEFAULT_FONT_FAMILY = `-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif`;
226
226
  var DEFAULT_FONT = `${DEFAULT_FONT_SIZE}px ${DEFAULT_FONT_FAMILY}`;
227
227
  var OFFSET = 20;
228
228
  var SCALE = 100;
@@ -7238,7 +7238,7 @@ function getElementSSRData(el) {
7238
7238
  function registerSSRDataGetter(getter) {
7239
7239
  ssrDataGetter = getter;
7240
7240
  }
7241
- var version = "5.6.76";
7241
+ var version = "5.6.79";
7242
7242
 
7243
7243
  // src/util/number.ts
7244
7244
  var RADIAN_EPSILON = 1e-4;
@@ -11393,7 +11393,7 @@ var ZRText = class extends Displayable_default {
11393
11393
  style.fontStyle,
11394
11394
  style.fontWeight,
11395
11395
  parseFontSize(style.fontSize),
11396
- style.fontFamily || "sans-serif"
11396
+ style.fontFamily || DEFAULT_FONT_FAMILY
11397
11397
  ].join(" ");
11398
11398
  }
11399
11399
  return font && trim(font) || style.textFont || style.font;
@@ -25788,7 +25788,7 @@ ECharts.internalField = function() {
25788
25788
  if (isGroup) {
25789
25789
  const children = el.childrenRef();
25790
25790
  for (let i = 0; i < children.length; i++) {
25791
- maxZ2 = Math.max(doUpdateZ(children[i], z, el.zLevel ?? zlevel, maxZ2), maxZ2, z2);
25791
+ maxZ2 = Math.max(doUpdateZ(children[i], z, el.zLevel ?? zlevel, maxZ2, z2), maxZ2);
25792
25792
  }
25793
25793
  } else {
25794
25794
  el.z = z;
@@ -33691,7 +33691,8 @@ var Layer = class extends Eventful_default {
33691
33691
  if (clearColor && clearColor !== "transparent") {
33692
33692
  let clearColorGradientOrPattern;
33693
33693
  if (isGradientObject(clearColor)) {
33694
- const shouldCache = clearColor.global || clearColor.__width === width2 && clearColor.__height === height2;
33694
+ const colorStopStr = clearColor.colorStops.map((item) => item.color + item.offset).toString();
33695
+ const shouldCache = clearColor.global || clearColor.__width === width2 && clearColor.__height === height2 && clearColor._colorStopStr === colorStopStr;
33695
33696
  clearColorGradientOrPattern = shouldCache && clearColor.__canvasGradient || getCanvasGradient(ctx2, clearColor, {
33696
33697
  x: 0,
33697
33698
  y: 0,
@@ -33701,6 +33702,7 @@ var Layer = class extends Eventful_default {
33701
33702
  clearColor.__canvasGradient = clearColorGradientOrPattern;
33702
33703
  clearColor.__width = width2;
33703
33704
  clearColor.__height = height2;
33705
+ clearColor._colorStopStr = colorStopStr;
33704
33706
  } else if (isImagePatternObject(clearColor)) {
33705
33707
  clearColor.scaleX = clearColor.scaleX || horizontalPixelRatio;
33706
33708
  clearColor.scaleY = clearColor.scaleY || verticalPixelRatio;
@@ -64322,7 +64324,6 @@ var BaseAxisPointer = class {
64322
64324
  const hoverBackgroundColor = extraGroupModel.get("hoverBackgroundColor");
64323
64325
  const extraIcon = createIcon(extraGroupModel.get("icon"), {
64324
64326
  x: size[0] / 2,
64325
- y: size[1] / 2,
64326
64327
  scaleX: size[0] / 2,
64327
64328
  scaleY: size[1] / 2,
64328
64329
  z2: 11,
@@ -64333,7 +64334,6 @@ var BaseAxisPointer = class {
64333
64334
  extraIcon.style.fill = color2;
64334
64335
  const extraRect = new Rect_default({
64335
64336
  shape: {
64336
- y: -padding / 2,
64337
64337
  x: -padding / 2,
64338
64338
  width: size[0] + padding,
64339
64339
  height: size[1] + padding
@@ -64370,18 +64370,17 @@ var BaseAxisPointer = class {
64370
64370
  const isLeft = position2 === "left";
64371
64371
  const distance2 = extraGroupModel.get("distance");
64372
64372
  extraGroup.x = isLeft ? pointer.shape.x1 + distance2 : pointer.shape.x2 - (size[0] + distance2);
64373
- extraGroup.y = pointer.shape.y1 - size[1] / 2;
64373
+ extraGroup.y = elOption.label.y;
64374
64374
  extraGroup.eachChild((el) => {
64375
64375
  if (elInner(el).type === "rect") {
64376
64376
  el.attr("shape", {
64377
- y: -padding / 2,
64378
64377
  x: -padding / 2,
64379
64378
  width: size[0] + padding,
64380
64379
  height: size[1] + padding
64381
64380
  });
64382
64381
  } else {
64383
64382
  el.x = size[0] / 2;
64384
- el.y = size[1] / 2;
64383
+ el.y = size[1] / 2 + padding / 2;
64385
64384
  el.scaleX = size[0] / 2;
64386
64385
  el.scaleY = size[1] / 2;
64387
64386
  }
@@ -68783,10 +68782,11 @@ var AxisProxy = class {
68783
68782
  let precision = getPixelPrecision(valueWindow, [0, 500]);
68784
68783
  precision = Math.min(precision, 20);
68785
68784
  const rawExtentInfo = axisModel.axis.scale.rawExtentInfo;
68786
- if (percentWindow[0] !== 0) {
68785
+ const isUseValueRange = this._dataZoomModel.get("useValueRange");
68786
+ if (percentWindow[0] !== 0 || isUseValueRange) {
68787
68787
  rawExtentInfo.setDeterminedMinMax("min", +valueWindow[0].toFixed(precision));
68788
68788
  }
68789
- if (percentWindow[1] !== 100) {
68789
+ if (percentWindow[1] !== 100 || isUseValueRange) {
68790
68790
  rawExtentInfo.setDeterminedMinMax("max", +valueWindow[1].toFixed(precision));
68791
68791
  }
68792
68792
  rawExtentInfo.freeze();
@@ -72753,6 +72753,31 @@ function getLeftTextX(x, text, textStyle, ecModel) {
72753
72753
  const paddings = normalizeCssArray2(textStyle.padding || 0);
72754
72754
  return x - textRect.width - paddings[1] - paddings[3] - (textStyle.borderWidth || 0) - 1;
72755
72755
  }
72756
+ var SECONDS_PER_HOUR = 3600;
72757
+ var SECONDS_PER_DAY = 86400;
72758
+ var SECONDS_PER_MONTH = 30 * SECONDS_PER_DAY;
72759
+ function formatSeconds(seconds2) {
72760
+ if (seconds2 >= SECONDS_PER_DAY) {
72761
+ const months = Math.floor(seconds2 / SECONDS_PER_MONTH);
72762
+ let remaining = seconds2 % SECONDS_PER_MONTH;
72763
+ const days = Math.floor(remaining / SECONDS_PER_DAY);
72764
+ remaining %= SECONDS_PER_DAY;
72765
+ const hours2 = Math.floor(remaining / SECONDS_PER_HOUR);
72766
+ return [
72767
+ months > 0 ? `${months}m` : null,
72768
+ days > 0 ? `${days}d` : null,
72769
+ hours2 > 0 && months === 0 ? `${hours2}h` : null
72770
+ ].filter(Boolean).join(" ");
72771
+ } else {
72772
+ const hours2 = Math.floor(seconds2 / SECONDS_PER_HOUR);
72773
+ const minutes2 = Math.floor(seconds2 % SECONDS_PER_HOUR / 60);
72774
+ const secs = seconds2 % 60;
72775
+ return hours2 > 0 ? `${pad2(hours2)}:${pad2(minutes2)}:${pad2(secs)}` : `${pad2(minutes2)}:${pad2(secs)}`;
72776
+ }
72777
+ }
72778
+ function pad2(num) {
72779
+ return num.toString().padStart(2, "0");
72780
+ }
72756
72781
 
72757
72782
  // src/util/color.ts
72758
72783
  function parseColor(color2) {
@@ -75326,8 +75351,10 @@ var MarkLabelModal2 = class extends Component_default {
75326
75351
  each(markerOpt.data, (item, key) => {
75327
75352
  if (!this.option.data[key]) {
75328
75353
  dataMap[key] = this.option.data[key] = merge(item, defaultDataOption);
75354
+ item.countDown = dataMap[key].countDown;
75329
75355
  } else {
75330
75356
  dataMap[key] = merge(this.option.data[key], item, true);
75357
+ item.countDown = dataMap[key].countDown;
75331
75358
  }
75332
75359
  if (item.$action === "remove") {
75333
75360
  this.option.data[key] = void 0;
@@ -75358,31 +75385,31 @@ var MarkLabelModal_default = MarkLabelModal;
75358
75385
  // src/component/marker/MarkLabelView.ts
75359
75386
  var DefaultColor = "rgb(41,98,255)";
75360
75387
  var markerTypeCalculator2 = {
75361
- dataMin: (item, seriesModel) => {
75388
+ dataMin: (item, seriesModel, backgroundColor2) => {
75362
75389
  const seriesData = seriesModel.getData();
75363
75390
  return {
75364
75391
  value: seriesData.getDataExtent(item.valueDim)[0]
75365
75392
  };
75366
75393
  },
75367
- dataMax: (item, seriesModel) => {
75394
+ dataMax: (item, seriesModel, backgroundColor2) => {
75368
75395
  const seriesData = seriesModel.getData();
75369
75396
  return {
75370
75397
  value: seriesData.getDataExtent(item.valueDim)[1]
75371
75398
  };
75372
75399
  },
75373
- min: (item, seriesModel) => {
75400
+ min: (item, seriesModel, backgroundColor2) => {
75374
75401
  const seriesData = seriesModel.getData();
75375
75402
  return {
75376
75403
  value: seriesData.getDataExtent(item.valueDim, true)[0]
75377
75404
  };
75378
75405
  },
75379
- max: (item, seriesModel) => {
75406
+ max: (item, seriesModel, backgroundColor2) => {
75380
75407
  const seriesData = seriesModel.getData();
75381
75408
  return {
75382
75409
  value: seriesData.getDataExtent(item.valueDim, true)[1]
75383
75410
  };
75384
75411
  },
75385
- rawLast: (item, seriesModel) => {
75412
+ rawLast: (item, seriesModel, backgroundColor2) => {
75386
75413
  const seriesData = seriesModel.getData();
75387
75414
  const lastIndex = seriesData.count(true) - 1;
75388
75415
  let fill = seriesData.getItemVisual(lastIndex, "style")?.fill;
@@ -75400,13 +75427,13 @@ var markerTypeCalculator2 = {
75400
75427
  return {
75401
75428
  value: seriesData.getByRawIndex(item.valueDim, lastIndex),
75402
75429
  labelTextStyle: {
75403
- fill: fill ? contrastColor2(fill) : "#fff",
75430
+ fill: fill ? contrastColor2(fill) : "#ffffff",
75404
75431
  backgroundColor: fill ? removeTransparency(fill) : DefaultColor,
75405
75432
  borderWidth: 0
75406
75433
  }
75407
75434
  };
75408
75435
  },
75409
- last: (item, seriesModel) => {
75436
+ last: (item, seriesModel, backgroundColor2) => {
75410
75437
  const seriesData = seriesModel.getData();
75411
75438
  const count2 = seriesData.count(true);
75412
75439
  const axisModel = seriesModel.getBaseAxis();
@@ -75416,7 +75443,6 @@ var markerTypeCalculator2 = {
75416
75443
  if (lastIndex >= count2 || lastIndex < 0) {
75417
75444
  return null;
75418
75445
  }
75419
- const backgroundColor2 = seriesModel.ecModel.get("backgroundColor");
75420
75446
  const lastItem = seriesData.count() - 1;
75421
75447
  let fill = isCandle(seriesModel.subType) ? seriesData.getItemVisual(lastItem, "style")?.stroke : seriesData.getItemVisual(lastItem, "style")?.fill;
75422
75448
  if (isPlot(seriesModel.subType)) {
@@ -75434,7 +75460,7 @@ var markerTypeCalculator2 = {
75434
75460
  }
75435
75461
  };
75436
75462
  },
75437
- allLast: (item, seriesModel) => {
75463
+ allLast: (item, seriesModel, backgroundColor2) => {
75438
75464
  const seriesData = seriesModel.getData();
75439
75465
  const count2 = seriesData.count(true);
75440
75466
  const axisModel = seriesModel.getBaseAxis();
@@ -75442,9 +75468,9 @@ var markerTypeCalculator2 = {
75442
75468
  const offset = seriesModel.get("offset") || 0;
75443
75469
  const lastIndex = extent3[1] + offset;
75444
75470
  if (lastIndex >= count2 || lastIndex < 0) {
75445
- return markerTypeCalculator2.rawLast(item, seriesModel);
75471
+ return markerTypeCalculator2.rawLast(item, seriesModel, backgroundColor2);
75446
75472
  }
75447
- return markerTypeCalculator2.last(item, seriesModel);
75473
+ return markerTypeCalculator2.last(item, seriesModel, backgroundColor2);
75448
75474
  }
75449
75475
  };
75450
75476
  var inner21 = makeInner();
@@ -75455,6 +75481,7 @@ var MarkLabelView2 = class extends Component_default2 {
75455
75481
  }
75456
75482
  init() {
75457
75483
  this.markerGroupMapBySeries = createHashMap();
75484
+ this._timerMap = createHashMap();
75458
75485
  this._graphicLabelElMap = createHashMap();
75459
75486
  this._graphLabelGroup = new Group_default();
75460
75487
  this.group.add(this._graphLabelGroup);
@@ -75463,21 +75490,29 @@ var MarkLabelView2 = class extends Component_default2 {
75463
75490
  const isAvoidOverlap = markerModel.get("isAvoidOverlap");
75464
75491
  const type = payload?.type;
75465
75492
  if (type !== "updateComOption") {
75466
- this.updateMarkLabels(markerModel, ecModel);
75493
+ this.updateMarkLabels(markerModel, ecModel, api2);
75467
75494
  }
75468
75495
  this.updateGraphicLabels(ecModel);
75469
75496
  const isUpdateGraphic = payload?.type ? ["dataZoom", "resize"].includes(payload.type) : Object.keys(ecModel.getNewBaseOption()).some((key) => ["grid", "yAxis", "xAxis"].includes(key));
75470
75497
  if (isUpdateGraphic) {
75471
75498
  this.graphicLabelsResize(ecModel);
75472
75499
  }
75473
- if (isAvoidOverlap) {
75474
- this.avoidOverlap();
75475
- }
75500
+ this.avoidOverlap(isAvoidOverlap);
75476
75501
  }
75477
- updateMarkLabels(markerModel, ecModel) {
75502
+ updateMarkLabels(markerModel, ecModel, api2) {
75478
75503
  const markerGroupMapBySeries = this.markerGroupMapBySeries;
75504
+ const timerMap = this._timerMap;
75479
75505
  const labelMap = markerModel.labelMap;
75480
75506
  const updatedSeriesByName = {};
75507
+ const height = api2.getHeight();
75508
+ let backgroundColor2 = ecModel.get("backgroundColor");
75509
+ if (isGradientObject(backgroundColor2) && !backgroundColor2.global && backgroundColor2.type === "linear") {
75510
+ backgroundColor2 = {
75511
+ ...backgroundColor2,
75512
+ global: true,
75513
+ y2: height
75514
+ };
75515
+ }
75481
75516
  ecModel.eachSeries((seriesModel) => {
75482
75517
  const priceScaleInvisible = seriesModel.get("priceScaleInvisible");
75483
75518
  const invisible = seriesModel.get("invisible");
@@ -75512,7 +75547,7 @@ var MarkLabelView2 = class extends Component_default2 {
75512
75547
  return;
75513
75548
  }
75514
75549
  const yCalcFn = markerTypeCalculator2[item.type];
75515
- const {value, labelTextStyle} = yCalcFn ? yCalcFn(item, seriesModel) || {} : {value: item.value};
75550
+ const {value, labelTextStyle} = yCalcFn ? yCalcFn(item, seriesModel, backgroundColor2) || {} : {value: item.value};
75516
75551
  if (!value) {
75517
75552
  if (el) {
75518
75553
  el.ignore = true;
@@ -75549,6 +75584,13 @@ var MarkLabelView2 = class extends Component_default2 {
75549
75584
  markerGroupMap.set(item.name, el);
75550
75585
  this.group.add(el);
75551
75586
  }
75587
+ if (item.countDown && item.countDown.show && item.countDown.value) {
75588
+ const key = seriesName + item.name;
75589
+ if (!timerMap.get(key)) {
75590
+ const countDownTextEl = el.childAt(3);
75591
+ this._labelCountDown(item, countDownTextEl, key);
75592
+ }
75593
+ }
75552
75594
  inner21(el).yAxisIndex = yAxisModel.index;
75553
75595
  inner21(el).isSort = item.showName;
75554
75596
  });
@@ -75572,6 +75614,11 @@ var MarkLabelView2 = class extends Component_default2 {
75572
75614
  return;
75573
75615
  }
75574
75616
  markerGroupMap.removeKey(item.name);
75617
+ const downKey = seriesName + item.name;
75618
+ if (timerMap.get(downKey)) {
75619
+ clearTimeout(timerMap.get(downKey));
75620
+ timerMap.removeKey(downKey);
75621
+ }
75575
75622
  this.group.remove(el);
75576
75623
  });
75577
75624
  markerGroupMapBySeries.removeKey(seriesName);
@@ -75684,7 +75731,22 @@ var MarkLabelView2 = class extends Component_default2 {
75684
75731
  graphicLabelElMap.removeKey(option.id);
75685
75732
  });
75686
75733
  }
75687
- avoidOverlap() {
75734
+ _labelCountDown(item, el, key) {
75735
+ const timerMap = this._timerMap;
75736
+ const timer = setTimeout(() => {
75737
+ item.countDown.value = item.countDown.value - 1;
75738
+ const text = formatSeconds(item.countDown.value);
75739
+ el.attr("style", {text});
75740
+ if (item.countDown.value && item.countDown.show) {
75741
+ this._labelCountDown(item, el, key);
75742
+ } else {
75743
+ el.ignore = true;
75744
+ timerMap.removeKey(key);
75745
+ }
75746
+ }, 1e3);
75747
+ timerMap.set(key, timer);
75748
+ }
75749
+ avoidOverlap(isAvoidOverlap) {
75688
75750
  const labelsByYAxisId = {};
75689
75751
  const markerGroupMapBySeries = this.markerGroupMapBySeries;
75690
75752
  markerGroupMapBySeries.each((markerGroupMap) => {
@@ -75710,24 +75772,28 @@ var MarkLabelView2 = class extends Component_default2 {
75710
75772
  labelsByYAxisId[yAxisId] = labels;
75711
75773
  });
75712
75774
  each(labelsByYAxisId, (labels) => {
75713
- labelAvoidOverlap(labels);
75775
+ labelAvoidOverlap(labels, isAvoidOverlap);
75714
75776
  });
75715
75777
  }
75716
75778
  };
75717
75779
  var MarkLabelView = MarkLabelView2;
75718
75780
  MarkLabelView.type = "markLabel";
75719
- function textYChange(label, y) {
75781
+ function textYChange(label, y, height) {
75720
75782
  if (label.type === "text") {
75721
75783
  label.y = y;
75722
75784
  } else {
75723
75785
  each(label.children(), (item) => {
75724
75786
  if (item.type === "text") {
75725
- item.y = y;
75787
+ if (inner21(item).labelType === "countDown") {
75788
+ item.attr("style", {y: y + inner21(item).parentHeight});
75789
+ return;
75790
+ }
75791
+ item.attr("style", {y});
75726
75792
  }
75727
75793
  });
75728
75794
  }
75729
75795
  }
75730
- function labelAvoidOverlap(labels, marginTop = 0) {
75796
+ function labelAvoidOverlap(labels, isAvoidOverlap, marginTop = 0) {
75731
75797
  if (labels.length === 0) {
75732
75798
  return;
75733
75799
  }
@@ -75738,18 +75804,18 @@ function labelAvoidOverlap(labels, marginTop = 0) {
75738
75804
  for (let i = 0; i < labels.length; i++) {
75739
75805
  const currentLabel = labels[i];
75740
75806
  let currentLabelY = inner21(currentLabel).y;
75741
- if (i === 0) {
75742
- textYChange(currentLabel, currentLabelY - offestY);
75807
+ if (i === 0 || !isAvoidOverlap) {
75808
+ textYChange(currentLabel, currentLabelY - offestY, height);
75743
75809
  continue;
75744
75810
  }
75745
75811
  const prevLabel = labels[i - 1];
75746
75812
  const prevLabelY = sortYbyId[prevLabel.id] ?? inner21(prevLabel).y;
75747
- const prevHeight = height + marginTop;
75813
+ const prevHeight = inner21(prevLabel).showCountDown ? height * 2 + marginTop - 1 : height + marginTop;
75748
75814
  if (prevLabelY > currentLabelY || Math.abs(currentLabelY - prevLabelY) < prevHeight) {
75749
75815
  currentLabelY = prevLabelY + prevHeight;
75750
75816
  }
75751
75817
  sortYbyId[currentLabel.id] = currentLabelY;
75752
- textYChange(currentLabel, currentLabelY - offestY);
75818
+ textYChange(currentLabel, currentLabelY - offestY, height);
75753
75819
  }
75754
75820
  }
75755
75821
  function getPaddingByStyle(fontsize, borderWidth = 0) {
@@ -75786,7 +75852,7 @@ function updateText({option, gridRect, position: position2, ecModel, el, y, offs
75786
75852
  }
75787
75853
  function createLabel({x, y, labelData, markerModel, gridRect, position: position2, labelTextStyle = {}, fontSize}) {
75788
75854
  const {zlevel} = markerModel.option;
75789
- const {lineStyle, showLine, showName, showTitle, title} = labelData;
75855
+ const {lineStyle, showLine, showName, showTitle, title, countDown} = labelData;
75790
75856
  const textStyle = Object.assign(labelData.textStyle ?? {}, {fontSize, padding: getPaddingByStyle(fontSize, labelTextStyle.borderWidth)}, labelTextStyle);
75791
75857
  const text = labelData.text;
75792
75858
  const labelTitle = title || labelData.name;
@@ -75794,18 +75860,30 @@ function createLabel({x, y, labelData, markerModel, gridRect, position: position
75794
75860
  const group = new Group_default();
75795
75861
  const labelY = y;
75796
75862
  const borderWidth = textStyle.borderWidth ?? 0;
75863
+ const font = getFont(textStyle, markerModel.ecModel);
75864
+ const countDownText = countDown && countDown.show && formatSeconds(countDown.value) || "";
75865
+ const renderText = countDownText.length > text.length ? countDownText : text;
75866
+ const textRect = getBoundingRect(renderText, font);
75867
+ const paddings = normalizeCssArray2(textStyle.padding || 0);
75868
+ const textElWidth = textRect.width + paddings[1] + paddings[3];
75869
+ const textElx = isLeft ? x - textElWidth - borderWidth - 1 : x + borderWidth;
75797
75870
  const textEl = new Text_default({
75798
- x: isLeft ? getLeftTextX(x, text, textStyle, markerModel.ecModel) : x,
75799
- y: labelY,
75800
- style: Object.assign({text}, textStyle),
75871
+ style: Object.assign({
75872
+ text,
75873
+ width: textRect.width,
75874
+ x: textElx,
75875
+ y: labelY
75876
+ }, textStyle),
75801
75877
  z: 101,
75802
75878
  zlevel,
75803
75879
  ignore: !showName
75804
75880
  });
75805
75881
  const textNameEl = new Text_default({
75806
- x: isLeft ? gridRect.x - borderWidth : getLeftTextX(gridRect.x + gridRect.width, labelTitle, textStyle, markerModel.ecModel) + borderWidth,
75807
- y: labelY,
75808
- style: Object.assign({text: labelTitle}, textStyle),
75882
+ style: Object.assign({
75883
+ text: labelTitle,
75884
+ x: isLeft ? gridRect.x - borderWidth : getLeftTextX(gridRect.x + gridRect.width, labelTitle, textStyle, markerModel.ecModel) + borderWidth,
75885
+ y: labelY
75886
+ }, textStyle),
75809
75887
  z: 101,
75810
75888
  zlevel,
75811
75889
  ignore: !showTitle
@@ -75829,16 +75907,44 @@ function createLabel({x, y, labelData, markerModel, gridRect, position: position
75829
75907
  group.add(lineEl);
75830
75908
  group.add(textEl);
75831
75909
  group.add(textNameEl);
75910
+ if (countDown) {
75911
+ const show = countDown.show && !!countDown.value;
75912
+ const offsetY = showName && show ? textRect.height + paddings[0] + paddings[2] - 1 : 0;
75913
+ const fill = textStyle.fill === "#ffffff" ? "rgba(255,255,255,0.8)" : "rgba(0,0,0,0.8)";
75914
+ const countDownEl = new Text_default({
75915
+ style: Object.assign({
75916
+ text: countDownText,
75917
+ width: textRect.width,
75918
+ x: textElx,
75919
+ y: labelY + offsetY
75920
+ }, textStyle, {fill}),
75921
+ z: 101,
75922
+ zlevel,
75923
+ ignore: !show
75924
+ });
75925
+ inner21(group).showCountDown = show;
75926
+ inner21(countDownEl).labelType = "countDown";
75927
+ inner21(countDownEl).parentHeight = offsetY;
75928
+ group.add(countDownEl);
75929
+ }
75832
75930
  return group;
75833
75931
  }
75834
75932
  function updateLabel({x, y, labelData, markerModel, gridRect, position: position2, el, labelTextStyle = {}, fontSize}) {
75835
- const {lineStyle, showLine, showName, showTitle, title} = labelData;
75933
+ const {lineStyle, showLine, showName, showTitle, title, countDown} = labelData;
75836
75934
  const textStyle = Object.assign(labelData.textStyle ?? {}, {fontSize, padding: getPaddingByStyle(fontSize, labelTextStyle.borderWidth)}, labelTextStyle);
75837
75935
  const borderWidth = textStyle.borderWidth ?? 0;
75838
75936
  const isLeft = position2 === "left";
75839
75937
  if (el.ignore) {
75840
75938
  el.ignore = false;
75841
75939
  }
75940
+ const text = labelData.text;
75941
+ const countDownText = countDown && countDown.show && formatSeconds(countDown.value) || "";
75942
+ const renderText = countDownText.length > text.length ? countDownText : text;
75943
+ const font = getFont(textStyle, markerModel.ecModel);
75944
+ const textRect = getBoundingRect(renderText, font);
75945
+ const paddings = normalizeCssArray2(textStyle.padding || 0);
75946
+ const textElWidth = textRect.width + paddings[1] + paddings[3];
75947
+ const textElx = isLeft ? x - textElWidth - borderWidth - 1 : x + borderWidth;
75842
75948
  const labelY = y;
75843
75949
  inner21(el).y = labelY;
75844
75950
  each(el.children(), (element) => {
@@ -75867,10 +75973,12 @@ function updateLabel({x, y, labelData, markerModel, gridRect, position: position
75867
75973
  return;
75868
75974
  }
75869
75975
  const textLabel = labelData.text;
75870
- const labelX = isLeft ? getLeftTextX(x, textLabel, textStyle, markerModel.ecModel) - borderWidth : x + borderWidth;
75871
- element.x = labelX;
75872
- element.y = labelY;
75873
- element.attr("style", Object.assign({text: textLabel}, textStyle));
75976
+ element.attr("style", Object.assign({
75977
+ text: textLabel,
75978
+ width: textRect.width,
75979
+ x: textElx,
75980
+ y: labelY
75981
+ }, textStyle));
75874
75982
  element.ignore = false;
75875
75983
  break;
75876
75984
  case "nameLabel":
@@ -75880,9 +75988,26 @@ function updateLabel({x, y, labelData, markerModel, gridRect, position: position
75880
75988
  }
75881
75989
  const labelTitle = title || labelData.name;
75882
75990
  const nameX = isLeft ? gridRect.x : getLeftTextX(gridRect.x + gridRect.width, labelTitle, textStyle, markerModel.ecModel);
75883
- element.x = nameX;
75884
- element.y = labelY;
75885
- element.attr("style", Object.assign({text: labelTitle}, textStyle));
75991
+ element.attr("style", Object.assign({text: labelTitle, x: nameX, y: labelY}, textStyle));
75992
+ element.ignore = false;
75993
+ break;
75994
+ case "countDown":
75995
+ if (!countDown.show || !countDown.value) {
75996
+ element.ignore = true;
75997
+ inner21(el).showCountDown = false;
75998
+ inner21(element).parentHeight = 0;
75999
+ return;
76000
+ }
76001
+ const offsetY = showName ? textRect.height + paddings[0] + paddings[2] - 1 : 0;
76002
+ inner21(el).showCountDown = true;
76003
+ inner21(element).parentHeight = offsetY;
76004
+ const fill = textStyle.fill === "#ffffff" ? "rgba(255,255,255,0.8)" : "rgba(0,0,0,0.8)";
76005
+ element.attr("style", Object.assign({
76006
+ text: countDownText,
76007
+ width: textRect.width,
76008
+ x: textElx,
76009
+ y: labelY + offsetY
76010
+ }, textStyle, {fill}));
75886
76011
  element.ignore = false;
75887
76012
  break;
75888
76013
  }