gifted-charts-core 0.1.48 → 0.1.50

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,6 +1,6 @@
1
1
  import { GestureResponderEvent, type ColorValue } from 'react-native';
2
2
  import { type yAxisSides } from '../utils/constants';
3
- import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap, type IntersectionAreaConfig } from '../utils/types';
3
+ import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap, type IntersectionAreaConfig, CustomBackground } from '../utils/types';
4
4
  export interface LineChartPropsType {
5
5
  height?: number;
6
6
  overflowTop?: number;
@@ -50,6 +50,7 @@ export interface LineChartPropsType {
50
50
  onDataChangeAnimationDuration?: number;
51
51
  animationEasing?: any;
52
52
  animateTogether?: boolean;
53
+ renderDataPointsAfterAnimationEnds?: boolean;
53
54
  xAxisLength?: number;
54
55
  xAxisThickness?: number;
55
56
  xAxisColor?: ColorValue;
@@ -161,10 +162,13 @@ export interface LineChartPropsType {
161
162
  yAxisLabelWidth?: number;
162
163
  hideYAxisText?: boolean;
163
164
  backgroundColor?: ColorValue;
165
+ customBackground?: CustomBackground;
164
166
  curved?: boolean;
165
167
  curvature?: number;
166
168
  curveType?: CurveType;
167
169
  horizSections?: sectionType[];
170
+ focusTogether?: boolean;
171
+ focusProximity?: number;
168
172
  hideDataPoints?: boolean;
169
173
  dataPointsHeight?: number;
170
174
  dataPointsWidth?: number;
@@ -314,7 +318,7 @@ export interface LineChartPropsType {
314
318
  intersectionAreaConfig?: IntersectionAreaConfig;
315
319
  }
316
320
  export interface lineDataItem {
317
- value: number;
321
+ value?: number;
318
322
  label?: string;
319
323
  labelComponent?: Function;
320
324
  labelTextStyle?: any;
@@ -363,6 +367,9 @@ export interface lineDataItem {
363
367
  showXAxisIndex?: boolean;
364
368
  hidePointer?: boolean;
365
369
  }
370
+ export interface lineDataItemNullSafe extends lineDataItem {
371
+ value: number;
372
+ }
366
373
  interface sectionType {
367
374
  value: string;
368
375
  }
@@ -38,7 +38,7 @@ import { useEffect, useState } from 'react';
38
38
  import { AxesAndRulesDefaults, BarDefaults } from '../../utils/constants';
39
39
  import { computeMaxAndMinItems } from '../../utils';
40
40
  export var useBarAndLineChartsWrapper = function (props) {
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;
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;
42
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;
43
43
  var yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
44
44
  var hideOrigin = (_a = axesAndRulesProps.hideOrigin) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.hideOrigin;
@@ -104,8 +104,8 @@ export var useBarAndLineChartsWrapper = function (props) {
104
104
  var secondaryDataArrayWithMinValue = (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length)
105
105
  ? secondaryData
106
106
  : setWithMinValueInDataset === null || setWithMinValueInDataset === void 0 ? void 0 : setWithMinValueInDataset.data;
107
- var _19 = 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 = _19.maxItem, secondaryMinItem = _19.minItem;
108
- var _20 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepValue = _20.stepValue, secondaryNegativeStepValue = _20.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _20.noOfSectionsBelowXAxis, showSecondaryFractionalValues = _20.showFractionalValues, secondaryRoundToDigits = _20.roundToDigits, secondaryStepHeight = _20.stepHeight, secondaryNegativeStepHeight = _20.negativeStepHeight;
107
+ var _20 = 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 = _20.maxItem, secondaryMinItem = _20.minItem;
108
+ var _21 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepValue = _21.stepValue, secondaryNegativeStepValue = _21.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _21.noOfSectionsBelowXAxis, showSecondaryFractionalValues = _21.showFractionalValues, secondaryRoundToDigits = _21.roundToDigits, secondaryStepHeight = _21.stepHeight, secondaryNegativeStepHeight = _21.negativeStepHeight;
109
109
  var primaryYAxisHeightBelowOrigin = noOfSectionsBelowXAxis * negativeStepHeight;
110
110
  var secondaryYAxisHeightBelowOrigin = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
111
111
  var biggerNegativeYAxisHeight = Math.max(primaryYAxisHeightBelowOrigin, secondaryYAxisHeightBelowOrigin);
@@ -178,7 +178,8 @@ export var useBarAndLineChartsWrapper = function (props) {
178
178
  showSecondaryFractionalValues: showSecondaryFractionalValues,
179
179
  secondaryRoundToDigits: secondaryRoundToDigits,
180
180
  secondaryStepHeight: secondaryStepHeight,
181
- secondaryNegativeStepHeight: secondaryNegativeStepHeight
181
+ secondaryNegativeStepHeight: secondaryNegativeStepHeight,
182
+ customBackground: props.customBackground
182
183
  };
183
184
  var lineInBarChartProps = {
184
185
  yAxisLabelWidth: yAxisLabelWidth,
@@ -201,15 +202,16 @@ export var useBarAndLineChartsWrapper = function (props) {
201
202
  selectedIndex: selectedIndex,
202
203
  yAxisOffset: (lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.isSecondary)
203
204
  ? (_16 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset) !== null && _16 !== void 0 ? _16 : 0
204
- : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0
205
+ : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0,
206
+ strokeDashArray: (_17 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.strokeDashArray) !== null && _17 !== void 0 ? _17 : [0, 0]
205
207
  };
206
208
  var lineInBarChartProps2 = __assign(__assign({}, lineInBarChartProps), { lineConfig: lineConfig2, points: points2, data: lineData2 !== null && lineData2 !== void 0 ? lineData2 : [], yAxisOffset: (lineConfig2 === null || lineConfig2 === void 0 ? void 0 : lineConfig2.isSecondary)
207
- ? (_17 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset) !== null && _17 !== void 0 ? _17 : 0
209
+ ? (_18 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset) !== null && _18 !== void 0 ? _18 : 0
208
210
  : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0 });
209
211
  var verticalLinesProps = {
210
212
  verticalLinesAr: verticalLinesAr,
211
213
  verticalLinesSpacing: verticalLinesSpacing,
212
- spacing: (_18 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.spacing) !== null && _18 !== void 0 ? _18 : spacing,
214
+ spacing: (_19 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.spacing) !== null && _19 !== void 0 ? _19 : spacing,
213
215
  initialSpacing: initialSpacing,
214
216
  verticalLinesZIndex: verticalLinesZIndex,
215
217
  verticalLinesHeight: verticalLinesHeight,
@@ -264,7 +266,7 @@ export var useBarAndLineChartsWrapper = function (props) {
264
266
  : difBwWidthHeight - 40) /
265
267
  2 +
266
268
  (yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52), ")");
267
- var _21 = __read(useState(false), 2), canMomentum = _21[0], setCanMomentum = _21[1];
269
+ var _22 = __read(useState(false), 2), canMomentum = _22[0], setCanMomentum = _22[1];
268
270
  var isCloseToEnd = function (_a) {
269
271
  var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
270
272
  return isRTL
package/dist/index.d.ts CHANGED
@@ -4,13 +4,13 @@
4
4
  export { useBarChart } from './BarChart';
5
5
  export { getPropsForAnimated2DWithGradient } from './BarChart/Animated2DWithGradient';
6
6
  export { useRenderStackBars } from './BarChart/RenderStackBars';
7
- export { type stackDataItem, type StackedBarChartPropsType, type BarChartPropsType, type defaultLineConfigType, type barDataItem, type Animated2DWithGradientPropsType, type RenderBarsPropsType, type trianglePropTypes, type animatedBarPropTypes, type FocusedBarConfig, type CommonPropsFor2dand3dBarsType } from './BarChart/types';
7
+ export { type stackDataItem, type StackedBarChartPropsType, type BarChartPropsType, type defaultLineConfigType, type barDataItem, type barDataItemNullSafe, type Animated2DWithGradientPropsType, type RenderBarsPropsType, type trianglePropTypes, type animatedBarPropTypes, type FocusedBarConfig, type CommonPropsFor2dand3dBarsType } from './BarChart/types';
8
8
  /************************************************************************************************************************
9
9
  /***************************************** Line Chart *****************************************
10
10
  /************************************************************************************************************************/
11
11
  export { useLineChart } from './LineChart';
12
12
  export { useLineChartBiColor } from './LineChart/LineChartBiColor';
13
- export { type LineChartPropsType, type lineDataItem, type bicolorLineDataItem, type LineChartBicolorPropsType } from './LineChart/types';
13
+ export { type LineChartPropsType, type lineDataItem, type lineDataItemNullSafe, type bicolorLineDataItem, type LineChartBicolorPropsType } from './LineChart/types';
14
14
  /***********************************************************************************************************************
15
15
  /***************************************** Pie Chart *****************************************
16
16
  /***********************************************************************************************************************/
@@ -36,4 +36,4 @@ export { type StripAndLabelProps } from './components/common/types';
36
36
  /***********************************************************************************************************************/
37
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
- 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';
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, type DataSetNullSafe, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap, type IntersectionAreaConfig, type LabelLineConfig } from './utils/types';
@@ -132,6 +132,7 @@ export declare const LineDefaults: {
132
132
  endSpacing: number;
133
133
  animationDuration: number;
134
134
  animateTogether: boolean;
135
+ renderDataPointsAfterAnimationEnds: boolean;
135
136
  disableScroll: boolean;
136
137
  scrollToEnd: boolean;
137
138
  scrollAnimation: boolean;
@@ -187,10 +188,12 @@ export declare const defaultPointerConfig: {
187
188
  autoAdjustPointerLabelPosition: boolean;
188
189
  pointerVanishDelay: number;
189
190
  activatePointersOnLongPress: boolean;
191
+ activatePointersInstantlyOnTouch: boolean;
190
192
  activatePointersDelay: number;
191
193
  initialPointerIndex: number;
192
194
  initialPointerAppearDelay: number;
193
195
  persistPointer: boolean;
196
+ resetPointerIndexOnRelease: boolean;
194
197
  hidePointers: boolean;
195
198
  hidePointer1: boolean;
196
199
  hidePointer2: boolean;
@@ -144,6 +144,7 @@ export var LineDefaults = {
144
144
  endSpacing: 20,
145
145
  animationDuration: defaultAnimationDuration,
146
146
  animateTogether: false,
147
+ renderDataPointsAfterAnimationEnds: false,
147
148
  disableScroll: false,
148
149
  scrollToEnd: false,
149
150
  scrollAnimation: true,
@@ -229,10 +230,12 @@ export var defaultPointerConfig = {
229
230
  autoAdjustPointerLabelPosition: false,
230
231
  pointerVanishDelay: 150,
231
232
  activatePointersOnLongPress: false,
233
+ activatePointersInstantlyOnTouch: true,
232
234
  activatePointersDelay: 150,
233
235
  initialPointerIndex: -1,
234
236
  initialPointerAppearDelay: 0,
235
237
  persistPointer: false,
238
+ resetPointerIndexOnRelease: false,
236
239
  hidePointers: false,
237
240
  hidePointer1: false,
238
241
  hidePointer2: false,
@@ -1,7 +1,7 @@
1
1
  import { type ColorValue } from 'react-native';
2
- import { type IDataSanitisationProps, type lineDataItem } from '../LineChart/types';
2
+ import { lineDataItemNullSafe, type IDataSanitisationProps, type lineDataItem } from '../LineChart/types';
3
3
  import { type arrowConfigType, CurveType, type HighlightedRange, type LineProperties, type LineSegment, Framework, referenceConfigType, secondaryYAxisType } from './types';
4
- import { type lineConfigType, type BarChartPropsType, type FocusedBarConfig, type barDataItem } from '../BarChart/types';
4
+ import { type lineConfigType, type BarChartPropsType, type FocusedBarConfig, type barDataItem, barDataItemNullSafe } from '../BarChart/types';
5
5
  import { type extendedLineChartPropsType } from '../LineChart';
6
6
  import { type extendedBarChartPropsType } from '../BarChart';
7
7
  export declare const getCumulativeWidth: (data: any, index: number, spacing: number) => number;
@@ -12,7 +12,7 @@ export declare const bezierCommand: (point: number[], i: number, a: number[][],
12
12
  export declare const getSegmentString: (lineSegment: LineSegment[] | undefined, index: number, startDelimeter: string, endDelimeter: string) => string;
13
13
  export declare const getCurvePathWithSegments: (path: string, lineSegment: LineSegment[] | undefined, startDelimeter: string, endDelimeter: string, curveType: CurveType) => string;
14
14
  export declare const getPreviousSegmentsLastPoint: (isCurved: boolean, previousSegment: string) => string;
15
- export declare const getPathWithHighlight: (data: lineDataItem[], i: number, highlightedRange: HighlightedRange, startIndex: number, endIndex: number, spacingArray: number[], getX: (spacingArray: number[], i: number) => number, getY: (value: number) => number) => string;
15
+ export declare const getPathWithHighlight: (data: lineDataItemNullSafe[], i: number, highlightedRange: HighlightedRange, startIndex: number, endIndex: number, spacingArray: number[], getX: (spacingArray: number[], i: number) => number, getY: (value: number) => number) => string;
16
16
  export declare const getRegionPathObjects: (points: string, color: ColorValue, currentLineThickness: number, thickness: number, strokeDashArray: number[], isCurved: boolean, startDelimeter: string, stop: string, endDelimeter: string, curveType: CurveType) => LineProperties[];
17
17
  export declare const getSegmentedPathObjects: (points: string, color: ColorValue, currentLineThickness: number, thickness: number, strokeDashArray: number[], isCurved: boolean, startDelimeter: string, endDelimeter: string, curveType: CurveType) => LineProperties[];
18
18
  export declare const getArrowPoints: (arrowTipX: number, arrowTipY: number, x1: number, y1: number, arrowLength?: number, arrowWidth?: number, showArrowBase?: boolean) => string;
@@ -41,7 +41,7 @@ interface IgetAxesAndRulesProps extends BarChartPropsType {
41
41
  }
42
42
  export declare const getAxesAndRulesProps: (props: extendedBarChartPropsType, containerHeight: number, stepHeight: number, stepValue: number, noOfSections: number, roundToDigits: number, negativeStepValue: number, secondaryMaxValue: number, secondaryMinItem: number, showSecondaryFractionalValues: boolean, secondaryRoundToDigits: number) => IgetAxesAndRulesProps;
43
43
  export declare const getExtendedContainerHeightWithPadding: (containerHeight: number, overflowTop?: number) => number;
44
- export declare const getSecondaryDataWithOffsetIncluded: (secondaryData?: barDataItem[] | lineDataItem[], secondaryYAxis?: any | undefined, showDataPointsForMissingValues?: boolean, interpolateMissingValues?: boolean, onlyPositive?: boolean) => barDataItem[] | lineDataItem[] | undefined;
44
+ export declare const getSecondaryDataWithOffsetIncluded: (secondaryData?: barDataItem[] | lineDataItem[], secondaryYAxis?: any | undefined, showDataPointsForMissingValues?: boolean, interpolateMissingValues?: boolean, onlyPositive?: boolean) => barDataItemNullSafe[] | lineDataItemNullSafe[] | undefined;
45
45
  export declare const getArrowProperty: (property: string, count: number, props: extendedLineChartPropsType, defaultArrowConfig: arrowConfigType) => any;
46
46
  interface IgetAllArrowProperties {
47
47
  arrowLength1: number;
@@ -101,12 +101,12 @@ export declare const getBarFrontColor: (isFocused?: boolean, focusedBarConfig?:
101
101
  export declare const getBarSideColor: (isFocused?: boolean, focusedBarConfig?: FocusedBarConfig, itemSideColor?: ColorValue, sideColor?: ColorValue) => ColorValue | undefined;
102
102
  export declare const getBarTopColor: (isFocused?: boolean, focusedBarConfig?: FocusedBarConfig, itemTopColor?: ColorValue, topColor?: ColorValue) => ColorValue | undefined;
103
103
  export declare const getBarWidth: (isFocused?: boolean, focusedBarConfig?: FocusedBarConfig, itemBarWidth?: number, barWidth?: number) => number;
104
- export declare const getInterpolatedData: (dataParam: lineDataItem[], showDataPointsForMissingValues?: boolean, interpolateMissingValues?: boolean, onlyPositive?: boolean) => lineDataItem[];
104
+ export declare const getInterpolatedData: (dataParam: lineDataItem[], showDataPointsForMissingValues?: boolean, interpolateMissingValues?: boolean, onlyPositive?: boolean) => lineDataItemNullSafe[];
105
105
  export declare const getLineSegmentsDueToNoExtrapolation: (data?: lineDataItem[]) => LineSegment[] | undefined;
106
106
  export declare const getLineSegmentsForMissingValues: (data?: lineDataItem[]) => LineSegment[] | undefined;
107
107
  export declare const getTextSizeForPieLabels: (textSize: number, radius: number) => number;
108
- export declare const adjustToOffset: (data: lineDataItem[], yAxisOffset?: number) => lineDataItem[];
109
- export declare const getSanitisedData: (data: lineDataItem[] | undefined, dataSanitisationProps: IDataSanitisationProps) => lineDataItem[];
108
+ export declare const adjustToOffset: (data: lineDataItemNullSafe[], yAxisOffset?: number) => lineDataItemNullSafe[];
109
+ export declare const getSanitisedData: (data: lineDataItem[] | undefined, dataSanitisationProps: IDataSanitisationProps) => lineDataItemNullSafe[];
110
110
  export declare const getStrokeDashArray: (strokeDash?: number[] | string, framework?: Framework) => number[] | string | undefined;
111
111
  export declare const emptyExternaLabelProperties: {
112
112
  labelLineColor: string;
@@ -788,7 +788,7 @@ export var clone = function (obj) {
788
788
  return temp;
789
789
  };
790
790
  export var getLineConfigForBarChart = function (lineConfig, barInitialSpacing) {
791
- 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;
791
+ 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;
792
792
  return {
793
793
  initialSpacing: (_b = (_a = lineConfig.initialSpacing) !== null && _a !== void 0 ? _a : barInitialSpacing) !== null && _b !== void 0 ? _b : defaultLineConfig.initialSpacing,
794
794
  spacing: lineConfig.spacing,
@@ -799,37 +799,38 @@ export var getLineConfigForBarChart = function (lineConfig, barInitialSpacing) {
799
799
  animationDuration: (_g = lineConfig.animationDuration) !== null && _g !== void 0 ? _g : defaultLineConfig.animationDuration,
800
800
  thickness: (_h = lineConfig.thickness) !== null && _h !== void 0 ? _h : defaultLineConfig.thickness,
801
801
  color: (_j = lineConfig.color) !== null && _j !== void 0 ? _j : defaultLineConfig.color,
802
- hideDataPoints: (_k = lineConfig.hideDataPoints) !== null && _k !== void 0 ? _k : defaultLineConfig.hideDataPoints,
803
- dataPointsShape: (_l = lineConfig.dataPointsShape) !== null && _l !== void 0 ? _l : defaultLineConfig.dataPointsShape,
804
- dataPointsHeight: (_m = lineConfig.dataPointsHeight) !== null && _m !== void 0 ? _m : defaultLineConfig.dataPointsHeight,
805
- dataPointsWidth: (_o = lineConfig.dataPointsWidth) !== null && _o !== void 0 ? _o : defaultLineConfig.dataPointsWidth,
806
- dataPointsColor: (_p = lineConfig.dataPointsColor) !== null && _p !== void 0 ? _p : defaultLineConfig.dataPointsColor,
807
- dataPointsRadius: (_q = lineConfig.dataPointsRadius) !== null && _q !== void 0 ? _q : defaultLineConfig.dataPointsRadius,
808
- textColor: (_r = lineConfig.textColor) !== null && _r !== void 0 ? _r : defaultLineConfig.textColor,
809
- textFontSize: (_s = lineConfig.textFontSize) !== null && _s !== void 0 ? _s : defaultLineConfig.textFontSize,
810
- textShiftX: (_t = lineConfig.textShiftX) !== null && _t !== void 0 ? _t : defaultLineConfig.textShiftX,
811
- textShiftY: (_u = lineConfig.textShiftY) !== null && _u !== void 0 ? _u : defaultLineConfig.textShiftY,
812
- shiftX: (_v = lineConfig.shiftX) !== null && _v !== void 0 ? _v : defaultLineConfig.shiftX,
813
- shiftY: (_w = lineConfig.shiftY) !== null && _w !== void 0 ? _w : defaultLineConfig.shiftY,
814
- delay: (_x = lineConfig.delay) !== null && _x !== void 0 ? _x : defaultLineConfig.delay,
815
- startIndex: (_y = lineConfig.startIndex) !== null && _y !== void 0 ? _y : defaultLineConfig.startIndex,
802
+ strokeDashArray: (_k = lineConfig.strokeDashArray) !== null && _k !== void 0 ? _k : [0, 0],
803
+ hideDataPoints: (_l = lineConfig.hideDataPoints) !== null && _l !== void 0 ? _l : defaultLineConfig.hideDataPoints,
804
+ dataPointsShape: (_m = lineConfig.dataPointsShape) !== null && _m !== void 0 ? _m : defaultLineConfig.dataPointsShape,
805
+ dataPointsHeight: (_o = lineConfig.dataPointsHeight) !== null && _o !== void 0 ? _o : defaultLineConfig.dataPointsHeight,
806
+ dataPointsWidth: (_p = lineConfig.dataPointsWidth) !== null && _p !== void 0 ? _p : defaultLineConfig.dataPointsWidth,
807
+ dataPointsColor: (_q = lineConfig.dataPointsColor) !== null && _q !== void 0 ? _q : defaultLineConfig.dataPointsColor,
808
+ dataPointsRadius: (_r = lineConfig.dataPointsRadius) !== null && _r !== void 0 ? _r : defaultLineConfig.dataPointsRadius,
809
+ textColor: (_s = lineConfig.textColor) !== null && _s !== void 0 ? _s : defaultLineConfig.textColor,
810
+ textFontSize: (_t = lineConfig.textFontSize) !== null && _t !== void 0 ? _t : defaultLineConfig.textFontSize,
811
+ textShiftX: (_u = lineConfig.textShiftX) !== null && _u !== void 0 ? _u : defaultLineConfig.textShiftX,
812
+ textShiftY: (_v = lineConfig.textShiftY) !== null && _v !== void 0 ? _v : defaultLineConfig.textShiftY,
813
+ shiftX: (_w = lineConfig.shiftX) !== null && _w !== void 0 ? _w : defaultLineConfig.shiftX,
814
+ shiftY: (_x = lineConfig.shiftY) !== null && _x !== void 0 ? _x : defaultLineConfig.shiftY,
815
+ delay: (_y = lineConfig.delay) !== null && _y !== void 0 ? _y : defaultLineConfig.delay,
816
+ startIndex: (_z = lineConfig.startIndex) !== null && _z !== void 0 ? _z : defaultLineConfig.startIndex,
816
817
  endIndex: lineConfig.endIndex === 0
817
818
  ? 0
818
- : (_z = lineConfig.endIndex) !== null && _z !== void 0 ? _z : defaultLineConfig.endIndex,
819
- showArrow: (_0 = lineConfig.showArrow) !== null && _0 !== void 0 ? _0 : defaultLineConfig.showArrow,
819
+ : (_0 = lineConfig.endIndex) !== null && _0 !== void 0 ? _0 : defaultLineConfig.endIndex,
820
+ showArrow: (_1 = lineConfig.showArrow) !== null && _1 !== void 0 ? _1 : defaultLineConfig.showArrow,
820
821
  arrowConfig: {
821
- length: (_2 = (_1 = lineConfig.arrowConfig) === null || _1 === void 0 ? void 0 : _1.length) !== null && _2 !== void 0 ? _2 : (_3 = defaultLineConfig.arrowConfig) === null || _3 === void 0 ? void 0 : _3.length,
822
- width: (_5 = (_4 = lineConfig.arrowConfig) === null || _4 === void 0 ? void 0 : _4.width) !== null && _5 !== void 0 ? _5 : (_6 = defaultLineConfig.arrowConfig) === null || _6 === void 0 ? void 0 : _6.width,
823
- strokeWidth: (_8 = (_7 = lineConfig.arrowConfig) === null || _7 === void 0 ? void 0 : _7.strokeWidth) !== null && _8 !== void 0 ? _8 : (_9 = defaultLineConfig.arrowConfig) === null || _9 === void 0 ? void 0 : _9.strokeWidth,
824
- strokeColor: (_11 = (_10 = lineConfig.arrowConfig) === null || _10 === void 0 ? void 0 : _10.strokeColor) !== null && _11 !== void 0 ? _11 : (_12 = defaultLineConfig.arrowConfig) === null || _12 === void 0 ? void 0 : _12.strokeColor,
825
- fillColor: (_14 = (_13 = lineConfig.arrowConfig) === null || _13 === void 0 ? void 0 : _13.fillColor) !== null && _14 !== void 0 ? _14 : (_15 = defaultLineConfig.arrowConfig) === null || _15 === void 0 ? void 0 : _15.fillColor,
826
- showArrowBase: (_17 = (_16 = lineConfig.arrowConfig) === null || _16 === void 0 ? void 0 : _16.showArrowBase) !== null && _17 !== void 0 ? _17 : (_18 = defaultLineConfig.arrowConfig) === null || _18 === void 0 ? void 0 : _18.showArrowBase
822
+ length: (_3 = (_2 = lineConfig.arrowConfig) === null || _2 === void 0 ? void 0 : _2.length) !== null && _3 !== void 0 ? _3 : (_4 = defaultLineConfig.arrowConfig) === null || _4 === void 0 ? void 0 : _4.length,
823
+ width: (_6 = (_5 = lineConfig.arrowConfig) === null || _5 === void 0 ? void 0 : _5.width) !== null && _6 !== void 0 ? _6 : (_7 = defaultLineConfig.arrowConfig) === null || _7 === void 0 ? void 0 : _7.width,
824
+ strokeWidth: (_9 = (_8 = lineConfig.arrowConfig) === null || _8 === void 0 ? void 0 : _8.strokeWidth) !== null && _9 !== void 0 ? _9 : (_10 = defaultLineConfig.arrowConfig) === null || _10 === void 0 ? void 0 : _10.strokeWidth,
825
+ strokeColor: (_12 = (_11 = lineConfig.arrowConfig) === null || _11 === void 0 ? void 0 : _11.strokeColor) !== null && _12 !== void 0 ? _12 : (_13 = defaultLineConfig.arrowConfig) === null || _13 === void 0 ? void 0 : _13.strokeColor,
826
+ fillColor: (_15 = (_14 = lineConfig.arrowConfig) === null || _14 === void 0 ? void 0 : _14.fillColor) !== null && _15 !== void 0 ? _15 : (_16 = defaultLineConfig.arrowConfig) === null || _16 === void 0 ? void 0 : _16.fillColor,
827
+ showArrowBase: (_18 = (_17 = lineConfig.arrowConfig) === null || _17 === void 0 ? void 0 : _17.showArrowBase) !== null && _18 !== void 0 ? _18 : (_19 = defaultLineConfig.arrowConfig) === null || _19 === void 0 ? void 0 : _19.showArrowBase
827
828
  },
828
829
  customDataPoint: lineConfig.customDataPoint,
829
- isSecondary: (_19 = lineConfig.isSecondary) !== null && _19 !== void 0 ? _19 : defaultLineConfig.isSecondary,
830
- focusEnabled: (_20 = lineConfig.focusEnabled) !== null && _20 !== void 0 ? _20 : defaultLineConfig.focusEnabled,
831
- focusedDataPointColor: (_21 = lineConfig.focusedDataPointColor) !== null && _21 !== void 0 ? _21 : defaultLineConfig.focusedDataPointColor,
832
- focusedDataPointRadius: (_22 = lineConfig.focusedDataPointRadius) !== null && _22 !== void 0 ? _22 : defaultLineConfig.focusedDataPointRadius,
830
+ isSecondary: (_20 = lineConfig.isSecondary) !== null && _20 !== void 0 ? _20 : defaultLineConfig.isSecondary,
831
+ focusEnabled: (_21 = lineConfig.focusEnabled) !== null && _21 !== void 0 ? _21 : defaultLineConfig.focusEnabled,
832
+ focusedDataPointColor: (_22 = lineConfig.focusedDataPointColor) !== null && _22 !== void 0 ? _22 : defaultLineConfig.focusedDataPointColor,
833
+ focusedDataPointRadius: (_23 = lineConfig.focusedDataPointRadius) !== null && _23 !== void 0 ? _23 : defaultLineConfig.focusedDataPointRadius,
833
834
  focusedDataPointIndex: lineConfig.focusedDataPointIndex
834
835
  };
835
836
  };
@@ -881,24 +882,25 @@ export var getBarWidth = function (isFocused, focusedBarConfig, itemBarWidth, ba
881
882
  export var getInterpolatedData = function (dataParam, showDataPointsForMissingValues, interpolateMissingValues, onlyPositive) {
882
883
  if (!interpolateMissingValues) {
883
884
  return dataParam.map(function (item) {
885
+ var _a;
884
886
  if (typeof item.value !== 'number') {
885
887
  if (showDataPointsForMissingValues)
886
888
  return __assign(__assign({}, item), { value: 0 });
887
889
  return __assign(__assign({}, item), { value: 0, hideDataPoint: true });
888
890
  }
889
- return item;
891
+ return __assign(__assign({}, item), { value: (_a = item.value) !== null && _a !== void 0 ? _a : 0 });
890
892
  });
891
893
  }
892
- if (!interpolateMissingValues)
893
- return dataParam;
894
+ // if (!interpolateMissingValues) return dataParam
894
895
  var data = clone(dataParam);
895
896
  var n = data.length;
896
897
  /** ************ PRE-PROCESSING **************/
897
898
  var numericValue;
898
899
  var numericValuesLength = data.filter(function (item) {
900
+ var _a;
899
901
  var isNum = typeof item.value === 'number';
900
902
  if (isNum) {
901
- numericValue = item.value;
903
+ numericValue = (_a = item.value) !== null && _a !== void 0 ? _a : 0;
902
904
  return true;
903
905
  }
904
906
  return false;
@@ -1,6 +1,6 @@
1
1
  import { type ColorValue } from 'react-native';
2
2
  import { type chartTypes, type yAxisSides } from './constants';
3
- import { type lineDataItem } from '../LineChart/types';
3
+ import { lineDataItemNullSafe, type lineDataItem } from '../LineChart/types';
4
4
  import { lineConfigType, type barDataItem, type stackDataItem } from '../BarChart/types';
5
5
  export declare enum Framework {
6
6
  reactJS = 0,
@@ -9,6 +9,15 @@ export declare enum Framework {
9
9
  export type RuleType = 'solid' | 'dashed' | 'dotted' | string;
10
10
  export type LabelsPosition = 'onBorder' | 'outward' | 'inward' | 'mid';
11
11
  export type Linecap = 'butt' | 'square' | 'round';
12
+ export interface CustomBackground {
13
+ color?: ColorValue;
14
+ component?: Function;
15
+ horizontalShift?: number;
16
+ verticalShift?: number;
17
+ height?: number;
18
+ width?: number;
19
+ widthAdjustment?: number;
20
+ }
12
21
  export interface RuleTypes {
13
22
  SOLID: RuleType;
14
23
  DASHED: RuleType;
@@ -125,6 +134,7 @@ export interface LineInBarChartPropsType {
125
134
  xAxisLabelsVerticalShift: number;
126
135
  selectedIndex: number;
127
136
  yAxisOffset: number;
137
+ strokeDashArray: number[];
128
138
  }
129
139
  export interface DataPointProps {
130
140
  data: any[];
@@ -228,6 +238,7 @@ export interface horizSectionPropTypes {
228
238
  secondaryRoundToDigits: number;
229
239
  secondaryStepHeight: number;
230
240
  secondaryNegativeStepHeight: number;
241
+ customBackground?: CustomBackground;
231
242
  }
232
243
  interface HorizSectionObject {
233
244
  value: string;
@@ -305,7 +316,8 @@ export interface BarAndLineChartsWrapperTypes {
305
316
  isRTL?: boolean;
306
317
  extraWidthDueToDataPoint?: number;
307
318
  nestedScrollEnabled?: boolean;
308
- dataSet?: DataSet[];
319
+ dataSet?: DataSetNullSafe[];
320
+ customBackground?: CustomBackground;
309
321
  }
310
322
  export interface HorizontalStripConfig {
311
323
  thickness?: number;
@@ -349,10 +361,12 @@ export interface Pointer {
349
361
  pointerLabelHeight?: number;
350
362
  pointerVanishDelay?: number;
351
363
  activatePointersOnLongPress?: boolean;
364
+ activatePointersInstantlyOnTouch?: boolean;
352
365
  activatePointersDelay?: number;
353
366
  initialPointerIndex?: number;
354
367
  initialPointerAppearDelay?: number;
355
368
  persistPointer?: boolean;
369
+ resetPointerIndexOnRelease?: boolean;
356
370
  hidePointers?: boolean;
357
371
  hidePointer1?: boolean;
358
372
  hidePointer2?: boolean;
@@ -426,6 +440,9 @@ export interface DataSet {
426
440
  hidePointers?: boolean;
427
441
  spacing?: number;
428
442
  }
443
+ export interface DataSetNullSafe extends DataSet {
444
+ data: lineDataItemNullSafe[];
445
+ }
429
446
  export interface IntersectionAreaConfig {
430
447
  fillColor?: ColorValue;
431
448
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
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": [