tvcharts 0.8.75 → 0.8.77

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
@@ -24806,11 +24806,9 @@ var ECharts = class extends Eventful_default {
24806
24806
  const extend2 = scale4.getExtent();
24807
24807
  const axis = xAxisModal.axis;
24808
24808
  const lastIndex = extend2[1];
24809
- const minLength = extend2[0] - extend2[1];
24810
24809
  const axisWidth = axis.getExtent()[1];
24811
24810
  const startX = Math.max(axis.dataToCoord(startIndex), 0);
24812
24811
  const endX = Math.min(axis.dataToCoord(lastIndex), axisWidth);
24813
- console.log("%c [ minLength ]-1359", "font-size:13px; background:pink; color:#bf2c9f;", xAxisModal, minLength, startIndex, extend2[1]);
24814
24812
  return (endX - startX) / scale4.barSpace + 0.5;
24815
24813
  }
24816
24814
  getViewOfComponentModel(componentModel) {
@@ -25249,7 +25247,6 @@ var ECharts = class extends Eventful_default {
25249
25247
  }
25250
25248
  }
25251
25249
  scrollByDistance(distance2, animationDuration) {
25252
- console.log("%c [ distance ]-2002", "font-size:13px; background:pink; color:#bf2c9f;", distance2);
25253
25250
  const xAxisModal = this._model.getComponent("xAxis", 0);
25254
25251
  const scale4 = xAxisModal.axis.scale;
25255
25252
  const duration = isNumber(animationDuration) && animationDuration > 0 ? animationDuration : 0;
@@ -68839,6 +68836,9 @@ var GraphicComponentView2 = class extends Component_default2 {
68839
68836
  return;
68840
68837
  }
68841
68838
  const elOption = item;
68839
+ if (elOption.style) {
68840
+ el.attr("style", elOption.style);
68841
+ }
68842
68842
  if (elOption.x || elOption.y) {
68843
68843
  el.attr({x: elOption.x, y: elOption.y});
68844
68844
  }
@@ -72131,18 +72131,26 @@ var TooltipTextHtmlContent = class {
72131
72131
  this._api = api2;
72132
72132
  this._container = container;
72133
72133
  }
72134
- show({x, y, text}) {
72134
+ show({x, y, text, position: position2 = "top"}) {
72135
72135
  const el = this.el;
72136
72136
  const style = el.style;
72137
72137
  style.position = "absolute";
72138
- style.top = y - margin2 + "px";
72139
72138
  style.left = x + "px";
72140
72139
  style.visibility = "visible";
72141
72140
  style.opacity = "1";
72142
- style.transform = "translateX(-50%) translateY(-100%)";
72141
+ const isTop = position2 === "top";
72142
+ let triangleStyle = "transform: translateX(-50%) translateY(50%) rotate(45deg); position: absolute; bottom: 0px;";
72143
+ if (isTop) {
72144
+ style.top = y - margin2 + "px";
72145
+ style.transform = "translateX(-50%) translateY(-100%)";
72146
+ } else {
72147
+ style.top = y + margin2 + "px";
72148
+ style.transform = "translateX(-50%) translateY(100%)";
72149
+ triangleStyle = "transform: translateX(-50%) translateY(-50%) rotate(45deg); position: absolute; top: 0px;";
72150
+ }
72143
72151
  el.innerHTML = `<div>
72144
- <div style="min-width: 32px; padding: 2px 8px; color: #fff; background-color: rgb(42, 46, 57); font-size: 14px; border-radius: 6px; box-shadow: rgba(0, 0, 0, 0.08) 0px 6px 16px 0px, rgba(0, 0, 0, 0.12) 0px 3px 6px -4px, rgba(0, 0, 0, 0.05) 0px 9px 28px 8px;">${text}</div>
72145
- <div style="width: 6px; height: 6px; transform: translateX(-50%) translateY(50%) rotate(45deg); position: absolute; bottom: 0px; left: 50%; background-color: rgb(42, 46, 57);"></div>
72152
+ <div style="min-width: 32px; padding: 2px 8px; color: #fff; background-color: rgb(42, 46, 57); font-size: 12px; border-radius: 6px; box-shadow: rgba(0, 0, 0, 0.08) 0px 6px 16px 0px, rgba(0, 0, 0, 0.12) 0px 3px 6px -4px, rgba(0, 0, 0, 0.05) 0px 9px 28px 8px;">${text}</div>
72153
+ <div style="width: 6px; height: 6px; ${triangleStyle} left: 50%; background-color: rgb(42, 46, 57);"></div>
72146
72154
  </div>`;
72147
72155
  }
72148
72156
  getSize() {
@@ -72183,6 +72191,7 @@ var TooltipView2 = class extends Component_default2 {
72183
72191
  }
72184
72192
  const tooltipModel = ecModel.getComponent("tooltip");
72185
72193
  const renderMode = this._renderMode = getTooltipRenderMode(tooltipModel.get("renderMode"));
72194
+ api2.getZr().on("mousedown", this._hideTip, this);
72186
72195
  this._tooltipContent = renderMode === "richText" ? new TooltipRichContent_default(api2) : new TooltipHTMLContent_default(api2, {
72187
72196
  appendTo: tooltipModel.get("appendToBody", true) ? "body" : tooltipModel.get("appendTo", true)
72188
72197
  });
@@ -72197,6 +72206,9 @@ var TooltipView2 = class extends Component_default2 {
72197
72206
  this._ecModel = ecModel;
72198
72207
  this._api = api2;
72199
72208
  this._keepShowPoint(tooltipModel, ecModel);
72209
+ if (this._lastTipTextPayload) {
72210
+ this.showTipText(tooltipModel, ecModel, api2, this._lastTipTextPayload);
72211
+ }
72200
72212
  if (!tooltipModel.get("showContent")) {
72201
72213
  return;
72202
72214
  }
@@ -72572,6 +72584,11 @@ var TooltipView2 = class extends Component_default2 {
72572
72584
  tooltipContent.show(tooltipModel, nearPointColor);
72573
72585
  this._updatePosition(tooltipModel, positionExpr, x, y, tooltipContent, params, el);
72574
72586
  }
72587
+ _hideTip() {
72588
+ if (this._lastTipTextPayload) {
72589
+ this.hideTipText();
72590
+ }
72591
+ }
72575
72592
  _getNearestPoint(point, tooltipDataParams, trigger3, borderColor) {
72576
72593
  if (trigger3 === "axis" || isArray(tooltipDataParams)) {
72577
72594
  return {
@@ -72719,9 +72736,36 @@ var TooltipView2 = class extends Component_default2 {
72719
72736
  }
72720
72737
  }
72721
72738
  showTipText(tooltipModel, ecModel, api2, payload) {
72722
- this._tooltipText.show(payload);
72739
+ let x = payload.x;
72740
+ let y = payload.y;
72741
+ const {position: position2 = "top", time, price, text} = payload;
72742
+ if (!x || !y) {
72743
+ const mainSeriesModal = ecModel.getMainSeries();
72744
+ if (!mainSeriesModal) {
72745
+ return;
72746
+ }
72747
+ const coordSys = mainSeriesModal.coordinateSystem;
72748
+ if (price != void 0) {
72749
+ const yAxisModel = coordSys.getAxis("y");
72750
+ y = yAxisModel.toGlobalCoord(yAxisModel.dataToCoord(price));
72751
+ }
72752
+ if (time != void 0) {
72753
+ const xAxisModal = coordSys.getAxis("x");
72754
+ const scale4 = xAxisModal.model.axis.scale;
72755
+ const ordinalMeta = scale4.getOrdinalMeta();
72756
+ const dataIndex = typeof time === "number" ? time : ordinalMeta.getOrdinal(time) ?? ordinalMeta.getClosestTime(time);
72757
+ const data = mainSeriesModal.getData();
72758
+ const price2 = data.getByRawIndex(position2 === "top" ? "highest" : "", dataIndex);
72759
+ const yAxisModel = coordSys.getAxis("y");
72760
+ y = yAxisModel.toGlobalCoord(yAxisModel.dataToCoord(price2));
72761
+ x = xAxisModal.toGlobalCoord(xAxisModal.dataToCoord(dataIndex));
72762
+ }
72763
+ this._lastTipTextPayload = payload;
72764
+ }
72765
+ this._tooltipText.show({text, x, y, position: position2});
72723
72766
  }
72724
- hideTipText(tooltipModel, ecModel, api2, payload) {
72767
+ hideTipText() {
72768
+ this._lastTipTextPayload = null;
72725
72769
  this._tooltipText.hide();
72726
72770
  }
72727
72771
  dispose(ecModel, api2) {
@@ -72733,6 +72777,7 @@ var TooltipView2 = class extends Component_default2 {
72733
72777
  this._pointEl = null;
72734
72778
  this._lastPoint = [];
72735
72779
  }
72780
+ api2.getZr().off("mousedown", this._hideTip);
72736
72781
  clear(this, "_updatePosition");
72737
72782
  this._tooltipContent.dispose();
72738
72783
  this._tooltipText.dispose();
@@ -75813,6 +75858,7 @@ var PlaybackOrderView4 = class extends Component_default2 {
75813
75858
  x,
75814
75859
  y
75815
75860
  });
75861
+ this.mousemoveTPSL = true;
75816
75862
  }, 500);
75817
75863
  };
75818
75864
  stopCloseEl2.onmouseout = () => {
@@ -75821,6 +75867,7 @@ var PlaybackOrderView4 = class extends Component_default2 {
75821
75867
  type: "hideTipText",
75822
75868
  escapeConnect: true
75823
75869
  });
75870
+ this.mousemoveTPSL = false;
75824
75871
  stopCloseRect.attr("invisible", true);
75825
75872
  };
75826
75873
  stopCloseEl2.onclick = () => {
@@ -75985,16 +76032,21 @@ var PlaybackOrderView4 = class extends Component_default2 {
75985
76032
  return;
75986
76033
  }
75987
76034
  this.group.remove(this.stopProfitGroup);
75988
- this.stopProfitLabelEl = null;
75989
76035
  this.stopProfitGroup = null;
75990
76036
  } else {
75991
76037
  if (!this.stopLossGroup) {
75992
76038
  return;
75993
76039
  }
75994
76040
  this.group.remove(this.stopLossGroup);
75995
- this.stopLossLabelEl = null;
75996
76041
  this.stopLossGroup = null;
75997
76042
  }
76043
+ if (this.mousemoveTPSL) {
76044
+ this.api.dispatchAction({
76045
+ type: "hideTipText",
76046
+ escapeConnect: true
76047
+ });
76048
+ this.mousemoveTPSL = false;
76049
+ }
75998
76050
  }
75999
76051
  renderLabels() {
76000
76052
  const rect = this.rect;
@@ -76051,6 +76103,7 @@ var PlaybackOrderView4 = class extends Component_default2 {
76051
76103
  textElList.push(this.stopProfitLabelEl);
76052
76104
  } else if (this.stopProfitLabelEl) {
76053
76105
  group.remove(this.stopProfitLabelEl);
76106
+ this.stopProfitLabelEl = null;
76054
76107
  }
76055
76108
  if (this.stopLossGroup) {
76056
76109
  if (!this.stopLossLabelEl) {
@@ -76075,6 +76128,7 @@ var PlaybackOrderView4 = class extends Component_default2 {
76075
76128
  textElList.push(this.stopLossLabelEl);
76076
76129
  } else if (this.stopLossLabelEl) {
76077
76130
  group.remove(this.stopLossLabelEl);
76131
+ this.stopLossLabelEl = null;
76078
76132
  }
76079
76133
  this.labels = textElList;
76080
76134
  const markLabelModal = this.ecModel.getComponent("markLabel");
@@ -76099,6 +76153,12 @@ var PlaybackOrderView4 = class extends Component_default2 {
76099
76153
  if (!this.orderGroup) {
76100
76154
  return;
76101
76155
  }
76156
+ if (this.mouseSelected || this.selected) {
76157
+ this.api.dispatchAction({
76158
+ type: "hideTipText",
76159
+ escapeConnect: true
76160
+ });
76161
+ }
76102
76162
  this.orderLabelEl = null;
76103
76163
  this.stopProfitLabelEl = null;
76104
76164
  this.stopLossLabelEl = null;