gifted-charts-core 0.0.28 → 0.0.30
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 +1 -1
- 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/components/BarAndLineChartsWrapper/index.d.ts +1 -0
- package/src/components/BarAndLineChartsWrapper/index.js +9 -0
- package/src/components/BarAndLineChartsWrapper/index.ts +16 -0
- package/src/index.d.ts +1 -1
- package/src/index.ts +2 -1
package/package.json
CHANGED
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
|
|
@@ -23,6 +23,7 @@ export declare const useBarAndLineChartsWrapper: (props: BarAndLineChartsWrapper
|
|
|
23
23
|
rotate?: undefined;
|
|
24
24
|
translateY?: undefined;
|
|
25
25
|
})[];
|
|
26
|
+
transformForHorizontalForReactJS: string;
|
|
26
27
|
horizSectionProps: horizSectionPropTypes;
|
|
27
28
|
referenceLinesOverChartContent: any;
|
|
28
29
|
setCanMomentum: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
@@ -216,6 +216,14 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
216
216
|
(yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52)
|
|
217
217
|
}
|
|
218
218
|
];
|
|
219
|
+
var transformForHorizontalForReactJS = "rotate(".concat(rtl ? '-90deg' : '90deg', ")\n translateY(").concat(-shiftX + (rtl ? -difBwWidthHeight + 14 : difBwWidthHeight) / 2 - 20, ")\n translateX(").concat(shiftY +
|
|
220
|
+
(rtl
|
|
221
|
+
? (props.width ? -98 - endSpacing : -75 - endSpacing) - difBwWidthHeight
|
|
222
|
+
: props.width
|
|
223
|
+
? difBwWidthHeight
|
|
224
|
+
: difBwWidthHeight - 40) /
|
|
225
|
+
2 +
|
|
226
|
+
(yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52), ")");
|
|
219
227
|
var _13 = __read(useState(false), 2), canMomentum = _13[0], setCanMomentum = _13[1];
|
|
220
228
|
var isCloseToEnd = function (_a) {
|
|
221
229
|
var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
|
|
@@ -249,6 +257,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
249
257
|
xAxisTextNumberOfLines: xAxisTextNumberOfLines,
|
|
250
258
|
actualContainerWidth: actualContainerWidth,
|
|
251
259
|
transformForHorizontal: transformForHorizontal,
|
|
260
|
+
transformForHorizontalForReactJS: transformForHorizontalForReactJS,
|
|
252
261
|
horizSectionProps: horizSectionProps,
|
|
253
262
|
referenceLinesOverChartContent: referenceLinesOverChartContent,
|
|
254
263
|
setCanMomentum: setCanMomentum,
|
|
@@ -316,6 +316,21 @@ export const useBarAndLineChartsWrapper = (
|
|
|
316
316
|
}
|
|
317
317
|
]
|
|
318
318
|
|
|
319
|
+
const transformForHorizontalForReactJS = `rotate(${rtl ? '-90deg' : '90deg'})
|
|
320
|
+
translateY(${
|
|
321
|
+
-shiftX + (rtl ? -difBwWidthHeight + 14 : difBwWidthHeight) / 2 - 20
|
|
322
|
+
})
|
|
323
|
+
translateX(${
|
|
324
|
+
shiftY +
|
|
325
|
+
(rtl
|
|
326
|
+
? (props.width ? -98 - endSpacing : -75 - endSpacing) - difBwWidthHeight
|
|
327
|
+
: props.width
|
|
328
|
+
? difBwWidthHeight
|
|
329
|
+
: difBwWidthHeight - 40) /
|
|
330
|
+
2 +
|
|
331
|
+
(yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52)
|
|
332
|
+
})`
|
|
333
|
+
|
|
319
334
|
const [canMomentum, setCanMomentum] = useState(false)
|
|
320
335
|
|
|
321
336
|
const isCloseToEnd = ({
|
|
@@ -360,6 +375,7 @@ export const useBarAndLineChartsWrapper = (
|
|
|
360
375
|
xAxisTextNumberOfLines,
|
|
361
376
|
actualContainerWidth,
|
|
362
377
|
transformForHorizontal,
|
|
378
|
+
transformForHorizontalForReactJS,
|
|
363
379
|
horizSectionProps,
|
|
364
380
|
referenceLinesOverChartContent,
|
|
365
381
|
setCanMomentum,
|
package/src/index.d.ts
CHANGED
|
@@ -34,4 +34,4 @@ export { getTopAndLeftForStripAndLabel } from './components/common/StripAndLabel
|
|
|
34
34
|
/***********************************************************************************************************************/
|
|
35
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';
|