gifted-charts-core 0.1.49 → 0.1.51

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.
@@ -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;
@@ -317,7 +318,7 @@ export interface LineChartPropsType {
317
318
  intersectionAreaConfig?: IntersectionAreaConfig;
318
319
  }
319
320
  export interface lineDataItem {
320
- value: number;
321
+ value?: number;
321
322
  label?: string;
322
323
  labelComponent?: Function;
323
324
  labelTextStyle?: any;
@@ -366,6 +367,9 @@ export interface lineDataItem {
366
367
  showXAxisIndex?: boolean;
367
368
  hidePointer?: boolean;
368
369
  }
370
+ export interface lineDataItemNullSafe extends lineDataItem {
371
+ value: number;
372
+ }
369
373
  interface sectionType {
370
374
  value: string;
371
375
  }
package/dist/index.d.ts CHANGED
@@ -4,13 +4,14 @@
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 { useRenderBars } from './BarChart/RenderBars';
8
+ 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
9
  /************************************************************************************************************************
9
10
  /***************************************** Line Chart *****************************************
10
11
  /************************************************************************************************************************/
11
12
  export { useLineChart } from './LineChart';
12
13
  export { useLineChartBiColor } from './LineChart/LineChartBiColor';
13
- export { type LineChartPropsType, type lineDataItem, type bicolorLineDataItem, type LineChartBicolorPropsType } from './LineChart/types';
14
+ export { type LineChartPropsType, type lineDataItem, type lineDataItemNullSafe, type bicolorLineDataItem, type LineChartBicolorPropsType } from './LineChart/types';
14
15
  /***********************************************************************************************************************
15
16
  /***************************************** Pie Chart *****************************************
16
17
  /***********************************************************************************************************************/
@@ -36,4 +37,4 @@ export { type StripAndLabelProps } from './components/common/types';
36
37
  /***********************************************************************************************************************/
37
38
  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
39
  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';
40
+ 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, type TooltipProps } from './utils/types';
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  export { useBarChart } from './BarChart';
5
5
  export { getPropsForAnimated2DWithGradient } from './BarChart/Animated2DWithGradient';
6
6
  export { useRenderStackBars } from './BarChart/RenderStackBars';
7
+ export { useRenderBars } from './BarChart/RenderBars';
7
8
  /************************************************************************************************************************
8
9
  /***************************************** Line Chart *****************************************
9
10
  /************************************************************************************************************************/
@@ -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;
@@ -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,
@@ -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;
@@ -882,24 +882,25 @@ export var getBarWidth = function (isFocused, focusedBarConfig, itemBarWidth, ba
882
882
  export var getInterpolatedData = function (dataParam, showDataPointsForMissingValues, interpolateMissingValues, onlyPositive) {
883
883
  if (!interpolateMissingValues) {
884
884
  return dataParam.map(function (item) {
885
+ var _a;
885
886
  if (typeof item.value !== 'number') {
886
887
  if (showDataPointsForMissingValues)
887
888
  return __assign(__assign({}, item), { value: 0 });
888
889
  return __assign(__assign({}, item), { value: 0, hideDataPoint: true });
889
890
  }
890
- return item;
891
+ return __assign(__assign({}, item), { value: (_a = item.value) !== null && _a !== void 0 ? _a : 0 });
891
892
  });
892
893
  }
893
- if (!interpolateMissingValues)
894
- return dataParam;
894
+ // if (!interpolateMissingValues) return dataParam
895
895
  var data = clone(dataParam);
896
896
  var n = data.length;
897
897
  /** ************ PRE-PROCESSING **************/
898
898
  var numericValue;
899
899
  var numericValuesLength = data.filter(function (item) {
900
+ var _a;
900
901
  var isNum = typeof item.value === 'number';
901
902
  if (isNum) {
902
- numericValue = item.value;
903
+ numericValue = (_a = item.value) !== null && _a !== void 0 ? _a : 0;
903
904
  return true;
904
905
  }
905
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,
@@ -79,6 +79,20 @@ export interface secondaryYAxisType {
79
79
  hideOrigin?: boolean;
80
80
  formatYLabel?: (label: string) => string;
81
81
  }
82
+ export interface TooltipProps {
83
+ barHeight: number;
84
+ barWidth: number;
85
+ item: any;
86
+ index: number;
87
+ isLast: boolean;
88
+ leftSpacing: number;
89
+ leftShiftForLastIndexTooltip: number;
90
+ leftShiftForTooltip: number;
91
+ renderTooltip?: Function;
92
+ autoCenterTooltip?: boolean;
93
+ horizontal?: boolean;
94
+ bottom: number;
95
+ }
82
96
  export interface secondaryLineConfigType {
83
97
  zIndex?: number;
84
98
  curved?: boolean;
@@ -316,7 +330,7 @@ export interface BarAndLineChartsWrapperTypes {
316
330
  isRTL?: boolean;
317
331
  extraWidthDueToDataPoint?: number;
318
332
  nestedScrollEnabled?: boolean;
319
- dataSet?: DataSet[];
333
+ dataSet?: DataSetNullSafe[];
320
334
  customBackground?: CustomBackground;
321
335
  }
322
336
  export interface HorizontalStripConfig {
@@ -440,6 +454,9 @@ export interface DataSet {
440
454
  hidePointers?: boolean;
441
455
  spacing?: number;
442
456
  }
457
+ export interface DataSetNullSafe extends DataSet {
458
+ data: lineDataItemNullSafe[];
459
+ }
443
460
  export interface IntersectionAreaConfig {
444
461
  fillColor?: ColorValue;
445
462
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
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": [