@fluentui/react-charting 5.23.76 → 5.23.78

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.
Files changed (104) hide show
  1. package/CHANGELOG.json +55 -1
  2. package/CHANGELOG.md +24 -2
  3. package/dist/react-charting.d.ts +12 -2
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +4 -2
  7. package/lib/components/AreaChart/AreaChart.base.d.ts +2 -0
  8. package/lib/components/AreaChart/AreaChart.base.js +20 -6
  9. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  10. package/lib/components/CommonComponents/CartesianChart.base.js +18 -14
  11. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  12. package/lib/components/CommonComponents/CartesianChart.types.d.ts +2 -2
  13. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  14. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +52 -92
  15. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  16. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  17. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +23 -14
  18. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  19. package/lib/components/HeatMapChart/HeatMapChart.base.js +1 -1
  20. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  21. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
  22. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +89 -26
  23. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  24. package/lib/components/LineChart/LineChart.base.d.ts +4 -3
  25. package/lib/components/LineChart/LineChart.base.js +50 -37
  26. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  27. package/lib/components/LineChart/eventAnnotation/LabelLink.js +1 -1
  28. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  29. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +4 -4
  30. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  31. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  32. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +55 -18
  33. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  34. package/lib/types/IDataPoint.d.ts +10 -0
  35. package/lib/types/IDataPoint.js.map +1 -1
  36. package/lib/utilities/utilities.d.ts +8 -5
  37. package/lib/utilities/utilities.js +35 -43
  38. package/lib/utilities/utilities.js.map +1 -1
  39. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +2 -0
  40. package/lib-amd/components/AreaChart/AreaChart.base.js +20 -6
  41. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  42. package/lib-amd/components/CommonComponents/CartesianChart.base.js +18 -14
  43. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  44. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +2 -2
  45. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  46. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +52 -92
  47. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  48. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  49. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -12
  50. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  51. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +1 -1
  52. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  53. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
  54. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +88 -25
  55. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  56. package/lib-amd/components/LineChart/LineChart.base.d.ts +4 -3
  57. package/lib-amd/components/LineChart/LineChart.base.js +50 -37
  58. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  59. package/lib-amd/components/LineChart/eventAnnotation/LabelLink.js +1 -1
  60. package/lib-amd/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  61. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +4 -4
  62. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  63. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  64. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +55 -18
  65. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  66. package/lib-amd/types/IDataPoint.d.ts +10 -0
  67. package/lib-amd/types/IDataPoint.js.map +1 -1
  68. package/lib-amd/utilities/utilities.d.ts +8 -5
  69. package/lib-amd/utilities/utilities.js +37 -45
  70. package/lib-amd/utilities/utilities.js.map +1 -1
  71. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +2 -0
  72. package/lib-commonjs/components/AreaChart/AreaChart.base.js +20 -6
  73. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  74. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +18 -14
  75. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  76. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +2 -2
  77. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  78. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +52 -92
  79. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  80. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  81. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -12
  82. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  83. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +1 -1
  84. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  85. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
  86. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +88 -25
  87. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  88. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +4 -3
  89. package/lib-commonjs/components/LineChart/LineChart.base.js +50 -37
  90. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  91. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +1 -1
  92. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  93. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +4 -4
  94. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  95. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  96. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +55 -18
  97. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  98. package/lib-commonjs/types/IDataPoint.d.ts +10 -0
  99. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  100. package/lib-commonjs/utilities/utilities.d.ts +8 -5
  101. package/lib-commonjs/utilities/utilities.js +37 -45
  102. package/lib-commonjs/utilities/utilities.js.map +1 -1
  103. package/package.json +4 -4
  104. package/src/components/CommonComponents/CartesianChart.types.ts +2 -1
@@ -29,6 +29,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
29
29
  var _a;
30
30
  var _this = _super.call(this, props) || this;
31
31
  _this._isRtl = getRTL();
32
+ _this.Y_ORIGIN = 0;
32
33
  _this.toImage = function (opts) {
33
34
  var _a, _b;
34
35
  return toImage((_a = _this._cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer, (_b = _this._legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, _this._isRtl, opts);
@@ -106,7 +107,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
106
107
  };
107
108
  _this._createLines = function (
108
109
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
109
- xScale, yScale, containerHeight, containerWidth, secondaryYScale) {
110
+ xScale, yScalePrimary, containerHeight, containerWidth, yScaleSecondary) {
110
111
  var _a;
111
112
  var lineObject = _this._getFormattedLineData(_this.props.data);
112
113
  var lines = [];
@@ -122,10 +123,12 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
122
123
  var shouldHighlight = _this._isLegendHighlighted(item) || _this._noLegendHighlighted(); // item is legend name
123
124
  for (var i = 1; i < lineObject[item].length; i++) {
124
125
  var x1 = xScale(lineObject[item][i - 1].xItem.xAxisPoint);
125
- var useSecondaryYScale = lineObject[item][i - 1].useSecondaryYScale && lineObject[item][i].useSecondaryYScale && secondaryYScale;
126
- var y1 = useSecondaryYScale ? secondaryYScale(lineObject[item][i - 1].y) : yScale(lineObject[item][i - 1].y);
126
+ var useSecondaryYScale = lineObject[item][i - 1].useSecondaryYScale && lineObject[item][i].useSecondaryYScale && yScaleSecondary;
127
+ var y1 = useSecondaryYScale
128
+ ? yScaleSecondary(lineObject[item][i - 1].y)
129
+ : yScalePrimary(lineObject[item][i - 1].y);
127
130
  var x2 = xScale(lineObject[item][i].xItem.xAxisPoint);
128
- var y2 = useSecondaryYScale ? secondaryYScale(lineObject[item][i].y) : yScale(lineObject[item][i].y);
131
+ var y2 = useSecondaryYScale ? yScaleSecondary(lineObject[item][i].y) : yScalePrimary(lineObject[item][i].y);
129
132
  if (lineBorderWidth > 0) {
130
133
  borderForLines.push(React.createElement("line", { key: "".concat(index, "-").concat(i, "-BorderLine"), x1: x1, y1: y1, x2: x2, y2: y2, opacity: shouldHighlight ? 1 : 0.1, strokeWidth: 3 + lineBorderWidth * 2, fill: "transparent", strokeLinecap: "round", stroke: theme.semanticColors.bodyBackground, transform: "translate(".concat(xScaleBandwidthTranslate, ", 0)") }));
131
134
  }
@@ -139,7 +142,9 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
139
142
  lineObject[item].forEach(function (circlePoint, subIndex) {
140
143
  // Create an object to store line point ref so that the object can be passed by reference to the focus handler
141
144
  var circleRef = { refElement: null };
142
- dots.push(React.createElement("circle", __assign({ key: "".concat(index, "-").concat(subIndex, "-dot"), cx: xScale(circlePoint.xItem.xAxisPoint), cy: circlePoint.useSecondaryYScale && secondaryYScale ? secondaryYScale(circlePoint.y) : yScale(circlePoint.y), onMouseOver: _this._isLegendHighlighted(item)
145
+ dots.push(React.createElement("circle", __assign({ key: "".concat(index, "-").concat(subIndex, "-dot"), cx: xScale(circlePoint.xItem.xAxisPoint), cy: circlePoint.useSecondaryYScale && yScaleSecondary
146
+ ? yScaleSecondary(circlePoint.y)
147
+ : yScalePrimary(circlePoint.y), onMouseOver: _this._isLegendHighlighted(item)
143
148
  ? _this._lineHover.bind(_this, circlePoint)
144
149
  : _this._onStackHover.bind(_this, circlePoint.xItem) }, (_this._isLegendHighlighted(item) && {
145
150
  onMouseLeave: _this._lineHoverOut,
@@ -233,7 +238,6 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
233
238
  _this._barWidth = getBarWidth(_this.props.barWidth, _this.props.maxBarWidth, xBarScale.bandwidth());
234
239
  }
235
240
  var bars = _this._points.map(function (singleChartData, indexNumber) {
236
- var yPoint = containerHeight - _this.margins.bottom;
237
241
  var xPoint = xBarScale(_this._xAxisType === XAxisTypes.NumericAxis
238
242
  ? singleChartData.xAxisPoint
239
243
  : _this._xAxisType === XAxisTypes.DateAxis
@@ -242,7 +246,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
242
246
  var xScaleBandwidthTranslate = _this._xAxisType !== XAxisTypes.StringAxis ? -_this._barWidth / 2 : (xBarScale.bandwidth() - _this._barWidth) / 2;
243
247
  var barTotalValue = 0;
244
248
  // Removing datapoints with zero data
245
- var barsToDisplay = singleChartData.chartData.filter(function (point) { return point.data > 0; });
249
+ var barsToDisplay = singleChartData.chartData.filter(function (point) { return point.data !== 0; });
246
250
  if (!barsToDisplay.length) {
247
251
  return undefined;
248
252
  }
@@ -250,6 +254,11 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
250
254
  if (heightValueScale < 0) {
251
255
  return undefined;
252
256
  }
257
+ var yBaseline = containerHeight - _this.margins.bottom - yBarScale(_this.Y_ORIGIN);
258
+ var yPositiveStart = yBaseline;
259
+ var yNegativeStart = yBaseline;
260
+ var yPoint = 0;
261
+ var heightOfLastBar = 0;
253
262
  var singleBar = barsToDisplay.map(function (point, index) {
254
263
  var _a, _b, _c, _d;
255
264
  var startColor = point.color ? point.color : _this._colors[index];
@@ -277,12 +286,22 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
277
286
  onClick: _this._onClick.bind(_this, point),
278
287
  role: 'img',
279
288
  };
280
- var barHeight = heightValueScale * point.data;
281
- if (barHeight < Math.max((heightValueScale * adjustedTotalHeight) / 100.0, barMinimumHeight)) {
282
- barHeight = Math.max((heightValueScale * adjustedTotalHeight) / 100.0, barMinimumHeight);
289
+ var barHeight = Math.abs(heightValueScale * point.data);
290
+ var minHeight = Math.max((heightValueScale * adjustedTotalHeight) / 100.0, barMinimumHeight);
291
+ if (barHeight < minHeight) {
292
+ barHeight = minHeight;
293
+ }
294
+ var gapOffset = index ? gapHeight : 0;
295
+ if (point.data >= _this.Y_ORIGIN) {
296
+ yPositiveStart -= barHeight + gapOffset;
297
+ yPoint = yPositiveStart;
298
+ }
299
+ else {
300
+ yPoint = yNegativeStart + gapOffset;
301
+ yNegativeStart = yPoint + barHeight;
283
302
  }
284
- yPoint = yPoint - barHeight - (index ? gapHeight : 0);
285
303
  barTotalValue += point.data;
304
+ heightOfLastBar = index === barsToDisplay.length - 1 ? barHeight : 0;
286
305
  var gradientId = getId('VSBC_Gradient') + "_".concat(indexNumber, "_").concat(index);
287
306
  // If set, apply the corner radius to the top of the final bar
288
307
  if (barCornerRadius && barHeight > barCornerRadius && index === barsToDisplay.length - 1) {
@@ -333,7 +352,9 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
333
352
  }
334
353
  return (React.createElement("g", { key: indexNumber + "".concat(shouldFocusWholeStack) },
335
354
  React.createElement("g", __assign({ id: "".concat(indexNumber, "-singleBar"), ref: function (e) { return (groupRef.refElement = e); } }, stackFocusProps), singleBar),
336
- !_this.props.hideLabels && _this._barWidth >= 16 && showLabel && (React.createElement("text", { x: xPoint + _this._barWidth / 2, y: yPoint - 6, textAnchor: "middle", className: _this._classNames.barLabel, "aria-label": "Total: ".concat(barLabel), role: "img", transform: "translate(".concat(xScaleBandwidthTranslate, ", 0)") }, formatValueWithSIPrefix(barLabel)))));
355
+ !_this.props.hideLabels && _this._barWidth >= 16 && showLabel && (React.createElement("text", { x: xPoint + _this._barWidth / 2,
356
+ //if total bar value >=0, show label above top bar, otherwise below bottom bar
357
+ y: barLabel >= _this.Y_ORIGIN ? yPoint - 6 : yPoint + heightOfLastBar + 12, textAnchor: "middle", className: _this._classNames.barLabel, "aria-label": "Total: ".concat(barLabel), role: "img", transform: "translate(".concat(xScaleBandwidthTranslate, ", 0)") }, formatValueWithSIPrefix(barLabel)))));
337
358
  });
338
359
  // Removing un wanted tooltip div from DOM, when prop not provided.
339
360
  if (!_this.props.showXAxisLablesTooltip) {
@@ -361,9 +382,9 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
361
382
  return bars.filter(function (bar) { return !!bar; });
362
383
  };
363
384
  _this._getScales = function (containerHeight, containerWidth) {
364
- var yMax = _this._yMax;
385
+ var yDomain = [Math.min(_this.Y_ORIGIN, _this._yMin), Math.max(_this.Y_ORIGIN, _this._yMax)];
365
386
  var yBarScale = d3ScaleLinear()
366
- .domain([0, yMax])
387
+ .domain(yDomain)
367
388
  .range([0, containerHeight - _this.margins.bottom - _this.margins.top]);
368
389
  if (_this._xAxisType === XAxisTypes.NumericAxis) {
369
390
  var xMax = d3Max(_this._dataset, function (point) { return point.x; });
@@ -412,7 +433,8 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
412
433
  _this._getAxisData = function (yAxisData) {
413
434
  if (yAxisData && yAxisData.yAxisDomainValues.length) {
414
435
  var domainValue = yAxisData.yAxisDomainValues;
415
- _this._yMax = Math.max(domainValue[domainValue.length - 1], _this.props.yMaxValue || 0);
436
+ _this._yMax = Math.max(domainValue[domainValue.length - 1], _this.props.yMaxValue || _this.Y_ORIGIN);
437
+ _this._yMin = Math.min(domainValue[0], _this.props.yMinValue || _this.Y_ORIGIN);
416
438
  }
417
439
  };
418
440
  /**
@@ -518,6 +540,21 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
518
540
  (numLines > 0 ? " and ".concat(numLines, " lines") : '') +
519
541
  '. ');
520
542
  };
543
+ _this._getMinMaxOfYAxis = function (dataset, yAxisType, useSecondaryYScale) {
544
+ if (!useSecondaryYScale) {
545
+ return findVSBCNumericMinMaxOfY(dataset);
546
+ }
547
+ var values = [];
548
+ _this.props.data.forEach(function (xPoint) {
549
+ var _a;
550
+ (_a = xPoint.lineData) === null || _a === void 0 ? void 0 : _a.forEach(function (point) {
551
+ if (point.useSecondaryYScale) {
552
+ values.push(point.y);
553
+ }
554
+ });
555
+ });
556
+ return { startValue: d3Min(values), endValue: d3Max(values) };
557
+ };
521
558
  initializeComponentRef(_this);
522
559
  _this.state = {
523
560
  isCalloutVisible: false,
@@ -583,7 +620,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
583
620
  tickValues: this.props.tickValues,
584
621
  tickFormat: this.props.tickFormat,
585
622
  };
586
- return (React.createElement(CartesianChart, __assign({}, this.props, { chartTitle: this._getChartTitle(), points: this._dataset, chartType: ChartTypes.VerticalStackedBarChart, xAxisType: this._xAxisType, calloutProps: calloutProps, createYAxis: createNumericYAxis, tickParams: tickParams, legendBars: legendBars, getMinMaxOfYAxis: findVSBCNumericMinMaxOfY, datasetForXAxisDomain: this._xAxisLabels, isCalloutForStack: shouldFocusWholeStack, getDomainNRangeValues: this._getDomainNRangeValues, createStringYAxis: createStringYAxis, barwidth: this._barWidth, focusZoneDirection: isCalloutForStack || _isHavingLines_1 ? FocusZoneDirection.horizontal : FocusZoneDirection.vertical, getmargins: this._getMargins, getGraphData: this._getGraphData, getAxisData: this._getAxisData, customizedCallout: this._getCustomizedCallout(), onChartMouseLeave: this._handleChartMouseLeave, getDomainMargins: this._getDomainMargins }, (this._xAxisType === XAxisTypes.StringAxis && {
623
+ return (React.createElement(CartesianChart, __assign({}, this.props, { chartTitle: this._getChartTitle(), points: this._dataset, chartType: ChartTypes.VerticalStackedBarChart, xAxisType: this._xAxisType, calloutProps: calloutProps, createYAxis: createNumericYAxis, tickParams: tickParams, legendBars: legendBars, getMinMaxOfYAxis: this._getMinMaxOfYAxis, datasetForXAxisDomain: this._xAxisLabels, isCalloutForStack: shouldFocusWholeStack, getDomainNRangeValues: this._getDomainNRangeValues, createStringYAxis: createStringYAxis, barwidth: this._barWidth, focusZoneDirection: isCalloutForStack || _isHavingLines_1 ? FocusZoneDirection.horizontal : FocusZoneDirection.vertical, getmargins: this._getMargins, getGraphData: this._getGraphData, getAxisData: this._getAxisData, customizedCallout: this._getCustomizedCallout(), onChartMouseLeave: this._handleChartMouseLeave, getDomainMargins: this._getDomainMargins }, (this._xAxisType === XAxisTypes.StringAxis && {
587
624
  xAxisInnerPadding: this._xAxisInnerPadding,
588
625
  xAxisOuterPadding: this._xAxisOuterPadding,
589
626
  }), { ref: this._cartesianChartRef, showRoundOffXTickValues: !isScalePaddingDefined(this.props.xAxisInnerPadding, this.props.xAxisPadding),
@@ -592,7 +629,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
592
629
  return (React.createElement(React.Fragment, null,
593
630
  React.createElement("g", null, _this._bars),
594
631
  React.createElement("g", null, _isHavingLines_1 &&
595
- _this._createLines(props.xScale, props.yScale, props.containerHeight, props.containerWidth, props.yScaleSecondary))));
632
+ _this._createLines(props.xScale, props.yScalePrimary, props.containerHeight, props.containerWidth, props.yScaleSecondary))));
596
633
  } })));
597
634
  }
598
635
  return (React.createElement("div", { id: this._emptyChartId, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
@@ -797,7 +834,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
797
834
  // When displaying gaps between the bars, the height of each bar is
798
835
  // adjusted so that the total of all bars is not changed by the gaps
799
836
  var totalData = bars.reduce(function (iter, value) { return iter + Math.abs(value.data); }, 0);
800
- var totalHeight = defaultTotalHeight !== null && defaultTotalHeight !== void 0 ? defaultTotalHeight : yBarScale(totalData);
837
+ var totalHeight = defaultTotalHeight !== null && defaultTotalHeight !== void 0 ? defaultTotalHeight : Math.abs(yBarScale(totalData) - yBarScale(this.Y_ORIGIN));
801
838
  var sumOfPercent = 0;
802
839
  bars.forEach(function (point) {
803
840
  var value = (Math.abs(point.data) / totalData) * 100;