@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/charts-vue.umd.js CHANGED
@@ -25098,6 +25098,7 @@ var area_Area = /** @class */ (function (_super) {
25098
25098
  var _this = this;
25099
25099
  if (animate === void 0) { animate = true; }
25100
25100
  var svg = this.getComponentContainer({ withinChartClip: true });
25101
+ var options = this.getOptions();
25101
25102
  var domain = [0, 0];
25102
25103
  var cartesianScales = this.services.cartesianScales;
25103
25104
  var orientation = cartesianScales.getOrientation();
@@ -25113,15 +25114,26 @@ var area_Area = /** @class */ (function (_super) {
25113
25114
  });
25114
25115
  // Update the bound data on area groups
25115
25116
  var groupedData = this.model.getGroupedData(this.configs.groups);
25116
- var bounds = tools_Tools.getProperty(this.getOptions(), 'bounds');
25117
+ var bounds = tools_Tools.getProperty(options, 'bounds');
25117
25118
  var boundsEnabled = bounds && groupedData && groupedData.length === 1;
25118
25119
  if (!boundsEnabled && bounds) {
25119
25120
  console.warn("Bounds can only be shown when having 1 single datagroup, you've supplied " + groupedData.length); // eslint-disable-line no-console
25120
25121
  }
25122
+ var upperBoundRangeValue = 0;
25123
+ // If includeZero is enabled, we want to replace upperBoundRange from 0 to domain value
25124
+ var includeZeroInRangeValue = function (position, domain) {
25125
+ if (tools_Tools.getProperty(options, 'axes', position, 'includeZero') ===
25126
+ false) {
25127
+ // Replace upperBoundRangeValue if domain is positive
25128
+ if (domain[0] > 0 && domain[1] > 0) {
25129
+ upperBoundRangeValue = domain[0];
25130
+ }
25131
+ }
25132
+ };
25121
25133
  var upperBound = function (d, i) {
25122
25134
  return boundsEnabled
25123
25135
  ? cartesianScales.getBoundedScaledValues(d, i)[0]
25124
- : cartesianScales.getRangeValue(0);
25136
+ : cartesianScales.getRangeValue(upperBoundRangeValue);
25125
25137
  };
25126
25138
  var lowerBound = function (d, i) {
25127
25139
  return boundsEnabled
@@ -25129,21 +25141,23 @@ var area_Area = /** @class */ (function (_super) {
25129
25141
  : cartesianScales.getRangeValue(d, i);
25130
25142
  };
25131
25143
  if (orientation === CartesianOrientations.VERTICAL) {
25132
- domain = this.services.cartesianScales.getMainYScale().domain();
25144
+ domain = cartesianScales.getMainYScale().domain();
25145
+ includeZeroInRangeValue(cartesianScales.getMainYAxisPosition(), domain);
25133
25146
  areaGenerator
25134
25147
  .x(function (d, i) { return cartesianScales.getDomainValue(d, i); })
25135
25148
  .y0(function (d, i) { return upperBound(d, i); })
25136
25149
  .y1(function (d, i) { return lowerBound(d, i); });
25137
25150
  }
25138
25151
  else {
25139
- domain = this.services.cartesianScales.getMainXScale().domain();
25152
+ domain = cartesianScales.getMainXScale().domain();
25153
+ includeZeroInRangeValue(cartesianScales.getMainXAxisPosition(), domain);
25140
25154
  areaGenerator
25141
25155
  .x0(function (d, i) { return upperBound(d, i); })
25142
25156
  .x1(function (d, i) { return lowerBound(d, i); })
25143
25157
  .y(function (d, i) { return cartesianScales.getDomainValue(d, i); });
25144
25158
  }
25145
25159
  // Is gradient enabled or not
25146
- var isGradientEnabled = tools_Tools.getProperty(this.getOptions(), 'color', 'gradient', 'enabled');
25160
+ var isGradientEnabled = tools_Tools.getProperty(options, 'color', 'gradient', 'enabled');
25147
25161
  // Should gradient style be applicable
25148
25162
  var isGradientAllowed = groupedData && groupedData.length === 1 && isGradientEnabled;
25149
25163
  if (groupedData.length > 1 && isGradientEnabled) {