@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/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.52.2](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.1...v0.52.2) (2021-11-19)
7
+
8
+ **Note:** Version bump only for package @carbon/charts-vue
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.52.1](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.0...v0.52.1) (2021-11-19)
15
+
16
+ **Note:** Version bump only for package @carbon/charts-vue
17
+
18
+
19
+
20
+
21
+
22
+ # [0.52.0](https://github.com/carbon-design-system/carbon-charts/compare/v0.51.4...v0.52.0) (2021-11-18)
23
+
24
+ **Note:** Version bump only for package @carbon/charts-vue
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.51.4](https://github.com/carbon-design-system/carbon-charts/compare/v0.51.3...v0.51.4) (2021-11-16)
31
+
32
+ **Note:** Version bump only for package @carbon/charts-vue
33
+
34
+
35
+
36
+
37
+
6
38
  ## [0.51.3](https://github.com/carbon-design-system/carbon-charts/compare/v0.51.2...v0.51.3) (2021-11-03)
7
39
 
8
40
  **Note:** Version bump only for package @carbon/charts-vue
@@ -10104,8 +10104,12 @@ var Service = /** @class */ (function () {
10104
10104
  this.services = services;
10105
10105
  this.init();
10106
10106
  }
10107
- Service.prototype.init = function () { };
10108
- Service.prototype.update = function () { };
10107
+ Service.prototype.init = function () {
10108
+ // do nothing.
10109
+ };
10110
+ Service.prototype.update = function () {
10111
+ // do nothing.
10112
+ };
10109
10113
  // Used to pass down information to the components
10110
10114
  Service.prototype.setModel = function (newObj) {
10111
10115
  this.model = newObj;
@@ -11699,12 +11703,12 @@ var Files = /** @class */ (function (_super) {
11699
11703
  function Files(model, services) {
11700
11704
  return _super.call(this, model, services) || this;
11701
11705
  }
11702
- Files.prototype.downloadCSV = function (content, filename, mimeType) {
11706
+ Files.prototype.downloadCSV = function (content, filename) {
11703
11707
  var anchor = document.createElement('a');
11704
- mimeType = 'text/csv;encoding:utf-8';
11705
- if (navigator.msSaveBlob) {
11708
+ var mimeType = 'text/csv;encoding:utf-8';
11709
+ if (navigator['msSaveBlob']) {
11706
11710
  // Internet Explorer 10
11707
- navigator.msSaveBlob(new Blob([content], {
11711
+ navigator['msSaveBlob'](new Blob([content], {
11708
11712
  type: mimeType,
11709
11713
  }), filename);
11710
11714
  }
@@ -17785,12 +17789,16 @@ var component_Component = /** @class */ (function () {
17785
17789
  this.setParent(src_select(this.services.domUtils.getMainContainer()));
17786
17790
  }
17787
17791
  }
17788
- Component.prototype.init = function () { };
17792
+ Component.prototype.init = function () {
17793
+ // do nothing.
17794
+ };
17789
17795
  Component.prototype.render = function (animate) {
17790
17796
  if (animate === void 0) { animate = true; }
17791
17797
  console.error('render() method is not implemented');
17792
17798
  };
17793
- Component.prototype.destroy = function () { };
17799
+ Component.prototype.destroy = function () {
17800
+ // do nothing.
17801
+ };
17794
17802
  // Used to pass down information to the components
17795
17803
  Component.prototype.setModel = function (newObj) {
17796
17804
  this.model = newObj;
@@ -20040,21 +20048,16 @@ var essentials_modal_Modal = /** @class */ (function (_super) {
20040
20048
  var modalInstance = modal.create(_this.modal.node());
20041
20049
  modalInstance.show();
20042
20050
  };
20043
- _this.handleHideModal = function () { };
20044
20051
  _this.init();
20045
20052
  return _this;
20046
20053
  }
20047
20054
  Modal.prototype.addEventListeners = function () {
20048
20055
  // listen to show-modal Custom Events to render the modal
20049
20056
  this.services.events.addEventListener(Events.Modal.SHOW, this.handleShowModal);
20050
- // listen to hide-modal Custom Events to hide the modal
20051
- this.services.events.addEventListener(Events.Modal.HIDE, this.handleHideModal);
20052
20057
  };
20053
20058
  Modal.prototype.removeEventListeners = function () {
20054
20059
  // remove show-modal Custom Events
20055
20060
  this.services.events.removeEventListener(Events.Modal.SHOW, this.handleShowModal);
20056
- // remove hide-modal Custom Events
20057
- this.services.events.removeEventListener(Events.Modal.HIDE, this.handleHideModal);
20058
20061
  };
20059
20062
  Modal.prototype.getModalHTML = function () {
20060
20063
  var options = this.model.getOptions();
@@ -25584,7 +25587,7 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
25584
25587
  y1 += d[1] === 0 ? 2 : 1;
25585
25588
  }
25586
25589
  else {
25587
- y1 -= d[1] === 0 ? 1 : 1;
25590
+ y1 -= 1;
25588
25591
  }
25589
25592
  }
25590
25593
  else if (!barIsNegative) {
@@ -34133,6 +34136,7 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34133
34136
  var _this = _super !== null && _super.apply(this, arguments) || this;
34134
34137
  _this.type = 'alluvial';
34135
34138
  _this.renderType = RenderTypes.SVG;
34139
+ _this.gradient_id = 'gradient-id-' + Math.floor(Math.random() * 99999999999);
34136
34140
  return _this;
34137
34141
  }
34138
34142
  Alluvial.prototype.render = function (animate) {
@@ -34152,6 +34156,8 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34152
34156
  }
34153
34157
  var options = this.model.getOptions();
34154
34158
  var data = this.model.getDisplayData();
34159
+ // Is gradient enabled or not
34160
+ var isGradientAllowed = tools_Tools.getProperty(this.getOptions(), 'color', 'gradient', 'enabled');
34155
34161
  // Set the custom node padding if provided
34156
34162
  var nodePadding = alluvial.minNodePadding;
34157
34163
  if (options.alluvial.nodePadding > alluvial.minNodePadding) {
@@ -34222,11 +34228,45 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34222
34228
  return x;
34223
34229
  });
34224
34230
  // Draws the links (Waves)
34225
- svg.append('g')
34231
+ var links = svg
34232
+ .append('g')
34226
34233
  .attr('fill', 'none')
34227
34234
  .selectAll('g')
34228
- .data(this.graph.links)
34229
- .join('path')
34235
+ .data(this.graph.links);
34236
+ // Exit so we can have multiple appends in group
34237
+ links.exit().remove();
34238
+ // Add gradient if requsted
34239
+ if (isGradientAllowed) {
34240
+ var scale_1 = tools_Tools.getProperty(this.getOptions(), 'color', 'scale');
34241
+ if (scale_1) {
34242
+ links
34243
+ .enter()
34244
+ .append('linearGradient')
34245
+ .attr('id', function (d) { return _this.gradient_id + "-link-" + d.index; })
34246
+ .attr('gradientUnits', 'userSpaceOnUse')
34247
+ .call(function (gradient) {
34248
+ return gradient
34249
+ .append('stop')
34250
+ .attr('offset', '0%')
34251
+ .attr('stop-color', function (d) {
34252
+ return scale_1[d.source.name];
34253
+ });
34254
+ })
34255
+ .call(function (gradient) {
34256
+ return gradient
34257
+ .append('stop')
34258
+ .attr('offset', '100%')
34259
+ .attr('stop-color', function (d) {
34260
+ return scale_1[d.target.name];
34261
+ });
34262
+ });
34263
+ }
34264
+ // Exit so path can be appended to the group
34265
+ links.exit().remove();
34266
+ }
34267
+ links
34268
+ .enter()
34269
+ .append('path')
34230
34270
  .classed('link', true)
34231
34271
  .attr('d', sankeyLinkHorizontal())
34232
34272
  .attr('id', function (d) {
@@ -34247,7 +34287,12 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34247
34287
  originalClassName: 'link',
34248
34288
  });
34249
34289
  })
34250
- .style('stroke', function (d) { return _this.model.getFillColor(d.source.name); })
34290
+ .style('stroke', function (d) {
34291
+ if (isGradientAllowed) {
34292
+ return "url(#" + _this.gradient_id + "-link-" + d.index + ")";
34293
+ }
34294
+ return _this.model.getFillColor(d.source.name);
34295
+ })
34251
34296
  .attr('stroke-width', function (d) { return Math.max(1, d.width); })
34252
34297
  .style('stroke-opacity', alluvial.opacity.default)
34253
34298
  .attr('aria-label', function (d) {
@@ -39732,6 +39777,7 @@ var chart_Chart = /** @class */ (function () {
39732
39777
  canvasZoom: canvas_zoom_CanvasZoom,
39733
39778
  };
39734
39779
  this.model = new model_ChartModel(this.services);
39780
+ // do nothing.
39735
39781
  }
39736
39782
  // Contains the code that uses properties that are overridable by the super-class
39737
39783
  Chart.prototype.init = function (holder, chartConfigs) {