@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.
@@ -6567,6 +6567,7 @@ class WebsyChart {
6567
6567
  this.rightAxis = null
6568
6568
  this.topAxis = null
6569
6569
  this.bottomAxis = null
6570
+ this.renderedKeys = {}
6570
6571
  if (!elementId) {
6571
6572
  console.log('No element Id provided for Websy Chart')
6572
6573
  return
@@ -7339,7 +7340,16 @@ else {
7339
7340
  // put the title horizontally on the top
7340
7341
  }
7341
7342
  }
7343
+ // Remove the unnecessary series
7344
+ let newKeys = this.options.data.series.map(s => s.key)
7345
+ for (const key in this.renderedKeys) {
7346
+ if (newKeys.indexOf(key) === -1) {
7347
+ // remove the components
7348
+ this[`remove${this.renderedKeys[key]}`](key)
7349
+ }
7350
+ }
7342
7351
  // Draw the series data
7352
+ this.renderedKeys = {}
7343
7353
  this.options.data.series.forEach((series, index) => {
7344
7354
  if (!series.key) {
7345
7355
  series.key = this.createIdentity()
@@ -7349,6 +7359,7 @@ else {
7349
7359
  }
7350
7360
  this[`render${series.type || 'bar'}`](series, index)
7351
7361
  this.renderLabels(series, index)
7362
+ this.renderedKeys[series.key] = series.type
7352
7363
  })
7353
7364
  }
7354
7365
  }
@@ -7682,6 +7693,14 @@ if (series.showSymbols === true) {
7682
7693
  this.rendersymbol(series, index)
7683
7694
  }
7684
7695
 
7696
+ }
7697
+ removeline (key) {
7698
+ /* global key d3 */
7699
+ let lines = this.lineLayer.selectAll(`.line_${key}`)
7700
+ .transition(this.transition)
7701
+ .style('stroke-opacity', 1e-6)
7702
+ .remove()
7703
+
7685
7704
  }
7686
7705
  rendersymbol (series, index) {
7687
7706
  /* global d3 series index series.key */
@@ -7205,6 +7205,7 @@ var WebsyChart = /*#__PURE__*/function () {
7205
7205
  this.rightAxis = null;
7206
7206
  this.topAxis = null;
7207
7207
  this.bottomAxis = null;
7208
+ this.renderedKeys = {};
7208
7209
 
7209
7210
  if (!elementId) {
7210
7211
  console.log('No element Id provided for Websy Chart');
@@ -8002,9 +8003,22 @@ var WebsyChart = /*#__PURE__*/function () {
8002
8003
  }
8003
8004
  } else {// put the title horizontally on the top
8004
8005
  }
8006
+ } // Remove the unnecessary series
8007
+
8008
+
8009
+ var newKeys = this.options.data.series.map(function (s) {
8010
+ return s.key;
8011
+ });
8012
+
8013
+ for (var key in this.renderedKeys) {
8014
+ if (newKeys.indexOf(key) === -1) {
8015
+ // remove the components
8016
+ this["remove".concat(this.renderedKeys[key])](key);
8017
+ }
8005
8018
  } // Draw the series data
8006
8019
 
8007
8020
 
8021
+ this.renderedKeys = {};
8008
8022
  this.options.data.series.forEach(function (series, index) {
8009
8023
  if (!series.key) {
8010
8024
  series.key = _this43.createIdentity();
@@ -8017,6 +8031,8 @@ var WebsyChart = /*#__PURE__*/function () {
8017
8031
  _this43["render".concat(series.type || 'bar')](series, index);
8018
8032
 
8019
8033
  _this43.renderLabels(series, index);
8034
+
8035
+ _this43.renderedKeys[series.key] = series.type;
8020
8036
  });
8021
8037
  }
8022
8038
  }
@@ -8310,6 +8326,12 @@ var WebsyChart = /*#__PURE__*/function () {
8310
8326
  this.rendersymbol(series, index);
8311
8327
  }
8312
8328
  }
8329
+ }, {
8330
+ key: "removeline",
8331
+ value: function removeline(key) {
8332
+ /* global key d3 */
8333
+ var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
8334
+ }
8313
8335
  }, {
8314
8336
  key: "rendersymbol",
8315
8337
  value: function rendersymbol(series, index) {