@tradecanvas/core 1.18.0 → 1.19.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.
package/dist/index.js CHANGED
@@ -8974,16 +8974,25 @@ var So = {
8974
8974
  }, To = (e) => e < 10 ? "0" + e : "" + e, Eo = class {
8975
8975
  tz = null;
8976
8976
  timeFormatter = null;
8977
+ timesPastData = !0;
8977
8978
  setTimezoneOffset(e) {
8978
8979
  this.tz = e;
8979
8980
  }
8980
8981
  setTimeFormatter(e) {
8981
8982
  this.timeFormatter = e;
8982
8983
  }
8984
+ setTimesPastData(e) {
8985
+ this.timesPastData = e;
8986
+ }
8987
+ getTimesPastData() {
8988
+ return this.timesPastData;
8989
+ }
8983
8990
  render(e, t, n, r, i) {
8984
8991
  let { chartRect: a } = t, o = i ?? a.y + a.height;
8985
8992
  e.strokeStyle = n.style?.axis.time.line ?? n.axisLine, e.lineWidth = 1, e.globalAlpha = .65, e.beginPath(), e.moveTo(a.x, o + .5), e.lineTo(a.x + a.width, o + .5), e.stroke(), e.globalAlpha = 1;
8986
- let s = t.barWidth + t.barSpacing, c = Math.max(1, Math.ceil(80 / s)), l = -t.offset + a.x + t.barWidth / 2, u = Math.floor(t.offset / s), d = Math.ceil((t.offset + a.width) / s), f = r.length > 0 ? D(Math.min(d, r.length - 1), r) : Date.now(), p = He(this.tz, f > 0xe8d4a51000 ? f : f * 1e3), m = `500 ${n.font.sizeSmall - 1}px ${n.font.family}`, h = a.x + a.width - 4;
8993
+ let s = t.barWidth + t.barSpacing, c = Math.max(1, Math.ceil(80 / s)), l = -t.offset + a.x + t.barWidth / 2, u = Math.floor(t.offset / s), d = Math.ceil((t.offset + a.width) / s);
8994
+ this.timesPastData || (u = Math.max(u, 0), d = Math.min(d, r.length - 1));
8995
+ let f = r.length > 0 ? D(Math.min(d, r.length - 1), r) : Date.now(), p = He(this.tz, f > 0xe8d4a51000 ? f : f * 1e3), m = `500 ${n.font.sizeSmall - 1}px ${n.font.family}`, h = a.x + a.width - 4;
8987
8996
  e.font = m;
8988
8997
  let g = h - e.measureText(p).width - 8;
8989
8998
  e.font = `500 ${n.font.sizeSmall}px ${n.font.family}`, e.textBaseline = "top", e.textAlign = "center", e.fillStyle = n.style?.axis.time.text ?? n.axisLabel;
@@ -9719,6 +9728,13 @@ var Go = class {
9719
9728
  data = [];
9720
9729
  tz = null;
9721
9730
  timeFormatter = null;
9731
+ timesPastData = !0;
9732
+ setTimesPastData(e) {
9733
+ this.timesPastData = e;
9734
+ }
9735
+ getTimesPastData() {
9736
+ return this.timesPastData;
9737
+ }
9722
9738
  setTimeFormatter(e) {
9723
9739
  this.timeFormatter = e;
9724
9740
  }
@@ -9833,7 +9849,7 @@ var Go = class {
9833
9849
  o < s.x || o > s.x + s.width || this.drawTimePill(e, t, n, r, i, o, a);
9834
9850
  }
9835
9851
  drawTimePill(e, t, n, r, i, a, o) {
9836
- if (r.length === 0) return;
9852
+ if (r.length === 0 || !this.timesPastData && (i < 0 || i >= r.length)) return;
9837
9853
  let s = D(i, r);
9838
9854
  Yo(e, {
9839
9855
  text: this.timeFormatter ? this.timeFormatter(s > 0xe8d4a51000 ? s : s * 1e3, {