gifted-charts-core 0.0.11 → 0.0.12

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.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "index.ts",
6
6
  "files": [
@@ -276,12 +276,20 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
276
276
  const endIndex5 = props.endIndex5 ?? data5.length - 1;
277
277
 
278
278
  const lineSegments = !interpolateMissingValues
279
- ? getLineSegmentsForMissingValues(data)
279
+ ? getLineSegmentsForMissingValues(props.data)
280
280
  : props.lineSegments;
281
- const lineSegments2 = props.lineSegments2;
282
- const lineSegments3 = props.lineSegments3;
283
- const lineSegments4 = props.lineSegments4;
284
- const lineSegments5 = props.lineSegments5;
281
+ const lineSegments2 = !interpolateMissingValues
282
+ ? getLineSegmentsForMissingValues(props.data2)
283
+ : props.lineSegments2;
284
+ const lineSegments3 = !interpolateMissingValues
285
+ ? getLineSegmentsForMissingValues(props.data3)
286
+ : props.lineSegments3;
287
+ const lineSegments4 = !interpolateMissingValues
288
+ ? getLineSegmentsForMissingValues(props.data4)
289
+ : props.lineSegments4;
290
+ const lineSegments5 = !interpolateMissingValues
291
+ ? getLineSegmentsForMissingValues(props.data5)
292
+ : props.lineSegments5;
285
293
 
286
294
  const highlightedRange = props.highlightedRange;
287
295
 
@@ -1339,14 +1339,15 @@ export const getInterpolatedData = (
1339
1339
  };
1340
1340
 
1341
1341
  export const getLineSegmentsForMissingValues = (
1342
- data: lineDataItem[]
1343
- ): LineSegment[] => {
1342
+ data?: lineDataItem[]
1343
+ ): LineSegment[] | undefined => {
1344
+ if (!data?.length) return undefined;
1344
1345
  let i,
1345
1346
  n = data.length;
1346
1347
  const numericValuesLength = data.filter(
1347
1348
  (item) => typeof item.value === "number"
1348
1349
  ).length;
1349
- if (!numericValuesLength) return [];
1350
+ if (!numericValuesLength) return undefined;
1350
1351
  const segments: LineSegment[] = [];
1351
1352
  for (i = 0; i < n; i++) {
1352
1353
  if (typeof data[i].value !== "number") {