gifted-charts-core 0.0.27 → 0.0.29
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 +2 -2
- package/src/BarChart/index.d.ts +6 -6
- package/src/BarChart/index.js +3 -3
- package/src/BarChart/index.ts +6 -6
- package/src/PopulationPyramid/index.js +1 -1
- package/src/PopulationPyramid/index.ts +1 -1
- package/src/index.d.ts +2 -2
- package/src/index.js +1 -1
- package/src/index.ts +2 -2
- package/src/utils/index.d.ts +0 -1
- package/src/utils/index.js +0 -10
- package/src/utils/index.ts +0 -13
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gifted-charts-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
|
|
5
|
-
"main": "index.
|
|
5
|
+
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"src"
|
|
8
8
|
],
|
package/src/BarChart/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { type lineConfigType, type BarChartPropsType, type barDataItem, type sta
|
|
|
3
3
|
import { type BarAndLineChartsWrapperTypes, type secondaryYAxisType } from '../utils/types';
|
|
4
4
|
import { type Animated } from 'react-native';
|
|
5
5
|
export interface extendedBarChartPropsType extends BarChartPropsType {
|
|
6
|
-
heightValue
|
|
7
|
-
widthValue
|
|
8
|
-
opacValue
|
|
6
|
+
heightValue?: Animated.Value;
|
|
7
|
+
widthValue?: Animated.Value;
|
|
8
|
+
opacValue?: Animated.Value;
|
|
9
9
|
verticalLinesUptoDataPoint?: boolean;
|
|
10
10
|
secondaryYAxis?: secondaryYAxisType | boolean;
|
|
11
11
|
}
|
|
@@ -81,8 +81,8 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
81
81
|
side: string;
|
|
82
82
|
labelWidth: number;
|
|
83
83
|
isThreeD: boolean;
|
|
84
|
-
animatedHeight: Animated.AnimatedInterpolation<string | number
|
|
85
|
-
appearingOpacity: Animated.AnimatedInterpolation<string | number
|
|
84
|
+
animatedHeight: Animated.AnimatedInterpolation<string | number> | undefined;
|
|
85
|
+
appearingOpacity: Animated.AnimatedInterpolation<string | number> | undefined;
|
|
86
86
|
autoShiftLabels: boolean;
|
|
87
87
|
yAxisAtTop: boolean;
|
|
88
88
|
secondaryData: import("..").lineDataItem[] | barDataItem[] | undefined;
|
|
@@ -95,7 +95,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
95
95
|
lineConfig2: lineConfigType;
|
|
96
96
|
lineData: (import("..").lineDataItem | barDataItem | stackDataItem)[];
|
|
97
97
|
lineData2: (import("..").lineDataItem | barDataItem | stackDataItem)[] | undefined;
|
|
98
|
-
animatedWidth: Animated.AnimatedInterpolation<string | number
|
|
98
|
+
animatedWidth: Animated.AnimatedInterpolation<string | number> | undefined;
|
|
99
99
|
lineBehindBars: boolean;
|
|
100
100
|
points: string;
|
|
101
101
|
setPoints: import("react").Dispatch<import("react").SetStateAction<string>>;
|
package/src/BarChart/index.js
CHANGED
|
@@ -365,15 +365,15 @@ export var useBarChart = function (props) {
|
|
|
365
365
|
setPointerX(x);
|
|
366
366
|
setPointerY(y);
|
|
367
367
|
};
|
|
368
|
-
var animatedHeight = heightValue.interpolate({
|
|
368
|
+
var animatedHeight = heightValue === null || heightValue === void 0 ? void 0 : heightValue.interpolate({
|
|
369
369
|
inputRange: [0, 1],
|
|
370
370
|
outputRange: ['0%', '100%']
|
|
371
371
|
});
|
|
372
|
-
var appearingOpacity = opacValue.interpolate({
|
|
372
|
+
var appearingOpacity = opacValue === null || opacValue === void 0 ? void 0 : opacValue.interpolate({
|
|
373
373
|
inputRange: [0, 1],
|
|
374
374
|
outputRange: [0, 1]
|
|
375
375
|
});
|
|
376
|
-
var animatedWidth = widthValue.interpolate({
|
|
376
|
+
var animatedWidth = widthValue === null || widthValue === void 0 ? void 0 : widthValue.interpolate({
|
|
377
377
|
inputRange: [0, 1],
|
|
378
378
|
outputRange: [0, initialSpacing + totalWidth + endSpacing]
|
|
379
379
|
});
|
package/src/BarChart/index.ts
CHANGED
|
@@ -32,9 +32,9 @@ import {
|
|
|
32
32
|
import { type Animated } from 'react-native'
|
|
33
33
|
|
|
34
34
|
export interface extendedBarChartPropsType extends BarChartPropsType {
|
|
35
|
-
heightValue
|
|
36
|
-
widthValue
|
|
37
|
-
opacValue
|
|
35
|
+
heightValue?: Animated.Value
|
|
36
|
+
widthValue?: Animated.Value
|
|
37
|
+
opacValue?: Animated.Value
|
|
38
38
|
verticalLinesUptoDataPoint?: boolean
|
|
39
39
|
secondaryYAxis?: secondaryYAxisType | boolean
|
|
40
40
|
}
|
|
@@ -578,16 +578,16 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
578
578
|
setPointerY(y)
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
const animatedHeight = heightValue
|
|
581
|
+
const animatedHeight = heightValue?.interpolate({
|
|
582
582
|
inputRange: [0, 1],
|
|
583
583
|
outputRange: ['0%', '100%']
|
|
584
584
|
})
|
|
585
|
-
const appearingOpacity = opacValue
|
|
585
|
+
const appearingOpacity = opacValue?.interpolate({
|
|
586
586
|
inputRange: [0, 1],
|
|
587
587
|
outputRange: [0, 1]
|
|
588
588
|
})
|
|
589
589
|
|
|
590
|
-
const animatedWidth = widthValue
|
|
590
|
+
const animatedWidth = widthValue?.interpolate({
|
|
591
591
|
inputRange: [0, 1],
|
|
592
592
|
outputRange: [0, initialSpacing + totalWidth + endSpacing]
|
|
593
593
|
})
|
|
@@ -59,7 +59,7 @@ export var usePopulationPyramid = function (props) {
|
|
|
59
59
|
? props.stepHeight * noOfSections
|
|
60
60
|
: height;
|
|
61
61
|
var stepHeight = (_s = props.stepHeight) !== null && _s !== void 0 ? _s : containerHeight / noOfSections;
|
|
62
|
-
var xAxisLabelsHeight =
|
|
62
|
+
var xAxisLabelsHeight = 30;
|
|
63
63
|
var containerHeightWithXaxisLabels = containerHeight + xAxisLabelsHeight;
|
|
64
64
|
var mid = (width + yAxisLabelWidth) / 2;
|
|
65
65
|
var leftMax = Math.max.apply(Math, __spreadArray([], __read(data.map(function (item) { return item.left; })), false));
|
|
@@ -159,7 +159,7 @@ export const usePopulationPyramid = (props: extendedPopulationPyramidPropsType)
|
|
|
159
159
|
: height
|
|
160
160
|
const stepHeight = props.stepHeight ?? containerHeight / noOfSections
|
|
161
161
|
|
|
162
|
-
const xAxisLabelsHeight =
|
|
162
|
+
const xAxisLabelsHeight = 30
|
|
163
163
|
const containerHeightWithXaxisLabels = containerHeight + xAxisLabelsHeight
|
|
164
164
|
|
|
165
165
|
const mid = (width + yAxisLabelWidth) / 2
|
package/src/index.d.ts
CHANGED
|
@@ -32,6 +32,6 @@ export { getTopAndLeftForStripAndLabel } from './components/common/StripAndLabel
|
|
|
32
32
|
/***********************************************************************************************************************
|
|
33
33
|
/********************************* common utils, constants and types ********************************
|
|
34
34
|
/***********************************************************************************************************************/
|
|
35
|
-
export {
|
|
35
|
+
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 } from './utils';
|
|
36
36
|
export { chartTypes, yAxisSides, loc, SEGMENT_START, SEGMENT_END, RANGE_ENTER, RANGE_EXIT, STOP, ruleTypes, AxesAndRulesDefaults, defaultArrowConfig, BarDefaults, defaultLineConfig, LineDefaults, defaultPointerConfig, pieColors, populationDefaults } from './utils/constants';
|
|
37
|
-
export { type RuleType, type RuleTypes, type RulesConfig, type CurveType, type EdgePosition, 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 } from './utils/types';
|
|
37
|
+
export { type RuleType, type RuleTypes, type RulesConfig, type CurveType, type EdgePosition, 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 Framework } from './utils/types';
|
package/src/index.js
CHANGED
|
@@ -28,5 +28,5 @@ export { getTopAndLeftForStripAndLabel } from './components/common/StripAndLabel
|
|
|
28
28
|
/***********************************************************************************************************************
|
|
29
29
|
/********************************* common utils, constants and types ********************************
|
|
30
30
|
/***********************************************************************************************************************/
|
|
31
|
-
export {
|
|
31
|
+
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 } from './utils';
|
|
32
32
|
export { chartTypes, yAxisSides, loc, SEGMENT_START, SEGMENT_END, RANGE_ENTER, RANGE_EXIT, STOP, ruleTypes, AxesAndRulesDefaults, defaultArrowConfig, BarDefaults, defaultLineConfig, LineDefaults, defaultPointerConfig, pieColors, populationDefaults } from './utils/constants';
|
package/src/index.ts
CHANGED
|
@@ -75,7 +75,6 @@ export { getTopAndLeftForStripAndLabel } from './components/common/StripAndLabel
|
|
|
75
75
|
/***********************************************************************************************************************/
|
|
76
76
|
|
|
77
77
|
export {
|
|
78
|
-
rnVersion,
|
|
79
78
|
getCumulativeWidth,
|
|
80
79
|
getLighterColor,
|
|
81
80
|
svgQuadraticCurvePath,
|
|
@@ -142,5 +141,6 @@ export {
|
|
|
142
141
|
type LineSegment,
|
|
143
142
|
type LineSvgProps,
|
|
144
143
|
type LineProperties,
|
|
145
|
-
type DataSet
|
|
144
|
+
type DataSet,
|
|
145
|
+
type Framework
|
|
146
146
|
} from './utils/types'
|
package/src/utils/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { type arrowConfigType, CurveType, type HighlightedRange, type LineProper
|
|
|
4
4
|
import { type lineConfigType, type BarChartPropsType, type FocusedBarConfig, type barDataItem } from '../BarChart/types';
|
|
5
5
|
import { type extendedLineChartPropsType } from '../LineChart';
|
|
6
6
|
import { type extendedBarChartPropsType } from '../BarChart';
|
|
7
|
-
export declare const rnVersion: number;
|
|
8
7
|
export declare const getCumulativeWidth: (data: any, index: number, spacing: number) => number;
|
|
9
8
|
export declare const getLighterColor: (color: string) => string;
|
|
10
9
|
export declare const svgQuadraticCurvePath: (points: number[][]) => string;
|
package/src/utils/index.js
CHANGED
|
@@ -25,18 +25,8 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
25
25
|
}
|
|
26
26
|
return ar;
|
|
27
27
|
};
|
|
28
|
-
var _a, _b;
|
|
29
28
|
import { AxesAndRulesDefaults, BarDefaults, RANGE_ENTER, RANGE_EXIT, STOP, defaultCurvature, defaultLineConfig, loc } from './constants';
|
|
30
29
|
import { CurveType, Framework } from './types';
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
32
|
-
var versionString = require('react-native/package.json').version;
|
|
33
|
-
var versionAr = (_b = (_a = versionString === null || versionString === void 0 ? void 0 : versionString.split) === null || _a === void 0 ? void 0 : _a.call(versionString, '.')) !== null && _b !== void 0 ? _b : '';
|
|
34
|
-
var msb = Number(versionAr[0]);
|
|
35
|
-
var mid = Number(versionAr[1]);
|
|
36
|
-
var lsb = Number(versionAr[2]);
|
|
37
|
-
export var rnVersion = (!isNaN(msb) ? msb : 0) * 1000000 +
|
|
38
|
-
(!isNaN(mid) ? mid : 0) * 10000 +
|
|
39
|
-
(!isNaN(lsb) ? lsb : 0);
|
|
40
30
|
export var getCumulativeWidth = function (data, index, spacing) {
|
|
41
31
|
var cumWidth = 0;
|
|
42
32
|
for (var i = 0; i < index; i++) {
|
package/src/utils/index.ts
CHANGED
|
@@ -30,19 +30,6 @@ import {
|
|
|
30
30
|
import { type extendedLineChartPropsType } from '../LineChart'
|
|
31
31
|
import { type extendedBarChartPropsType } from '../BarChart'
|
|
32
32
|
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
34
|
-
const versionString = require('react-native/package.json').version
|
|
35
|
-
|
|
36
|
-
const versionAr = versionString?.split?.('.') ?? ''
|
|
37
|
-
const msb = Number(versionAr[0])
|
|
38
|
-
const mid = Number(versionAr[1])
|
|
39
|
-
const lsb = Number(versionAr[2])
|
|
40
|
-
|
|
41
|
-
export const rnVersion =
|
|
42
|
-
(!isNaN(msb) ? msb : 0) * 1000000 +
|
|
43
|
-
(!isNaN(mid) ? mid : 0) * 10000 +
|
|
44
|
-
(!isNaN(lsb) ? lsb : 0)
|
|
45
|
-
|
|
46
33
|
export const getCumulativeWidth = (
|
|
47
34
|
data: any,
|
|
48
35
|
index: number,
|