tvcharts 0.7.79 → 0.7.81

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
@@ -22568,7 +22568,7 @@ var ArrowUp = Path_default.extend({
22568
22568
  ctx2.lineTo(cx - width + rectWidth, cy + height);
22569
22569
  ctx2.lineTo(cx - width + rectWidth, triangleY);
22570
22570
  ctx2.lineTo(cx - width, triangleY);
22571
- ctx2.closePath();
22571
+ ctx2.lineTo(cx, cy - height);
22572
22572
  }
22573
22573
  });
22574
22574
  var ArrowUpClose = Path_default.extend({
@@ -22594,7 +22594,7 @@ var ArrowUpClose = Path_default.extend({
22594
22594
  ctx2.lineTo(cx - width + rectWidth, cy + height);
22595
22595
  ctx2.lineTo(cx - width + rectWidth, triangleY);
22596
22596
  ctx2.lineTo(cx - width, triangleY);
22597
- ctx2.closePath();
22597
+ ctx2.lineTo(cx, cy - height);
22598
22598
  ctx2.rect(cx - width + 0.5, cy - height - 0.5 - rectHeight, shape.width - 0.5, rectHeight);
22599
22599
  }
22600
22600
  });
@@ -22620,7 +22620,7 @@ var ArrowDown = Path_default.extend({
22620
22620
  ctx2.lineTo(cx - width + rectWidth, cy - height);
22621
22621
  ctx2.lineTo(cx - width + rectWidth, triangleY);
22622
22622
  ctx2.lineTo(cx - width, triangleY);
22623
- ctx2.closePath();
22623
+ ctx2.lineTo(cx, cy + height);
22624
22624
  }
22625
22625
  });
22626
22626
  var ArrowDownClose = Path_default.extend({
@@ -22646,7 +22646,7 @@ var ArrowDownClose = Path_default.extend({
22646
22646
  ctx2.lineTo(cx - width + rectWidth, cy - height);
22647
22647
  ctx2.lineTo(cx - width + rectWidth, triangleY);
22648
22648
  ctx2.lineTo(cx - width, triangleY);
22649
- ctx2.closePath();
22649
+ ctx2.lineTo(cx, cy + height);
22650
22650
  ctx2.rect(cx - width + 0.5, cy + height + 0.5, shape.width - 0.5, rectHeight);
22651
22651
  }
22652
22652
  });
@@ -56935,10 +56935,10 @@ var StrategyView2 = class extends Chart_default {
56935
56935
  fill: textColor ?? "#fff",
56936
56936
  fontSize: 12,
56937
56937
  stroke: textBorder,
56938
- lineWidth: textBorderWidth
56939
- },
56940
- x: point[0],
56941
- y: point[1]
56938
+ lineWidth: textBorderWidth,
56939
+ x: point[0],
56940
+ y: point[1]
56941
+ }
56942
56942
  });
56943
56943
  el.states.emphasis = emphasisState;
56944
56944
  symbolGroup.add(el);
@@ -59643,10 +59643,10 @@ var LabelsView2 = class extends Chart_default {
59643
59643
  fontFamily,
59644
59644
  fontSize,
59645
59645
  stroke: textBorderColor,
59646
- lineWidth: textBorderWidth
59647
- },
59648
- x: point[0] + offset[0],
59649
- y: point[1] + offset[1]
59646
+ lineWidth: textBorderWidth,
59647
+ x: point[0] + offset[0],
59648
+ y: point[1] + offset[1]
59649
+ }
59650
59650
  });
59651
59651
  el.states.emphasis = emphasisState;
59652
59652
  textGroup.add(el);
@@ -59971,10 +59971,24 @@ function changeLabelOffsetBySymbol(symbol, symbolRect, shape, oldOffset) {
59971
59971
  }
59972
59972
  return oldOffset;
59973
59973
  }
59974
+ var getTextRect2 = (text, font) => {
59975
+ let width = 0;
59976
+ let height = 0;
59977
+ text.split("\n").forEach((item) => {
59978
+ height = height + getLineHeight(font);
59979
+ width = Math.max(width, getWidth(item, font));
59980
+ });
59981
+ return {
59982
+ width,
59983
+ height
59984
+ };
59985
+ };
59986
+ var defaultOffset = [0, 0];
59987
+ var defaultLabel = {};
59974
59988
  var labelsLayout = {
59975
59989
  seriesType: "labels",
59976
59990
  plan: createRenderPlanner(),
59977
- reset: function(seriesModel) {
59991
+ reset: function(seriesModel, ecModel) {
59978
59992
  const data = seriesModel.getData();
59979
59993
  const coordSys = seriesModel.coordinateSystem;
59980
59994
  if (!coordSys) {
@@ -59992,6 +60006,9 @@ var labelsLayout = {
59992
60006
  const xOffset = seriesModel.get("offset") || 0;
59993
60007
  const price = getYByLocation2(seriesModel);
59994
60008
  const showLast = seriesModel.get("showLast");
60009
+ const gTextStyleModel = ecModel.getModel("textStyle");
60010
+ const gfontSize = gTextStyleModel && (gTextStyleModel.getShallow("fontSize") || 12) + "px";
60011
+ const gfontFamily = gTextStyleModel && gTextStyleModel.getShallow("fontFamily") || "sans-serif";
59995
60012
  return {
59996
60013
  progress(params, labelsData) {
59997
60014
  const symbolStyleMap = {};
@@ -60010,20 +60027,19 @@ var labelsLayout = {
60010
60027
  }
60011
60028
  const itemModel = data.getItemModel(i);
60012
60029
  const yloc = itemModel.get("yloc");
60013
- const symbol = itemModel.getShallow("symbol");
60014
- let symbolSize = itemModel.getShallow("symbolSize");
60015
- const symbolOffset = itemModel.getShallow("symbolOffset") || [0, 0];
60030
+ const symbol = itemModel.get("symbol");
60031
+ let symbolSize = itemModel.get("symbolSize");
60032
+ const symbolOffset = itemModel.get("symbolOffset") || defaultOffset;
60016
60033
  let symbolShape = {};
60017
- const style = itemModel.getModel("itemStyle").getItemStyle();
60018
- const labelModel = itemModel.getModel("label");
60019
- let oldOffset = labelModel.get("offset") || [0, 0];
60020
- const align = labelModel.get("align");
60034
+ const labelModel = itemModel.option.label || defaultLabel;
60035
+ let oldOffset = labelModel.offset || defaultOffset;
60036
+ const align = labelModel.align;
60021
60037
  const size = itemModel.get("size") ?? "normal";
60022
- const text = labelModel.get("formatter");
60038
+ const text = labelModel.formatter;
60023
60039
  const isLabel = labelSymbolByType[symbol];
60024
- const textShow = labelModel.get("show");
60025
- let fontSize = labelModel.getShallow("fontSize");
60026
- let position2 = labelModel.get("position") || "top";
60040
+ const textShow = labelModel.show;
60041
+ let fontSize = labelModel.fontSize;
60042
+ let position2 = labelModel.position || "top";
60027
60043
  if (location === "top" || location === "belowbar") {
60028
60044
  position2 = "bottom";
60029
60045
  }
@@ -60031,15 +60047,18 @@ var labelsLayout = {
60031
60047
  position2 = "inside";
60032
60048
  }
60033
60049
  if (textShow) {
60034
- labelModel.option.fontSize = fontSize = getSymbolLabelFontSize(size, bandWidth);
60050
+ labelModel.fontSize = fontSize = getSymbolLabelFontSize(size, bandWidth);
60035
60051
  }
60036
60052
  let textRect = void 0;
60037
60053
  if (textShow) {
60038
- textRect = labelModel.getTextRect(text);
60054
+ textRect = getTextRect2(text, `
60055
+ ${fontSize || gfontSize}
60056
+ ${labelModel.fontFamily || gfontFamily}
60057
+ `);
60039
60058
  if (isLabel) {
60040
60059
  symbolSize = [textRect.width + HPadding, textRect.height + VPadding];
60041
60060
  }
60042
- const align2 = labelModel.get("align");
60061
+ const align2 = labelModel.align;
60043
60062
  if (align2 === "left") {
60044
60063
  oldOffset = [-textRect.width / 2, 0];
60045
60064
  } else if (align2 === "right") {
@@ -60068,19 +60087,19 @@ var labelsLayout = {
60068
60087
  if (symbol === "labelCenter") {
60069
60088
  symbolPoint[1] = symbolPoint[1] + symbolRect[1] / 2;
60070
60089
  }
60071
- if (symbol !== "none" && style.fill) {
60090
+ if (symbol !== "none" && itemModel.option.itemStyle.color) {
60072
60091
  const symbolStyles = symbolStyleMap[symbol] || [];
60073
60092
  symbolStyles.push({
60074
60093
  point: symbolPoint,
60075
60094
  size: symbolRect,
60076
60095
  offset: symbolOffset,
60077
- color: style.fill,
60096
+ color: itemModel.option.itemStyle.color,
60078
60097
  shape: symbolShape
60079
60098
  });
60080
60099
  symbolStyleMap[symbol] = symbolStyles;
60081
60100
  }
60082
60101
  if (textShow) {
60083
- const labelPoint = [...symbolPoint];
60102
+ const labelPoint = symbolPoint.slice();
60084
60103
  if (position2 === "inside") {
60085
60104
  labelPoint[1] = labelPoint[1] - textRect.height / 2 - symbolRect[1] / 2;
60086
60105
  } else if (position2 === "top") {
@@ -60093,11 +60112,11 @@ var labelsLayout = {
60093
60112
  align: align || "center",
60094
60113
  point: labelPoint,
60095
60114
  fontSize,
60096
- textColor: labelModel.get("color") || "#fff",
60097
- fontFamily: labelModel.get("fontFamily"),
60115
+ textColor: labelModel.color || "#2962FF",
60116
+ fontFamily: labelModel.fontFamily,
60098
60117
  offset: [oldOffset[0] + symbolOffset[0], oldOffset[1] + symbolOffset[1]],
60099
- textBorderColor: labelModel.get("textBorderColor"),
60100
- textBorderWidth: labelModel.get("textBorderWidth")
60118
+ textBorderColor: labelModel.textBorderColor,
60119
+ textBorderWidth: labelModel.textBorderWidth
60101
60120
  });
60102
60121
  }
60103
60122
  }
@@ -60431,8 +60450,8 @@ var FillsView_default = FillsView;
60431
60450
  // src/chart/fills/fillsLayout.ts
60432
60451
  function getKey(itemModel) {
60433
60452
  let key = itemModel.option?.color;
60434
- if (!key && itemModel.get("topValue") !== void 0) {
60435
- key = `${itemModel.get("topColor") || "rgba(255,255,255,0)"}:${itemModel.get("topValue")}:${itemModel.get("bottomColor") || "rgba(255,255,255,0)"}:${itemModel.get("bottomValue")}`;
60453
+ if (!key && itemModel.get("topValue", true) !== void 0) {
60454
+ key = `${itemModel.get("topColor", true) || "rgba(255,255,255,0)"}:${itemModel.get("topValue", true)}:${itemModel.get("bottomColor", true) || "rgba(255,255,255,0)"}:${itemModel.get("bottomValue", true)}`;
60436
60455
  }
60437
60456
  return key || "transparent";
60438
60457
  }
@@ -75815,7 +75834,7 @@ var MarkLabelView2 = class extends Component_default2 {
75815
75834
  markerGroupMap.set(item.name, el);
75816
75835
  this.group.add(el);
75817
75836
  }
75818
- if (item.countDown && item.countDown.show && item.countDown.value) {
75837
+ if (item.countDown && item.countDown.show && item.countDown.value > 0) {
75819
75838
  const key = seriesName + item.name;
75820
75839
  if (!timerMap.get(key)) {
75821
75840
  const countDownTextEl = el.childAt(3);