@carbon/charts-vue 0.54.0 → 0.54.4

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.54.4](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.3...v0.54.4) (2022-01-10)
7
+
8
+ **Note:** Version bump only for package @carbon/charts-vue
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.54.3](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.2...v0.54.3) (2022-01-07)
15
+
16
+ **Note:** Version bump only for package @carbon/charts-vue
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.54.2](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.1...v0.54.2) (2022-01-05)
23
+
24
+ **Note:** Version bump only for package @carbon/charts-vue
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.54.1](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.0...v0.54.1) (2022-01-05)
31
+
32
+ **Note:** Version bump only for package @carbon/charts-vue
33
+
34
+
35
+
36
+
37
+
6
38
  # [0.54.0](https://github.com/carbon-design-system/carbon-charts/compare/v0.53.5...v0.54.0) (2021-12-24)
7
39
 
8
40
 
@@ -9713,7 +9713,7 @@ var model_ChartModel = /** @class */ (function () {
9713
9713
  };
9714
9714
  ChartModel.prototype.getStackKeys = function (_a) {
9715
9715
  var _this = this;
9716
- var _b = _a.bins, bins = _b === void 0 ? null : _b, _c = _a.groups, groups = _c === void 0 ? null : _c;
9716
+ var _b = _a === void 0 ? { bins: null, groups: null } : _a, _c = _b.bins, bins = _c === void 0 ? null : _c, _d = _b.groups, groups = _d === void 0 ? null : _d;
9717
9717
  var options = this.getOptions();
9718
9718
  var displayData = this.getDisplayData(groups);
9719
9719
  var stackKeys;
@@ -25089,6 +25089,7 @@ var area_Area = /** @class */ (function (_super) {
25089
25089
  var _this = this;
25090
25090
  if (animate === void 0) { animate = true; }
25091
25091
  var svg = this.getComponentContainer({ withinChartClip: true });
25092
+ var options = this.getOptions();
25092
25093
  var domain = [0, 0];
25093
25094
  var cartesianScales = this.services.cartesianScales;
25094
25095
  var orientation = cartesianScales.getOrientation();
@@ -25104,15 +25105,26 @@ var area_Area = /** @class */ (function (_super) {
25104
25105
  });
25105
25106
  // Update the bound data on area groups
25106
25107
  var groupedData = this.model.getGroupedData(this.configs.groups);
25107
- var bounds = tools_Tools.getProperty(this.getOptions(), 'bounds');
25108
+ var bounds = tools_Tools.getProperty(options, 'bounds');
25108
25109
  var boundsEnabled = bounds && groupedData && groupedData.length === 1;
25109
25110
  if (!boundsEnabled && bounds) {
25110
25111
  console.warn("Bounds can only be shown when having 1 single datagroup, you've supplied " + groupedData.length); // eslint-disable-line no-console
25111
25112
  }
25113
+ var upperBoundRangeValue = 0;
25114
+ // If includeZero is enabled, we want to replace upperBoundRange from 0 to domain value
25115
+ var includeZeroInRangeValue = function (position, domain) {
25116
+ if (tools_Tools.getProperty(options, 'axes', position, 'includeZero') ===
25117
+ false) {
25118
+ // Replace upperBoundRangeValue if domain is positive
25119
+ if (domain[0] > 0 && domain[1] > 0) {
25120
+ upperBoundRangeValue = domain[0];
25121
+ }
25122
+ }
25123
+ };
25112
25124
  var upperBound = function (d, i) {
25113
25125
  return boundsEnabled
25114
25126
  ? cartesianScales.getBoundedScaledValues(d, i)[0]
25115
- : cartesianScales.getRangeValue(0);
25127
+ : cartesianScales.getRangeValue(upperBoundRangeValue);
25116
25128
  };
25117
25129
  var lowerBound = function (d, i) {
25118
25130
  return boundsEnabled
@@ -25120,21 +25132,23 @@ var area_Area = /** @class */ (function (_super) {
25120
25132
  : cartesianScales.getRangeValue(d, i);
25121
25133
  };
25122
25134
  if (orientation === CartesianOrientations.VERTICAL) {
25123
- domain = this.services.cartesianScales.getMainYScale().domain();
25135
+ domain = cartesianScales.getMainYScale().domain();
25136
+ includeZeroInRangeValue(cartesianScales.getMainYAxisPosition(), domain);
25124
25137
  areaGenerator
25125
25138
  .x(function (d, i) { return cartesianScales.getDomainValue(d, i); })
25126
25139
  .y0(function (d, i) { return upperBound(d, i); })
25127
25140
  .y1(function (d, i) { return lowerBound(d, i); });
25128
25141
  }
25129
25142
  else {
25130
- domain = this.services.cartesianScales.getMainXScale().domain();
25143
+ domain = cartesianScales.getMainXScale().domain();
25144
+ includeZeroInRangeValue(cartesianScales.getMainXAxisPosition(), domain);
25131
25145
  areaGenerator
25132
25146
  .x0(function (d, i) { return upperBound(d, i); })
25133
25147
  .x1(function (d, i) { return lowerBound(d, i); })
25134
25148
  .y(function (d, i) { return cartesianScales.getDomainValue(d, i); });
25135
25149
  }
25136
25150
  // Is gradient enabled or not
25137
- var isGradientEnabled = tools_Tools.getProperty(this.getOptions(), 'color', 'gradient', 'enabled');
25151
+ var isGradientEnabled = tools_Tools.getProperty(options, 'color', 'gradient', 'enabled');
25138
25152
  // Should gradient style be applicable
25139
25153
  var isGradientAllowed = groupedData && groupedData.length === 1 && isGradientEnabled;
25140
25154
  if (groupedData.length > 1 && isGradientEnabled) {
@@ -25982,6 +25996,7 @@ var bar_stacked_extends = (undefined && undefined.__extends) || (function () {
25982
25996
 
25983
25997
 
25984
25998
 
25999
+
25985
26000
  // D3 Imports
25986
26001
 
25987
26002
  var bar_stacked_StackedBar = /** @class */ (function (_super) {
@@ -26213,6 +26228,21 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
26213
26228
  });
26214
26229
  });
26215
26230
  };
26231
+ StackedBar.prototype.getBarWidth = function () {
26232
+ var options = this.getOptions();
26233
+ if (tools_Tools.getProperty(options, "bars", "width")) {
26234
+ return options.bars.width;
26235
+ }
26236
+ var mainXScale = this.services.cartesianScales.getMainXScale();
26237
+ var chartWidth = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
26238
+ useAttrs: true,
26239
+ }).width;
26240
+ var numberOfDomainValues = this.model.getStackKeys().length;
26241
+ if (!mainXScale.step) {
26242
+ return Math.min(options.bars.maxWidth, (chartWidth * 0.25) / numberOfDomainValues);
26243
+ }
26244
+ return Math.min(options.bars.maxWidth, mainXScale.step() / 2);
26245
+ };
26216
26246
  StackedBar.prototype.destroy = function () {
26217
26247
  // Remove event listeners
26218
26248
  this.parent