@websy/websy-designs 1.4.0 → 1.4.1

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.
@@ -6193,6 +6193,7 @@ class WebsyChart {
6193
6193
  this.rightAxis = null
6194
6194
  this.topAxis = null
6195
6195
  this.bottomAxis = null
6196
+ this.renderedKeys = {}
6196
6197
  if (!elementId) {
6197
6198
  console.log('No element Id provided for Websy Chart')
6198
6199
  return
@@ -6965,7 +6966,16 @@ else {
6965
6966
  // put the title horizontally on the top
6966
6967
  }
6967
6968
  }
6969
+ // Remove the unnecessary series
6970
+ let newKeys = this.options.data.series.map(s => s.key)
6971
+ for (const key in this.renderedKeys) {
6972
+ if (newKeys.indexOf(key) === -1) {
6973
+ // remove the components
6974
+ this[`remove${this.renderedKeys[key]}`](key)
6975
+ }
6976
+ }
6968
6977
  // Draw the series data
6978
+ this.renderedKeys = {}
6969
6979
  this.options.data.series.forEach((series, index) => {
6970
6980
  if (!series.key) {
6971
6981
  series.key = this.createIdentity()
@@ -6975,6 +6985,7 @@ else {
6975
6985
  }
6976
6986
  this[`render${series.type || 'bar'}`](series, index)
6977
6987
  this.renderLabels(series, index)
6988
+ this.renderedKeys[series.key] = series.type
6978
6989
  })
6979
6990
  }
6980
6991
  }
@@ -7308,6 +7319,14 @@ if (series.showSymbols === true) {
7308
7319
  this.rendersymbol(series, index)
7309
7320
  }
7310
7321
 
7322
+ }
7323
+ removeline (key) {
7324
+ /* global key d3 */
7325
+ let lines = this.lineLayer.selectAll(`.line_${key}`)
7326
+ .transition(this.transition)
7327
+ .style('stroke-opacity', 1e-6)
7328
+ .remove()
7329
+
7311
7330
  }
7312
7331
  rendersymbol (series, index) {
7313
7332
  /* global d3 series index series.key */
@@ -6782,6 +6782,7 @@ var WebsyChart = /*#__PURE__*/function () {
6782
6782
  this.rightAxis = null;
6783
6783
  this.topAxis = null;
6784
6784
  this.bottomAxis = null;
6785
+ this.renderedKeys = {};
6785
6786
 
6786
6787
  if (!elementId) {
6787
6788
  console.log('No element Id provided for Websy Chart');
@@ -7579,9 +7580,22 @@ var WebsyChart = /*#__PURE__*/function () {
7579
7580
  }
7580
7581
  } else {// put the title horizontally on the top
7581
7582
  }
7583
+ } // Remove the unnecessary series
7584
+
7585
+
7586
+ var newKeys = this.options.data.series.map(function (s) {
7587
+ return s.key;
7588
+ });
7589
+
7590
+ for (var key in this.renderedKeys) {
7591
+ if (newKeys.indexOf(key) === -1) {
7592
+ // remove the components
7593
+ this["remove".concat(this.renderedKeys[key])](key);
7594
+ }
7582
7595
  } // Draw the series data
7583
7596
 
7584
7597
 
7598
+ this.renderedKeys = {};
7585
7599
  this.options.data.series.forEach(function (series, index) {
7586
7600
  if (!series.key) {
7587
7601
  series.key = _this40.createIdentity();
@@ -7594,6 +7608,8 @@ var WebsyChart = /*#__PURE__*/function () {
7594
7608
  _this40["render".concat(series.type || 'bar')](series, index);
7595
7609
 
7596
7610
  _this40.renderLabels(series, index);
7611
+
7612
+ _this40.renderedKeys[series.key] = series.type;
7597
7613
  });
7598
7614
  }
7599
7615
  }
@@ -7887,6 +7903,12 @@ var WebsyChart = /*#__PURE__*/function () {
7887
7903
  this.rendersymbol(series, index);
7888
7904
  }
7889
7905
  }
7906
+ }, {
7907
+ key: "removeline",
7908
+ value: function removeline(key) {
7909
+ /* global key d3 */
7910
+ var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
7911
+ }
7890
7912
  }, {
7891
7913
  key: "rendersymbol",
7892
7914
  value: function rendersymbol(series, index) {