@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
@@ -32,6 +32,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
32
32
  var _a;
33
33
  var _this = _super.call(this, props) || this;
34
34
  _this._isRtl = (0, Utilities_1.getRTL)();
35
+ _this.Y_ORIGIN = 0;
35
36
  _this.toImage = function (opts) {
36
37
  var _a, _b;
37
38
  return (0, image_export_utils_1.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);
@@ -109,7 +110,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
109
110
  };
110
111
  _this._createLines = function (
111
112
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
112
- xScale, yScale, containerHeight, containerWidth, secondaryYScale) {
113
+ xScale, yScalePrimary, containerHeight, containerWidth, yScaleSecondary) {
113
114
  var _a;
114
115
  var lineObject = _this._getFormattedLineData(_this.props.data);
115
116
  var lines = [];
@@ -125,10 +126,12 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
125
126
  var shouldHighlight = _this._isLegendHighlighted(item) || _this._noLegendHighlighted(); // item is legend name
126
127
  for (var i = 1; i < lineObject[item].length; i++) {
127
128
  var x1 = xScale(lineObject[item][i - 1].xItem.xAxisPoint);
128
- var useSecondaryYScale = lineObject[item][i - 1].useSecondaryYScale && lineObject[item][i].useSecondaryYScale && secondaryYScale;
129
- var y1 = useSecondaryYScale ? secondaryYScale(lineObject[item][i - 1].y) : yScale(lineObject[item][i - 1].y);
129
+ var useSecondaryYScale = lineObject[item][i - 1].useSecondaryYScale && lineObject[item][i].useSecondaryYScale && yScaleSecondary;
130
+ var y1 = useSecondaryYScale
131
+ ? yScaleSecondary(lineObject[item][i - 1].y)
132
+ : yScalePrimary(lineObject[item][i - 1].y);
130
133
  var x2 = xScale(lineObject[item][i].xItem.xAxisPoint);
131
- var y2 = useSecondaryYScale ? secondaryYScale(lineObject[item][i].y) : yScale(lineObject[item][i].y);
134
+ var y2 = useSecondaryYScale ? yScaleSecondary(lineObject[item][i].y) : yScalePrimary(lineObject[item][i].y);
132
135
  if (lineBorderWidth > 0) {
133
136
  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)") }));
134
137
  }
@@ -142,7 +145,9 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
142
145
  lineObject[item].forEach(function (circlePoint, subIndex) {
143
146
  // Create an object to store line point ref so that the object can be passed by reference to the focus handler
144
147
  var circleRef = { refElement: null };
145
- dots.push(React.createElement("circle", tslib_1.__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)
148
+ dots.push(React.createElement("circle", tslib_1.__assign({ key: "".concat(index, "-").concat(subIndex, "-dot"), cx: xScale(circlePoint.xItem.xAxisPoint), cy: circlePoint.useSecondaryYScale && yScaleSecondary
149
+ ? yScaleSecondary(circlePoint.y)
150
+ : yScalePrimary(circlePoint.y), onMouseOver: _this._isLegendHighlighted(item)
146
151
  ? _this._lineHover.bind(_this, circlePoint)
147
152
  : _this._onStackHover.bind(_this, circlePoint.xItem) }, (_this._isLegendHighlighted(item) && {
148
153
  onMouseLeave: _this._lineHoverOut,
@@ -236,7 +241,6 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
236
241
  _this._barWidth = (0, index_3.getBarWidth)(_this.props.barWidth, _this.props.maxBarWidth, xBarScale.bandwidth());
237
242
  }
238
243
  var bars = _this._points.map(function (singleChartData, indexNumber) {
239
- var yPoint = containerHeight - _this.margins.bottom;
240
244
  var xPoint = xBarScale(_this._xAxisType === index_3.XAxisTypes.NumericAxis
241
245
  ? singleChartData.xAxisPoint
242
246
  : _this._xAxisType === index_3.XAxisTypes.DateAxis
@@ -245,7 +249,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
245
249
  var xScaleBandwidthTranslate = _this._xAxisType !== index_3.XAxisTypes.StringAxis ? -_this._barWidth / 2 : (xBarScale.bandwidth() - _this._barWidth) / 2;
246
250
  var barTotalValue = 0;
247
251
  // Removing datapoints with zero data
248
- var barsToDisplay = singleChartData.chartData.filter(function (point) { return point.data > 0; });
252
+ var barsToDisplay = singleChartData.chartData.filter(function (point) { return point.data !== 0; });
249
253
  if (!barsToDisplay.length) {
250
254
  return undefined;
251
255
  }
@@ -253,6 +257,11 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
253
257
  if (heightValueScale < 0) {
254
258
  return undefined;
255
259
  }
260
+ var yBaseline = containerHeight - _this.margins.bottom - yBarScale(_this.Y_ORIGIN);
261
+ var yPositiveStart = yBaseline;
262
+ var yNegativeStart = yBaseline;
263
+ var yPoint = 0;
264
+ var heightOfLastBar = 0;
256
265
  var singleBar = barsToDisplay.map(function (point, index) {
257
266
  var _a, _b, _c, _d;
258
267
  var startColor = point.color ? point.color : _this._colors[index];
@@ -280,12 +289,22 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
280
289
  onClick: _this._onClick.bind(_this, point),
281
290
  role: 'img',
282
291
  };
283
- var barHeight = heightValueScale * point.data;
284
- if (barHeight < Math.max((heightValueScale * adjustedTotalHeight) / 100.0, barMinimumHeight)) {
285
- barHeight = Math.max((heightValueScale * adjustedTotalHeight) / 100.0, barMinimumHeight);
292
+ var barHeight = Math.abs(heightValueScale * point.data);
293
+ var minHeight = Math.max((heightValueScale * adjustedTotalHeight) / 100.0, barMinimumHeight);
294
+ if (barHeight < minHeight) {
295
+ barHeight = minHeight;
296
+ }
297
+ var gapOffset = index ? gapHeight : 0;
298
+ if (point.data >= _this.Y_ORIGIN) {
299
+ yPositiveStart -= barHeight + gapOffset;
300
+ yPoint = yPositiveStart;
301
+ }
302
+ else {
303
+ yPoint = yNegativeStart + gapOffset;
304
+ yNegativeStart = yPoint + barHeight;
286
305
  }
287
- yPoint = yPoint - barHeight - (index ? gapHeight : 0);
288
306
  barTotalValue += point.data;
307
+ heightOfLastBar = index === barsToDisplay.length - 1 ? barHeight : 0;
289
308
  var gradientId = (0, Utilities_1.getId)('VSBC_Gradient') + "_".concat(indexNumber, "_").concat(index);
290
309
  // If set, apply the corner radius to the top of the final bar
291
310
  if (barCornerRadius && barHeight > barCornerRadius && index === barsToDisplay.length - 1) {
@@ -336,7 +355,9 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
336
355
  }
337
356
  return (React.createElement("g", { key: indexNumber + "".concat(shouldFocusWholeStack) },
338
357
  React.createElement("g", tslib_1.__assign({ id: "".concat(indexNumber, "-singleBar"), ref: function (e) { return (groupRef.refElement = e); } }, stackFocusProps), singleBar),
339
- !_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)") }, (0, index_3.formatValueWithSIPrefix)(barLabel)))));
358
+ !_this.props.hideLabels && _this._barWidth >= 16 && showLabel && (React.createElement("text", { x: xPoint + _this._barWidth / 2,
359
+ //if total bar value >=0, show label above top bar, otherwise below bottom bar
360
+ 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)") }, (0, index_3.formatValueWithSIPrefix)(barLabel)))));
340
361
  });
341
362
  // Removing un wanted tooltip div from DOM, when prop not provided.
342
363
  if (!_this.props.showXAxisLablesTooltip) {
@@ -364,9 +385,9 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
364
385
  return bars.filter(function (bar) { return !!bar; });
365
386
  };
366
387
  _this._getScales = function (containerHeight, containerWidth) {
367
- var yMax = _this._yMax;
388
+ var yDomain = [Math.min(_this.Y_ORIGIN, _this._yMin), Math.max(_this.Y_ORIGIN, _this._yMax)];
368
389
  var yBarScale = (0, d3_scale_1.scaleLinear)()
369
- .domain([0, yMax])
390
+ .domain(yDomain)
370
391
  .range([0, containerHeight - _this.margins.bottom - _this.margins.top]);
371
392
  if (_this._xAxisType === index_3.XAxisTypes.NumericAxis) {
372
393
  var xMax = (0, d3_array_1.max)(_this._dataset, function (point) { return point.x; });
@@ -415,7 +436,8 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
415
436
  _this._getAxisData = function (yAxisData) {
416
437
  if (yAxisData && yAxisData.yAxisDomainValues.length) {
417
438
  var domainValue = yAxisData.yAxisDomainValues;
418
- _this._yMax = Math.max(domainValue[domainValue.length - 1], _this.props.yMaxValue || 0);
439
+ _this._yMax = Math.max(domainValue[domainValue.length - 1], _this.props.yMaxValue || _this.Y_ORIGIN);
440
+ _this._yMin = Math.min(domainValue[0], _this.props.yMinValue || _this.Y_ORIGIN);
419
441
  }
420
442
  };
421
443
  /**
@@ -521,6 +543,21 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
521
543
  (numLines > 0 ? " and ".concat(numLines, " lines") : '') +
522
544
  '. ');
523
545
  };
546
+ _this._getMinMaxOfYAxis = function (dataset, yAxisType, useSecondaryYScale) {
547
+ if (!useSecondaryYScale) {
548
+ return (0, index_3.findVSBCNumericMinMaxOfY)(dataset);
549
+ }
550
+ var values = [];
551
+ _this.props.data.forEach(function (xPoint) {
552
+ var _a;
553
+ (_a = xPoint.lineData) === null || _a === void 0 ? void 0 : _a.forEach(function (point) {
554
+ if (point.useSecondaryYScale) {
555
+ values.push(point.y);
556
+ }
557
+ });
558
+ });
559
+ return { startValue: (0, d3_array_1.min)(values), endValue: (0, d3_array_1.max)(values) };
560
+ };
524
561
  (0, Utilities_1.initializeComponentRef)(_this);
525
562
  _this.state = {
526
563
  isCalloutVisible: false,
@@ -586,7 +623,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
586
623
  tickValues: this.props.tickValues,
587
624
  tickFormat: this.props.tickFormat,
588
625
  };
589
- return (React.createElement(index_2.CartesianChart, tslib_1.__assign({}, this.props, { chartTitle: this._getChartTitle(), points: this._dataset, chartType: index_3.ChartTypes.VerticalStackedBarChart, xAxisType: this._xAxisType, calloutProps: calloutProps, createYAxis: index_3.createNumericYAxis, tickParams: tickParams, legendBars: legendBars, getMinMaxOfYAxis: index_3.findVSBCNumericMinMaxOfY, datasetForXAxisDomain: this._xAxisLabels, isCalloutForStack: shouldFocusWholeStack, getDomainNRangeValues: this._getDomainNRangeValues, createStringYAxis: index_3.createStringYAxis, barwidth: this._barWidth, focusZoneDirection: isCalloutForStack || _isHavingLines_1 ? react_focus_1.FocusZoneDirection.horizontal : react_focus_1.FocusZoneDirection.vertical, getmargins: this._getMargins, getGraphData: this._getGraphData, getAxisData: this._getAxisData, customizedCallout: this._getCustomizedCallout(), onChartMouseLeave: this._handleChartMouseLeave, getDomainMargins: this._getDomainMargins }, (this._xAxisType === index_3.XAxisTypes.StringAxis && {
626
+ return (React.createElement(index_2.CartesianChart, tslib_1.__assign({}, this.props, { chartTitle: this._getChartTitle(), points: this._dataset, chartType: index_3.ChartTypes.VerticalStackedBarChart, xAxisType: this._xAxisType, calloutProps: calloutProps, createYAxis: index_3.createNumericYAxis, tickParams: tickParams, legendBars: legendBars, getMinMaxOfYAxis: this._getMinMaxOfYAxis, datasetForXAxisDomain: this._xAxisLabels, isCalloutForStack: shouldFocusWholeStack, getDomainNRangeValues: this._getDomainNRangeValues, createStringYAxis: index_3.createStringYAxis, barwidth: this._barWidth, focusZoneDirection: isCalloutForStack || _isHavingLines_1 ? react_focus_1.FocusZoneDirection.horizontal : react_focus_1.FocusZoneDirection.vertical, getmargins: this._getMargins, getGraphData: this._getGraphData, getAxisData: this._getAxisData, customizedCallout: this._getCustomizedCallout(), onChartMouseLeave: this._handleChartMouseLeave, getDomainMargins: this._getDomainMargins }, (this._xAxisType === index_3.XAxisTypes.StringAxis && {
590
627
  xAxisInnerPadding: this._xAxisInnerPadding,
591
628
  xAxisOuterPadding: this._xAxisOuterPadding,
592
629
  }), { ref: this._cartesianChartRef, showRoundOffXTickValues: !(0, index_3.isScalePaddingDefined)(this.props.xAxisInnerPadding, this.props.xAxisPadding),
@@ -595,7 +632,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
595
632
  return (React.createElement(React.Fragment, null,
596
633
  React.createElement("g", null, _this._bars),
597
634
  React.createElement("g", null, _isHavingLines_1 &&
598
- _this._createLines(props.xScale, props.yScale, props.containerHeight, props.containerWidth, props.yScaleSecondary))));
635
+ _this._createLines(props.xScale, props.yScalePrimary, props.containerHeight, props.containerWidth, props.yScaleSecondary))));
599
636
  } })));
600
637
  }
601
638
  return (React.createElement("div", { id: this._emptyChartId, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
@@ -800,7 +837,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
800
837
  // When displaying gaps between the bars, the height of each bar is
801
838
  // adjusted so that the total of all bars is not changed by the gaps
802
839
  var totalData = bars.reduce(function (iter, value) { return iter + Math.abs(value.data); }, 0);
803
- var totalHeight = defaultTotalHeight !== null && defaultTotalHeight !== void 0 ? defaultTotalHeight : yBarScale(totalData);
840
+ var totalHeight = defaultTotalHeight !== null && defaultTotalHeight !== void 0 ? defaultTotalHeight : Math.abs(yBarScale(totalData) - yBarScale(this.Y_ORIGIN));
804
841
  var sumOfPercent = 0;
805
842
  bars.forEach(function (point) {
806
843
  var value = (Math.abs(point.data) / totalData) * 100;