@carbon/charts-vue 0.54.3 → 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,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.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
+
6
14
  ## [0.54.3](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.2...v0.54.3) (2022-01-07)
7
15
 
8
16
  **Note:** Version bump only for package @carbon/charts-vue
@@ -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) {