gifted-charts-core 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -3,12 +3,12 @@ import { type lineConfigType, type BarChartPropsType, type barDataItem, type sta
3
3
  import { type BarAndLineChartsWrapperTypes, type secondaryYAxisType } from '../utils/types';
4
4
  import { type Animated } from 'react-native';
5
5
  export interface extendedBarChartPropsType extends BarChartPropsType {
6
+ parentWidth: number;
6
7
  heightValue?: Animated.Value;
7
8
  widthValue?: Animated.Value;
8
9
  opacValue?: Animated.Value;
9
10
  verticalLinesUptoDataPoint?: boolean;
10
11
  secondaryYAxis?: secondaryYAxisType | boolean;
11
- screenWidth?: number;
12
12
  }
13
13
  export declare const useBarChart: (props: extendedBarChartPropsType) => {
14
14
  lineConfig: lineConfigType;
@@ -30,11 +30,11 @@ import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPad
30
30
  import { AxesAndRulesDefaults, BarDefaults, chartTypes, defaultLineConfig, defaultPointerConfig } from '../utils/constants';
31
31
  export var useBarChart = function (props) {
32
32
  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, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47;
33
- var heightValue = props.heightValue, widthValue = props.widthValue, opacValue = props.opacValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, _48 = props.screenWidth, screenWidth = _48 === void 0 ? 300 : _48;
34
- var _49 = __read(useState(''), 2), points = _49[0], setPoints = _49[1];
35
- var _50 = __read(useState(''), 2), points2 = _50[0], setPoints2 = _50[1];
36
- var _51 = __read(useState(''), 2), arrowPoints = _51[0], setArrowPoints = _51[1];
37
- var _52 = __read(useState(-1), 2), selectedIndex = _52[0], setSelectedIndex = _52[1];
33
+ var heightValue = props.heightValue, widthValue = props.widthValue, opacValue = props.opacValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth;
34
+ var _48 = __read(useState(''), 2), points = _48[0], setPoints = _48[1];
35
+ var _49 = __read(useState(''), 2), points2 = _49[0], setPoints2 = _49[1];
36
+ var _50 = __read(useState(''), 2), arrowPoints = _50[0], setArrowPoints = _50[1];
37
+ var _51 = __read(useState(-1), 2), selectedIndex = _51[0], setSelectedIndex = _51[1];
38
38
  var showLine = (_a = props.showLine) !== null && _a !== void 0 ? _a : BarDefaults.showLine;
39
39
  var data = useMemo(function () {
40
40
  if (!props.data) {
@@ -51,11 +51,15 @@ export var useBarChart = function (props) {
51
51
  var yAxisLabelWidth = (_b = props.yAxisLabelWidth) !== null && _b !== void 0 ? _b : (props.hideYAxisText
52
52
  ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
53
53
  : AxesAndRulesDefaults.yAxisLabelWidth);
54
- var autoComputedSectionWidth = (screenWidth - yAxisLabelWidth) / (data.length + 1);
55
- var autoComputedBarWidth = autoComputedSectionWidth * .6;
56
- var defaultBarWidth = adjustToWidth ? autoComputedBarWidth : BarDefaults.barWidth;
54
+ var autoComputedSectionWidth = props.initialSpacing !== undefined
55
+ ? (parentWidth - yAxisLabelWidth) / data.length - props.initialSpacing
56
+ : (parentWidth - yAxisLabelWidth) / (data.length + 0.5);
57
+ var autoComputedBarWidth = autoComputedSectionWidth * 0.6;
58
+ var defaultBarWidth = adjustToWidth
59
+ ? autoComputedBarWidth
60
+ : BarDefaults.barWidth;
57
61
  var barWidth = (_c = props.barWidth) !== null && _c !== void 0 ? _c : defaultBarWidth;
58
- var autoComputedSpacing = autoComputedSectionWidth * .4;
62
+ var autoComputedSpacing = autoComputedSectionWidth * 0.4;
59
63
  var spacing = (_d = props.spacing) !== null && _d !== void 0 ? _d : (adjustToWidth ? autoComputedSpacing : BarDefaults.spacing);
60
64
  var initialSpacing = (_e = props.initialSpacing) !== null && _e !== void 0 ? _e : spacing;
61
65
  var endSpacing = (_f = props.endSpacing) !== null && _f !== void 0 ? _f : spacing;
@@ -119,7 +123,8 @@ export var useBarChart = function (props) {
119
123
  minItem = stackSumMin;
120
124
  }
121
125
  totalWidth +=
122
- ((_b = (_a = stackItem.stacks[0].barWidth) !== null && _a !== void 0 ? _a : props.barWidth) !== null && _b !== void 0 ? _b : defaultBarWidth) + spacing;
126
+ ((_b = (_a = stackItem.stacks[0].barWidth) !== null && _a !== void 0 ? _a : props.barWidth) !== null && _b !== void 0 ? _b : defaultBarWidth) +
127
+ spacing;
123
128
  });
124
129
  }
125
130
  else {
@@ -177,12 +182,12 @@ export var useBarChart = function (props) {
177
182
  var barBorderColor = (_13 = props.barBorderColor) !== null && _13 !== void 0 ? _13 : BarDefaults.barBorderColor;
178
183
  var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
179
184
  var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
180
- var _53 = __read(useState(-1), 2), pointerIndex = _53[0], setPointerIndex = _53[1];
181
- var _54 = __read(useState(0), 2), pointerX = _54[0], setPointerX = _54[1];
182
- var _55 = __read(useState(0), 2), pointerY = _55[0], setPointerY = _55[1];
183
- var _56 = __read(useState(), 2), pointerItem = _56[0], setPointerItem = _56[1];
184
- var _57 = __read(useState(0), 2), responderStartTime = _57[0], setResponderStartTime = _57[1];
185
- var _58 = __read(useState(false), 2), responderActive = _58[0], setResponderActive = _58[1];
185
+ var _52 = __read(useState(-1), 2), pointerIndex = _52[0], setPointerIndex = _52[1];
186
+ var _53 = __read(useState(0), 2), pointerX = _53[0], setPointerX = _53[1];
187
+ var _54 = __read(useState(0), 2), pointerY = _54[0], setPointerY = _54[1];
188
+ var _55 = __read(useState(), 2), pointerItem = _55[0], setPointerItem = _55[1];
189
+ var _56 = __read(useState(0), 2), responderStartTime = _56[0], setResponderStartTime = _56[1];
190
+ var _57 = __read(useState(false), 2), responderActive = _57[0], setResponderActive = _57[1];
186
191
  var pointerConfig = props.pointerConfig;
187
192
  var getPointerProps = (_14 = props.getPointerProps) !== null && _14 !== void 0 ? _14 : null;
188
193
  var pointerHeight = (_15 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _15 !== void 0 ? _15 : defaultPointerConfig.height;
@@ -32,16 +32,23 @@ import {
32
32
  import { type Animated } from 'react-native'
33
33
 
34
34
  export interface extendedBarChartPropsType extends BarChartPropsType {
35
+ parentWidth: number,
35
36
  heightValue?: Animated.Value
36
37
  widthValue?: Animated.Value
37
38
  opacValue?: Animated.Value
38
39
  verticalLinesUptoDataPoint?: boolean
39
40
  secondaryYAxis?: secondaryYAxisType | boolean
40
- screenWidth?: number
41
41
  }
42
42
 
43
43
  export const useBarChart = (props: extendedBarChartPropsType) => {
44
- const { heightValue, widthValue, opacValue, yAxisOffset, adjustToWidth, screenWidth=300 } = props
44
+ const {
45
+ heightValue,
46
+ widthValue,
47
+ opacValue,
48
+ yAxisOffset,
49
+ adjustToWidth,
50
+ parentWidth,
51
+ } = props
45
52
  const [points, setPoints] = useState('')
46
53
  const [points2, setPoints2] = useState('')
47
54
  const [arrowPoints, setArrowPoints] = useState('')
@@ -66,16 +73,22 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
66
73
  (props.hideYAxisText
67
74
  ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
68
75
  : AxesAndRulesDefaults.yAxisLabelWidth)
69
-
70
- const autoComputedSectionWidth = (screenWidth - yAxisLabelWidth) / (data.length + 1)
71
- const autoComputedBarWidth = autoComputedSectionWidth * .6
72
76
 
73
- const defaultBarWidth = adjustToWidth ? autoComputedBarWidth : BarDefaults.barWidth
77
+ const autoComputedSectionWidth =
78
+ props.initialSpacing !== undefined
79
+ ? (parentWidth - yAxisLabelWidth) / data.length - props.initialSpacing
80
+ : (parentWidth - yAxisLabelWidth) / (data.length + 0.5)
81
+
82
+ const autoComputedBarWidth = autoComputedSectionWidth * 0.6
83
+ const defaultBarWidth = adjustToWidth
84
+ ? autoComputedBarWidth
85
+ : BarDefaults.barWidth
74
86
  const barWidth = props.barWidth ?? defaultBarWidth
75
87
 
76
- const autoComputedSpacing = autoComputedSectionWidth * .4
88
+ const autoComputedSpacing = autoComputedSectionWidth * 0.4
77
89
 
78
- const spacing = props.spacing ?? ( adjustToWidth ? autoComputedSpacing : BarDefaults.spacing)
90
+ const spacing =
91
+ props.spacing ?? (adjustToWidth ? autoComputedSpacing : BarDefaults.spacing)
79
92
  const initialSpacing = props.initialSpacing ?? spacing
80
93
  const endSpacing = props.endSpacing ?? spacing
81
94
  const showFractionalValues =
@@ -93,7 +106,6 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
93
106
  const animationDuration =
94
107
  props.animationDuration ?? BarDefaults.animationDuration
95
108
 
96
-
97
109
  const secondaryData = getSecondaryDataWithOffsetIncluded(
98
110
  props.secondaryData,
99
111
  props.secondaryYAxis
@@ -168,9 +180,8 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
168
180
  minItem = stackSumMin
169
181
  }
170
182
  totalWidth +=
171
- (stackItem.stacks[0].barWidth ??
172
- props.barWidth ??
173
- defaultBarWidth) + spacing
183
+ (stackItem.stacks[0].barWidth ?? props.barWidth ?? defaultBarWidth) +
184
+ spacing
174
185
  })
175
186
  } else {
176
187
  data.forEach((item: barDataItem) => {
@@ -279,6 +279,7 @@ export interface BarChartPropsType {
279
279
  focusBarOnPress?: boolean;
280
280
  focusedBarConfig?: FocusedBarConfig;
281
281
  adjustToWidth?: boolean;
282
+ parentWidth?: number;
282
283
  }
283
284
  export interface FocusedBarConfig {
284
285
  color?: ColorValue;
@@ -465,7 +466,7 @@ export interface RenderBarsPropsType {
465
466
  spacing: number;
466
467
  propSpacing?: number;
467
468
  data?: any;
468
- barWidth?: number;
469
+ barWidth: number;
469
470
  sideWidth?: number;
470
471
  labelWidth?: number;
471
472
  isThreeD?: boolean;
@@ -315,6 +315,7 @@ export interface BarChartPropsType {
315
315
  focusedBarConfig?: FocusedBarConfig
316
316
 
317
317
  adjustToWidth?: boolean
318
+ parentWidth?: number
318
319
  }
319
320
 
320
321
  export interface FocusedBarConfig {
@@ -508,7 +509,7 @@ export interface RenderBarsPropsType {
508
509
  spacing: number
509
510
  propSpacing?: number
510
511
  data?: any
511
- barWidth?: number
512
+ barWidth: number
512
513
  sideWidth?: number
513
514
  labelWidth?: number
514
515
 
@@ -5,7 +5,10 @@ interface Points {
5
5
  points: string;
6
6
  color: string;
7
7
  }
8
- export declare const useLineChartBiColor: (props: LineChartBicolorPropsType) => {
8
+ interface extendedLineChartBicolorPropsType extends LineChartBicolorPropsType {
9
+ parentWidth: number;
10
+ }
11
+ export declare const useLineChartBiColor: (props: extendedLineChartBicolorPropsType) => {
9
12
  toggle: boolean;
10
13
  setToggle: import("react").Dispatch<import("react").SetStateAction<boolean>>;
11
14
  pointsArray: Points[];
@@ -19,7 +19,11 @@ interface Points {
19
19
  color: string
20
20
  }
21
21
 
22
- export const useLineChartBiColor = (props: LineChartBicolorPropsType) => {
22
+ interface extendedLineChartBicolorPropsType extends LineChartBicolorPropsType {
23
+ parentWidth: number
24
+ }
25
+
26
+ export const useLineChartBiColor = (props: extendedLineChartBicolorPropsType) => {
23
27
  const [toggle, setToggle] = useState(false)
24
28
  const [pointsArray, setPointsArray] = useState<Points[]>([])
25
29
  const [fillPointsArray, setFillPointsArray] = useState<Points[]>([])
@@ -4,7 +4,7 @@ import { type BarAndLineChartsWrapperTypes, EdgePosition, type LineSegment } fro
4
4
  import { type Animated } from 'react-native';
5
5
  export interface extendedLineChartPropsType extends LineChartPropsType {
6
6
  animations?: Animated.Value[];
7
- screenWidth: number;
7
+ parentWidth: number;
8
8
  }
9
9
  export declare const useLineChart: (props: extendedLineChartPropsType) => {
10
10
  curvature: number;
@@ -45,6 +45,8 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
45
45
  setPointerItem4: import("react").Dispatch<import("react").SetStateAction<lineDataItem | undefined>>;
46
46
  pointerY5: number;
47
47
  setPointerY5: import("react").Dispatch<import("react").SetStateAction<number>>;
48
+ pointerYsForDataSet: number[];
49
+ setPointerYsForDataSet: import("react").Dispatch<import("react").SetStateAction<number[]>>;
48
50
  pointerItem5: lineDataItem | undefined;
49
51
  setPointerItem5: import("react").Dispatch<import("react").SetStateAction<lineDataItem | undefined>>;
50
52
  secondaryPointerY: number;
@@ -363,6 +365,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
363
365
  showDataPointOnFocus: boolean;
364
366
  showStripOnFocus: boolean;
365
367
  showTextOnFocus: boolean;
368
+ showDataPointLabelOnFocus: boolean;
366
369
  stripHeight: number | undefined;
367
370
  stripWidth: number;
368
371
  stripColor: any;
@@ -376,7 +379,6 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
376
379
  lineGradientEndColor: string;
377
380
  getPointerY: (value: number) => number;
378
381
  initialisePointers: () => void;
379
- setPointerConfig: (initialPointerIndex: number, item: lineDataItem, x: number, y: number, y2: number, y3: number, y4: number, y5: number) => void;
380
382
  barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes;
381
383
  yAxisExtraHeightAtTop: number;
382
384
  };
@@ -30,49 +30,50 @@ import { AxesAndRulesDefaults, LineDefaults, SEGMENT_END, SEGMENT_START, chartTy
30
30
  import { adjustToOffset, computeMaxAndMinItems, getAllArrowProperties, getArrowPoints, getAxesAndRulesProps, getCurvePathWithSegments, getExtendedContainerHeightWithPadding, getInterpolatedData, getLineSegmentsForMissingValues, getMaxValue, getNoOfSections, getPathWithHighlight, getSanitisedData, getSecondaryDataWithOffsetIncluded, getSegmentString, svgPath } from '../utils';
31
31
  import { EdgePosition } from '../utils/types';
32
32
  export var useLineChart = function (props) {
33
- 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, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133, _134, _135, _136, _137, _138, _139, _140, _141, _142, _143, _144, _145, _146, _147, _148, _149, _150, _151, _152, _153, _154, _155, _156, _157, _158, _159, _160, _161, _162, _163, _164, _165, _166, _167, _168, _169, _170, _171, _172, _173, _174, _175, _176, _177, _178, _179, _180, _181, _182, _183, _184, _185, _186, _187, _188, _189, _190, _191, _192, _193, _194, _195, _196, _197, _198, _199, _200, _201, _202, _203, _204, _205, _206, _207, _208, _209, _210, _211, _212, _213, _214, _215, _216, _217, _218, _219, _220, _221, _222, _223, _224, _225, _226, _227, _228, _229, _230, _231, _232, _233, _234, _235, _236, _237, _238, _239, _240, _241, _242, _243, _244, _245, _246, _247, _248, _249, _250, _251, _252, _253, _254, _255, _256, _257, _258, _259, _260, _261, _262, _263, _264, _265, _266, _267, _268, _269, _270, _271, _272, _273, _274, _275, _276, _277, _278, _279, _280, _281, _282, _283, _284, _285, _286, _287, _288, _289, _290, _291;
34
- var animations = props.animations, showDataPointsForMissingValues = props.showDataPointsForMissingValues, _292 = props.interpolateMissingValues, interpolateMissingValues = _292 === void 0 ? true : _292, onlyPositive = props.onlyPositive, yAxisOffset = props.yAxisOffset, screenWidth = props.screenWidth;
33
+ 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, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133, _134, _135, _136, _137, _138, _139, _140, _141, _142, _143, _144, _145, _146, _147, _148, _149, _150, _151, _152, _153, _154, _155, _156, _157, _158, _159, _160, _161, _162, _163, _164, _165, _166, _167, _168, _169, _170, _171, _172, _173, _174, _175, _176, _177, _178, _179, _180, _181, _182, _183, _184, _185, _186, _187, _188, _189, _190, _191, _192, _193, _194, _195, _196, _197, _198, _199, _200, _201, _202, _203, _204, _205, _206, _207, _208, _209, _210, _211, _212, _213, _214, _215, _216, _217, _218, _219, _220, _221, _222, _223, _224, _225, _226, _227, _228, _229, _230, _231, _232, _233, _234, _235, _236, _237, _238, _239, _240, _241, _242, _243, _244, _245, _246, _247, _248, _249, _250, _251, _252, _253, _254, _255, _256, _257, _258, _259, _260, _261, _262, _263, _264, _265, _266, _267, _268, _269, _270, _271, _272, _273, _274, _275, _276, _277, _278, _279, _280, _281, _282, _283, _284, _285, _286, _287, _288, _289, _290, _291, _292;
34
+ var animations = props.animations, showDataPointsForMissingValues = props.showDataPointsForMissingValues, _293 = props.interpolateMissingValues, interpolateMissingValues = _293 === void 0 ? true : _293, onlyPositive = props.onlyPositive, yAxisOffset = props.yAxisOffset, parentWidth = props.parentWidth;
35
35
  var curvature = (_a = props.curvature) !== null && _a !== void 0 ? _a : LineDefaults.curvature;
36
36
  var curveType = (_b = props.curveType) !== null && _b !== void 0 ? _b : LineDefaults.curveType;
37
- var _293 = __read(useState(0), 2), scrollX = _293[0], setScrollX = _293[1];
38
- var _294 = __read(useState(''), 2), arrow1Points = _294[0], setArrow1Points = _294[1];
39
- var _295 = __read(useState(''), 2), arrow2Points = _295[0], setArrow2Points = _295[1];
40
- var _296 = __read(useState(''), 2), arrow3Points = _296[0], setArrow3Points = _296[1];
41
- var _297 = __read(useState(''), 2), arrow4Points = _297[0], setArrow4Points = _297[1];
42
- var _298 = __read(useState(''), 2), arrow5Points = _298[0], setArrow5Points = _298[1];
43
- var _299 = __read(useState(''), 2), secondaryArrowPoints = _299[0], setSecondaryArrowPoints = _299[1];
44
- var _300 = __read(useState(-1), 2), pointerIndex = _300[0], setPointerIndex = _300[1];
45
- var _301 = __read(useState(0), 2), pointerX = _301[0], setPointerX = _301[1];
46
- var _302 = __read(useState(0), 2), pointerY = _302[0], setPointerY = _302[1];
47
- var _303 = __read(useState(), 2), pointerItem = _303[0], setPointerItem = _303[1];
48
- var _304 = __read(useState(0), 2), pointerY2 = _304[0], setPointerY2 = _304[1];
49
- var _305 = __read(useState(), 2), pointerItem2 = _305[0], setPointerItem2 = _305[1];
50
- var _306 = __read(useState(0), 2), pointerY3 = _306[0], setPointerY3 = _306[1];
51
- var _307 = __read(useState(), 2), pointerItem3 = _307[0], setPointerItem3 = _307[1];
52
- var _308 = __read(useState(0), 2), pointerY4 = _308[0], setPointerY4 = _308[1];
53
- var _309 = __read(useState(), 2), pointerItem4 = _309[0], setPointerItem4 = _309[1];
54
- var _310 = __read(useState(0), 2), pointerY5 = _310[0], setPointerY5 = _310[1];
55
- var _311 = __read(useState(), 2), pointerItem5 = _311[0], setPointerItem5 = _311[1];
56
- var _312 = __read(useState(0), 2), secondaryPointerY = _312[0], setSecondaryPointerY = _312[1];
57
- var _313 = __read(useState(), 2), secondaryPointerItem = _313[0], setSecondaryPointerItem = _313[1];
58
- var _314 = __read(useState(0), 2), responderStartTime = _314[0], setResponderStartTime = _314[1];
59
- var _315 = __read(useState(false), 2), responderActive = _315[0], setResponderActive = _315[1];
60
- var _316 = __read(useState(''), 2), points = _316[0], setPoints = _316[1];
61
- var _317 = __read(useState(''), 2), points2 = _317[0], setPoints2 = _317[1];
62
- var _318 = __read(useState(''), 2), points3 = _318[0], setPoints3 = _318[1];
63
- var _319 = __read(useState(''), 2), points4 = _319[0], setPoints4 = _319[1];
64
- var _320 = __read(useState(''), 2), points5 = _320[0], setPoints5 = _320[1];
65
- var _321 = __read(useState(''), 2), secondaryPoints = _321[0], setSecondaryPoints = _321[1];
66
- var _322 = __read(useState(''), 2), fillPoints = _322[0], setFillPoints = _322[1];
67
- var _323 = __read(useState(''), 2), fillPoints2 = _323[0], setFillPoints2 = _323[1];
68
- var _324 = __read(useState(''), 2), fillPoints3 = _324[0], setFillPoints3 = _324[1];
69
- var _325 = __read(useState(''), 2), fillPoints4 = _325[0], setFillPoints4 = _325[1];
70
- var _326 = __read(useState(''), 2), fillPoints5 = _326[0], setFillPoints5 = _326[1];
71
- var _327 = __read(useState(''), 2), secondaryFillPoints = _327[0], setSecondaryFillPoints = _327[1];
72
- var _328 = __read(useState([]), 2), pointsFromSet = _328[0], setPointsFromSet = _328[1];
73
- var _329 = __read(useState([]), 2), fillPointsFromSet = _329[0], setFillPointsFromSet = _329[1];
74
- var _330 = __read(useState([]), 2), arrowPointsFromSet = _330[0], setArrowPointsFromSet = _330[1];
75
- var _331 = __read(useState(-1), 2), selectedIndex = _331[0], setSelectedIndex = _331[1];
37
+ var _294 = __read(useState(0), 2), scrollX = _294[0], setScrollX = _294[1];
38
+ var _295 = __read(useState(''), 2), arrow1Points = _295[0], setArrow1Points = _295[1];
39
+ var _296 = __read(useState(''), 2), arrow2Points = _296[0], setArrow2Points = _296[1];
40
+ var _297 = __read(useState(''), 2), arrow3Points = _297[0], setArrow3Points = _297[1];
41
+ var _298 = __read(useState(''), 2), arrow4Points = _298[0], setArrow4Points = _298[1];
42
+ var _299 = __read(useState(''), 2), arrow5Points = _299[0], setArrow5Points = _299[1];
43
+ var _300 = __read(useState(''), 2), secondaryArrowPoints = _300[0], setSecondaryArrowPoints = _300[1];
44
+ var _301 = __read(useState(-1), 2), pointerIndex = _301[0], setPointerIndex = _301[1];
45
+ var _302 = __read(useState(0), 2), pointerX = _302[0], setPointerX = _302[1];
46
+ var _303 = __read(useState(0), 2), pointerY = _303[0], setPointerY = _303[1];
47
+ var _304 = __read(useState(), 2), pointerItem = _304[0], setPointerItem = _304[1];
48
+ var _305 = __read(useState(0), 2), pointerY2 = _305[0], setPointerY2 = _305[1];
49
+ var _306 = __read(useState(), 2), pointerItem2 = _306[0], setPointerItem2 = _306[1];
50
+ var _307 = __read(useState(0), 2), pointerY3 = _307[0], setPointerY3 = _307[1];
51
+ var _308 = __read(useState(), 2), pointerItem3 = _308[0], setPointerItem3 = _308[1];
52
+ var _309 = __read(useState(0), 2), pointerY4 = _309[0], setPointerY4 = _309[1];
53
+ var _310 = __read(useState(), 2), pointerItem4 = _310[0], setPointerItem4 = _310[1];
54
+ var _311 = __read(useState(0), 2), pointerY5 = _311[0], setPointerY5 = _311[1];
55
+ var _312 = __read(useState([]), 2), pointerYsForDataSet = _312[0], setPointerYsForDataSet = _312[1];
56
+ var _313 = __read(useState(), 2), pointerItem5 = _313[0], setPointerItem5 = _313[1];
57
+ var _314 = __read(useState(0), 2), secondaryPointerY = _314[0], setSecondaryPointerY = _314[1];
58
+ var _315 = __read(useState(), 2), secondaryPointerItem = _315[0], setSecondaryPointerItem = _315[1];
59
+ var _316 = __read(useState(0), 2), responderStartTime = _316[0], setResponderStartTime = _316[1];
60
+ var _317 = __read(useState(false), 2), responderActive = _317[0], setResponderActive = _317[1];
61
+ var _318 = __read(useState(''), 2), points = _318[0], setPoints = _318[1];
62
+ var _319 = __read(useState(''), 2), points2 = _319[0], setPoints2 = _319[1];
63
+ var _320 = __read(useState(''), 2), points3 = _320[0], setPoints3 = _320[1];
64
+ var _321 = __read(useState(''), 2), points4 = _321[0], setPoints4 = _321[1];
65
+ var _322 = __read(useState(''), 2), points5 = _322[0], setPoints5 = _322[1];
66
+ var _323 = __read(useState(''), 2), secondaryPoints = _323[0], setSecondaryPoints = _323[1];
67
+ var _324 = __read(useState(''), 2), fillPoints = _324[0], setFillPoints = _324[1];
68
+ var _325 = __read(useState(''), 2), fillPoints2 = _325[0], setFillPoints2 = _325[1];
69
+ var _326 = __read(useState(''), 2), fillPoints3 = _326[0], setFillPoints3 = _326[1];
70
+ var _327 = __read(useState(''), 2), fillPoints4 = _327[0], setFillPoints4 = _327[1];
71
+ var _328 = __read(useState(''), 2), fillPoints5 = _328[0], setFillPoints5 = _328[1];
72
+ var _329 = __read(useState(''), 2), secondaryFillPoints = _329[0], setSecondaryFillPoints = _329[1];
73
+ var _330 = __read(useState([]), 2), pointsFromSet = _330[0], setPointsFromSet = _330[1];
74
+ var _331 = __read(useState([]), 2), fillPointsFromSet = _331[0], setFillPointsFromSet = _331[1];
75
+ var _332 = __read(useState([]), 2), arrowPointsFromSet = _332[0], setArrowPointsFromSet = _332[1];
76
+ var _333 = __read(useState(-1), 2), selectedIndex = _333[0], setSelectedIndex = _333[1];
76
77
  var noOfSections = getNoOfSections(props.noOfSections, props.maxValue, props.stepValue);
77
78
  var containerHeight = (_c = props.height) !== null && _c !== void 0 ? _c : (((_d = props.stepHeight) !== null && _d !== void 0 ? _d : 0) * noOfSections ||
78
79
  AxesAndRulesDefaults.containerHeight);
@@ -156,7 +157,7 @@ export var useLineChart = function (props) {
156
157
  ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
157
158
  : AxesAndRulesDefaults.yAxisLabelWidth);
158
159
  var spacing = (_5 = props.spacing) !== null && _5 !== void 0 ? _5 : (adjustToWidth
159
- ? (((_6 = props.width) !== null && _6 !== void 0 ? _6 : screenWidth - yAxisLabelWidth) - initialSpacing) /
160
+ ? (((_6 = props.width) !== null && _6 !== void 0 ? _6 : parentWidth - yAxisLabelWidth) - initialSpacing) /
160
161
  Math.max((data0 !== null && data0 !== void 0 ? data0 : data).length - 1, 1)
161
162
  : LineDefaults.spacing);
162
163
  var xAxisThickness = (_7 = props.xAxisThickness) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.xAxisThickness;
@@ -229,7 +230,7 @@ export var useLineChart = function (props) {
229
230
  var textColor4 = (_94 = (_93 = props.textColor4) !== null && _93 !== void 0 ? _93 : props.textColor) !== null && _94 !== void 0 ? _94 : LineDefaults.textColor;
230
231
  var textColor5 = (_96 = (_95 = props.textColor5) !== null && _95 !== void 0 ? _95 : props.textColor) !== null && _96 !== void 0 ? _96 : LineDefaults.textColor;
231
232
  var totalWidth = initialSpacing + spacing * (data0 !== null && data0 !== void 0 ? data0 : data).length;
232
- var _332 = computeMaxAndMinItems(data0 !== null && data0 !== void 0 ? data0 : data, props.roundToDigits, props.showFractionalValues), maxItem = _332.maxItem, minItem = _332.minItem;
233
+ var _334 = computeMaxAndMinItems(data0 !== null && data0 !== void 0 ? data0 : data, props.roundToDigits, props.showFractionalValues), maxItem = _334.maxItem, minItem = _334.minItem;
233
234
  var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxItem);
234
235
  var mostNegativeValue = (_97 = props.mostNegativeValue) !== null && _97 !== void 0 ? _97 : minItem;
235
236
  var overflowTop = (_98 = props.overflowTop) !== null && _98 !== void 0 ? _98 : 0;
@@ -337,7 +338,7 @@ export var useLineChart = function (props) {
337
338
  var endOpacity5 = (_177 = props.endOpacity5) !== null && _177 !== void 0 ? _177 : endOpacity;
338
339
  defaultArrowConfig.strokeWidth = (_179 = (_178 = dataSet === null || dataSet === void 0 ? void 0 : dataSet[0]) === null || _178 === void 0 ? void 0 : _178.thickness) !== null && _179 !== void 0 ? _179 : thickness1;
339
340
  defaultArrowConfig.strokeColor = (_181 = (_180 = dataSet === null || dataSet === void 0 ? void 0 : dataSet[0]) === null || _180 === void 0 ? void 0 : _180.color) !== null && _181 !== void 0 ? _181 : color1;
340
- var _333 = getAllArrowProperties(props, defaultArrowConfig), arrowLength1 = _333.arrowLength1, arrowWidth1 = _333.arrowWidth1, arrowStrokeWidth1 = _333.arrowStrokeWidth1, arrowStrokeColor1 = _333.arrowStrokeColor1, arrowFillColor1 = _333.arrowFillColor1, showArrowBase1 = _333.showArrowBase1, arrowLength2 = _333.arrowLength2, arrowWidth2 = _333.arrowWidth2, arrowStrokeWidth2 = _333.arrowStrokeWidth2, arrowStrokeColor2 = _333.arrowStrokeColor2, arrowFillColor2 = _333.arrowFillColor2, showArrowBase2 = _333.showArrowBase2, arrowLength3 = _333.arrowLength3, arrowWidth3 = _333.arrowWidth3, arrowStrokeWidth3 = _333.arrowStrokeWidth3, arrowStrokeColor3 = _333.arrowStrokeColor3, arrowFillColor3 = _333.arrowFillColor3, showArrowBase3 = _333.showArrowBase3, arrowLength4 = _333.arrowLength4, arrowWidth4 = _333.arrowWidth4, arrowStrokeWidth4 = _333.arrowStrokeWidth4, arrowStrokeColor4 = _333.arrowStrokeColor4, arrowFillColor4 = _333.arrowFillColor4, showArrowBase4 = _333.showArrowBase4, arrowLength5 = _333.arrowLength5, arrowWidth5 = _333.arrowWidth5, arrowStrokeWidth5 = _333.arrowStrokeWidth5, arrowStrokeColor5 = _333.arrowStrokeColor5, arrowFillColor5 = _333.arrowFillColor5, showArrowBase5 = _333.showArrowBase5, arrowLengthsFromSet = _333.arrowLengthsFromSet, arrowWidthsFromSet = _333.arrowWidthsFromSet, arrowStrokeWidthsFromSet = _333.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _333.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _333.arrowFillColorsFromSet, showArrowBasesFromSet = _333.showArrowBasesFromSet;
341
+ var _335 = getAllArrowProperties(props, defaultArrowConfig), arrowLength1 = _335.arrowLength1, arrowWidth1 = _335.arrowWidth1, arrowStrokeWidth1 = _335.arrowStrokeWidth1, arrowStrokeColor1 = _335.arrowStrokeColor1, arrowFillColor1 = _335.arrowFillColor1, showArrowBase1 = _335.showArrowBase1, arrowLength2 = _335.arrowLength2, arrowWidth2 = _335.arrowWidth2, arrowStrokeWidth2 = _335.arrowStrokeWidth2, arrowStrokeColor2 = _335.arrowStrokeColor2, arrowFillColor2 = _335.arrowFillColor2, showArrowBase2 = _335.showArrowBase2, arrowLength3 = _335.arrowLength3, arrowWidth3 = _335.arrowWidth3, arrowStrokeWidth3 = _335.arrowStrokeWidth3, arrowStrokeColor3 = _335.arrowStrokeColor3, arrowFillColor3 = _335.arrowFillColor3, showArrowBase3 = _335.showArrowBase3, arrowLength4 = _335.arrowLength4, arrowWidth4 = _335.arrowWidth4, arrowStrokeWidth4 = _335.arrowStrokeWidth4, arrowStrokeColor4 = _335.arrowStrokeColor4, arrowFillColor4 = _335.arrowFillColor4, showArrowBase4 = _335.showArrowBase4, arrowLength5 = _335.arrowLength5, arrowWidth5 = _335.arrowWidth5, arrowStrokeWidth5 = _335.arrowStrokeWidth5, arrowStrokeColor5 = _335.arrowStrokeColor5, arrowFillColor5 = _335.arrowFillColor5, showArrowBase5 = _335.showArrowBase5, arrowLengthsFromSet = _335.arrowLengthsFromSet, arrowWidthsFromSet = _335.arrowWidthsFromSet, arrowStrokeWidthsFromSet = _335.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _335.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _335.arrowFillColorsFromSet, showArrowBasesFromSet = _335.showArrowBasesFromSet;
341
342
  var secondaryLineConfig = {
342
343
  zIndex: (_183 = (_182 = props.secondaryLineConfig) === null || _182 === void 0 ? void 0 : _182.zIndex) !== null && _183 !== void 0 ? _183 : zIndex1,
343
344
  curved: (_185 = (_184 = props.secondaryLineConfig) === null || _184 === void 0 ? void 0 : _184.curved) !== null && _185 !== void 0 ? _185 : props.curved,
@@ -955,17 +956,18 @@ export var useLineChart = function (props) {
955
956
  var showDataPointOnFocus = (_279 = props.showDataPointOnFocus) !== null && _279 !== void 0 ? _279 : LineDefaults.showDataPointOnFocus;
956
957
  var showStripOnFocus = (_280 = props.showStripOnFocus) !== null && _280 !== void 0 ? _280 : LineDefaults.showStripOnFocus;
957
958
  var showTextOnFocus = (_281 = props.showTextOnFocus) !== null && _281 !== void 0 ? _281 : LineDefaults.showTextOnFocus;
959
+ var showDataPointLabelOnFocus = (_282 = props.showDataPointLabelOnFocus) !== null && _282 !== void 0 ? _282 : LineDefaults.showDataPointLabelOnFocus;
958
960
  var stripHeight = props.stripHeight;
959
- var stripWidth = (_282 = props.stripWidth) !== null && _282 !== void 0 ? _282 : LineDefaults.stripWidth;
960
- var stripColor = (_283 = props.stripColor) !== null && _283 !== void 0 ? _283 : color1;
961
- var stripOpacity = (_284 = props.stripOpacity) !== null && _284 !== void 0 ? _284 : (startOpacity1 + endOpacity1) / 2;
962
- var unFocusOnPressOut = (_285 = props.unFocusOnPressOut) !== null && _285 !== void 0 ? _285 : LineDefaults.unFocusOnPressOut;
963
- var delayBeforeUnFocus = (_286 = props.delayBeforeUnFocus) !== null && _286 !== void 0 ? _286 : LineDefaults.delayBeforeUnFocus;
961
+ var stripWidth = (_283 = props.stripWidth) !== null && _283 !== void 0 ? _283 : LineDefaults.stripWidth;
962
+ var stripColor = (_284 = props.stripColor) !== null && _284 !== void 0 ? _284 : color1;
963
+ var stripOpacity = (_285 = props.stripOpacity) !== null && _285 !== void 0 ? _285 : (startOpacity1 + endOpacity1) / 2;
964
+ var unFocusOnPressOut = (_286 = props.unFocusOnPressOut) !== null && _286 !== void 0 ? _286 : LineDefaults.unFocusOnPressOut;
965
+ var delayBeforeUnFocus = (_287 = props.delayBeforeUnFocus) !== null && _287 !== void 0 ? _287 : LineDefaults.delayBeforeUnFocus;
964
966
  var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
965
- var lineGradient = (_287 = props.lineGradient) !== null && _287 !== void 0 ? _287 : LineDefaults.lineGradient;
966
- var lineGradientDirection = (_288 = props.lineGradientDirection) !== null && _288 !== void 0 ? _288 : 'vertical';
967
- var lineGradientStartColor = (_289 = props.lineGradientStartColor) !== null && _289 !== void 0 ? _289 : LineDefaults.lineGradientStartColor;
968
- var lineGradientEndColor = (_290 = props.lineGradientEndColor) !== null && _290 !== void 0 ? _290 : LineDefaults.lineGradientEndColor;
967
+ var lineGradient = (_288 = props.lineGradient) !== null && _288 !== void 0 ? _288 : LineDefaults.lineGradient;
968
+ var lineGradientDirection = (_289 = props.lineGradientDirection) !== null && _289 !== void 0 ? _289 : 'vertical';
969
+ var lineGradientStartColor = (_290 = props.lineGradientStartColor) !== null && _290 !== void 0 ? _290 : LineDefaults.lineGradientStartColor;
970
+ var lineGradientEndColor = (_291 = props.lineGradientEndColor) !== null && _291 !== void 0 ? _291 : LineDefaults.lineGradientEndColor;
969
971
  var getPointerY = function (value) {
970
972
  return value
971
973
  ? containerHeight -
@@ -977,23 +979,36 @@ export var useLineChart = function (props) {
977
979
  var initialisePointers = function () {
978
980
  var _a, _b, _c, _d;
979
981
  if (initialPointerIndex !== -1) {
980
- var item_1 = (data0 !== null && data0 !== void 0 ? data0 : data)[initialPointerIndex];
981
982
  var x_1 = initialSpacing +
982
983
  spacing * initialPointerIndex -
983
984
  (pointerRadius || pointerWidth / 2) -
984
985
  1;
985
- var y_1 = getPointerY(item_1.value);
986
- var y2_1 = getPointerY((_a = data2 === null || data2 === void 0 ? void 0 : data2[initialPointerIndex]) === null || _a === void 0 ? void 0 : _a.value);
987
- var y3_1 = getPointerY((_b = data3 === null || data3 === void 0 ? void 0 : data3[initialPointerIndex]) === null || _b === void 0 ? void 0 : _b.value);
988
- var y4_1 = getPointerY((_c = data4 === null || data4 === void 0 ? void 0 : data4[initialPointerIndex]) === null || _c === void 0 ? void 0 : _c.value);
989
- var y5_1 = getPointerY((_d = data5 === null || data5 === void 0 ? void 0 : data5[initialPointerIndex]) === null || _d === void 0 ? void 0 : _d.value);
990
- if (initialPointerAppearDelay) {
991
- setTimeout(function () {
992
- setPointerConfig(initialPointerIndex, item_1, x_1, y_1, y2_1, y3_1, y4_1, y5_1);
993
- }, initialPointerAppearDelay);
986
+ if (dataSet === null || dataSet === void 0 ? void 0 : dataSet.length) {
987
+ var item_1 = dataSet[0].data[initialPointerIndex];
988
+ if (initialPointerAppearDelay) {
989
+ setTimeout(function () {
990
+ setPointerConfigForDataSet(initialPointerIndex, item_1, x_1);
991
+ }, initialPointerAppearDelay);
992
+ }
993
+ else {
994
+ setPointerConfigForDataSet(initialPointerIndex, item_1, x_1);
995
+ }
994
996
  }
995
997
  else {
996
- setPointerConfig(initialPointerIndex, item_1, x_1, y_1, y2_1, y3_1, y4_1, y5_1);
998
+ var item_2 = (data0 !== null && data0 !== void 0 ? data0 : data)[initialPointerIndex];
999
+ var y_1 = getPointerY(item_2.value);
1000
+ var y2_1 = getPointerY((_a = data2 === null || data2 === void 0 ? void 0 : data2[initialPointerIndex]) === null || _a === void 0 ? void 0 : _a.value);
1001
+ var y3_1 = getPointerY((_b = data3 === null || data3 === void 0 ? void 0 : data3[initialPointerIndex]) === null || _b === void 0 ? void 0 : _b.value);
1002
+ var y4_1 = getPointerY((_c = data4 === null || data4 === void 0 ? void 0 : data4[initialPointerIndex]) === null || _c === void 0 ? void 0 : _c.value);
1003
+ var y5_1 = getPointerY((_d = data5 === null || data5 === void 0 ? void 0 : data5[initialPointerIndex]) === null || _d === void 0 ? void 0 : _d.value);
1004
+ if (initialPointerAppearDelay) {
1005
+ setTimeout(function () {
1006
+ setPointerConfig(initialPointerIndex, item_2, x_1, y_1, y2_1, y3_1, y4_1, y5_1);
1007
+ }, initialPointerAppearDelay);
1008
+ }
1009
+ else {
1010
+ setPointerConfig(initialPointerIndex, item_2, x_1, y_1, y2_1, y3_1, y4_1, y5_1);
1011
+ }
997
1012
  }
998
1013
  }
999
1014
  };
@@ -1015,6 +1030,14 @@ export var useLineChart = function (props) {
1015
1030
  setPointerY4(y4);
1016
1031
  setPointerY5(y5);
1017
1032
  };
1033
+ var setPointerConfigForDataSet = function (initialPointerIndex, item, x) {
1034
+ var _a;
1035
+ setPointerIndex(initialPointerIndex);
1036
+ setPointerItem(item);
1037
+ setPointerX(x);
1038
+ var initialPointerYs = (_a = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return getPointerY(set.data[initialPointerIndex].value); })) !== null && _a !== void 0 ? _a : [];
1039
+ setPointerYsForDataSet(initialPointerYs);
1040
+ };
1018
1041
  var barAndLineChartsWrapperProps = {
1019
1042
  chartType: chartTypes.LINE,
1020
1043
  containerHeight: containerHeight,
@@ -1076,7 +1099,7 @@ export var useLineChart = function (props) {
1076
1099
  pointerY: pointerY,
1077
1100
  onEndReached: props.onEndReached,
1078
1101
  onStartReached: props.onStartReached,
1079
- endReachedOffset: (_291 = props.endReachedOffset) !== null && _291 !== void 0 ? _291 : LineDefaults.endReachedOffset,
1102
+ endReachedOffset: (_292 = props.endReachedOffset) !== null && _292 !== void 0 ? _292 : LineDefaults.endReachedOffset,
1080
1103
  onMomentumScrollEnd: props.onMomentumScrollEnd
1081
1104
  };
1082
1105
  return {
@@ -1118,6 +1141,8 @@ export var useLineChart = function (props) {
1118
1141
  setPointerItem4: setPointerItem4,
1119
1142
  pointerY5: pointerY5,
1120
1143
  setPointerY5: setPointerY5,
1144
+ pointerYsForDataSet: pointerYsForDataSet,
1145
+ setPointerYsForDataSet: setPointerYsForDataSet,
1121
1146
  pointerItem5: pointerItem5,
1122
1147
  setPointerItem5: setPointerItem5,
1123
1148
  secondaryPointerY: secondaryPointerY,
@@ -1407,6 +1432,7 @@ export var useLineChart = function (props) {
1407
1432
  showDataPointOnFocus: showDataPointOnFocus,
1408
1433
  showStripOnFocus: showStripOnFocus,
1409
1434
  showTextOnFocus: showTextOnFocus,
1435
+ showDataPointLabelOnFocus: showDataPointLabelOnFocus,
1410
1436
  stripHeight: stripHeight,
1411
1437
  stripWidth: stripWidth,
1412
1438
  stripColor: stripColor,
@@ -1420,7 +1446,6 @@ export var useLineChart = function (props) {
1420
1446
  lineGradientEndColor: lineGradientEndColor,
1421
1447
  getPointerY: getPointerY,
1422
1448
  initialisePointers: initialisePointers,
1423
- setPointerConfig: setPointerConfig,
1424
1449
  barAndLineChartsWrapperProps: barAndLineChartsWrapperProps,
1425
1450
  yAxisExtraHeightAtTop: yAxisExtraHeightAtTop
1426
1451
  };
@@ -43,7 +43,7 @@ export interface extendedLineChartPropsType extends LineChartPropsType {
43
43
  // heightValue: Animated.Value
44
44
  // widthValue: Animated.Value
45
45
  // opacValue: Animated.Value
46
- screenWidth: number
46
+ parentWidth: number
47
47
  }
48
48
 
49
49
  export const useLineChart = (props: extendedLineChartPropsType) => {
@@ -53,7 +53,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
53
53
  interpolateMissingValues = true,
54
54
  onlyPositive,
55
55
  yAxisOffset,
56
- screenWidth
56
+ parentWidth
57
57
  } = props
58
58
  const curvature = props.curvature ?? LineDefaults.curvature
59
59
  const curveType = props.curveType ?? LineDefaults.curveType
@@ -76,6 +76,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
76
76
  const [pointerY4, setPointerY4] = useState(0)
77
77
  const [pointerItem4, setPointerItem4] = useState<lineDataItem>()
78
78
  const [pointerY5, setPointerY5] = useState(0)
79
+ const [pointerYsForDataSet, setPointerYsForDataSet] = useState<number[]>([])
79
80
  const [pointerItem5, setPointerItem5] = useState<lineDataItem>()
80
81
  const [secondaryPointerY, setSecondaryPointerY] = useState(0)
81
82
  const [secondaryPointerItem, setSecondaryPointerItem] = useState()
@@ -245,7 +246,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
245
246
  const spacing =
246
247
  props.spacing ??
247
248
  (adjustToWidth
248
- ? ((props.width ?? screenWidth - yAxisLabelWidth) - initialSpacing) /
249
+ ? ((props.width ?? parentWidth - yAxisLabelWidth) - initialSpacing) /
249
250
  Math.max((data0 ?? data).length - 1, 1)
250
251
  : LineDefaults.spacing)
251
252
 
@@ -1640,6 +1641,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
1640
1641
  const showStripOnFocus =
1641
1642
  props.showStripOnFocus ?? LineDefaults.showStripOnFocus
1642
1643
  const showTextOnFocus = props.showTextOnFocus ?? LineDefaults.showTextOnFocus
1644
+ const showDataPointLabelOnFocus =
1645
+ props.showDataPointLabelOnFocus ?? LineDefaults.showDataPointLabelOnFocus
1643
1646
  const stripHeight = props.stripHeight
1644
1647
  const stripWidth = props.stripWidth ?? LineDefaults.stripWidth
1645
1648
  const stripColor = props.stripColor ?? color1
@@ -1669,24 +1672,35 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
1669
1672
 
1670
1673
  const initialisePointers = (): void => {
1671
1674
  if (initialPointerIndex !== -1) {
1672
- const item = (data0 ?? data)[initialPointerIndex]
1673
1675
  const x =
1674
1676
  initialSpacing +
1675
1677
  spacing * initialPointerIndex -
1676
1678
  (pointerRadius || pointerWidth / 2) -
1677
1679
  1
1678
- const y = getPointerY(item.value)
1679
- const y2 = getPointerY(data2?.[initialPointerIndex]?.value)
1680
- const y3 = getPointerY(data3?.[initialPointerIndex]?.value)
1681
- const y4 = getPointerY(data4?.[initialPointerIndex]?.value)
1682
- const y5 = getPointerY(data5?.[initialPointerIndex]?.value)
1683
-
1684
- if (initialPointerAppearDelay) {
1685
- setTimeout(() => {
1686
- setPointerConfig(initialPointerIndex, item, x, y, y2, y3, y4, y5)
1687
- }, initialPointerAppearDelay)
1680
+ if (dataSet?.length) {
1681
+ const item = dataSet[0].data[initialPointerIndex]
1682
+ if (initialPointerAppearDelay) {
1683
+ setTimeout(() => {
1684
+ setPointerConfigForDataSet(initialPointerIndex, item, x)
1685
+ }, initialPointerAppearDelay)
1686
+ } else {
1687
+ setPointerConfigForDataSet(initialPointerIndex, item, x)
1688
+ }
1688
1689
  } else {
1689
- setPointerConfig(initialPointerIndex, item, x, y, y2, y3, y4, y5)
1690
+ const item = (data0 ?? data)[initialPointerIndex]
1691
+ const y = getPointerY(item.value)
1692
+ const y2 = getPointerY(data2?.[initialPointerIndex]?.value)
1693
+ const y3 = getPointerY(data3?.[initialPointerIndex]?.value)
1694
+ const y4 = getPointerY(data4?.[initialPointerIndex]?.value)
1695
+ const y5 = getPointerY(data5?.[initialPointerIndex]?.value)
1696
+
1697
+ if (initialPointerAppearDelay) {
1698
+ setTimeout(() => {
1699
+ setPointerConfig(initialPointerIndex, item, x, y, y2, y3, y4, y5)
1700
+ }, initialPointerAppearDelay)
1701
+ } else {
1702
+ setPointerConfig(initialPointerIndex, item, x, y, y2, y3, y4, y5)
1703
+ }
1690
1704
  }
1691
1705
  }
1692
1706
  }
@@ -1721,6 +1735,21 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
1721
1735
  setPointerY5(y5)
1722
1736
  }
1723
1737
 
1738
+ const setPointerConfigForDataSet = (
1739
+ initialPointerIndex: number,
1740
+ item: lineDataItem,
1741
+ x: number
1742
+ ) => {
1743
+ setPointerIndex(initialPointerIndex)
1744
+ setPointerItem(item)
1745
+ setPointerX(x)
1746
+
1747
+ const initialPointerYs =
1748
+ dataSet?.map((set) => getPointerY(set.data[initialPointerIndex].value)) ??
1749
+ []
1750
+ setPointerYsForDataSet(initialPointerYs)
1751
+ }
1752
+
1724
1753
  const barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes = {
1725
1754
  chartType: chartTypes.LINE,
1726
1755
  containerHeight,
@@ -1830,6 +1859,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
1830
1859
  setPointerItem4,
1831
1860
  pointerY5,
1832
1861
  setPointerY5,
1862
+ pointerYsForDataSet,
1863
+ setPointerYsForDataSet,
1833
1864
  pointerItem5,
1834
1865
  setPointerItem5,
1835
1866
  secondaryPointerY,
@@ -2119,6 +2150,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
2119
2150
  showDataPointOnFocus,
2120
2151
  showStripOnFocus,
2121
2152
  showTextOnFocus,
2153
+ showDataPointLabelOnFocus,
2122
2154
  stripHeight,
2123
2155
  stripWidth,
2124
2156
  stripColor,
@@ -2132,7 +2164,6 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
2132
2164
  lineGradientEndColor,
2133
2165
  getPointerY,
2134
2166
  initialisePointers,
2135
- setPointerConfig,
2136
2167
  barAndLineChartsWrapperProps,
2137
2168
  yAxisExtraHeightAtTop
2138
2169
  }
@@ -56,6 +56,7 @@ export interface LineChartPropsType {
56
56
  showDataPointOnFocus?: boolean;
57
57
  showStripOnFocus?: boolean;
58
58
  showTextOnFocus?: boolean;
59
+ showDataPointLabelOnFocus?: boolean;
59
60
  stripHeight?: number;
60
61
  stripWidth?: number;
61
62
  stripColor?: ColorValue | string | any;
@@ -292,6 +293,7 @@ export interface LineChartPropsType {
292
293
  showDataPointsForMissingValues?: boolean;
293
294
  interpolateMissingValues?: boolean;
294
295
  onlyPositive?: boolean;
296
+ parentWidth?: number;
295
297
  }
296
298
  export interface lineDataItem {
297
299
  value: number;
@@ -413,6 +415,7 @@ export interface LineChartBicolorPropsType {
413
415
  showDataPointOnFocus?: boolean;
414
416
  showStripOnFocus?: boolean;
415
417
  showTextOnFocus?: boolean;
418
+ showDataPointLabelOnFocus?: boolean;
416
419
  stripHeight?: number;
417
420
  stripWidth?: number;
418
421
  stripColor?: ColorValue | string | any;
@@ -522,6 +525,7 @@ export interface LineChartBicolorPropsType {
522
525
  formatYLabel?: (label: string) => string;
523
526
  onScroll?: Function;
524
527
  endReachedOffset?: number;
528
+ parentWidth?: number;
525
529
  }
526
530
  export interface IDataSanitisationProps {
527
531
  showDataPointsForMissingValues: boolean | undefined;
@@ -70,6 +70,7 @@ export interface LineChartPropsType {
70
70
  showDataPointOnFocus?: boolean
71
71
  showStripOnFocus?: boolean
72
72
  showTextOnFocus?: boolean
73
+ showDataPointLabelOnFocus?: boolean
73
74
  stripHeight?: number
74
75
  stripWidth?: number
75
76
  stripColor?: ColorValue | string | any
@@ -325,6 +326,7 @@ export interface LineChartPropsType {
325
326
  showDataPointsForMissingValues?: boolean
326
327
  interpolateMissingValues?: boolean
327
328
  onlyPositive?: boolean
329
+ parentWidth?: number
328
330
  }
329
331
 
330
332
  export interface lineDataItem {
@@ -460,6 +462,7 @@ export interface LineChartBicolorPropsType {
460
462
  showDataPointOnFocus?: boolean
461
463
  showStripOnFocus?: boolean
462
464
  showTextOnFocus?: boolean
465
+ showDataPointLabelOnFocus?: boolean
463
466
  stripHeight?: number
464
467
  stripWidth?: number
465
468
  stripColor?: ColorValue | string | any
@@ -584,6 +587,7 @@ export interface LineChartBicolorPropsType {
584
587
  formatYLabel?: (label: string) => string
585
588
  onScroll?: Function
586
589
  endReachedOffset?: number
590
+ parentWidth?: number
587
591
  }
588
592
 
589
593
  export interface IDataSanitisationProps {
@@ -157,6 +157,7 @@ export declare const LineDefaults: {
157
157
  showDataPointOnFocus: boolean;
158
158
  showStripOnFocus: boolean;
159
159
  showTextOnFocus: boolean;
160
+ showDataPointLabelOnFocus: boolean;
160
161
  stripWidth: number;
161
162
  unFocusOnPressOut: boolean;
162
163
  delayBeforeUnFocus: number;
@@ -196,6 +196,7 @@ export var LineDefaults = {
196
196
  showDataPointOnFocus: false,
197
197
  showStripOnFocus: false,
198
198
  showTextOnFocus: false,
199
+ showDataPointLabelOnFocus: false,
199
200
  stripWidth: 2,
200
201
  unFocusOnPressOut: true,
201
202
  delayBeforeUnFocus: 300,
@@ -228,6 +228,7 @@ export const LineDefaults = {
228
228
  showDataPointOnFocus: false,
229
229
  showStripOnFocus: false,
230
230
  showTextOnFocus: false,
231
+ showDataPointLabelOnFocus: false,
231
232
  stripWidth: 2,
232
233
  unFocusOnPressOut: true,
233
234
  delayBeforeUnFocus: 300,
@@ -531,6 +531,7 @@ export var getAxesAndRulesProps = function (props, stepValue, maxValue) {
531
531
  verticalLinesHeight: props.verticalLinesHeight,
532
532
  verticalLinesColor: props.verticalLinesColor,
533
533
  verticalLinesShift: props.verticalLinesShift,
534
+ verticalLinesStrokeDashArray: props.verticalLinesStrokeDashArray,
534
535
  verticalLinesZIndex: props.verticalLinesZIndex,
535
536
  verticalLinesSpacing: props.verticalLinesSpacing,
536
537
  noOfVerticalLines: props.noOfVerticalLines,
@@ -711,6 +711,7 @@ export const getAxesAndRulesProps = (
711
711
  verticalLinesHeight: props.verticalLinesHeight,
712
712
  verticalLinesColor: props.verticalLinesColor,
713
713
  verticalLinesShift: props.verticalLinesShift,
714
+ verticalLinesStrokeDashArray: props.verticalLinesStrokeDashArray,
714
715
  verticalLinesZIndex: props.verticalLinesZIndex,
715
716
  verticalLinesSpacing: props.verticalLinesSpacing,
716
717
  noOfVerticalLines: props.noOfVerticalLines,
@@ -248,6 +248,7 @@ export interface Pointer {
248
248
  pointer3Color?: ColorValue;
249
249
  pointer4Color?: ColorValue;
250
250
  pointer5Color?: ColorValue;
251
+ pointerColorsForDataSet?: ColorValue[];
251
252
  secondaryPointerColor?: ColorValue;
252
253
  pointerComponent?: Function;
253
254
  showPointerStrip?: boolean;
@@ -20,13 +20,13 @@ export interface RuleTypes {
20
20
 
21
21
  export enum CurveType {
22
22
  CUBIC,
23
- QUADRATIC,
23
+ QUADRATIC
24
24
  }
25
25
 
26
26
  export enum EdgePosition {
27
27
  AFTER_DATA_POINT,
28
28
  AROUND_DATA_POINT,
29
- BEFORE_DATA_POINT,
29
+ BEFORE_DATA_POINT
30
30
  }
31
31
 
32
32
  export interface RulesConfig {
@@ -280,6 +280,7 @@ export interface Pointer {
280
280
  pointer3Color?: ColorValue
281
281
  pointer4Color?: ColorValue
282
282
  pointer5Color?: ColorValue
283
+ pointerColorsForDataSet?: ColorValue[]
283
284
  secondaryPointerColor?: ColorValue
284
285
  pointerComponent?: Function
285
286
  showPointerStrip?: boolean