gifted-charts-core 0.1.29 → 0.1.31

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.
@@ -58,6 +58,7 @@ export interface StackedBarChartPropsType {
58
58
  color?: ColorValue;
59
59
  topLabelComponent?: Component;
60
60
  topLabelContainerStyle?: any;
61
+ topLabelTextStyle?: any;
61
62
  opacity?: number;
62
63
  label: string;
63
64
  labelTextStyle?: any;
@@ -374,7 +374,6 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
374
374
  stripStrokeDashArray: number[] | undefined;
375
375
  unFocusOnPressOut: boolean;
376
376
  delayBeforeUnFocus: number;
377
- containerHeightIncludingBelowXAxis: number;
378
377
  lineGradient: boolean;
379
378
  lineGradientDirection: string;
380
379
  lineGradientStartColor: string;
@@ -474,7 +474,7 @@ export var useLineChart = function (props) {
474
474
  (initialSpacing + spacing * (set.data.length - 1)) +
475
475
  ' ' +
476
476
  heightUptoXaxis;
477
- ppp += 'L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
477
+ ppp += ' L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
478
478
  fillPointsArray_1.push(ppp.replace('L', 'M'));
479
479
  }
480
480
  }
@@ -598,7 +598,7 @@ export var useLineChart = function (props) {
598
598
  (initialSpacing + spacing * (data.length - 1)) +
599
599
  ' ' +
600
600
  heightUptoXaxis;
601
- ppp += 'L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
601
+ ppp += ' L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
602
602
  setFillPoints(ppp.replace('L', 'M'));
603
603
  }
604
604
  if ((areaChart !== null && areaChart !== void 0 ? areaChart : areaChart2) && data2.length > 0) {
@@ -609,7 +609,7 @@ export var useLineChart = function (props) {
609
609
  (initialSpacing + spacing * (data.length - 1)) +
610
610
  ' ' +
611
611
  heightUptoXaxis;
612
- ppp2 += 'L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
612
+ ppp2 += ' L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
613
613
  setFillPoints2(ppp2.replace('L', 'M'));
614
614
  }
615
615
  if ((areaChart !== null && areaChart !== void 0 ? areaChart : areaChart3) && data3.length > 0) {
@@ -620,7 +620,7 @@ export var useLineChart = function (props) {
620
620
  (initialSpacing + spacing * (data.length - 1)) +
621
621
  ' ' +
622
622
  heightUptoXaxis;
623
- ppp3 += 'L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
623
+ ppp3 += ' L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
624
624
  setFillPoints3(ppp3.replace('L', 'M'));
625
625
  }
626
626
  if ((areaChart !== null && areaChart !== void 0 ? areaChart : areaChart4) && data4.length > 0) {
@@ -631,7 +631,7 @@ export var useLineChart = function (props) {
631
631
  (initialSpacing + spacing * (data.length - 1)) +
632
632
  ' ' +
633
633
  heightUptoXaxis;
634
- ppp4 += 'L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
634
+ ppp4 += ' L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
635
635
  setFillPoints4(ppp4.replace('L', 'M'));
636
636
  }
637
637
  if ((areaChart !== null && areaChart !== void 0 ? areaChart : areaChart5) && data5.length > 0) {
@@ -642,7 +642,7 @@ export var useLineChart = function (props) {
642
642
  (initialSpacing + spacing * (data.length - 1)) +
643
643
  ' ' +
644
644
  heightUptoXaxis;
645
- ppp5 += 'L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
645
+ ppp5 += ' L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
646
646
  setFillPoints5(ppp5.replace('L', 'M'));
647
647
  }
648
648
  }
@@ -833,7 +833,7 @@ export var useLineChart = function (props) {
833
833
  (initialSpacing + spacing * (secondaryData.length - 1)) +
834
834
  ' ' +
835
835
  heightUptoXaxis;
836
- ppp += 'L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
836
+ ppp += ' L' + initialSpacing + ' ' + heightUptoXaxis + ' ';
837
837
  setSecondaryFillPoints(ppp.replace('L', 'M'));
838
838
  }
839
839
  }
@@ -938,7 +938,6 @@ export var useLineChart = function (props) {
938
938
  var stripStrokeDashArray = props.stripStrokeDashArray;
939
939
  var unFocusOnPressOut = (_288 = props.unFocusOnPressOut) !== null && _288 !== void 0 ? _288 : LineDefaults.unFocusOnPressOut;
940
940
  var delayBeforeUnFocus = (_289 = props.delayBeforeUnFocus) !== null && _289 !== void 0 ? _289 : LineDefaults.delayBeforeUnFocus;
941
- var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
942
941
  var lineGradient = (_290 = props.lineGradient) !== null && _290 !== void 0 ? _290 : LineDefaults.lineGradient;
943
942
  var lineGradientDirection = (_291 = props.lineGradientDirection) !== null && _291 !== void 0 ? _291 : 'vertical';
944
943
  var lineGradientStartColor = (_292 = props.lineGradientStartColor) !== null && _292 !== void 0 ? _292 : LineDefaults.lineGradientStartColor;
@@ -1428,7 +1427,6 @@ export var useLineChart = function (props) {
1428
1427
  stripStrokeDashArray: stripStrokeDashArray,
1429
1428
  unFocusOnPressOut: unFocusOnPressOut,
1430
1429
  delayBeforeUnFocus: delayBeforeUnFocus,
1431
- containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
1432
1430
  lineGradient: lineGradient,
1433
1431
  lineGradientDirection: lineGradientDirection,
1434
1432
  lineGradientStartColor: lineGradientStartColor,
@@ -34,7 +34,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
34
  }
35
35
  return to.concat(ar || Array.prototype.slice.call(from));
36
36
  };
37
- import { emptyExternaLabelProperties, getTextSizeForPieLabels } from '../utils';
37
+ import { defaultLabelLineConfig, emptyExternaLabelProperties, getTextSizeForPieLabels } from '../utils';
38
38
  export var getPieChartMainProps = function (props) {
39
39
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
40
40
  var isThreeD = props.isThreeD, isBiggerPie = props.isBiggerPie, paddingHorizontal = props.paddingHorizontal, paddingVertical = props.paddingVertical, extraRadius = props.extraRadius, showExternalLabels = props.showExternalLabels, externalLabelComponent = props.externalLabelComponent;
@@ -73,13 +73,13 @@ export var getPieChartMainProps = function (props) {
73
73
  var textColor = (_o = props.textColor) !== null && _o !== void 0 ? _o : '';
74
74
  var textSize = getTextSizeForPieLabels((_p = props.textSize) !== null && _p !== void 0 ? _p : 0, radius);
75
75
  var labelLineConfig = {
76
- length: (_r = (_q = props.labelLineConfig) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : 10,
77
- tailLength: (_t = (_s = props.labelLineConfig) === null || _s === void 0 ? void 0 : _s.tailLength) !== null && _t !== void 0 ? _t : 8,
78
- color: (_v = (_u = props.labelLineConfig) === null || _u === void 0 ? void 0 : _u.color) !== null && _v !== void 0 ? _v : 'black',
79
- thickness: (_x = (_w = props.labelLineConfig) === null || _w === void 0 ? void 0 : _w.thickness) !== null && _x !== void 0 ? _x : 1,
80
- labelComponentWidth: (_z = (_y = props.labelLineConfig) === null || _y === void 0 ? void 0 : _y.labelComponentWidth) !== null && _z !== void 0 ? _z : 20,
81
- labelComponentHeight: (_1 = (_0 = props.labelLineConfig) === null || _0 === void 0 ? void 0 : _0.labelComponentHeight) !== null && _1 !== void 0 ? _1 : 10,
82
- labelComponentMargin: (_3 = (_2 = props.labelLineConfig) === null || _2 === void 0 ? void 0 : _2.labelComponentMargin) !== null && _3 !== void 0 ? _3 : 4
76
+ length: (_r = (_q = props.labelLineConfig) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : defaultLabelLineConfig.length,
77
+ tailLength: (_t = (_s = props.labelLineConfig) === null || _s === void 0 ? void 0 : _s.tailLength) !== null && _t !== void 0 ? _t : defaultLabelLineConfig.tailLength,
78
+ color: (_v = (_u = props.labelLineConfig) === null || _u === void 0 ? void 0 : _u.color) !== null && _v !== void 0 ? _v : defaultLabelLineConfig.color,
79
+ thickness: (_x = (_w = props.labelLineConfig) === null || _w === void 0 ? void 0 : _w.thickness) !== null && _x !== void 0 ? _x : defaultLabelLineConfig.thickness,
80
+ labelComponentWidth: (_z = (_y = props.labelLineConfig) === null || _y === void 0 ? void 0 : _y.labelComponentWidth) !== null && _z !== void 0 ? _z : defaultLabelLineConfig.labelComponentWidth,
81
+ labelComponentHeight: (_1 = (_0 = props.labelLineConfig) === null || _0 === void 0 ? void 0 : _0.labelComponentHeight) !== null && _1 !== void 0 ? _1 : defaultLabelLineConfig.labelComponentHeight,
82
+ labelComponentMargin: (_3 = (_2 = props.labelLineConfig) === null || _2 === void 0 ? void 0 : _2.labelComponentMargin) !== null && _3 !== void 0 ? _3 : defaultLabelLineConfig.labelComponentMargin
83
83
  };
84
84
  var tiltAngle = (_4 = props.tiltAngle) !== null && _4 !== void 0 ? _4 : '55deg';
85
85
  if (tiltAngle &&
@@ -1,6 +1,8 @@
1
1
  import { type HorizSectionsType, type horizSectionPropTypes, type secondaryYAxisType } from '../../utils/types';
2
2
  export declare const getHorizSectionVals: (props: horizSectionPropTypes) => {
3
- secondaryYAxisConfig: secondaryYAxisType;
3
+ secondaryYAxisConfig: secondaryYAxisType & {
4
+ stepValue: number;
5
+ };
4
6
  horizSections: HorizSectionsType;
5
7
  yAxisExtraHeightAtTop: number;
6
8
  secondaryHorizSections: HorizSectionsType;
@@ -1,8 +1,8 @@
1
1
  import { AxesAndRulesDefaults } from '../../utils/constants';
2
- import { computeMaxAndMinItems, getLabelTextUtil } from '../../utils';
2
+ import { getLabelTextUtil } from '../../utils';
3
3
  export var getHorizSectionVals = function (props) {
4
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
5
- var width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, noOfSections = props.noOfSections, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, yAxisExtraHeight = props.yAxisExtraHeight, trimYAxisAtTop = props.trimYAxisAtTop, dashWidth = props.dashWidth, dashGap = props.dashGap, rulesType = props.rulesType, rulesThickness = props.rulesThickness, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, showFractionalValues = props.showFractionalValues, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisLabelPrefix = props.yAxisLabelPrefix, yAxisLabelSuffix = props.yAxisLabelSuffix, yAxisTextStyle = props.yAxisTextStyle, containerHeight = props.containerHeight, maxValue = props.maxValue, referenceLinesConfig = props.referenceLinesConfig, yAxisLabelTexts = props.yAxisLabelTexts, stepValue = props.stepValue, negativeStepValue = props.negativeStepValue, roundToDigits = props.roundToDigits, yAxisOffset = props.yAxisOffset, formatYLabel = props.formatYLabel, secondaryData = props.secondaryData, secondaryYAxis = props.secondaryYAxis;
4
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
5
+ var width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, noOfSections = props.noOfSections, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, yAxisExtraHeight = props.yAxisExtraHeight, trimYAxisAtTop = props.trimYAxisAtTop, dashWidth = props.dashWidth, dashGap = props.dashGap, rulesType = props.rulesType, rulesThickness = props.rulesThickness, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, showFractionalValues = props.showFractionalValues, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisLabelPrefix = props.yAxisLabelPrefix, yAxisLabelSuffix = props.yAxisLabelSuffix, yAxisTextStyle = props.yAxisTextStyle, containerHeight = props.containerHeight, maxValue = props.maxValue, referenceLinesConfig = props.referenceLinesConfig, yAxisLabelTexts = props.yAxisLabelTexts, stepValue = props.stepValue, negativeStepValue = props.negativeStepValue, roundToDigits = props.roundToDigits, yAxisOffset = props.yAxisOffset, formatYLabel = props.formatYLabel, secondaryMaxItem = props.secondaryMaxItem, secondaryMinItem = props.secondaryMinItem, secondaryYAxis = props.secondaryYAxis, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepValue = props.secondaryNegativeStepValue, secondaryNoOfSectionsBelowXAxis = props.secondaryNoOfSectionsBelowXAxis;
6
6
  var yAxisExtraHeightAtTop = trimYAxisAtTop ? 0 : yAxisExtraHeight;
7
7
  /***********************************************************************************************************************************
8
8
  * *
@@ -13,43 +13,39 @@ export var getHorizSectionVals = function (props) {
13
13
  noOfSections: (_a = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.noOfSections) !== null && _a !== void 0 ? _a : noOfSections,
14
14
  maxValue: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue,
15
15
  mostNegativeValue: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.mostNegativeValue,
16
- stepValue: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepValue,
16
+ stepValue: secondaryStepValue,
17
17
  stepHeight: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepHeight,
18
- negativeStepValue: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepValue,
19
- negativeStepHeight: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepHeight,
18
+ negativeStepValue: secondaryNegativeStepValue,
19
+ negativeStepHeight: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.negativeStepHeight,
20
20
  showFractionalValues: (_b = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showFractionalValues) !== null && _b !== void 0 ? _b : showFractionalValues,
21
21
  roundToDigits: (_c = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.roundToDigits) !== null && _c !== void 0 ? _c : roundToDigits,
22
- noOfSectionsBelowXAxis: (_d = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.noOfSectionsBelowXAxis) !== null && _d !== void 0 ? _d : noOfSectionsBelowXAxis,
23
- showYAxisIndices: (_e = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showYAxisIndices) !== null && _e !== void 0 ? _e : showYAxisIndices,
24
- yAxisIndicesHeight: (_f = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesHeight) !== null && _f !== void 0 ? _f : yAxisIndicesHeight,
25
- yAxisIndicesWidth: (_g = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesWidth) !== null && _g !== void 0 ? _g : yAxisIndicesWidth,
26
- yAxisIndicesColor: (_h = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesColor) !== null && _h !== void 0 ? _h : yAxisIndicesColor,
27
- yAxisSide: (_j = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisSide) !== null && _j !== void 0 ? _j : yAxisSide,
22
+ noOfSectionsBelowXAxis: secondaryNoOfSectionsBelowXAxis,
23
+ showYAxisIndices: (_d = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showYAxisIndices) !== null && _d !== void 0 ? _d : showYAxisIndices,
24
+ yAxisIndicesHeight: (_e = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesHeight) !== null && _e !== void 0 ? _e : yAxisIndicesHeight,
25
+ yAxisIndicesWidth: (_f = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesWidth) !== null && _f !== void 0 ? _f : yAxisIndicesWidth,
26
+ yAxisIndicesColor: (_g = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesColor) !== null && _g !== void 0 ? _g : yAxisIndicesColor,
27
+ yAxisSide: (_h = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisSide) !== null && _h !== void 0 ? _h : yAxisSide,
28
28
  yAxisOffset: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset,
29
- yAxisThickness: (_k = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisThickness) !== null && _k !== void 0 ? _k : yAxisThickness,
30
- yAxisColor: (_l = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisColor) !== null && _l !== void 0 ? _l : yAxisColor,
31
- yAxisLabelContainerStyle: (_m = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelContainerStyle) !== null && _m !== void 0 ? _m : yAxisLabelContainerStyle,
32
- yAxisLabelTexts: (_o = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelTexts) !== null && _o !== void 0 ? _o : yAxisLabelTexts,
33
- yAxisTextStyle: (_p = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisTextStyle) !== null && _p !== void 0 ? _p : yAxisTextStyle,
34
- yAxisTextNumberOfLines: (_q = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisTextNumberOfLines) !== null && _q !== void 0 ? _q : yAxisTextNumberOfLines,
35
- yAxisLabelWidth: (_r = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelWidth) !== null && _r !== void 0 ? _r : yAxisLabelWidth,
36
- hideYAxisText: (_s = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.hideYAxisText) !== null && _s !== void 0 ? _s : hideYAxisText,
37
- yAxisLabelPrefix: (_t = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelPrefix) !== null && _t !== void 0 ? _t : yAxisLabelPrefix,
38
- yAxisLabelSuffix: (_u = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelSuffix) !== null && _u !== void 0 ? _u : yAxisLabelSuffix,
39
- hideOrigin: (_v = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.hideOrigin) !== null && _v !== void 0 ? _v : hideOrigin,
29
+ yAxisThickness: (_j = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisThickness) !== null && _j !== void 0 ? _j : yAxisThickness,
30
+ yAxisColor: (_k = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisColor) !== null && _k !== void 0 ? _k : yAxisColor,
31
+ yAxisLabelContainerStyle: (_l = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelContainerStyle) !== null && _l !== void 0 ? _l : yAxisLabelContainerStyle,
32
+ yAxisLabelTexts: (_m = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelTexts) !== null && _m !== void 0 ? _m : yAxisLabelTexts,
33
+ yAxisTextStyle: (_o = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisTextStyle) !== null && _o !== void 0 ? _o : yAxisTextStyle,
34
+ yAxisTextNumberOfLines: (_p = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisTextNumberOfLines) !== null && _p !== void 0 ? _p : yAxisTextNumberOfLines,
35
+ yAxisLabelWidth: (_q = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelWidth) !== null && _q !== void 0 ? _q : yAxisLabelWidth,
36
+ hideYAxisText: (_r = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.hideYAxisText) !== null && _r !== void 0 ? _r : hideYAxisText,
37
+ yAxisLabelPrefix: (_s = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelPrefix) !== null && _s !== void 0 ? _s : yAxisLabelPrefix,
38
+ yAxisLabelSuffix: (_t = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelSuffix) !== null && _t !== void 0 ? _t : yAxisLabelSuffix,
39
+ hideOrigin: (_u = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.hideOrigin) !== null && _u !== void 0 ? _u : hideOrigin,
40
40
  formatYLabel: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.formatYLabel
41
41
  };
42
- var _20 = computeMaxAndMinItems(secondaryData, secondaryYAxisConfig.roundToDigits, secondaryYAxisConfig.showFractionalValues), maxItem = _20.maxItem, minItem = _20.minItem;
43
42
  secondaryYAxisConfig.maxValue =
44
- (_w = secondaryYAxisConfig.maxValue) !== null && _w !== void 0 ? _w : (maxItem || maxValue);
43
+ (_v = secondaryYAxisConfig.maxValue) !== null && _v !== void 0 ? _v : (secondaryMaxItem || maxValue);
45
44
  secondaryYAxisConfig.mostNegativeValue =
46
- (_x = secondaryYAxisConfig.mostNegativeValue) !== null && _x !== void 0 ? _x : minItem;
47
- secondaryYAxisConfig.stepValue =
48
- (_y = secondaryYAxisConfig.stepValue) !== null && _y !== void 0 ? _y : ((_z = secondaryYAxisConfig.maxValue) !== null && _z !== void 0 ? _z : 0) /
49
- ((_0 = secondaryYAxisConfig.noOfSections) !== null && _0 !== void 0 ? _0 : noOfSections);
45
+ (_w = secondaryYAxisConfig.mostNegativeValue) !== null && _w !== void 0 ? _w : secondaryMinItem;
50
46
  secondaryYAxisConfig.stepHeight =
51
47
  secondaryYAxisConfig.stepHeight ||
52
- containerHeight / ((_1 = secondaryYAxisConfig.noOfSections) !== null && _1 !== void 0 ? _1 : noOfSections);
48
+ containerHeight / ((_x = secondaryYAxisConfig.noOfSections) !== null && _x !== void 0 ? _x : noOfSections);
53
49
  var horizSections = [];
54
50
  for (var i = 0; i <= noOfSections; i++) {
55
51
  var value = maxValue - stepValue * i;
@@ -58,7 +54,7 @@ export var getHorizSectionVals = function (props) {
58
54
  }
59
55
  horizSections.push({
60
56
  value: (yAxisLabelTexts === null || yAxisLabelTexts === void 0 ? void 0 : yAxisLabelTexts.length)
61
- ? (_2 = yAxisLabelTexts[noOfSections + noOfSectionsBelowXAxis - i]) !== null && _2 !== void 0 ? _2 : value.toString()
57
+ ? (_y = yAxisLabelTexts[noOfSections + noOfSectionsBelowXAxis - i]) !== null && _y !== void 0 ? _y : value.toString()
62
58
  : value.toString()
63
59
  });
64
60
  }
@@ -71,22 +67,22 @@ export var getHorizSectionVals = function (props) {
71
67
  }
72
68
  horizSectionsBelow.push({
73
69
  value: props.yAxisLabelTexts
74
- ? (_3 = props.yAxisLabelTexts[noOfSectionsBelowXAxis - i]) !== null && _3 !== void 0 ? _3 : value.toString()
70
+ ? (_z = props.yAxisLabelTexts[noOfSectionsBelowXAxis - i]) !== null && _z !== void 0 ? _z : value.toString()
75
71
  : value.toString()
76
72
  });
77
73
  }
78
74
  }
79
75
  var secondaryHorizSections = [];
80
76
  if (secondaryYAxis) {
81
- for (var i = 0; i <= ((_4 = secondaryYAxisConfig.noOfSections) !== null && _4 !== void 0 ? _4 : noOfSections); i++) {
77
+ for (var i = 0; i <= ((_0 = secondaryYAxisConfig.noOfSections) !== null && _0 !== void 0 ? _0 : noOfSections); i++) {
82
78
  var value = secondaryYAxisConfig.stepValue * i;
83
79
  if (secondaryYAxisConfig.showFractionalValues ||
84
80
  secondaryYAxisConfig.roundToDigits) {
85
- value = parseFloat(value.toFixed((_5 = secondaryYAxisConfig.roundToDigits) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.roundToDigits));
81
+ value = parseFloat(value.toFixed((_1 = secondaryYAxisConfig.roundToDigits) !== null && _1 !== void 0 ? _1 : AxesAndRulesDefaults.roundToDigits));
86
82
  }
87
83
  secondaryHorizSections.push({
88
- value: ((_6 = secondaryYAxisConfig.yAxisLabelTexts) === null || _6 === void 0 ? void 0 : _6.length)
89
- ? (_7 = secondaryYAxisConfig.yAxisLabelTexts[i - noOfSectionsBelowXAxis - 1]) !== null && _7 !== void 0 ? _7 : value.toString()
84
+ value: ((_2 = secondaryYAxisConfig.yAxisLabelTexts) === null || _2 === void 0 ? void 0 : _2.length)
85
+ ? (_3 = secondaryYAxisConfig.yAxisLabelTexts[i - noOfSectionsBelowXAxis - 1]) !== null && _3 !== void 0 ? _3 : value.toString()
90
86
  : value.toString()
91
87
  });
92
88
  }
@@ -98,11 +94,11 @@ export var getHorizSectionVals = function (props) {
98
94
  (i - secondaryYAxisConfig.noOfSectionsBelowXAxis - 1);
99
95
  if (secondaryYAxisConfig.showFractionalValues ||
100
96
  secondaryYAxisConfig.roundToDigits) {
101
- value = parseFloat(value.toFixed((_8 = secondaryYAxisConfig.roundToDigits) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.roundToDigits));
97
+ value = parseFloat(value.toFixed((_4 = secondaryYAxisConfig.roundToDigits) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.roundToDigits));
102
98
  }
103
99
  secondaryHorizSectionsBelow.push({
104
- value: ((_9 = secondaryYAxisConfig.yAxisLabelTexts) === null || _9 === void 0 ? void 0 : _9.length)
105
- ? (_10 = secondaryYAxisConfig.yAxisLabelTexts[i - 1]) !== null && _10 !== void 0 ? _10 : value.toString()
100
+ value: ((_5 = secondaryYAxisConfig.yAxisLabelTexts) === null || _5 === void 0 ? void 0 : _5.length)
101
+ ? (_6 = secondaryYAxisConfig.yAxisLabelTexts[i - 1]) !== null && _6 !== void 0 ? _6 : value.toString()
106
102
  : value.toString()
107
103
  });
108
104
  }
@@ -123,12 +119,12 @@ export var getHorizSectionVals = function (props) {
123
119
  };
124
120
  showReferenceLine1 = referenceLinesConfig.showReferenceLine1 || false;
125
121
  referenceLine1Position =
126
- (_11 = referenceLinesConfig.referenceLine1Position) !== null && _11 !== void 0 ? _11 : (referenceLinesConfig.referenceLine1Position || containerHeight / 2);
122
+ (_7 = referenceLinesConfig.referenceLine1Position) !== null && _7 !== void 0 ? _7 : (referenceLinesConfig.referenceLine1Position || containerHeight / 2);
127
123
  referenceLine1Config = referenceLinesConfig.referenceLine1Config
128
124
  ? {
129
125
  thickness: referenceLinesConfig.referenceLine1Config.thickness ||
130
126
  defaultReferenceConfig.thickness,
131
- width: (_12 = referenceLinesConfig.referenceLine1Config.width) !== null && _12 !== void 0 ? _12 : defaultReferenceConfig.width,
127
+ width: (_8 = referenceLinesConfig.referenceLine1Config.width) !== null && _8 !== void 0 ? _8 : defaultReferenceConfig.width,
132
128
  color: referenceLinesConfig.referenceLine1Config.color ||
133
129
  defaultReferenceConfig.color,
134
130
  type: referenceLinesConfig.referenceLine1Config.type ||
@@ -141,17 +137,17 @@ export var getHorizSectionVals = function (props) {
141
137
  defaultReferenceConfig.labelText,
142
138
  labelTextStyle: referenceLinesConfig.referenceLine1Config.labelTextStyle ||
143
139
  defaultReferenceConfig.labelTextStyle,
144
- zIndex: (_13 = referenceLinesConfig.referenceLine1Config.zIndex) !== null && _13 !== void 0 ? _13 : defaultReferenceConfig.zIndex
140
+ zIndex: (_9 = referenceLinesConfig.referenceLine1Config.zIndex) !== null && _9 !== void 0 ? _9 : defaultReferenceConfig.zIndex
145
141
  }
146
142
  : defaultReferenceConfig;
147
143
  showReferenceLine2 = referenceLinesConfig.showReferenceLine2 || false;
148
144
  referenceLine2Position =
149
- (_14 = referenceLinesConfig.referenceLine2Position) !== null && _14 !== void 0 ? _14 : (referenceLinesConfig.referenceLine2Position || (3 * containerHeight) / 2);
145
+ (_10 = referenceLinesConfig.referenceLine2Position) !== null && _10 !== void 0 ? _10 : (referenceLinesConfig.referenceLine2Position || (3 * containerHeight) / 2);
150
146
  referenceLine2Config = referenceLinesConfig.referenceLine2Config
151
147
  ? {
152
148
  thickness: referenceLinesConfig.referenceLine2Config.thickness ||
153
149
  defaultReferenceConfig.thickness,
154
- width: (_15 = referenceLinesConfig.referenceLine2Config.width) !== null && _15 !== void 0 ? _15 : defaultReferenceConfig.width,
150
+ width: (_11 = referenceLinesConfig.referenceLine2Config.width) !== null && _11 !== void 0 ? _11 : defaultReferenceConfig.width,
155
151
  color: referenceLinesConfig.referenceLine2Config.color ||
156
152
  defaultReferenceConfig.color,
157
153
  type: referenceLinesConfig.referenceLine2Config.type ||
@@ -164,17 +160,17 @@ export var getHorizSectionVals = function (props) {
164
160
  defaultReferenceConfig.labelText,
165
161
  labelTextStyle: referenceLinesConfig.referenceLine2Config.labelTextStyle ||
166
162
  defaultReferenceConfig.labelTextStyle,
167
- zIndex: (_16 = referenceLinesConfig.referenceLine2Config.zIndex) !== null && _16 !== void 0 ? _16 : defaultReferenceConfig.zIndex
163
+ zIndex: (_12 = referenceLinesConfig.referenceLine2Config.zIndex) !== null && _12 !== void 0 ? _12 : defaultReferenceConfig.zIndex
168
164
  }
169
165
  : defaultReferenceConfig;
170
166
  showReferenceLine3 = referenceLinesConfig.showReferenceLine3 || false;
171
167
  referenceLine3Position =
172
- (_17 = referenceLinesConfig.referenceLine3Position) !== null && _17 !== void 0 ? _17 : (referenceLinesConfig.referenceLine3Position || containerHeight / 3);
168
+ (_13 = referenceLinesConfig.referenceLine3Position) !== null && _13 !== void 0 ? _13 : (referenceLinesConfig.referenceLine3Position || containerHeight / 3);
173
169
  referenceLine3Config = referenceLinesConfig.referenceLine3Config
174
170
  ? {
175
171
  thickness: referenceLinesConfig.referenceLine3Config.thickness ||
176
172
  defaultReferenceConfig.thickness,
177
- width: (_18 = referenceLinesConfig.referenceLine3Config.width) !== null && _18 !== void 0 ? _18 : defaultReferenceConfig.width,
173
+ width: (_14 = referenceLinesConfig.referenceLine3Config.width) !== null && _14 !== void 0 ? _14 : defaultReferenceConfig.width,
178
174
  color: referenceLinesConfig.referenceLine3Config.color ||
179
175
  defaultReferenceConfig.color,
180
176
  type: referenceLinesConfig.referenceLine3Config.type ||
@@ -187,7 +183,7 @@ export var getHorizSectionVals = function (props) {
187
183
  defaultReferenceConfig.labelText,
188
184
  labelTextStyle: referenceLinesConfig.referenceLine3Config.labelTextStyle ||
189
185
  defaultReferenceConfig.labelTextStyle,
190
- zIndex: (_19 = referenceLinesConfig.referenceLine3Config.zIndex) !== null && _19 !== void 0 ? _19 : defaultReferenceConfig.zIndex
186
+ zIndex: (_15 = referenceLinesConfig.referenceLine3Config.zIndex) !== null && _15 !== void 0 ? _15 : defaultReferenceConfig.zIndex
191
187
  }
192
188
  : defaultReferenceConfig;
193
189
  var getLabelTexts = function (val, index) {
@@ -36,9 +36,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
36
36
  };
37
37
  import { useEffect, useState } from 'react';
38
38
  import { AxesAndRulesDefaults, BarDefaults } from '../../utils/constants';
39
+ import { computeMaxAndMinItems } from '../../utils';
39
40
  export var useBarAndLineChartsWrapper = function (props) {
40
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
41
- var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, rtl = props.rtl, shiftX = props.shiftX, shiftY = props.shiftY, initialSpacing = props.initialSpacing, data = props.data, stackData = props.stackData, secondaryData = props.secondaryData, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, spacing = props.spacing, lineConfig = props.lineConfig, lineConfig2 = props.lineConfig2, maxValue = props.maxValue, lineData = props.lineData, lineData2 = props.lineData2, animatedWidth = props.animatedWidth, lineBehindBars = props.lineBehindBars, points = props.points, points2 = props.points2, arrowPoints = props.arrowPoints, width = props.width, horizSections = props.horizSections, endSpacing = props.endSpacing, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, showFractionalValues = props.showFractionalValues, axesAndRulesProps = props.axesAndRulesProps, yAxisLabelTexts = props.yAxisLabelTexts, yAxisOffset = props.yAxisOffset, rotateYAxisTexts = props.rotateYAxisTexts, pointerConfig = props.pointerConfig, getPointerProps = props.getPointerProps, pointerIndex = props.pointerIndex, pointerX = props.pointerX, pointerY = props.pointerY, scrollEventThrottle = props.scrollEventThrottle, endReachedOffset = props.endReachedOffset, isRTL = props.isRTL, selectedIndex = props.selectedIndex;
41
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
42
+ var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, rtl = props.rtl, shiftX = props.shiftX, shiftY = props.shiftY, initialSpacing = props.initialSpacing, data = props.data, dataSet = props.dataSet, stackData = props.stackData, secondaryData = props.secondaryData, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, spacing = props.spacing, lineConfig = props.lineConfig, lineConfig2 = props.lineConfig2, maxValue = props.maxValue, lineData = props.lineData, lineData2 = props.lineData2, animatedWidth = props.animatedWidth, lineBehindBars = props.lineBehindBars, points = props.points, points2 = props.points2, arrowPoints = props.arrowPoints, width = props.width, horizSections = props.horizSections, endSpacing = props.endSpacing, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, showFractionalValues = props.showFractionalValues, axesAndRulesProps = props.axesAndRulesProps, yAxisLabelTexts = props.yAxisLabelTexts, yAxisOffset = props.yAxisOffset, rotateYAxisTexts = props.rotateYAxisTexts, pointerConfig = props.pointerConfig, getPointerProps = props.getPointerProps, pointerIndex = props.pointerIndex, pointerX = props.pointerX, pointerY = props.pointerY, scrollEventThrottle = props.scrollEventThrottle, endReachedOffset = props.endReachedOffset, isRTL = props.isRTL, selectedIndex = props.selectedIndex;
42
43
  var yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
43
44
  var hideOrigin = (_a = axesAndRulesProps.hideOrigin) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.hideOrigin;
44
45
  var yAxisSide = (_b = axesAndRulesProps.yAxisSide) !== null && _b !== void 0 ? _b : AxesAndRulesDefaults.yAxisSide;
@@ -92,6 +93,28 @@ export var useBarAndLineChartsWrapper = function (props) {
92
93
  var secondaryXAxis = axesAndRulesProps.secondaryXAxis;
93
94
  var verticalLinesAr = noOfVerticalLines
94
95
  ? __spreadArray([], __read(Array(noOfVerticalLines).keys()), false) : __spreadArray([], __read(Array(stackData ? stackData.length : data.length).keys()), false);
96
+ var extendedContainerHeight = containerHeight + overflowTop + 10;
97
+ var dataSetArray = __spreadArray([], __read((dataSet !== null && dataSet !== void 0 ? dataSet : [])), false);
98
+ var setWithMinValueInDataset = (_12 = (_11 = dataSetArray
99
+ .filter(function (set) { return set.isSecondary; })).sort) === null || _12 === void 0 ? void 0 : _12.call(_11, function (a, b) {
100
+ var minA = Math.min.apply(Math, __spreadArray([], __read(a.data.map(function (item) { return item.value; })), false));
101
+ var minB = Math.min.apply(Math, __spreadArray([], __read(b.data.map(function (item) { return item.value; })), false));
102
+ return minA - minB;
103
+ })[0];
104
+ var secondaryDataArrayWithMinValue = (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length)
105
+ ? secondaryData
106
+ : setWithMinValueInDataset === null || setWithMinValueInDataset === void 0 ? void 0 : setWithMinValueInDataset.data;
107
+ var _25 = computeMaxAndMinItems(secondaryDataArrayWithMinValue, (_13 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.roundToDigits) !== null && _13 !== void 0 ? _13 : roundToDigits, (_14 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showFractionalValues) !== null && _14 !== void 0 ? _14 : showFractionalValues), secondaryMaxItem = _25.maxItem, secondaryMinItem = _25.minItem;
108
+ var secondaryStepValue = (_15 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepValue) !== null && _15 !== void 0 ? _15 : ((_16 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _16 !== void 0 ? _16 : 0) /
109
+ ((_17 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.noOfSections) !== null && _17 !== void 0 ? _17 : noOfSections);
110
+ var secondaryNegativeStepValue = (_18 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.negativeStepValue) !== null && _18 !== void 0 ? _18 : secondaryStepValue;
111
+ var secondaryNoOfSectionsBelowXAxis = (_19 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.noOfSectionsBelowXAxis) !== null && _19 !== void 0 ? _19 : (secondaryNegativeStepValue ? Math.ceil(((_20 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.mostNegativeValue) !== null && _20 !== void 0 ? _20 : secondaryMinItem) /
112
+ -secondaryNegativeStepValue) : 0);
113
+ var primaryYAxisHeightBelowOrigin = noOfSectionsBelowXAxis * negativeStepHeight;
114
+ var secondaryYAxisHeightBelowOrigin = secondaryNoOfSectionsBelowXAxis *
115
+ ((_22 = (_21 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.negativeStepHeight) !== null && _21 !== void 0 ? _21 : secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepHeight) !== null && _22 !== void 0 ? _22 : stepHeight);
116
+ var biggerNegativeYAxisHeight = Math.max(primaryYAxisHeightBelowOrigin, secondaryYAxisHeightBelowOrigin);
117
+ var containerHeightIncludingBelowXAxis = extendedContainerHeight + biggerNegativeYAxisHeight;
95
118
  var horizSectionProps = {
96
119
  chartType: chartType,
97
120
  width: width,
@@ -149,10 +172,14 @@ export var useBarAndLineChartsWrapper = function (props) {
149
172
  stepValue: stepValue,
150
173
  negativeStepValue: negativeStepValue,
151
174
  roundToDigits: roundToDigits,
152
- secondaryData: secondaryData,
153
175
  secondaryYAxis: secondaryYAxis,
154
176
  formatYLabel: axesAndRulesProps.formatYLabel,
155
- secondaryXAxis: secondaryXAxis
177
+ secondaryXAxis: secondaryXAxis,
178
+ secondaryMaxItem: secondaryMaxItem,
179
+ secondaryMinItem: secondaryMinItem,
180
+ secondaryStepValue: secondaryStepValue,
181
+ secondaryNegativeStepValue: secondaryNegativeStepValue,
182
+ secondaryNoOfSectionsBelowXAxis: secondaryNoOfSectionsBelowXAxis
156
183
  };
157
184
  var lineInBarChartProps = {
158
185
  yAxisLabelWidth: yAxisLabelWidth,
@@ -160,7 +187,7 @@ export var useBarAndLineChartsWrapper = function (props) {
160
187
  spacing: spacing,
161
188
  containerHeight: containerHeight,
162
189
  lineConfig: lineConfig,
163
- maxValue: (_11 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _11 !== void 0 ? _11 : maxValue,
190
+ maxValue: (_23 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _23 !== void 0 ? _23 : maxValue,
164
191
  animatedWidth: animatedWidth,
165
192
  lineBehindBars: lineBehindBars,
166
193
  points: points,
@@ -174,12 +201,10 @@ export var useBarAndLineChartsWrapper = function (props) {
174
201
  selectedIndex: selectedIndex
175
202
  };
176
203
  var lineInBarChartProps2 = __assign(__assign({}, lineInBarChartProps), { lineConfig: lineConfig2, points: points2, data: lineData2 !== null && lineData2 !== void 0 ? lineData2 : [] });
177
- var extendedContainerHeight = containerHeight + overflowTop + 10;
178
- var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
179
204
  var verticalLinesProps = {
180
205
  verticalLinesAr: verticalLinesAr,
181
206
  verticalLinesSpacing: verticalLinesSpacing,
182
- spacing: (_12 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.spacing) !== null && _12 !== void 0 ? _12 : spacing,
207
+ spacing: (_24 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.spacing) !== null && _24 !== void 0 ? _24 : spacing,
183
208
  initialSpacing: initialSpacing,
184
209
  verticalLinesZIndex: verticalLinesZIndex,
185
210
  verticalLinesHeight: verticalLinesHeight,
@@ -234,7 +259,7 @@ export var useBarAndLineChartsWrapper = function (props) {
234
259
  : difBwWidthHeight - 40) /
235
260
  2 +
236
261
  (yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52), ")");
237
- var _13 = __read(useState(false), 2), canMomentum = _13[0], setCanMomentum = _13[1];
262
+ var _26 = __read(useState(false), 2), canMomentum = _26[0], setCanMomentum = _26[1];
238
263
  var isCloseToEnd = function (_a) {
239
264
  var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
240
265
  return isRTL
package/dist/index.d.ts CHANGED
@@ -34,6 +34,6 @@ export { type StripAndLabelProps } from './components/common/types';
34
34
  /***********************************************************************************************************************
35
35
  /********************************* common utils, constants and types ********************************
36
36
  /***********************************************************************************************************************/
37
- export { getCumulativeWidth, getLighterColor, svgQuadraticCurvePath, svgPath, bezierCommand, getSegmentString, getCurvePathWithSegments, getPreviousSegmentsLastPoint, getPathWithHighlight, getRegionPathObjects, getSegmentedPathObjects, getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getSecondaryDataWithOffsetIncluded, getArrowProperty, getAllArrowProperties, maxAndMinUtil, computeMaxAndMinItems, getLabelTextUtil, getXForLineInBar, getYForLineInBar, clone, getLineConfigForBarChart, adjustToOffset } from './utils';
37
+ export { getCumulativeWidth, getLighterColor, svgQuadraticCurvePath, svgPath, bezierCommand, getSegmentString, getCurvePathWithSegments, getPreviousSegmentsLastPoint, getPathWithHighlight, getRegionPathObjects, getSegmentedPathObjects, getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getSecondaryDataWithOffsetIncluded, getArrowProperty, getAllArrowProperties, maxAndMinUtil, computeMaxAndMinItems, getLabelTextUtil, getXForLineInBar, getYForLineInBar, clone, getLineConfigForBarChart, adjustToOffset, pointsWithPaddedRepititions } from './utils';
38
38
  export { chartTypes, yAxisSides, loc, SEGMENT_START, SEGMENT_END, RANGE_ENTER, RANGE_EXIT, STOP, ruleTypes, AxesAndRulesDefaults, defaultArrowConfig, BarDefaults, defaultLineConfig, LineDefaults, defaultPointerConfig, pieColors, populationDefaults, defaultAnimationDuration } from './utils/constants';
39
39
  export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap, type IntersectionAreaConfig, type LabelLineConfig } from './utils/types';
package/dist/index.js CHANGED
@@ -29,6 +29,6 @@ export { getTopAndLeftForStripAndLabel } from './components/common/StripAndLabel
29
29
  /***********************************************************************************************************************
30
30
  /********************************* common utils, constants and types ********************************
31
31
  /***********************************************************************************************************************/
32
- export { getCumulativeWidth, getLighterColor, svgQuadraticCurvePath, svgPath, bezierCommand, getSegmentString, getCurvePathWithSegments, getPreviousSegmentsLastPoint, getPathWithHighlight, getRegionPathObjects, getSegmentedPathObjects, getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getSecondaryDataWithOffsetIncluded, getArrowProperty, getAllArrowProperties, maxAndMinUtil, computeMaxAndMinItems, getLabelTextUtil, getXForLineInBar, getYForLineInBar, clone, getLineConfigForBarChart, adjustToOffset } from './utils';
32
+ export { getCumulativeWidth, getLighterColor, svgQuadraticCurvePath, svgPath, bezierCommand, getSegmentString, getCurvePathWithSegments, getPreviousSegmentsLastPoint, getPathWithHighlight, getRegionPathObjects, getSegmentedPathObjects, getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getSecondaryDataWithOffsetIncluded, getArrowProperty, getAllArrowProperties, maxAndMinUtil, computeMaxAndMinItems, getLabelTextUtil, getXForLineInBar, getYForLineInBar, clone, getLineConfigForBarChart, adjustToOffset, pointsWithPaddedRepititions } from './utils';
33
33
  export { chartTypes, yAxisSides, loc, SEGMENT_START, SEGMENT_END, RANGE_ENTER, RANGE_EXIT, STOP, ruleTypes, AxesAndRulesDefaults, defaultArrowConfig, BarDefaults, defaultLineConfig, LineDefaults, defaultPointerConfig, pieColors, populationDefaults, defaultAnimationDuration } from './utils/constants';
34
34
  export { CurveType, EdgePosition, Framework } from './utils/types';
@@ -120,4 +120,5 @@ export declare const defaultLabelLineConfig: {
120
120
  labelComponentHeight: number;
121
121
  labelComponentMargin: number;
122
122
  };
123
+ export declare const pointsWithPaddedRepititions: (oldPoints: string, newPoints: string) => string[];
123
124
  export {};
@@ -658,10 +658,7 @@ export var maxAndMinUtil = function (maxItem, minItem, roundToDigits, showFracti
658
658
  maxItem /= 10 * (roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : 1);
659
659
  maxItem = parseFloat(maxItem.toFixed(roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : 1));
660
660
  if (minItem !== 0) {
661
- minItem *= 10 * (roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : 1);
662
- minItem = minItem - (10 + (minItem % 10));
663
- minItem /= 10 * (roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : 1);
664
- minItem = parseFloat(minItem.toFixed(roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : 1));
661
+ minItem += minItem / 10;
665
662
  }
666
663
  }
667
664
  else {
@@ -1047,3 +1044,111 @@ export var defaultLabelLineConfig = {
1047
1044
  labelComponentHeight: 10,
1048
1045
  labelComponentMargin: 4
1049
1046
  };
1047
+ var secondLastIndexOf = function (text, seq) {
1048
+ // assuming seq is a single char
1049
+ var strCopy = text;
1050
+ var lastIndex = strCopy.lastIndexOf(seq);
1051
+ strCopy =
1052
+ strCopy.substring(0, lastIndex) + 'x' + strCopy.substring(lastIndex + 1);
1053
+ return strCopy.lastIndexOf(seq);
1054
+ };
1055
+ var thirdLastIndexOf = function (text, seq) {
1056
+ // assuming seq is a single char
1057
+ var strCopy = text;
1058
+ var lastIndex = strCopy.lastIndexOf(seq);
1059
+ strCopy =
1060
+ strCopy.substring(0, lastIndex) + 'x' + strCopy.substring(lastIndex + 1);
1061
+ lastIndex = strCopy.lastIndexOf(seq);
1062
+ strCopy =
1063
+ strCopy.substring(0, lastIndex) + 'x' + strCopy.substring(lastIndex + 1);
1064
+ return strCopy.lastIndexOf(seq);
1065
+ };
1066
+ export var pointsWithPaddedRepititions = function (oldPoints, newPoints) {
1067
+ /*
1068
+ ** Handles these cases-
1069
+ **
1070
+ ** 1. Straight line chart
1071
+ ** 2. Curved Line chart
1072
+ ** 3. Straight Area chart -> we need to repeatedly add the 3rd last substring from the points array which represents the last point
1073
+ ** 4. Curved Area chart -> we need to repeatedly add the 3nd last substring (the 2 last substrings start with L while the 3rd last will start with C) from the points array which represents the last point
1074
+ */
1075
+ var oldPointsCopy = oldPoints.trim();
1076
+ var newPointsCopy = newPoints.trim();
1077
+ var char = oldPointsCopy.indexOf('C') === -1 ? 'L' : 'C';
1078
+ var oldPointsCopyAr = oldPointsCopy.split(char);
1079
+ var newPointsCopyAr = newPointsCopy.split(char);
1080
+ var oldPointsCopyLen = oldPointsCopyAr.length - 1;
1081
+ var newPointsCopyLen = newPointsCopyAr.length - 1;
1082
+ var diff = Math.abs(oldPointsCopyLen - newPointsCopyLen);
1083
+ var lastSequence = oldPointsCopyLen < newPointsCopyLen
1084
+ ? oldPointsCopyAr[oldPointsCopyLen].trim()
1085
+ : newPointsCopyAr[newPointsCopyLen].trim();
1086
+ var indexOfL = lastSequence.indexOf('L');
1087
+ var isCurvedAreaChart = char === 'C' && indexOfL !== -1;
1088
+ var isStraightAreaChart = !isCurvedAreaChart &&
1089
+ oldPointsCopyAr[0].substring(1).trim() ===
1090
+ oldPointsCopyAr[oldPointsCopyLen].trim();
1091
+ var repeats = isCurvedAreaChart
1092
+ ? lastSequence.substring(0, indexOfL)
1093
+ : isStraightAreaChart
1094
+ ? oldPointsCopyLen < newPointsCopyLen
1095
+ ? oldPointsCopyAr[oldPointsCopyLen - 2]
1096
+ : newPointsCopyAr[newPointsCopyLen - 2]
1097
+ : lastSequence;
1098
+ repeats = char + (repeats === null || repeats === void 0 ? void 0 : repeats.trim());
1099
+ if (isCurvedAreaChart) {
1100
+ if (oldPointsCopyLen < newPointsCopyLen) {
1101
+ oldPointsCopy = oldPointsCopy
1102
+ .substring(0, secondLastIndexOf(oldPointsCopy, 'L'))
1103
+ .trim();
1104
+ }
1105
+ else {
1106
+ newPointsCopy = newPointsCopy
1107
+ .substring(0, secondLastIndexOf(newPointsCopy, 'L'))
1108
+ .trim();
1109
+ }
1110
+ }
1111
+ if (isStraightAreaChart) {
1112
+ if (oldPointsCopyLen < newPointsCopyLen) {
1113
+ oldPointsCopy = oldPointsCopy
1114
+ .substring(0, thirdLastIndexOf(oldPointsCopy, 'L'))
1115
+ .trim();
1116
+ }
1117
+ else {
1118
+ newPointsCopy = newPointsCopy
1119
+ .substring(0, thirdLastIndexOf(newPointsCopy, 'L'))
1120
+ .trim();
1121
+ }
1122
+ }
1123
+ for (var i = 0; i < diff; i++) {
1124
+ if (oldPointsCopyLen < newPointsCopyLen) {
1125
+ oldPointsCopy += " ".concat(repeats);
1126
+ }
1127
+ else {
1128
+ newPointsCopy += " ".concat(repeats);
1129
+ }
1130
+ }
1131
+ oldPointsCopy = oldPointsCopy.trim();
1132
+ newPointsCopy = newPointsCopy.trim();
1133
+ if (isCurvedAreaChart) {
1134
+ if (oldPointsCopyLen < newPointsCopyLen) {
1135
+ oldPointsCopy +=
1136
+ ' ' + oldPoints.substring(secondLastIndexOf(oldPoints, 'L'));
1137
+ }
1138
+ else {
1139
+ newPointsCopy +=
1140
+ ' ' + newPoints.substring(secondLastIndexOf(newPoints, 'L'));
1141
+ }
1142
+ }
1143
+ if (isStraightAreaChart) {
1144
+ if (oldPointsCopyLen < newPointsCopyLen) {
1145
+ oldPointsCopy +=
1146
+ ' ' + oldPoints.substring(thirdLastIndexOf(oldPoints, 'L'));
1147
+ }
1148
+ else {
1149
+ newPointsCopy +=
1150
+ ' ' + newPoints.substring(thirdLastIndexOf(newPoints, 'L'));
1151
+ }
1152
+ }
1153
+ return [oldPointsCopy.trim(), newPointsCopy.trim()];
1154
+ };
@@ -210,12 +210,16 @@ export interface horizSectionPropTypes {
210
210
  stepValue: number;
211
211
  negativeStepValue: number;
212
212
  roundToDigits: number | undefined;
213
- secondaryData: any[] | undefined;
214
213
  secondaryYAxis: secondaryYAxisType | null;
215
214
  formatYLabel?: (label: string) => string;
216
215
  onlyReferenceLines?: boolean;
217
216
  renderReferenceLines?: boolean;
218
217
  secondaryXAxis?: XAxisConfig;
218
+ secondaryMaxItem: number;
219
+ secondaryMinItem: number;
220
+ secondaryStepValue: number;
221
+ secondaryNegativeStepValue: number;
222
+ secondaryNoOfSectionsBelowXAxis: number;
219
223
  }
220
224
  interface HorizSectionObject {
221
225
  value: string;
@@ -293,6 +297,7 @@ export interface BarAndLineChartsWrapperTypes {
293
297
  isRTL?: boolean;
294
298
  extraWidthDueToDataPoint?: number;
295
299
  nestedScrollEnabled?: boolean;
300
+ dataSet?: DataSet[];
296
301
  }
297
302
  export interface Pointer {
298
303
  height?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "./dist/index.js",
6
6
  "files": [