@carbon/charts-vue 0.52.1 → 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,14 @@
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
+
6
14
  ## [0.52.1](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.0...v0.52.1) (2021-11-19)
7
15
 
8
16
  **Note:** Version bump only for package @carbon/charts-vue
@@ -34136,6 +34136,7 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34136
34136
  var _this = _super !== null && _super.apply(this, arguments) || this;
34137
34137
  _this.type = 'alluvial';
34138
34138
  _this.renderType = RenderTypes.SVG;
34139
+ _this.gradient_id = 'gradient-id-' + Math.floor(Math.random() * 99999999999);
34139
34140
  return _this;
34140
34141
  }
34141
34142
  Alluvial.prototype.render = function (animate) {
@@ -34155,6 +34156,8 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34155
34156
  }
34156
34157
  var options = this.model.getOptions();
34157
34158
  var data = this.model.getDisplayData();
34159
+ // Is gradient enabled or not
34160
+ var isGradientAllowed = tools_Tools.getProperty(this.getOptions(), 'color', 'gradient', 'enabled');
34158
34161
  // Set the custom node padding if provided
34159
34162
  var nodePadding = alluvial.minNodePadding;
34160
34163
  if (options.alluvial.nodePadding > alluvial.minNodePadding) {
@@ -34225,11 +34228,45 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34225
34228
  return x;
34226
34229
  });
34227
34230
  // Draws the links (Waves)
34228
- svg.append('g')
34231
+ var links = svg
34232
+ .append('g')
34229
34233
  .attr('fill', 'none')
34230
34234
  .selectAll('g')
34231
- .data(this.graph.links)
34232
- .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')
34233
34270
  .classed('link', true)
34234
34271
  .attr('d', sankeyLinkHorizontal())
34235
34272
  .attr('id', function (d) {
@@ -34250,7 +34287,12 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34250
34287
  originalClassName: 'link',
34251
34288
  });
34252
34289
  })
34253
- .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
+ })
34254
34296
  .attr('stroke-width', function (d) { return Math.max(1, d.width); })
34255
34297
  .style('stroke-opacity', alluvial.opacity.default)
34256
34298
  .attr('aria-label', function (d) {