@carbon/charts-vue 0.51.3 → 0.52.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.
package/charts-vue.umd.js CHANGED
@@ -10113,8 +10113,12 @@ var Service = /** @class */ (function () {
10113
10113
  this.services = services;
10114
10114
  this.init();
10115
10115
  }
10116
- Service.prototype.init = function () { };
10117
- Service.prototype.update = function () { };
10116
+ Service.prototype.init = function () {
10117
+ // do nothing.
10118
+ };
10119
+ Service.prototype.update = function () {
10120
+ // do nothing.
10121
+ };
10118
10122
  // Used to pass down information to the components
10119
10123
  Service.prototype.setModel = function (newObj) {
10120
10124
  this.model = newObj;
@@ -11708,12 +11712,12 @@ var Files = /** @class */ (function (_super) {
11708
11712
  function Files(model, services) {
11709
11713
  return _super.call(this, model, services) || this;
11710
11714
  }
11711
- Files.prototype.downloadCSV = function (content, filename, mimeType) {
11715
+ Files.prototype.downloadCSV = function (content, filename) {
11712
11716
  var anchor = document.createElement('a');
11713
- mimeType = 'text/csv;encoding:utf-8';
11714
- if (navigator.msSaveBlob) {
11717
+ var mimeType = 'text/csv;encoding:utf-8';
11718
+ if (navigator['msSaveBlob']) {
11715
11719
  // Internet Explorer 10
11716
- navigator.msSaveBlob(new Blob([content], {
11720
+ navigator['msSaveBlob'](new Blob([content], {
11717
11721
  type: mimeType,
11718
11722
  }), filename);
11719
11723
  }
@@ -17794,12 +17798,16 @@ var component_Component = /** @class */ (function () {
17794
17798
  this.setParent(src_select(this.services.domUtils.getMainContainer()));
17795
17799
  }
17796
17800
  }
17797
- Component.prototype.init = function () { };
17801
+ Component.prototype.init = function () {
17802
+ // do nothing.
17803
+ };
17798
17804
  Component.prototype.render = function (animate) {
17799
17805
  if (animate === void 0) { animate = true; }
17800
17806
  console.error('render() method is not implemented');
17801
17807
  };
17802
- Component.prototype.destroy = function () { };
17808
+ Component.prototype.destroy = function () {
17809
+ // do nothing.
17810
+ };
17803
17811
  // Used to pass down information to the components
17804
17812
  Component.prototype.setModel = function (newObj) {
17805
17813
  this.model = newObj;
@@ -20049,21 +20057,16 @@ var essentials_modal_Modal = /** @class */ (function (_super) {
20049
20057
  var modalInstance = modal.create(_this.modal.node());
20050
20058
  modalInstance.show();
20051
20059
  };
20052
- _this.handleHideModal = function () { };
20053
20060
  _this.init();
20054
20061
  return _this;
20055
20062
  }
20056
20063
  Modal.prototype.addEventListeners = function () {
20057
20064
  // listen to show-modal Custom Events to render the modal
20058
20065
  this.services.events.addEventListener(Events.Modal.SHOW, this.handleShowModal);
20059
- // listen to hide-modal Custom Events to hide the modal
20060
- this.services.events.addEventListener(Events.Modal.HIDE, this.handleHideModal);
20061
20066
  };
20062
20067
  Modal.prototype.removeEventListeners = function () {
20063
20068
  // remove show-modal Custom Events
20064
20069
  this.services.events.removeEventListener(Events.Modal.SHOW, this.handleShowModal);
20065
- // remove hide-modal Custom Events
20066
- this.services.events.removeEventListener(Events.Modal.HIDE, this.handleHideModal);
20067
20070
  };
20068
20071
  Modal.prototype.getModalHTML = function () {
20069
20072
  var options = this.model.getOptions();
@@ -25593,7 +25596,7 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
25593
25596
  y1 += d[1] === 0 ? 2 : 1;
25594
25597
  }
25595
25598
  else {
25596
- y1 -= d[1] === 0 ? 1 : 1;
25599
+ y1 -= 1;
25597
25600
  }
25598
25601
  }
25599
25602
  else if (!barIsNegative) {
@@ -34142,6 +34145,7 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34142
34145
  var _this = _super !== null && _super.apply(this, arguments) || this;
34143
34146
  _this.type = 'alluvial';
34144
34147
  _this.renderType = RenderTypes.SVG;
34148
+ _this.gradient_id = 'gradient-id-' + Math.floor(Math.random() * 99999999999);
34145
34149
  return _this;
34146
34150
  }
34147
34151
  Alluvial.prototype.render = function (animate) {
@@ -34161,6 +34165,8 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34161
34165
  }
34162
34166
  var options = this.model.getOptions();
34163
34167
  var data = this.model.getDisplayData();
34168
+ // Is gradient enabled or not
34169
+ var isGradientAllowed = tools_Tools.getProperty(this.getOptions(), 'color', 'gradient', 'enabled');
34164
34170
  // Set the custom node padding if provided
34165
34171
  var nodePadding = alluvial.minNodePadding;
34166
34172
  if (options.alluvial.nodePadding > alluvial.minNodePadding) {
@@ -34231,11 +34237,45 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34231
34237
  return x;
34232
34238
  });
34233
34239
  // Draws the links (Waves)
34234
- svg.append('g')
34240
+ var links = svg
34241
+ .append('g')
34235
34242
  .attr('fill', 'none')
34236
34243
  .selectAll('g')
34237
- .data(this.graph.links)
34238
- .join('path')
34244
+ .data(this.graph.links);
34245
+ // Exit so we can have multiple appends in group
34246
+ links.exit().remove();
34247
+ // Add gradient if requsted
34248
+ if (isGradientAllowed) {
34249
+ var scale_1 = tools_Tools.getProperty(this.getOptions(), 'color', 'scale');
34250
+ if (scale_1) {
34251
+ links
34252
+ .enter()
34253
+ .append('linearGradient')
34254
+ .attr('id', function (d) { return _this.gradient_id + "-link-" + d.index; })
34255
+ .attr('gradientUnits', 'userSpaceOnUse')
34256
+ .call(function (gradient) {
34257
+ return gradient
34258
+ .append('stop')
34259
+ .attr('offset', '0%')
34260
+ .attr('stop-color', function (d) {
34261
+ return scale_1[d.source.name];
34262
+ });
34263
+ })
34264
+ .call(function (gradient) {
34265
+ return gradient
34266
+ .append('stop')
34267
+ .attr('offset', '100%')
34268
+ .attr('stop-color', function (d) {
34269
+ return scale_1[d.target.name];
34270
+ });
34271
+ });
34272
+ }
34273
+ // Exit so path can be appended to the group
34274
+ links.exit().remove();
34275
+ }
34276
+ links
34277
+ .enter()
34278
+ .append('path')
34239
34279
  .classed('link', true)
34240
34280
  .attr('d', sankeyLinkHorizontal())
34241
34281
  .attr('id', function (d) {
@@ -34256,7 +34296,12 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34256
34296
  originalClassName: 'link',
34257
34297
  });
34258
34298
  })
34259
- .style('stroke', function (d) { return _this.model.getFillColor(d.source.name); })
34299
+ .style('stroke', function (d) {
34300
+ if (isGradientAllowed) {
34301
+ return "url(#" + _this.gradient_id + "-link-" + d.index + ")";
34302
+ }
34303
+ return _this.model.getFillColor(d.source.name);
34304
+ })
34260
34305
  .attr('stroke-width', function (d) { return Math.max(1, d.width); })
34261
34306
  .style('stroke-opacity', alluvial.opacity.default)
34262
34307
  .attr('aria-label', function (d) {
@@ -39741,6 +39786,7 @@ var chart_Chart = /** @class */ (function () {
39741
39786
  canvasZoom: canvas_zoom_CanvasZoom,
39742
39787
  };
39743
39788
  this.model = new model_ChartModel(this.services);
39789
+ // do nothing.
39744
39790
  }
39745
39791
  // Contains the code that uses properties that are overridable by the super-class
39746
39792
  Chart.prototype.init = function (holder, chartConfigs) {