@ixfx/components 0.4.1 → 0.4.2

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.
Files changed (51) hide show
  1. package/bundle/index.d.ts +207 -111
  2. package/bundle/index.d.ts.map +1 -1
  3. package/bundle/index.js +357 -223
  4. package/bundle/index.js.map +1 -1
  5. package/dist/button.d.ts +1 -1
  6. package/dist/button.d.ts.map +1 -1
  7. package/dist/checkbox.d.ts.map +1 -1
  8. package/dist/checkbox.js.map +1 -1
  9. package/dist/crumbs.d.ts +1 -1
  10. package/dist/crumbs.d.ts.map +1 -1
  11. package/dist/crumbs.js +1 -1
  12. package/dist/crumbs.js.map +1 -1
  13. package/dist/data-display.js.map +1 -1
  14. package/dist/incr-search.d.ts +1 -1
  15. package/dist/{index-BMjri2-S.d.ts → index-9fGVAg1d.d.ts} +2 -2
  16. package/dist/{index-BMjri2-S.d.ts.map → index-9fGVAg1d.d.ts.map} +1 -1
  17. package/dist/index-CowKi2mo.d.ts.map +1 -1
  18. package/dist/{index-CWpNcQKE.d.ts → index-_RTQSKHi.d.ts} +2 -2
  19. package/dist/{index-CWpNcQKE.d.ts.map → index-_RTQSKHi.d.ts.map} +1 -1
  20. package/dist/index.d.ts +10 -12
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +4 -4
  23. package/dist/index.js.map +1 -1
  24. package/dist/menu.d.ts +1 -1
  25. package/dist/miller.d.ts +1 -1
  26. package/dist/panel.d.ts.map +1 -1
  27. package/dist/panel.js.map +1 -1
  28. package/dist/plots.d.ts +1 -1
  29. package/dist/plots.js +1 -1
  30. package/dist/split-layout.js.map +1 -1
  31. package/dist/swipe.d.ts.map +1 -1
  32. package/dist/swipe.js.map +1 -1
  33. package/dist/timeline-2OFtN4Ta.js.map +1 -1
  34. package/dist/{tree-CJWpMUvD.js → tree-D84RUgFC.js} +2 -2
  35. package/dist/tree-D84RUgFC.js.map +1 -0
  36. package/dist/{tree-component-BcO26Xvt.d.ts → tree-component-BaCSPWg1.d.ts} +1 -6
  37. package/dist/tree-component-BaCSPWg1.d.ts.map +1 -0
  38. package/dist/tree.d.ts +1 -1
  39. package/dist/tree.d.ts.map +1 -1
  40. package/dist/tree.js +1 -1
  41. package/dist/{xy-axis-McdUpcYr.d.ts → xy-axis-CEI7ojks.d.ts} +173 -70
  42. package/dist/xy-axis-CEI7ojks.d.ts.map +1 -0
  43. package/dist/{xy-axis-CK64haaK.js → xy-axis-DbPezP6A.js} +188 -54
  44. package/dist/xy-axis-DbPezP6A.js.map +1 -0
  45. package/dist/xy-pad.d.ts.map +1 -1
  46. package/dist/xy-pad.js.map +1 -1
  47. package/package.json +2 -2
  48. package/dist/tree-CJWpMUvD.js.map +0 -1
  49. package/dist/tree-component-BcO26Xvt.d.ts.map +0 -1
  50. package/dist/xy-axis-CK64haaK.js.map +0 -1
  51. package/dist/xy-axis-McdUpcYr.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { n as safeCustomElement, t as __decorate } from "./decorate-DdjvVHS-.js";
2
- import { a as radiansNormalise, c as isEmpty$1, d as isPlaceholder, f as isPoint, i as piPi$1, l as isNaN$1, m as pointTest, n as average$1, o as guard$2, p as isPoint3d, r as averager, s as guardNonZeroPoint, t as colour_exports, u as isNull } from "./colour-C3MQIjFJ-vRCdr8W-.js";
2
+ import { a as radiansNormalise, c as isEmpty$1, d as isPlaceholder, f as isPoint, i as piPi$1, l as isNaN, m as pointTest, n as average$1, o as guard$2, p as isPoint3d, r as averager, s as guardNonZeroPoint, t as colour_exports, u as isNull } from "./colour-C3MQIjFJ-vRCdr8W-.js";
3
3
  import { C as resultThrow, S as percentTest, _ as functionTest, c as round, f as wrap, l as scale, o as quantiseEvery, r as dotProduct, s as rangeStream, t as clamp, v as integerTest, w as stringTest, x as numberTest } from "./dist-CA13FvMn.js";
4
4
  import { LitElement, css, html, svg } from "lit";
5
5
  import { property, state } from "lit/decorators.js";
@@ -5920,7 +5920,7 @@ var point_exports = /* @__PURE__ */ __exportAll$2({
5920
5920
  invert: () => invert,
5921
5921
  isEmpty: () => isEmpty$1,
5922
5922
  isEqual: () => isEqual,
5923
- isNaN: () => isNaN$1,
5923
+ isNaN: () => isNaN,
5924
5924
  isNull: () => isNull,
5925
5925
  isPlaceholder: () => isPlaceholder,
5926
5926
  isPoint: () => isPoint,
@@ -6559,9 +6559,20 @@ function applyAgeModification(base, ageFraction, ageStyle) {
6559
6559
  }
6560
6560
  //#endregion
6561
6561
  //#region src/plots/data.ts
6562
+ /**
6563
+ * A data series
6564
+ */
6562
6565
  var PlotDataSeries = class {
6563
6566
  #rangeStream;
6564
6567
  #options;
6568
+ /**
6569
+ * Constructor.
6570
+ *
6571
+ * Default options:
6572
+ * - `capacityLimit`: 100
6573
+ * - `persistentScaling`: true
6574
+ * @param options
6575
+ */
6565
6576
  constructor(options = {}) {
6566
6577
  this.values = [];
6567
6578
  this.#rangeStream = rangeStream();
@@ -6575,11 +6586,20 @@ var PlotDataSeries = class {
6575
6586
  ...options
6576
6587
  };
6577
6588
  }
6578
- add(value) {
6579
- this.values.push(value);
6580
- this.range = this.#rangeStream.seen(value);
6589
+ /**
6590
+ * Adds a single value
6591
+ * @param valueOrValues Value to add
6592
+ */
6593
+ add(valueOrValues) {
6594
+ if (typeof valueOrValues === `number`) {
6595
+ this.values.push(valueOrValues);
6596
+ this.range = this.#rangeStream.seen(valueOrValues);
6597
+ } else {
6598
+ this.values.push(...valueOrValues);
6599
+ for (const v of valueOrValues) this.range = this.#rangeStream.seen(v);
6600
+ }
6581
6601
  if (this.values.length > this.#options.capacityLimit) {
6582
- this.values.shift();
6602
+ this.values = this.values.slice(this.values.length - this.#options.capacityLimit);
6583
6603
  if (!this.#options.persistentScaling) this.#recompute();
6584
6604
  }
6585
6605
  }
@@ -6587,14 +6607,24 @@ var PlotDataSeries = class {
6587
6607
  if (!this.#options.persistentScaling) this.#rangeStream = rangeStream();
6588
6608
  for (let i = 0; i < this.values.length; i++) this.range = this.#rangeStream.seen(this.values[i]);
6589
6609
  }
6610
+ /**
6611
+ * Sets the entire data series at once, replacing any existing data. If the number of values exceeds the `capacityLimit`, only the most recent values up to the limit are kept.
6612
+ * @param values
6613
+ */
6590
6614
  set(values) {
6591
6615
  if (values.length > this.#options.capacityLimit) values = values.slice(values.length - this.#options.capacityLimit);
6592
6616
  this.values = values;
6593
6617
  this.#recompute();
6594
6618
  }
6619
+ /**
6620
+ * Clear all data and reset range. If `persistentScaling` is _false_, also resets scaling to initial state.
6621
+ * @returns _true_ if there was data to clear
6622
+ */
6595
6623
  clear() {
6624
+ const empty = this.values.length === 0;
6596
6625
  this.values = [];
6597
6626
  if (!this.#options.persistentScaling) this.#recompute();
6627
+ return !empty;
6598
6628
  }
6599
6629
  };
6600
6630
  //#endregion
@@ -6692,44 +6722,104 @@ let PlotMultiAxis = class PlotMultiAxis extends LitElement {
6692
6722
  #seriesOrder;
6693
6723
  #seriesSet;
6694
6724
  #pendingStyles;
6695
- addData(nameOrData, value) {
6696
- if (typeof nameOrData === `object` && nameOrData !== null) {
6697
- const entries = Object.entries(nameOrData);
6698
- for (const [name, val] of entries) this.#addToSeries(name, val);
6699
- } else this.#addToSeries(nameOrData, value);
6700
- this.requestUpdate();
6725
+ /**
6726
+ * Adds a single data point
6727
+ * @param name Series name
6728
+ * @param value Value
6729
+ * @param witholdRedraw If _false_ (default) plot is automatically redrawn
6730
+ */
6731
+ addData(name, value, witholdRedraw = false) {
6732
+ return this.#addToSeries(name, value, witholdRedraw);
6701
6733
  }
6734
+ setData(name, values, witholdRedraw = false) {
6735
+ const [el, created] = this.#ensurePlot(name);
6736
+ if (!this.#seriesSet.has(name)) {
6737
+ this.#seriesSet.add(name);
6738
+ this.#seriesOrder.push(name);
6739
+ }
6740
+ el.set(values, witholdRedraw);
6741
+ if (created) this.requestUpdate();
6742
+ return el;
6743
+ }
6744
+ setObjects(data, witholdRedraw = false) {
6745
+ const entries = Object.entries(data);
6746
+ for (const [name, vals] of entries) this.setData(name, vals, true);
6747
+ if (witholdRedraw) return;
6748
+ this.redraw();
6749
+ }
6750
+ /**
6751
+ * Calls redraw() on all subplots.
6752
+ */
6753
+ redraw() {
6754
+ for (const el of this.#instances.values()) el.redraw();
6755
+ }
6756
+ /**
6757
+ * Adds a record of data points to the plot. Each key in the record corresponds to a series name, and its value is added as a data point to that series. If a series does not exist for a given key, it will be created.
6758
+ * @param data Data to add
6759
+ * @param witholdRedraw If _false_ (default) plot is automatically redrawn after adding the data. If _true_, plot is not redrawn automatically, and you need to call `redraw()` manually to update the plot after adding the data.
6760
+ */
6761
+ addObject(data, witholdRedraw = false) {
6762
+ const entries = Object.entries(data);
6763
+ for (const [name, val] of entries) this.#addToSeries(name, val, true);
6764
+ if (witholdRedraw) return;
6765
+ this.redraw();
6766
+ }
6767
+ /**
6768
+ * Styles a series by setting CSS variables on the subplot.
6769
+ * @param name Name of series
6770
+ * @param styles Styles to apply
6771
+ */
6702
6772
  styleSeries(name, styles) {
6703
- const normalized = {};
6704
- for (const [key, val] of Object.entries(styles)) normalized[key.startsWith(`--`) ? key : `--${key}`] = val;
6773
+ const normalised = {};
6774
+ for (const [key, val] of Object.entries(styles)) normalised[key.startsWith(`--`) ? key : `--${key}`] = val;
6705
6775
  const el = this.#instances.get(name);
6706
6776
  if (!el) {
6707
- this.#pendingStyles.set(name, normalized);
6777
+ this.#pendingStyles.set(name, normalised);
6708
6778
  return;
6709
6779
  }
6710
- for (const [key, val] of Object.entries(normalized)) el.style.setProperty(key, val);
6780
+ for (const [key, val] of Object.entries(normalised)) el.style.setProperty(key, val);
6711
6781
  }
6782
+ /**
6783
+ * Clears data from all sub-plots
6784
+ * @returns _True_ if there was data to clear
6785
+ */
6712
6786
  clear() {
6713
- for (const el of this.#instances.values()) el.clear();
6787
+ let cleared = false;
6788
+ for (const el of this.#instances.values()) cleared = cleared || el.clear();
6789
+ return cleared;
6714
6790
  }
6791
+ /**
6792
+ * Clears data from a given series
6793
+ * @param name Series name
6794
+ * @returns _True_ if series was found and had data
6795
+ */
6715
6796
  clearSeries(name) {
6716
6797
  const el = this.#instances.get(name);
6717
- if (el) el.clear();
6798
+ if (el) {
6799
+ el.clear();
6800
+ return true;
6801
+ }
6802
+ return false;
6718
6803
  }
6804
+ /**
6805
+ * Returns a copy of the series names
6806
+ */
6719
6807
  get series() {
6720
6808
  return [...this.#seriesOrder];
6721
6809
  }
6722
- #addToSeries(name, value) {
6723
- const el = this.#ensurePlot(name);
6810
+ #addToSeries(name, valueOrValues, withholdRedraw = false) {
6811
+ const [el, created] = this.#ensurePlot(name);
6724
6812
  if (!this.#seriesSet.has(name)) {
6725
6813
  this.#seriesSet.add(name);
6726
6814
  this.#seriesOrder.push(name);
6727
6815
  }
6728
- el.add(value);
6816
+ el.add(valueOrValues, withholdRedraw);
6817
+ if (created) this.requestUpdate();
6818
+ return el;
6729
6819
  }
6730
6820
  #ensurePlot(name) {
6731
6821
  let el = this.#instances.get(name);
6732
- if (el) return el;
6822
+ if (el) return [el, false];
6733
6823
  el = document.createElement(`ixfx-plot-single-axis`);
6734
6824
  el.tooltips = false;
6735
6825
  this.#instances.set(name, el);
@@ -6758,7 +6848,7 @@ let PlotMultiAxis = class PlotMultiAxis extends LitElement {
6758
6848
  el.addEventListener(`plot-pointer-leave`, () => {
6759
6849
  this.#onSubPlotPointerLeave();
6760
6850
  });
6761
- return el;
6851
+ return [el, true];
6762
6852
  }
6763
6853
  #onSubPlotPointerMove(clientX, clientY, index) {
6764
6854
  if (index < 0) {
@@ -6793,7 +6883,7 @@ let PlotMultiAxis = class PlotMultiAxis extends LitElement {
6793
6883
  part="container"
6794
6884
  style=${gridStyle}
6795
6885
  >
6796
- ${repeat(this.#seriesOrder, (name) => name, (name) => this.#ensurePlot(name))}
6886
+ ${repeat(this.#seriesOrder, (name) => name, (name) => this.#ensurePlot(name)[0])}
6797
6887
  </div>
6798
6888
  `;
6799
6889
  }
@@ -6859,10 +6949,10 @@ PlotMultiAxis = __decorate([safeCustomElement(`ixfx-plot-multi-axis`)], PlotMult
6859
6949
  let PlotHistogram = class PlotHistogram extends LitElement {
6860
6950
  constructor(..._args) {
6861
6951
  super(..._args);
6862
- this.orientation = "horizontal";
6952
+ this.orientation = `horizontal`;
6863
6953
  this.resolution = .1;
6864
6954
  this.capacity = 100;
6865
- this.title = "";
6955
+ this.title = ``;
6866
6956
  this.paused = false;
6867
6957
  this._width = 100;
6868
6958
  this._height = 40;
@@ -6876,7 +6966,7 @@ let PlotHistogram = class PlotHistogram extends LitElement {
6876
6966
  #hasProgrammaticData;
6877
6967
  #parseDeclarativeData(text) {
6878
6968
  if (!text) return [];
6879
- return text.trim().split(/[,\s;]+/).map((t) => Number.parseFloat(t)).filter((n) => !isNaN(n));
6969
+ return text.trim().split(/[,\s;]+/).map((t) => Number.parseFloat(t)).filter((n) => !Number.isNaN(n));
6880
6970
  }
6881
6971
  add(v) {
6882
6972
  this.#hasProgrammaticData = true;
@@ -6903,12 +6993,12 @@ let PlotHistogram = class PlotHistogram extends LitElement {
6903
6993
  this._height = e.contentRect.height;
6904
6994
  }).observe(this);
6905
6995
  if (!this.#hasProgrammaticData) {
6906
- const data = this.#parseDeclarativeData(this.textContent ?? "");
6996
+ const data = this.#parseDeclarativeData(this.textContent ?? ``);
6907
6997
  if (data.length > 0) this.#series.set(data);
6908
6998
  }
6909
6999
  }
6910
7000
  updated(changed) {
6911
- if (changed.has("capacity")) {
7001
+ if (changed.has(`capacity`)) {
6912
7002
  const old = [...this.#series.values];
6913
7003
  this.#series = new PlotDataSeries({
6914
7004
  capacityLimit: this.capacity,
@@ -6921,19 +7011,19 @@ let PlotHistogram = class PlotHistogram extends LitElement {
6921
7011
  return getComputedStyle(this).getPropertyValue(name).trim();
6922
7012
  }
6923
7013
  #getGapPx() {
6924
- const val = this.#readCssVar("--plot-histogram-gap");
6925
- if (val === "") return 1;
6926
- const parsed = parseFloat(val);
6927
- return isFinite(parsed) ? Math.max(0, parsed) : 1;
7014
+ const val = this.#readCssVar(`--plot-histogram-gap`);
7015
+ if (val === ``) return 1;
7016
+ const parsed = Number.parseFloat(val);
7017
+ return Number.isFinite(parsed) ? Math.max(0, parsed) : 1;
6928
7018
  }
6929
7019
  #getBarLengthOverride() {
6930
- const val = this.#readCssVar("--plot-histogram-bar-length");
6931
- if (val === "" || val === "auto") return null;
6932
- const parsed = parseFloat(val);
6933
- return isFinite(parsed) ? Math.max(0, Math.min(1, parsed)) : null;
7020
+ const val = this.#readCssVar(`--plot-histogram-bar-length`);
7021
+ if (val === `` || val === `auto`) return null;
7022
+ const parsed = Number.parseFloat(val);
7023
+ return Number.isFinite(parsed) ? Math.max(0, Math.min(1, parsed)) : null;
6934
7024
  }
6935
7025
  #emitClick(i, valueMin, valueMax, relativeValue) {
6936
- this.dispatchEvent(new CustomEvent("plot-bucket-click", {
7026
+ this.dispatchEvent(new CustomEvent(`plot-bucket-click`, {
6937
7027
  detail: {
6938
7028
  bucketIndex: i,
6939
7029
  valueMin,
@@ -6948,7 +7038,7 @@ let PlotHistogram = class PlotHistogram extends LitElement {
6948
7038
  const { values, range } = this.#series;
6949
7039
  const w = this._width;
6950
7040
  const h = this._height;
6951
- const isHorizontal = this.orientation === "horizontal";
7041
+ const isHorizontal = this.orientation === `horizontal`;
6952
7042
  const padding = Math.min(4, (isHorizontal ? h : w) * .05);
6953
7043
  const dataMin = this.min ?? range.min;
6954
7044
  const dataSpan = (this.max ?? range.max) - dataMin || 1;
@@ -6958,7 +7048,7 @@ let PlotHistogram = class PlotHistogram extends LitElement {
6958
7048
  const bucketSize = availableMain / bucketCount;
6959
7049
  const gap = this.#getGapPx();
6960
7050
  const barLengthOverride = this.#getBarLengthOverride();
6961
- const buckets = new Array(bucketCount).fill(0);
7051
+ const buckets = Array.from({ length: bucketCount }).fill(0);
6962
7052
  for (const v of values) {
6963
7053
  const normalized = (v - dataMin) / dataSpan;
6964
7054
  const index = Math.min(bucketCount - 1, Math.max(0, Math.floor(normalized * bucketCount)));
@@ -6992,7 +7082,7 @@ let PlotHistogram = class PlotHistogram extends LitElement {
6992
7082
  }
6993
7083
  })}
6994
7084
  ${this.title ? svg`<text x=${padding + 2} y=${padding + Math.min(10, h * .6)}
6995
- class="overlay-text" fill=${"var(--plot-text, var(--surface-2-text, #fff))"}
7085
+ class="overlay-text" fill=${`var(--plot-text, var(--surface-2-text, #fff))`}
6996
7086
  style="opacity: 0.6">${this.title}</text>` : svg``}
6997
7087
  </svg>
6998
7088
  `;
@@ -7033,7 +7123,7 @@ let PlotHistogram = class PlotHistogram extends LitElement {
7033
7123
  `;
7034
7124
  }
7035
7125
  };
7036
- __decorate([property({ attribute: "orientation" })], PlotHistogram.prototype, "orientation", void 0);
7126
+ __decorate([property({ attribute: `orientation` })], PlotHistogram.prototype, "orientation", void 0);
7037
7127
  __decorate([property({ type: Number })], PlotHistogram.prototype, "resolution", void 0);
7038
7128
  __decorate([property({ type: Number })], PlotHistogram.prototype, "min", void 0);
7039
7129
  __decorate([property({ type: Number })], PlotHistogram.prototype, "max", void 0);
@@ -7045,7 +7135,7 @@ __decorate([property({
7045
7135
  })], PlotHistogram.prototype, "paused", void 0);
7046
7136
  __decorate([state()], PlotHistogram.prototype, "_width", void 0);
7047
7137
  __decorate([state()], PlotHistogram.prototype, "_height", void 0);
7048
- PlotHistogram = __decorate([safeCustomElement("ixfx-plot-histogram")], PlotHistogram);
7138
+ PlotHistogram = __decorate([safeCustomElement(`ixfx-plot-histogram`)], PlotHistogram);
7049
7139
  //#endregion
7050
7140
  //#region src/plots/single-axis.ts
7051
7141
  function buildLinePath(points) {
@@ -7160,9 +7250,9 @@ let PlotSingleAxis = class PlotSingleAxis extends LitElement {
7160
7250
  persistentScaling: true
7161
7251
  });
7162
7252
  this.#hasProgrammaticData = false;
7163
- this.valueFormat = (v) => v ? v.toFixed(2) : ``;
7164
7253
  this.#lastClientX = null;
7165
7254
  this.#lastClientY = null;
7255
+ this.valueFormat = (v) => v ? v.toFixed(2) : ``;
7166
7256
  this.#onPointerMove = (e) => {
7167
7257
  this.#lastClientX = e.clientX;
7168
7258
  this.#lastClientY = e.clientY;
@@ -7203,41 +7293,85 @@ let PlotSingleAxis = class PlotSingleAxis extends LitElement {
7203
7293
  }
7204
7294
  #series;
7205
7295
  #hasProgrammaticData;
7296
+ #lastClientX;
7297
+ #lastClientY;
7206
7298
  #parseDeclarativeData(text) {
7207
7299
  if (!text) return [];
7208
- return text.trim().split(/[,\s;]+/).map((t) => Number.parseFloat(t)).filter((n) => !isNaN(n));
7300
+ return text.trim().split(/[,\s;]+/).map((t) => Number.parseFloat(t)).filter((n) => !Number.isNaN(n));
7209
7301
  }
7302
+ /**
7303
+ * Get all values in the data series as a readonly array.
7304
+ */
7210
7305
  get values() {
7211
7306
  return this.#series.values;
7212
7307
  }
7308
+ /**
7309
+ * Get length of data series
7310
+ */
7213
7311
  get dataCount() {
7214
7312
  return this.#series.values.length;
7215
7313
  }
7314
+ /**
7315
+ * Get value at specific index of data series
7316
+ * @param index
7317
+ */
7216
7318
  getValueAt(index) {
7217
7319
  return this.#series.values[index];
7218
7320
  }
7321
+ /**
7322
+ * Get value index based on client X position
7323
+ * @param clientX
7324
+ */
7219
7325
  getIndexFromClientX(clientX) {
7220
7326
  return this.#getIndexFromX(clientX, this.getBoundingClientRect());
7221
7327
  }
7222
- #lastClientX;
7223
- #lastClientY;
7224
- add(v) {
7328
+ /**
7329
+ * Adds a value to the data series.
7330
+ *
7331
+ * Pass `withholdRedraw = true` to prevent automatic redraw after adding the value. In this case, call `redraw()` manually after adding all values to update the plot.
7332
+ *
7333
+ * Use {@link set} to replace the entire data series at once.
7334
+ * @param valueOrValues Single value, or several values
7335
+ * @param withholdRedraw If _false_ (default) plot is automatically redrawn
7336
+ */
7337
+ add(valueOrValues, withholdRedraw = false) {
7225
7338
  this.#hasProgrammaticData = true;
7226
- this.#series.add(v);
7339
+ this.#series.add(valueOrValues);
7227
7340
  if (this.paused) return;
7341
+ if (withholdRedraw) return;
7342
+ this.redraw();
7343
+ }
7344
+ /**
7345
+ * Redraws the plot.
7346
+ * Normally not needed, unless add() is called with withholdRedraw = true, or styleSeries() is used to update series styles.
7347
+ */
7348
+ redraw() {
7228
7349
  this.requestUpdate();
7229
7350
  this.#updateTooltipAtLastPos();
7230
7351
  }
7231
- set(values) {
7352
+ /**
7353
+ * Sets the entire data for a series at once, replacing contents.
7354
+ *
7355
+ * Use add() to add values one by one.
7356
+ *
7357
+ * Pass `withholdRedraw = true` to prevent automatic redraw after setting the values. In this case, call `redraw()` manually after setting the values to update the plot.
7358
+ * @param values Values
7359
+ * @param withholdRedraw If _false_ (default) plot is automatically redrawn
7360
+ */
7361
+ set(values, withholdRedraw = false) {
7232
7362
  this.#hasProgrammaticData = true;
7233
7363
  this.#series.set(values);
7234
7364
  if (this.paused) return;
7235
- this.requestUpdate();
7236
- this.#updateTooltipAtLastPos();
7365
+ if (withholdRedraw) return;
7366
+ this.redraw();
7237
7367
  }
7368
+ /**
7369
+ * Clears all data and redraws
7370
+ */
7238
7371
  clear() {
7239
- this.#series.clear();
7372
+ const result = this.#series.clear();
7240
7373
  this.requestUpdate();
7374
+ return result;
7241
7375
  }
7242
7376
  firstUpdated(_changed) {
7243
7377
  this._width = this.clientWidth || 100;
@@ -7712,4 +7846,4 @@ PlotXyAxis = __decorate([safeCustomElement(`ixfx-plot-xy-axis`)], PlotXyAxis);
7712
7846
  //#endregion
7713
7847
  export { isEqualValueDefault as _, PlotDataSeries as a, parseColourScaleAttr as c, QueueMutable as d, isPrimitive as f, isEqualDefault as g, defaultComparer as h, PlotMultiAxis as i, readBaseColour as l, __exportAll$1 as m, PlotSingleAxis as n, applyAgeModification as o, toStringAbbreviate as p, PlotHistogram as r, computeColour as s, PlotXyAxis as t, last$2 as u, isEqualValueIgnoreOrder as v };
7714
7848
 
7715
- //# sourceMappingURL=xy-axis-CK64haaK.js.map
7849
+ //# sourceMappingURL=xy-axis-DbPezP6A.js.map