gifted-charts-core 0.1.22 → 0.1.24

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,5 +1,5 @@
1
1
  import { type ColorValue, type ViewStyle } from 'react-native';
2
- import { type FocusedBarConfig, type BarChartPropsType, type CommonPropsFor2Dand3DbarsType, type barDataItem, type stackDataItem } from './types';
2
+ import { type FocusedBarConfig, type BarChartPropsType, type CommonPropsFor2dand3dBarsType, type barDataItem, type stackDataItem } from './types';
3
3
  import { type ReactNode } from 'react';
4
4
  interface Animated2dWithGradientPropsType extends BarChartPropsType {
5
5
  item: barDataItem;
@@ -15,7 +15,7 @@ interface Animated2dWithGradientPropsType extends BarChartPropsType {
15
15
  interface IgetPropsForAnimated2DWithGradientReturnType {
16
16
  commonStyleForBar: ViewStyle[];
17
17
  barStyleWithBackground: ViewStyle[];
18
- commonPropsFor2Dand3Dbars: CommonPropsFor2Dand3DbarsType;
18
+ commonPropsFor2dAnd3dBars: CommonPropsFor2dand3dBarsType;
19
19
  isFocused?: boolean;
20
20
  focusedBarConfig?: FocusedBarConfig;
21
21
  localFrontColor: ColorValue;
@@ -73,7 +73,7 @@ export var getPropsForAnimated2DWithGradient = function (props) {
73
73
  backgroundColor: localFrontColor
74
74
  }
75
75
  ], false);
76
- var commonPropsFor2Dand3Dbars = {
76
+ var commonPropsFor2dAnd3dBars = {
77
77
  barBackgroundPattern: (_x = item.barBackgroundPattern) !== null && _x !== void 0 ? _x : barBackgroundPattern,
78
78
  barInnerComponent: isFocused
79
79
  ? (_y = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.barInnerComponent) !== null && _y !== void 0 ? _y : barInnerComponent
@@ -101,7 +101,7 @@ export var getPropsForAnimated2DWithGradient = function (props) {
101
101
  return {
102
102
  commonStyleForBar: commonStyleForBar,
103
103
  barStyleWithBackground: barStyleWithBackground,
104
- commonPropsFor2Dand3Dbars: commonPropsFor2Dand3Dbars,
104
+ commonPropsFor2dAnd3dBars: commonPropsFor2dAnd3dBars,
105
105
  isFocused: isFocused,
106
106
  focusedBarConfig: focusedBarConfig,
107
107
  localFrontColor: localFrontColor
@@ -1,6 +1,6 @@
1
1
  import { type StackedBarChartPropsType, type stackDataItem } from './types';
2
2
  export declare const useRenderStackBars: (props: StackedBarChartPropsType) => {
3
- cotainsNegative: boolean;
3
+ containsNegativeValue: boolean;
4
4
  noAnimation: boolean;
5
5
  localBarInnerComponent: ((item?: stackDataItem, index?: number) => import("react").ReactNode) | undefined;
6
6
  borderRadius: number | undefined;
@@ -18,8 +18,8 @@ import { useState } from 'react';
18
18
  export var useRenderStackBars = function (props) {
19
19
  var _a, _b, _c, _d, _e, _f, _g, _h;
20
20
  var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, propSpacing = props.propSpacing, initialSpacing = props.initialSpacing, stackData = props.stackData, isAnimated = props.isAnimated, xAxisThickness = props.xAxisThickness, renderTooltip = props.renderTooltip, leftShiftForTooltip = props.leftShiftForTooltip, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, autoCenterTooltip = props.autoCenterTooltip, horizontal = props.horizontal;
21
- var cotainsNegative = item.stacks.some(function (item) { return item.value < 0; });
22
- var noAnimation = cotainsNegative || !isAnimated;
21
+ var containsNegativeValue = item.stacks.some(function (item) { return item.value < 0; });
22
+ var noAnimation = containsNegativeValue || !isAnimated;
23
23
  var localBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
24
24
  var borderRadius = item.borderRadius, borderTopLeftRadius = item.borderTopLeftRadius, borderTopRightRadius = item.borderTopRightRadius, borderBottomLeftRadius = item.borderBottomLeftRadius, borderBottomRightRadius = item.borderBottomRightRadius;
25
25
  var leftSpacing = initialSpacing;
@@ -90,7 +90,7 @@ export var useRenderStackBars = function (props) {
90
90
  horizontal: horizontal
91
91
  };
92
92
  return {
93
- cotainsNegative: cotainsNegative,
93
+ containsNegativeValue: containsNegativeValue,
94
94
  noAnimation: noAnimation,
95
95
  localBarInnerComponent: localBarInnerComponent,
96
96
  borderRadius: borderRadius,
@@ -5,7 +5,7 @@ export interface extendedBarChartPropsType extends BarChartPropsType {
5
5
  parentWidth: number;
6
6
  heightValue?: Animated.Value;
7
7
  widthValue?: Animated.Value;
8
- opacValue?: Animated.Value;
8
+ opacityValue?: Animated.Value;
9
9
  verticalLinesUptoDataPoint?: boolean;
10
10
  secondaryYAxis?: secondaryYAxisType | boolean;
11
11
  }
@@ -30,7 +30,7 @@ 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, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex, negativeStepValue = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip;
33
+ var heightValue = props.heightValue, widthValue = props.widthValue, opacityValue = props.opacityValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex, negativeStepValue = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip;
34
34
  var _48 = __read(useState(''), 2), points = _48[0], setPoints = _48[1];
35
35
  var _49 = __read(useState(''), 2), points2 = _49[0], setPoints2 = _49[1];
36
36
  var _50 = __read(useState(''), 2), arrowPoints = _50[0], setArrowPoints = _50[1];
@@ -385,7 +385,7 @@ export var useBarChart = function (props) {
385
385
  inputRange: [0, 1],
386
386
  outputRange: ['0%', '100%']
387
387
  });
388
- var appearingOpacity = opacValue === null || opacValue === void 0 ? void 0 : opacValue.interpolate({
388
+ var appearingOpacity = opacityValue === null || opacityValue === void 0 ? void 0 : opacityValue.interpolate({
389
389
  inputRange: [0, 1],
390
390
  outputRange: [0, 1]
391
391
  });
@@ -594,7 +594,7 @@ export interface animatedBarPropTypes {
594
594
  focusBarOnPress?: boolean;
595
595
  focusedBarConfig?: FocusedBarConfig;
596
596
  }
597
- export interface CommonPropsFor2Dand3DbarsType {
597
+ export interface CommonPropsFor2dand3dBarsType {
598
598
  barBackgroundPattern?: () => ReactNode;
599
599
  barInnerComponent?: (item?: barDataItem, index?: number) => ReactNode;
600
600
  patternId?: string;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@
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 Animated2DWithGradientPropsType, type RenderBarsPropsType, type trianglePropTypes, type animatedBarPropTypes, type FocusedBarConfig, type CommonPropsFor2dand3dBarsType } from './BarChart/types';
8
8
  /************************************************************************************************************************
9
9
  /***************************************** Line Chart *****************************************
10
10
  /************************************************************************************************************************/
@@ -883,7 +883,10 @@ export var getInterpolatedData = function (dataParam, showDataPointsForMissingVa
883
883
  // 4. None has valid value -> this is already handled in preprocessing
884
884
  var pre = data.slice(0, index);
885
885
  var post = data.slice(index + 1, n);
886
- var preValidIndex = pre.findLastIndex(function (item) { return typeof item.value === 'number'; });
886
+ var preValidIndex = pre
887
+ .slice()
888
+ .reverse()
889
+ .findIndex(function (item) { return typeof item.value === 'number'; });
887
890
  var postValidInd = post.findIndex(function (item) { return typeof item.value === 'number'; });
888
891
  var postValidIndex = postValidInd + index + 1;
889
892
  var count, step;
@@ -900,7 +903,10 @@ export var getInterpolatedData = function (dataParam, showDataPointsForMissingVa
900
903
  // 1. There's only 1 valid value in the pre -> this is already handled in preprocessing
901
904
  // 2. There are more than valid values in pre
902
905
  var secondPre = data.slice(0, preValidIndex);
903
- var secondPreIndex = secondPre.findLastIndex(function (item) { return typeof item.value === 'number'; });
906
+ var secondPreIndex = secondPre
907
+ .slice()
908
+ .reverse()
909
+ .findIndex(function (item) { return typeof item.value === 'number'; });
904
910
  count = preValidIndex - secondPreIndex;
905
911
  step = (data[secondPreIndex].value - data[preValidIndex].value) / count;
906
912
  data[index].value =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
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": [