@carbon/charts-vue 0.52.1 → 0.53.0

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.53.0](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.4...v0.53.0) (2021-12-01)
7
+
8
+ **Note:** Version bump only for package @carbon/charts-vue
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.52.4](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.3...v0.52.4) (2021-12-01)
15
+
16
+ **Note:** Version bump only for package @carbon/charts-vue
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.52.3](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.2...v0.52.3) (2021-11-22)
23
+
24
+ **Note:** Version bump only for package @carbon/charts-vue
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.52.2](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.1...v0.52.2) (2021-11-19)
31
+
32
+ **Note:** Version bump only for package @carbon/charts-vue
33
+
34
+
35
+
36
+
37
+
6
38
  ## [0.52.1](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.0...v0.52.1) (2021-11-19)
7
39
 
8
40
  **Note:** Version bump only for package @carbon/charts-vue
@@ -1071,6 +1071,7 @@ var meter = {
1071
1071
  },
1072
1072
  total: {
1073
1073
  paddingLeft: 36,
1074
+ paddingRight: 24,
1074
1075
  },
1075
1076
  height: {
1076
1077
  default: 8,
@@ -23272,9 +23273,9 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23272
23273
  title.exit().remove();
23273
23274
  // appends the associated percentage after title
23274
23275
  this.appendPercentage();
23275
- // if status ranges are provided (custom or default), display indicator
23276
- this.displayStatus();
23277
23276
  }
23277
+ // if status ranges are provided (custom or default), display indicator
23278
+ this.displayStatus();
23278
23279
  // get the max width of a title (with consideration for the status/percentage)
23279
23280
  var maxWidth = this.getMaxTitleWidth();
23280
23281
  var titleElement = dom_utils_DOMUtils.appendOrSelect(svg, 'text.meter-title');
@@ -23345,7 +23346,7 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23345
23346
  var totalString = totalFormatter !== null
23346
23347
  ? totalFormatter(totalValue)
23347
23348
  : total + " " + unit + " total";
23348
- var containerBounds = dom_utils_DOMUtils.getSVGElementSize(this.services.domUtils.getMainContainer(), { useAttrs: true });
23349
+ var containerBounds = dom_utils_DOMUtils.getHTMLElementSize(this.services.domUtils.getMainContainer());
23349
23350
  // need to check if the width is 0, and try to use the parent attribute
23350
23351
  // this can happen if the chart is toggled on/off and the height is 0 for the parent, it wont validateDimensions
23351
23352
  var containerWidth = containerBounds.width
@@ -23359,7 +23360,10 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23359
23360
  .append('text')
23360
23361
  .classed('proportional-meter-total', true)
23361
23362
  .merge(title)
23362
- .attr('x', containerWidth)
23363
+ // Position the total text -24 pixels to add spacing between text and status icon (if status exists)
23364
+ .attr('x', this.model.getStatus()
23365
+ ? containerWidth - meter.total.paddingRight
23366
+ : containerWidth)
23363
23367
  .attr('y', '1em')
23364
23368
  .attr('text-anchor', 'end')
23365
23369
  .text(function (d) { return d; });
@@ -34136,6 +34140,7 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34136
34140
  var _this = _super !== null && _super.apply(this, arguments) || this;
34137
34141
  _this.type = 'alluvial';
34138
34142
  _this.renderType = RenderTypes.SVG;
34143
+ _this.gradient_id = 'gradient-id-' + Math.floor(Math.random() * 99999999999);
34139
34144
  return _this;
34140
34145
  }
34141
34146
  Alluvial.prototype.render = function (animate) {
@@ -34155,6 +34160,8 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34155
34160
  }
34156
34161
  var options = this.model.getOptions();
34157
34162
  var data = this.model.getDisplayData();
34163
+ // Is gradient enabled or not
34164
+ var isGradientAllowed = tools_Tools.getProperty(this.getOptions(), 'color', 'gradient', 'enabled');
34158
34165
  // Set the custom node padding if provided
34159
34166
  var nodePadding = alluvial.minNodePadding;
34160
34167
  if (options.alluvial.nodePadding > alluvial.minNodePadding) {
@@ -34225,11 +34232,45 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34225
34232
  return x;
34226
34233
  });
34227
34234
  // Draws the links (Waves)
34228
- svg.append('g')
34235
+ var links = svg
34236
+ .append('g')
34229
34237
  .attr('fill', 'none')
34230
34238
  .selectAll('g')
34231
- .data(this.graph.links)
34232
- .join('path')
34239
+ .data(this.graph.links);
34240
+ // Exit so we can have multiple appends in group
34241
+ links.exit().remove();
34242
+ // Add gradient if requsted
34243
+ if (isGradientAllowed) {
34244
+ var scale_1 = tools_Tools.getProperty(this.getOptions(), 'color', 'scale');
34245
+ if (scale_1) {
34246
+ links
34247
+ .enter()
34248
+ .append('linearGradient')
34249
+ .attr('id', function (d) { return _this.gradient_id + "-link-" + d.index; })
34250
+ .attr('gradientUnits', 'userSpaceOnUse')
34251
+ .call(function (gradient) {
34252
+ return gradient
34253
+ .append('stop')
34254
+ .attr('offset', '0%')
34255
+ .attr('stop-color', function (d) {
34256
+ return scale_1[d.source.name];
34257
+ });
34258
+ })
34259
+ .call(function (gradient) {
34260
+ return gradient
34261
+ .append('stop')
34262
+ .attr('offset', '100%')
34263
+ .attr('stop-color', function (d) {
34264
+ return scale_1[d.target.name];
34265
+ });
34266
+ });
34267
+ }
34268
+ // Exit so path can be appended to the group
34269
+ links.exit().remove();
34270
+ }
34271
+ links
34272
+ .enter()
34273
+ .append('path')
34233
34274
  .classed('link', true)
34234
34275
  .attr('d', sankeyLinkHorizontal())
34235
34276
  .attr('id', function (d) {
@@ -34250,7 +34291,12 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34250
34291
  originalClassName: 'link',
34251
34292
  });
34252
34293
  })
34253
- .style('stroke', function (d) { return _this.model.getFillColor(d.source.name); })
34294
+ .style('stroke', function (d) {
34295
+ if (isGradientAllowed) {
34296
+ return "url(#" + _this.gradient_id + "-link-" + d.index + ")";
34297
+ }
34298
+ return _this.model.getFillColor(d.source.name);
34299
+ })
34254
34300
  .attr('stroke-width', function (d) { return Math.max(1, d.width); })
34255
34301
  .style('stroke-opacity', alluvial.opacity.default)
34256
34302
  .attr('aria-label', function (d) {
@@ -39207,7 +39253,7 @@ var zoom_bar_ZoomBar = /** @class */ (function (_super) {
39207
39253
  }, { skipUpdate: true });
39208
39254
  }
39209
39255
  else if (newInitialZoomDomain === null &&
39210
- oldInitialZoomDomain != null) {
39256
+ oldInitialZoomDomain !== null) {
39211
39257
  // if newInitialZoomDomain is set to null (when oldInitialZoomDomain is not null)
39212
39258
  // save initialZoomDomain and reset zoom domain to default domain
39213
39259
  this.model.set({
@@ -41503,9 +41549,18 @@ var meter_MeterChartModel = /** @class */ (function (_super) {
41503
41549
  */
41504
41550
  MeterChartModel.prototype.getStatus = function () {
41505
41551
  var options = this.getOptions();
41506
- var dataValue = tools_Tools.getProperty(this.getDisplayData(), 0, 'value');
41552
+ var dataValues = tools_Tools.getProperty(this.getDisplayData());
41553
+ var totalValue = (dataValues
41554
+ ? dataValues.reduce(function (previous, current) {
41555
+ return { value: previous.value + current.value };
41556
+ })
41557
+ : 0).value;
41507
41558
  // use max value if the percentage is bigger than 100%
41508
- var boundedValue = dataValue > 100 ? 100 : dataValue;
41559
+ var boundedValue = tools_Tools.getProperty(options, 'meter', 'proportional')
41560
+ ? totalValue
41561
+ : totalValue > 100
41562
+ ? 100
41563
+ : totalValue;
41509
41564
  // user needs to supply ranges
41510
41565
  var allRanges = tools_Tools.getProperty(options, 'meter', 'status', 'ranges');
41511
41566
  if (allRanges) {
@@ -41662,7 +41717,9 @@ var meter_Meter = /** @class */ (function (_super) {
41662
41717
  // rect with the value binded
41663
41718
  var valued = svg.selectAll('rect.value').data(stackedData);
41664
41719
  // if user provided a color for the bar, we dont want to attach a status class
41665
- var className = status != null && !self.model.isUserProvidedColorScaleValid()
41720
+ var className = status != null &&
41721
+ !self.model.isUserProvidedColorScaleValid() &&
41722
+ !proportional
41666
41723
  ? "value status--" + status
41667
41724
  : 'value';
41668
41725
  // draw the value bar
@@ -41708,9 +41765,7 @@ var meter_Meter = /** @class */ (function (_super) {
41708
41765
  .attr('aria-label', function (d) { return d.value; });
41709
41766
  valued.exit().remove();
41710
41767
  // draw the peak
41711
- var peakValue = proportional
41712
- ? null
41713
- : tools_Tools.getProperty(options, 'meter', 'peak');
41768
+ var peakValue = tools_Tools.getProperty(options, 'meter', 'peak');
41714
41769
  var peakData = peakValue;
41715
41770
  if (peakValue !== null) {
41716
41771
  if (peakValue > domainMax) {
@@ -41732,7 +41787,11 @@ var meter_Meter = /** @class */ (function (_super) {
41732
41787
  .attr('y1', 0)
41733
41788
  .attr('y2', function () {
41734
41789
  var userProvidedHeight = tools_Tools.getProperty(options, 'meter', 'height');
41735
- return userProvidedHeight ? userProvidedHeight : 8;
41790
+ return userProvidedHeight
41791
+ ? userProvidedHeight
41792
+ : proportional
41793
+ ? meter.height.proportional
41794
+ : meter.height.default;
41736
41795
  })
41737
41796
  .transition()
41738
41797
  .call(function (t) {