gifted-charts-core 0.0.20 → 0.0.22

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.
@@ -1,8 +1,12 @@
1
- import { AxesAndRulesDefaults } from "../../utils/constants";
2
- import { HorizSectionsType, secondaryYAxisType } from "../../utils/types";
3
- import { computeMaxAndMinItems, getLabelTextUtil } from "../../utils";
1
+ import { AxesAndRulesDefaults } from '../../utils/constants'
2
+ import {
3
+ type HorizSectionsType,
4
+ type horizSectionPropTypes,
5
+ type secondaryYAxisType
6
+ } from '../../utils/types'
7
+ import { computeMaxAndMinItems, getLabelTextUtil } from '../../utils'
4
8
 
5
- export const getHorizSectionVals = (props) => {
9
+ export const getHorizSectionVals = (props: horizSectionPropTypes) => {
6
10
  const {
7
11
  width,
8
12
  noOfSectionsBelowXAxis,
@@ -47,10 +51,10 @@ export const getHorizSectionVals = (props) => {
47
51
  formatYLabel,
48
52
 
49
53
  secondaryData,
50
- secondaryYAxis,
51
- } = props;
54
+ secondaryYAxis
55
+ } = props
52
56
 
53
- const yAxisExtraHeightAtTop = trimYAxisAtTop ? 0 : yAxisExtraHeight;
57
+ const yAxisExtraHeightAtTop = trimYAxisAtTop ? 0 : yAxisExtraHeight
54
58
 
55
59
  /***********************************************************************************************************************************
56
60
  * *
@@ -92,69 +96,69 @@ export const getHorizSectionVals = (props) => {
92
96
  yAxisLabelPrefix: secondaryYAxis?.yAxisLabelPrefix ?? yAxisLabelPrefix,
93
97
  yAxisLabelSuffix: secondaryYAxis?.yAxisLabelSuffix ?? yAxisLabelSuffix,
94
98
  hideOrigin: secondaryYAxis?.hideOrigin ?? hideOrigin,
95
- formatYLabel: secondaryYAxis?.formatYLabel,
96
- };
99
+ formatYLabel: secondaryYAxis?.formatYLabel
100
+ }
97
101
 
98
102
  const { maxItem, minItem } = computeMaxAndMinItems(
99
103
  secondaryData,
100
104
  secondaryYAxisConfig.roundToDigits,
101
105
  secondaryYAxisConfig.showFractionalValues
102
- );
106
+ )
103
107
  secondaryYAxisConfig.maxValue =
104
- secondaryYAxisConfig.maxValue ?? (maxItem || maxValue);
108
+ secondaryYAxisConfig.maxValue ?? (maxItem || maxValue)
105
109
  secondaryYAxisConfig.mostNegativeValue =
106
- secondaryYAxisConfig.mostNegativeValue ?? minItem;
110
+ secondaryYAxisConfig.mostNegativeValue ?? minItem
107
111
  secondaryYAxisConfig.stepValue =
108
112
  secondaryYAxisConfig.stepValue ??
109
113
  (secondaryYAxisConfig.maxValue ?? 0) /
110
- (secondaryYAxisConfig.noOfSections ?? noOfSections);
114
+ (secondaryYAxisConfig.noOfSections ?? noOfSections)
111
115
  secondaryYAxisConfig.stepHeight =
112
116
  secondaryYAxisConfig.stepHeight ||
113
- containerHeight / (secondaryYAxisConfig.noOfSections ?? noOfSections);
117
+ containerHeight / (secondaryYAxisConfig.noOfSections ?? noOfSections)
114
118
 
115
- const horizSections: HorizSectionsType = [];
119
+ const horizSections: HorizSectionsType = []
116
120
  for (let i = 0; i <= noOfSections; i++) {
117
- let value = maxValue - stepValue * i;
121
+ let value = maxValue - stepValue * i
118
122
  if (showFractionalValues || roundToDigits) {
119
123
  value = parseFloat(
120
124
  value.toFixed(roundToDigits ?? AxesAndRulesDefaults.roundToDigits)
121
- );
125
+ )
122
126
  }
123
127
 
124
128
  horizSections.push({
125
129
  value: yAxisLabelTexts?.length
126
130
  ? yAxisLabelTexts[noOfSections + noOfSectionsBelowXAxis - i] ??
127
131
  value.toString()
128
- : value.toString(),
129
- });
132
+ : value.toString()
133
+ })
130
134
  }
131
135
 
132
- const horizSectionsBelow: HorizSectionsType = [];
136
+ const horizSectionsBelow: HorizSectionsType = []
133
137
  if (noOfSectionsBelowXAxis) {
134
138
  for (let i = 1; i <= noOfSectionsBelowXAxis; i++) {
135
- let value = stepValue * -i;
139
+ let value = stepValue * -i
136
140
  if (showFractionalValues || roundToDigits) {
137
141
  value = parseFloat(
138
142
  value.toFixed(roundToDigits ?? AxesAndRulesDefaults.roundToDigits)
139
- );
143
+ )
140
144
  }
141
145
  horizSectionsBelow.push({
142
146
  value: props.yAxisLabelTexts
143
147
  ? props.yAxisLabelTexts[noOfSectionsBelowXAxis - i] ??
144
148
  value.toString()
145
- : value.toString(),
146
- });
149
+ : value.toString()
150
+ })
147
151
  }
148
152
  }
149
153
 
150
- const secondaryHorizSections: HorizSectionsType = [];
154
+ const secondaryHorizSections: HorizSectionsType = []
151
155
  if (secondaryYAxis) {
152
156
  for (
153
157
  let i = 0;
154
158
  i <= (secondaryYAxisConfig.noOfSections ?? noOfSections);
155
159
  i++
156
160
  ) {
157
- let value = secondaryYAxisConfig.stepValue * i;
161
+ let value = secondaryYAxisConfig.stepValue * i
158
162
  if (
159
163
  secondaryYAxisConfig.showFractionalValues ||
160
164
  secondaryYAxisConfig.roundToDigits
@@ -164,24 +168,24 @@ export const getHorizSectionVals = (props) => {
164
168
  secondaryYAxisConfig.roundToDigits ??
165
169
  AxesAndRulesDefaults.roundToDigits
166
170
  )
167
- );
171
+ )
168
172
  }
169
173
  secondaryHorizSections.push({
170
174
  value: secondaryYAxisConfig.yAxisLabelTexts?.length
171
175
  ? secondaryYAxisConfig.yAxisLabelTexts[
172
176
  i - noOfSectionsBelowXAxis - 1
173
177
  ] ?? value.toString()
174
- : value.toString(),
175
- });
178
+ : value.toString()
179
+ })
176
180
  }
177
181
  }
178
182
 
179
- const secondaryHorizSectionsBelow: HorizSectionsType = [];
183
+ const secondaryHorizSectionsBelow: HorizSectionsType = []
180
184
  if (secondaryYAxisConfig.noOfSectionsBelowXAxis) {
181
185
  for (let i = 1; i <= secondaryYAxisConfig.noOfSectionsBelowXAxis; i++) {
182
186
  let value =
183
187
  secondaryYAxisConfig.stepValue *
184
- (i - secondaryYAxisConfig.noOfSectionsBelowXAxis - 1);
188
+ (i - secondaryYAxisConfig.noOfSectionsBelowXAxis - 1)
185
189
  if (
186
190
  secondaryYAxisConfig.showFractionalValues ||
187
191
  secondaryYAxisConfig.roundToDigits
@@ -191,13 +195,13 @@ export const getHorizSectionVals = (props) => {
191
195
  secondaryYAxisConfig.roundToDigits ??
192
196
  AxesAndRulesDefaults.roundToDigits
193
197
  )
194
- );
198
+ )
195
199
  }
196
200
  secondaryHorizSectionsBelow.push({
197
201
  value: secondaryYAxisConfig.yAxisLabelTexts?.length
198
202
  ? secondaryYAxisConfig.yAxisLabelTexts[i - 1] ?? value.toString()
199
- : value.toString(),
200
- });
203
+ : value.toString()
204
+ })
201
205
  }
202
206
  }
203
207
 
@@ -215,25 +219,25 @@ export const getHorizSectionVals = (props) => {
215
219
 
216
220
  showReferenceLine3,
217
221
  referenceLine3Position,
218
- referenceLine3Config,
219
- } = referenceLinesConfig;
222
+ referenceLine3Config
223
+ } = referenceLinesConfig
220
224
 
221
225
  const defaultReferenceConfig = {
222
226
  thickness: rulesThickness,
223
227
  width: (width || totalWidth - spacing) + endSpacing,
224
- color: "black",
228
+ color: 'black',
225
229
  type: rulesType,
226
- dashWidth: dashWidth,
227
- dashGap: dashGap,
228
- labelText: "",
230
+ dashWidth,
231
+ dashGap,
232
+ labelText: '',
229
233
  labelTextStyle: null,
230
- zIndex: 1,
231
- };
234
+ zIndex: 1
235
+ }
232
236
 
233
- showReferenceLine1 = referenceLinesConfig.showReferenceLine1 || false;
237
+ showReferenceLine1 = referenceLinesConfig.showReferenceLine1 || false
234
238
  referenceLine1Position =
235
239
  referenceLinesConfig.referenceLine1Position ??
236
- (referenceLinesConfig.referenceLine1Position || containerHeight / 2);
240
+ (referenceLinesConfig.referenceLine1Position || containerHeight / 2)
237
241
  referenceLine1Config = referenceLinesConfig.referenceLine1Config
238
242
  ? {
239
243
  thickness:
@@ -262,14 +266,14 @@ export const getHorizSectionVals = (props) => {
262
266
  defaultReferenceConfig.labelTextStyle,
263
267
  zIndex:
264
268
  referenceLinesConfig.referenceLine1Config.zIndex ??
265
- defaultReferenceConfig.zIndex,
269
+ defaultReferenceConfig.zIndex
266
270
  }
267
- : defaultReferenceConfig;
271
+ : defaultReferenceConfig
268
272
 
269
- showReferenceLine2 = referenceLinesConfig.showReferenceLine2 || false;
273
+ showReferenceLine2 = referenceLinesConfig.showReferenceLine2 || false
270
274
  referenceLine2Position =
271
275
  referenceLinesConfig.referenceLine2Position ??
272
- (referenceLinesConfig.referenceLine2Position || (3 * containerHeight) / 2);
276
+ (referenceLinesConfig.referenceLine2Position || (3 * containerHeight) / 2)
273
277
  referenceLine2Config = referenceLinesConfig.referenceLine2Config
274
278
  ? {
275
279
  thickness:
@@ -298,14 +302,14 @@ export const getHorizSectionVals = (props) => {
298
302
  defaultReferenceConfig.labelTextStyle,
299
303
  zIndex:
300
304
  referenceLinesConfig.referenceLine2Config.zIndex ??
301
- defaultReferenceConfig.zIndex,
305
+ defaultReferenceConfig.zIndex
302
306
  }
303
- : defaultReferenceConfig;
307
+ : defaultReferenceConfig
304
308
 
305
- showReferenceLine3 = referenceLinesConfig.showReferenceLine3 || false;
309
+ showReferenceLine3 = referenceLinesConfig.showReferenceLine3 || false
306
310
  referenceLine3Position =
307
311
  referenceLinesConfig.referenceLine3Position ??
308
- (referenceLinesConfig.referenceLine3Position || containerHeight / 3);
312
+ (referenceLinesConfig.referenceLine3Position || containerHeight / 3)
309
313
  referenceLine3Config = referenceLinesConfig.referenceLine3Config
310
314
  ? {
311
315
  thickness:
@@ -334,46 +338,46 @@ export const getHorizSectionVals = (props) => {
334
338
  defaultReferenceConfig.labelTextStyle,
335
339
  zIndex:
336
340
  referenceLinesConfig.referenceLine3Config.zIndex ??
337
- defaultReferenceConfig.zIndex,
341
+ defaultReferenceConfig.zIndex
338
342
  }
339
- : defaultReferenceConfig;
343
+ : defaultReferenceConfig
340
344
 
341
- const getLabelTexts = (val, index) => {
342
- return getLabelTextUtil(
343
- val,
344
- index,
345
- showFractionalValues,
346
- yAxisLabelTexts,
347
- yAxisOffset,
348
- yAxisLabelPrefix,
349
- yAxisLabelSuffix,
350
- roundToDigits ?? AxesAndRulesDefaults.roundToDigits,
351
- formatYLabel,
352
- );
353
- };
354
-
355
- const getLabelTextsForSecondaryYAxis = (val, index) => {
356
- const {
357
- showFractionalValues,
358
- yAxisLabelTexts,
359
- yAxisOffset,
360
- yAxisLabelPrefix,
361
- yAxisLabelSuffix,
362
- roundToDigits,
363
- formatYLabel,
364
- } = secondaryYAxisConfig;
365
- return getLabelTextUtil(
366
- val,
367
- index,
368
- showFractionalValues,
369
- yAxisLabelTexts,
370
- yAxisOffset,
371
- yAxisLabelPrefix,
372
- yAxisLabelSuffix,
373
- roundToDigits ?? AxesAndRulesDefaults.roundToDigits,
374
- formatYLabel,
375
- );
376
- };
345
+ const getLabelTexts = (val: string, index: number): string => {
346
+ return getLabelTextUtil(
347
+ val,
348
+ index,
349
+ showFractionalValues,
350
+ yAxisLabelTexts,
351
+ yAxisOffset,
352
+ yAxisLabelPrefix,
353
+ yAxisLabelSuffix,
354
+ roundToDigits ?? AxesAndRulesDefaults.roundToDigits,
355
+ formatYLabel
356
+ )
357
+ }
358
+
359
+ const getLabelTextsForSecondaryYAxis = (val: string, index: number): string => {
360
+ const {
361
+ showFractionalValues,
362
+ yAxisLabelTexts,
363
+ yAxisOffset,
364
+ yAxisLabelPrefix,
365
+ yAxisLabelSuffix,
366
+ roundToDigits,
367
+ formatYLabel
368
+ } = secondaryYAxisConfig
369
+ return getLabelTextUtil(
370
+ val,
371
+ index,
372
+ showFractionalValues,
373
+ yAxisLabelTexts,
374
+ yAxisOffset,
375
+ yAxisLabelPrefix,
376
+ yAxisLabelSuffix,
377
+ roundToDigits ?? AxesAndRulesDefaults.roundToDigits,
378
+ formatYLabel
379
+ )
380
+ }
377
381
 
378
382
  return {
379
383
  secondaryYAxisConfig,
@@ -392,6 +396,6 @@ export const getHorizSectionVals = (props) => {
392
396
  horizSectionsBelow,
393
397
  secondaryHorizSectionsBelow,
394
398
  getLabelTexts,
395
- getLabelTextsForSecondaryYAxis,
396
- };
397
- };
399
+ getLabelTextsForSecondaryYAxis
400
+ }
401
+ }
@@ -1,10 +1,10 @@
1
- import { useEffect, useState } from "react";
2
- import { AxesAndRulesDefaults, BarDefaults } from "../../utils/constants";
1
+ import { useEffect, useState } from 'react'
2
+ import { AxesAndRulesDefaults, BarDefaults } from '../../utils/constants'
3
3
  import {
4
- BarAndLineChartsWrapperTypes,
5
- horizSectionPropTypes,
6
- } from "../../utils/types";
7
- import { I18nManager } from "react-native";
4
+ type BarAndLineChartsWrapperTypes,
5
+ type horizSectionPropTypes
6
+ } from '../../utils/types'
7
+ import { I18nManager, type NativeScrollEvent } from 'react-native'
8
8
 
9
9
  export const useBarAndLineChartsWrapper = (
10
10
  props: BarAndLineChartsWrapperTypes
@@ -58,110 +58,110 @@ export const useBarAndLineChartsWrapper = (
58
58
  pointerY,
59
59
 
60
60
  scrollEventThrottle,
61
- endReachedOffset,
62
- } = props;
61
+ endReachedOffset
62
+ } = props
63
63
 
64
- let yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
64
+ const yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop
65
65
 
66
66
  const hideOrigin =
67
- axesAndRulesProps.hideOrigin ?? AxesAndRulesDefaults.hideOrigin;
67
+ axesAndRulesProps.hideOrigin ?? AxesAndRulesDefaults.hideOrigin
68
68
 
69
69
  const yAxisSide =
70
- axesAndRulesProps.yAxisSide ?? AxesAndRulesDefaults.yAxisSide;
71
- const yAxisLabelContainerStyle = axesAndRulesProps.yAxisLabelContainerStyle;
70
+ axesAndRulesProps.yAxisSide ?? AxesAndRulesDefaults.yAxisSide
71
+ const yAxisLabelContainerStyle = axesAndRulesProps.yAxisLabelContainerStyle
72
72
  const yAxisColor =
73
- axesAndRulesProps.yAxisColor ?? AxesAndRulesDefaults.yAxisColor;
73
+ axesAndRulesProps.yAxisColor ?? AxesAndRulesDefaults.yAxisColor
74
74
  const yAxisExtraHeight =
75
- axesAndRulesProps.yAxisExtraHeight ?? containerHeight / 20;
75
+ axesAndRulesProps.yAxisExtraHeight ?? containerHeight / 20
76
76
  const trimYAxisAtTop =
77
- axesAndRulesProps.trimYAxisAtTop ?? AxesAndRulesDefaults.trimYAxisAtTop;
77
+ axesAndRulesProps.trimYAxisAtTop ?? AxesAndRulesDefaults.trimYAxisAtTop
78
78
  const overflowTop =
79
- axesAndRulesProps.overflowTop ?? AxesAndRulesDefaults.overflowTop;
79
+ axesAndRulesProps.overflowTop ?? AxesAndRulesDefaults.overflowTop
80
80
  const yAxisThickness =
81
- axesAndRulesProps.yAxisThickness ?? AxesAndRulesDefaults.yAxisThickness;
81
+ axesAndRulesProps.yAxisThickness ?? AxesAndRulesDefaults.yAxisThickness
82
82
  const xAxisColor =
83
- axesAndRulesProps.xAxisColor ?? AxesAndRulesDefaults.xAxisColor;
84
- const xAxisLength = axesAndRulesProps.xAxisLength;
83
+ axesAndRulesProps.xAxisColor ?? AxesAndRulesDefaults.xAxisColor
84
+ const xAxisLength = axesAndRulesProps.xAxisLength
85
85
  const xAxisType =
86
- axesAndRulesProps.xAxisType ?? AxesAndRulesDefaults.xAxisType;
86
+ axesAndRulesProps.xAxisType ?? AxesAndRulesDefaults.xAxisType
87
87
  const xAxisLabelsVerticalShift =
88
88
  axesAndRulesProps.xAxisLabelsVerticalShift ??
89
- AxesAndRulesDefaults.xAxisLabelsVerticalShift;
90
- const xAxisLabelsHeight = axesAndRulesProps.xAxisLabelsHeight;
91
- const xAxisTextNumberOfLines = axesAndRulesProps.xAxisTextNumberOfLines;
89
+ AxesAndRulesDefaults.xAxisLabelsVerticalShift
90
+ const xAxisLabelsHeight = axesAndRulesProps.xAxisLabelsHeight
91
+ const xAxisTextNumberOfLines = axesAndRulesProps.xAxisTextNumberOfLines
92
92
  const dashWidth =
93
- axesAndRulesProps.dashWidth ?? AxesAndRulesDefaults.dashWidth;
94
- const dashGap = axesAndRulesProps.dashGap ?? AxesAndRulesDefaults.dashGap;
93
+ axesAndRulesProps.dashWidth ?? AxesAndRulesDefaults.dashWidth
94
+ const dashGap = axesAndRulesProps.dashGap ?? AxesAndRulesDefaults.dashGap
95
95
  const backgroundColor =
96
- axesAndRulesProps.backgroundColor ?? AxesAndRulesDefaults.backgroundColor;
96
+ axesAndRulesProps.backgroundColor ?? AxesAndRulesDefaults.backgroundColor
97
97
  const hideRules =
98
- axesAndRulesProps.hideRules ?? AxesAndRulesDefaults.hideRules;
99
- const rulesLength = axesAndRulesProps.rulesLength;
98
+ axesAndRulesProps.hideRules ?? AxesAndRulesDefaults.hideRules
99
+ const rulesLength = axesAndRulesProps.rulesLength
100
100
  const rulesType =
101
- axesAndRulesProps.rulesType ?? AxesAndRulesDefaults.rulesType;
101
+ axesAndRulesProps.rulesType ?? AxesAndRulesDefaults.rulesType
102
102
  const rulesThickness =
103
- axesAndRulesProps.rulesThickness ?? AxesAndRulesDefaults.rulesThickness;
103
+ axesAndRulesProps.rulesThickness ?? AxesAndRulesDefaults.rulesThickness
104
104
  const rulesColor =
105
- axesAndRulesProps.rulesColor ?? AxesAndRulesDefaults.rulesColor;
105
+ axesAndRulesProps.rulesColor ?? AxesAndRulesDefaults.rulesColor
106
106
  const rulesConfigArray =
107
- axesAndRulesProps.rulesConfigArray ?? AxesAndRulesDefaults.rulesConfigArray;
108
- const showYAxisIndices = axesAndRulesProps.showYAxisIndices ?? false;
107
+ axesAndRulesProps.rulesConfigArray ?? AxesAndRulesDefaults.rulesConfigArray
108
+ const showYAxisIndices = axesAndRulesProps.showYAxisIndices ?? false
109
109
  const yAxisIndicesHeight =
110
110
  axesAndRulesProps.yAxisIndicesHeight ??
111
- AxesAndRulesDefaults.yAxisIndicesHeight;
111
+ AxesAndRulesDefaults.yAxisIndicesHeight
112
112
  const yAxisIndicesWidth =
113
113
  axesAndRulesProps.yAxisIndicesWidth ??
114
- AxesAndRulesDefaults.yAxisIndicesWidth;
114
+ AxesAndRulesDefaults.yAxisIndicesWidth
115
115
  const yAxisIndicesColor =
116
116
  axesAndRulesProps.yAxisIndicesColor ??
117
- AxesAndRulesDefaults.yAxisIndicesColor;
117
+ AxesAndRulesDefaults.yAxisIndicesColor
118
118
  const hideYAxisText =
119
- axesAndRulesProps.hideYAxisText ?? AxesAndRulesDefaults.hideYAxisText;
119
+ axesAndRulesProps.hideYAxisText ?? AxesAndRulesDefaults.hideYAxisText
120
120
  const yAxisTextNumberOfLines =
121
121
  axesAndRulesProps.yAxisTextNumberOfLines ??
122
- AxesAndRulesDefaults.yAxisTextNumberOfLines;
123
- const yAxisLabelPrefix = axesAndRulesProps.yAxisLabelPrefix ?? "";
124
- const yAxisLabelSuffix = axesAndRulesProps.yAxisLabelSuffix ?? "";
125
- const yAxisTextStyle = axesAndRulesProps.yAxisTextStyle;
126
- const secondaryYAxis = axesAndRulesProps.secondaryYAxis;
127
- const stepValue = axesAndRulesProps.stepValue;
128
- const roundToDigits = axesAndRulesProps.roundToDigits;
122
+ AxesAndRulesDefaults.yAxisTextNumberOfLines
123
+ const yAxisLabelPrefix = axesAndRulesProps.yAxisLabelPrefix ?? ''
124
+ const yAxisLabelSuffix = axesAndRulesProps.yAxisLabelSuffix ?? ''
125
+ const yAxisTextStyle = axesAndRulesProps.yAxisTextStyle
126
+ const secondaryYAxis = axesAndRulesProps.secondaryYAxis
127
+ const stepValue = axesAndRulesProps.stepValue
128
+ const roundToDigits = axesAndRulesProps.roundToDigits
129
129
 
130
- const referenceLinesConfig = axesAndRulesProps.referenceLinesConfig;
130
+ const referenceLinesConfig = axesAndRulesProps.referenceLinesConfig
131
131
  const referenceLinesOverChartContent =
132
132
  referenceLinesConfig.referenceLinesOverChartContent ??
133
- AxesAndRulesDefaults.referenceLinesOverChartContent;
133
+ AxesAndRulesDefaults.referenceLinesOverChartContent
134
134
 
135
135
  const showVerticalLines =
136
136
  axesAndRulesProps.showVerticalLines ??
137
- AxesAndRulesDefaults.showVerticalLines;
137
+ AxesAndRulesDefaults.showVerticalLines
138
138
  const verticalLinesThickness =
139
139
  axesAndRulesProps.verticalLinesThickness ??
140
- AxesAndRulesDefaults.verticalLinesThickness;
141
- const verticalLinesHeight = axesAndRulesProps.verticalLinesHeight;
140
+ AxesAndRulesDefaults.verticalLinesThickness
141
+ const verticalLinesHeight = axesAndRulesProps.verticalLinesHeight
142
142
  const verticalLinesColor =
143
143
  axesAndRulesProps.verticalLinesColor ??
144
- AxesAndRulesDefaults.verticalLinesColor;
144
+ AxesAndRulesDefaults.verticalLinesColor
145
145
  const verticalLinesStrokeDashArray =
146
146
  axesAndRulesProps.verticalLinesStrokeDashArray ??
147
- AxesAndRulesDefaults.verticalLinesStrokeDashArray;
147
+ AxesAndRulesDefaults.verticalLinesStrokeDashArray
148
148
  const verticalLinesShift =
149
149
  axesAndRulesProps.verticalLinesShift ??
150
- AxesAndRulesDefaults.verticalLinesShift;
150
+ AxesAndRulesDefaults.verticalLinesShift
151
151
  const verticalLinesZIndex =
152
152
  axesAndRulesProps.verticalLinesZIndex ??
153
- AxesAndRulesDefaults.verticalLinesZIndex;
153
+ AxesAndRulesDefaults.verticalLinesZIndex
154
154
  const verticalLinesSpacing =
155
155
  axesAndRulesProps.verticalLinesSpacing ??
156
- AxesAndRulesDefaults.verticalLinesSpacing;
156
+ AxesAndRulesDefaults.verticalLinesSpacing
157
157
  const verticalLinesUptoDataPoint =
158
158
  axesAndRulesProps.verticalLinesUptoDataPoint ??
159
- AxesAndRulesDefaults.verticalLinesUptoDataPoint;
160
- const noOfVerticalLines = axesAndRulesProps.noOfVerticalLines;
159
+ AxesAndRulesDefaults.verticalLinesUptoDataPoint
160
+ const noOfVerticalLines = axesAndRulesProps.noOfVerticalLines
161
161
 
162
162
  const verticalLinesAr = noOfVerticalLines
163
163
  ? [...Array(noOfVerticalLines).keys()]
164
- : [...Array(stackData ? stackData.length : data.length).keys()];
164
+ : [...Array(stackData ? stackData.length : data.length).keys()]
165
165
 
166
166
  const horizSectionProps: horizSectionPropTypes = {
167
167
  width,
@@ -225,8 +225,8 @@ export const useBarAndLineChartsWrapper = (
225
225
 
226
226
  secondaryData,
227
227
  secondaryYAxis,
228
- formatYLabel: axesAndRulesProps.formatYLabel,
229
- };
228
+ formatYLabel: axesAndRulesProps.formatYLabel
229
+ }
230
230
 
231
231
  const lineInBarChartProps = {
232
232
  yAxisLabelWidth,
@@ -244,17 +244,17 @@ export const useBarAndLineChartsWrapper = (
244
244
  barWidth,
245
245
  labelsExtraHeight,
246
246
  scrollEventThrottle,
247
- xAxisLabelsVerticalShift,
248
- };
247
+ xAxisLabelsVerticalShift
248
+ }
249
249
  const lineInBarChartProps2 = {
250
250
  ...lineInBarChartProps,
251
251
  lineConfig: lineConfig2,
252
252
  points: points2,
253
- data: lineData2,
254
- };
255
- const extendedContainerHeight = containerHeight + overflowTop + 10;
253
+ data: lineData2
254
+ }
255
+ const extendedContainerHeight = containerHeight + overflowTop + 10
256
256
  const containerHeightIncludingBelowXAxis =
257
- extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
257
+ extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight
258
258
  const verticalLinesProps = {
259
259
  verticalLinesAr,
260
260
  verticalLinesSpacing,
@@ -278,28 +278,28 @@ export const useBarAndLineChartsWrapper = (
278
278
  containerHeightIncludingBelowXAxis,
279
279
  yAxisLabelWidth,
280
280
  totalWidth,
281
- xAxisLabelsVerticalShift,
282
- };
281
+ xAxisLabelsVerticalShift
282
+ }
283
283
 
284
284
  const actualContainerHeight =
285
- containerHeightIncludingBelowXAxis + labelsExtraHeight - 10;
286
- const actualContainerWidth = (width ?? totalWidth) + yAxisLabelWidth;
285
+ containerHeightIncludingBelowXAxis + labelsExtraHeight - 10
286
+ const actualContainerWidth = (width ?? totalWidth) + yAxisLabelWidth
287
287
 
288
288
  /*******************************************************************************************************************************************/
289
- /*************** horizontal chart related calculations *******************/
289
+ /** ************* horizontal chart related calculations *******************/
290
290
  /*******************************************************************************************************************************************/
291
291
 
292
292
  const containerHeightIncludingXaxisLabels =
293
- actualContainerHeight + BarDefaults.labelsWidthForHorizontal;
293
+ actualContainerHeight + BarDefaults.labelsWidthForHorizontal
294
294
 
295
295
  const difBwWidthHeight =
296
- actualContainerWidth - containerHeightIncludingXaxisLabels;
296
+ actualContainerWidth - containerHeightIncludingXaxisLabels
297
297
 
298
298
  const transformForHorizontal = [
299
- { rotate: rtl ? "-90deg" : "90deg" },
299
+ { rotate: rtl ? '-90deg' : '90deg' },
300
300
  {
301
301
  translateY:
302
- -shiftX + (rtl ? -difBwWidthHeight + 14 : difBwWidthHeight) / 2 - 20,
302
+ -shiftX + (rtl ? -difBwWidthHeight + 14 : difBwWidthHeight) / 2 - 20
303
303
  },
304
304
  {
305
305
  translateX:
@@ -311,18 +311,22 @@ export const useBarAndLineChartsWrapper = (
311
311
  ? difBwWidthHeight
312
312
  : difBwWidthHeight - 40) /
313
313
  2 +
314
- (yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52),
315
- },
316
- ];
314
+ (yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52)
315
+ }
316
+ ]
317
317
 
318
- const [canMomentum, setCanMomentum] = useState(false);
318
+ const [canMomentum, setCanMomentum] = useState(false)
319
319
 
320
- const isCloseToEnd = ({ layoutMeasurement, contentOffset, contentSize }) => {
320
+ const isCloseToEnd = ({
321
+ layoutMeasurement,
322
+ contentOffset,
323
+ contentSize
324
+ }: NativeScrollEvent): boolean => {
321
325
  return I18nManager.isRTL
322
326
  ? contentOffset.x <= initialSpacing
323
327
  : layoutMeasurement.width + contentOffset.x >=
324
- contentSize.width - initialSpacing - endReachedOffset;
325
- };
328
+ contentSize.width - initialSpacing - endReachedOffset
329
+ }
326
330
 
327
331
  // const isCloseToStart = ({ layoutMeasurement, contentOffset }) => {
328
332
  // return layoutMeasurement.width + contentOffset.x <= initialSpacing;
@@ -331,19 +335,19 @@ export const useBarAndLineChartsWrapper = (
331
335
  const isCloseToStart = ({
332
336
  layoutMeasurement,
333
337
  contentOffset,
334
- contentSize,
335
- }) => {
338
+ contentSize
339
+ }: NativeScrollEvent): boolean => {
336
340
  return I18nManager.isRTL
337
341
  ? layoutMeasurement.width + contentOffset.x >=
338
342
  contentSize.width - initialSpacing - endReachedOffset
339
- : contentOffset.x <= initialSpacing;
340
- };
343
+ : contentOffset.x <= initialSpacing
344
+ }
341
345
 
342
346
  useEffect(() => {
343
347
  if (pointerConfig && getPointerProps) {
344
- getPointerProps({ pointerIndex, pointerX, pointerY });
348
+ getPointerProps({ pointerIndex, pointerX, pointerY })
345
349
  }
346
- }, [pointerIndex, pointerX, pointerY]);
350
+ }, [pointerIndex, pointerX, pointerY])
347
351
 
348
352
  return {
349
353
  containerHeightIncludingBelowXAxis,
@@ -367,6 +371,6 @@ export const useBarAndLineChartsWrapper = (
367
371
  showVerticalLines,
368
372
  verticalLinesProps,
369
373
  lineInBarChartProps,
370
- lineInBarChartProps2,
371
- };
372
- };
374
+ lineInBarChartProps2
375
+ }
376
+ }