react-native-gifted-charts 1.4.12 → 1.4.14
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 +6 -10
- package/src/BarChart/Animated2DWithGradient.tsx +197 -0
- package/src/BarChart/RenderBars.tsx +458 -0
- package/src/BarChart/RenderStackBars.tsx +385 -0
- package/src/BarChart/index.tsx +381 -0
- package/src/BarChart/styles.tsx +47 -0
- package/src/Components/AnimatedThreeDBar/index.tsx +258 -0
- package/src/Components/AnimatedThreeDBar/styles.tsx +14 -0
- package/src/Components/BarAndLineChartsWrapper/index.tsx +244 -0
- package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +590 -0
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +147 -0
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +157 -0
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +86 -0
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +42 -0
- package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +131 -0
- package/src/Components/BarSpecificComponents/barBackgroundPattern.tsx +30 -0
- package/src/Components/BarSpecificComponents/cap.tsx +34 -0
- package/src/Components/common/LinearGradient.tsx +27 -0
- package/src/Components/common/Pointer.tsx +37 -0
- package/src/Components/common/StripAndLabel.tsx +98 -0
- package/src/Components/lineSvg.tsx +42 -0
- package/src/LineChart/LineChartBicolor.tsx +740 -0
- package/src/LineChart/index.tsx +2158 -0
- package/src/LineChart/styles.tsx +47 -0
- package/src/PieChart/index.tsx +165 -0
- package/src/PieChart/main.tsx +363 -0
- package/src/PieChartPro/index.tsx +267 -0
- package/src/PopulationPyramid/index.tsx +603 -0
- package/src/index.tsx +25 -0
- package/src/todos.md +23 -0
- package/src/utils/index.ts +16 -0
- package/dist/BarChart/Animated2DWithGradient.js +0 -1
- package/dist/BarChart/RenderBars.js +0 -1
- package/dist/BarChart/RenderStackBars.js +0 -1
- package/dist/BarChart/index.js +0 -1
- package/dist/BarChart/styles.js +0 -1
- package/dist/Components/AnimatedThreeDBar/index.js +0 -1
- package/dist/Components/AnimatedThreeDBar/styles.js +0 -1
- package/dist/Components/BarAndLineChartsWrapper/index.js +0 -1
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +0 -1
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +0 -1
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +0 -1
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +0 -1
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +0 -1
- package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +0 -1
- package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +0 -1
- package/dist/Components/BarSpecificComponents/cap.js +0 -1
- package/dist/Components/common/LinearGradient.js +0 -1
- package/dist/Components/common/Pointer.js +0 -1
- package/dist/Components/common/StripAndLabel.js +0 -1
- package/dist/Components/lineSvg.js +0 -1
- package/dist/LineChart/LineChartBicolor.js +0 -1
- package/dist/LineChart/index.js +0 -1
- package/dist/LineChart/styles.js +0 -1
- package/dist/PieChart/index.js +0 -1
- package/dist/PieChart/main.js +0 -1
- package/dist/PieChartPro/index.js +0 -1
- package/dist/PopulationPyramid/index.js +0 -1
- package/dist/index.js +0 -1
- package/dist/utils/index.js +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import Svg, {Line} from 'react-native-svg';
|
|
4
|
+
import {getTopAndLeftForStripAndLabel} from 'gifted-charts-core';
|
|
5
|
+
|
|
6
|
+
export const StripAndLabel = props => {
|
|
7
|
+
const {
|
|
8
|
+
pointerX,
|
|
9
|
+
pointerLabelWidth,
|
|
10
|
+
pointerRadius,
|
|
11
|
+
pointerWidth,
|
|
12
|
+
pointerYLocal,
|
|
13
|
+
pointerStripUptoDataPoint,
|
|
14
|
+
pointerStripHeight,
|
|
15
|
+
pointerItemLocal,
|
|
16
|
+
showPointerStrip,
|
|
17
|
+
pointerStripWidth,
|
|
18
|
+
containerHeight,
|
|
19
|
+
xAxisThickness,
|
|
20
|
+
pointerStripColor,
|
|
21
|
+
pointerConfig,
|
|
22
|
+
pointerLabelComponent,
|
|
23
|
+
secondaryPointerItem,
|
|
24
|
+
pointerEvents,
|
|
25
|
+
isBarChart,
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
const {top, left} = getTopAndLeftForStripAndLabel(props);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View
|
|
32
|
+
style={{
|
|
33
|
+
position: 'absolute',
|
|
34
|
+
left: pointerX + (pointerItemLocal[0]?.pointerShiftX || 0),
|
|
35
|
+
top: pointerYLocal,
|
|
36
|
+
}}>
|
|
37
|
+
{(
|
|
38
|
+
isBarChart
|
|
39
|
+
? showPointerStrip && !pointerLabelComponent
|
|
40
|
+
: showPointerStrip
|
|
41
|
+
) ? (
|
|
42
|
+
<View
|
|
43
|
+
style={{
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
left: (pointerRadius || pointerWidth) - pointerStripWidth / 4,
|
|
46
|
+
top: pointerStripUptoDataPoint
|
|
47
|
+
? pointerRadius || pointerStripHeight / 2
|
|
48
|
+
: -pointerYLocal + 8,
|
|
49
|
+
width: pointerStripWidth,
|
|
50
|
+
height: pointerStripUptoDataPoint
|
|
51
|
+
? containerHeight - pointerYLocal + 5 - xAxisThickness
|
|
52
|
+
: pointerStripHeight,
|
|
53
|
+
marginTop: pointerStripUptoDataPoint
|
|
54
|
+
? 0
|
|
55
|
+
: containerHeight - pointerStripHeight,
|
|
56
|
+
}}>
|
|
57
|
+
<Svg>
|
|
58
|
+
<Line
|
|
59
|
+
stroke={pointerStripColor}
|
|
60
|
+
strokeWidth={pointerStripWidth}
|
|
61
|
+
strokeDasharray={
|
|
62
|
+
pointerConfig?.strokeDashArray
|
|
63
|
+
? pointerConfig?.strokeDashArray
|
|
64
|
+
: ''
|
|
65
|
+
}
|
|
66
|
+
x1={0}
|
|
67
|
+
y1={0}
|
|
68
|
+
x2={0}
|
|
69
|
+
y2={
|
|
70
|
+
pointerStripUptoDataPoint
|
|
71
|
+
? containerHeight - pointerYLocal + 5 - xAxisThickness
|
|
72
|
+
: pointerStripHeight
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
</Svg>
|
|
76
|
+
</View>
|
|
77
|
+
) : null}
|
|
78
|
+
|
|
79
|
+
{pointerLabelComponent ? (
|
|
80
|
+
<View
|
|
81
|
+
pointerEvents={pointerEvents ?? 'none'}
|
|
82
|
+
style={[
|
|
83
|
+
{
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
left: left,
|
|
86
|
+
top: top,
|
|
87
|
+
marginTop: pointerStripUptoDataPoint
|
|
88
|
+
? 0
|
|
89
|
+
: containerHeight - pointerStripHeight,
|
|
90
|
+
width: pointerLabelWidth,
|
|
91
|
+
},
|
|
92
|
+
]}>
|
|
93
|
+
{pointerLabelComponent?.(pointerItemLocal, secondaryPointerItem)}
|
|
94
|
+
</View>
|
|
95
|
+
) : null}
|
|
96
|
+
</View>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {ColorValue} from 'react-native';
|
|
3
|
+
import Svg, {G, Path} from 'react-native-svg';
|
|
4
|
+
import { ruleTypes } from 'gifted-charts-core';
|
|
5
|
+
|
|
6
|
+
type ruleProps = {
|
|
7
|
+
thickness: number;
|
|
8
|
+
width: number;
|
|
9
|
+
color: ColorValue | String | any;
|
|
10
|
+
type: String;
|
|
11
|
+
dashWidth: number;
|
|
12
|
+
dashGap: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type configType = {
|
|
16
|
+
config: ruleProps;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function Rule(props: configType) {
|
|
20
|
+
const {thickness, width, color, type, dashWidth, dashGap} = props.config;
|
|
21
|
+
if (type === ruleTypes.SOLID) {
|
|
22
|
+
return (
|
|
23
|
+
<Svg height={thickness} width={width} {...props}>
|
|
24
|
+
<G fill="lightgray" stroke={color} strokeWidth={thickness}>
|
|
25
|
+
<Path d={`M0 ${thickness / 2}h${width}`} />
|
|
26
|
+
</G>
|
|
27
|
+
</Svg>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return (
|
|
31
|
+
<Svg height={thickness} width={width} {...props}>
|
|
32
|
+
<G fill="lightgray" stroke={color} strokeWidth={thickness}>
|
|
33
|
+
<Path
|
|
34
|
+
strokeDasharray={`${dashWidth},${dashGap}`}
|
|
35
|
+
d={`M0 ${thickness / 2}h${width}`}
|
|
36
|
+
/>
|
|
37
|
+
</G>
|
|
38
|
+
</Svg>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default Rule;
|