-
Notifications
You must be signed in to change notification settings - Fork 81
/
CombinedChart.js
122 lines (112 loc) · 3.16 KB
/
CombinedChart.js
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { requireNativeComponent, View } from 'react-native';
class CombinedChart extends Component {
constructor(props) {
super(props);
}
render() {
let chartData = {};
let children = this.props.children;
let { style, animateY, animateX, animateXY, ...other } = this.props;
if (children.length) {
for (var i = 0; i < children.length; i++) {
var child = children[i]
chartData[child.props.chartType] = child.props.data;
}
} else {
chartData[children.props.chartType] = children.props.data;
}
if (animateY) {
chartData.animateY = animateY
} else if (animateX) {
chartData.animateX = animateX
} else if (animateXY) {
chartData.animateXY = animateXY
}
return (
<MPCombinedChart
style={style}
{...other}
data={chartData}
/>
);
}
}
CombinedChart.propTypes = {
...View.propTypes,
data: PropTypes.object,
touchEnabled: PropTypes.bool,
dragEnabled: PropTypes.bool,
scaleEnabled: PropTypes.bool,
scaleXEnabled: PropTypes.bool,
scaleYEnabled: PropTypes.bool,
pinchZoom: PropTypes.bool,
doubleTapToZoomEnabled: PropTypes.bool,
highlightPerDragEnabled: PropTypes.bool,
highlightPerTapEnabled: PropTypes.bool,
dragDecelerationEnabled: PropTypes.bool,
dragDecelerationFrictionCoef: PropTypes.number,
maxVisibleValueCount: PropTypes.number,
limitLine: PropTypes.object,
description: PropTypes.string,
backgroundColor: PropTypes.string,
drawGridBackground: PropTypes.bool,
gridBackgroundColor: PropTypes.string,
visibleXRange: PropTypes.array,
borderColor: PropTypes.string,
borderWidth: PropTypes.number,
xAxis: PropTypes.object,
yAxisLeft: PropTypes.object,
yAxisRight: PropTypes.object,
yAxis: PropTypes.object,
fitScreen: PropTypes.bool,
chartPadding: PropTypes.string,
legend: PropTypes.object,
scaleX: PropTypes.number,
scaleY: PropTypes.number,
translateX: PropTypes.number,
translateY: PropTypes.number,
rotation: PropTypes.number,
renderToHardwareTextureAndroid: PropTypes.bool,
onLayout: PropTypes.bool,
accessibilityLiveRegion: PropTypes.string,
accessibilityComponentType: PropTypes.string,
importantForAccessibility: PropTypes.string,
accessibilityLabel: PropTypes.string,
testID: PropTypes.string,
viewCenter: PropTypes.array,
zoomTo: PropTypes.object,
extraOffsets: PropTypes.string,
animateY: PropTypes.object,
animateX: PropTypes.object,
animateXY: PropTypes.object,
};
class chart extends Component {
constructor(props) {
super(props);
}
render() {
return null;
}
}
chart.propTypes = {
chartType: PropTypes.string,
data: PropTypes.object,
};
CombinedChart.Chart = chart;
// RIGHT_OF_CHART,
// RIGHT_OF_CHART_CENTER,
// RIGHT_OF_CHART_INSIDE,
// LEFT_OF_CHART,
// LEFT_OF_CHART_CENTER,
// LEFT_OF_CHART_INSIDE,
// BELOW_CHART_LEFT,
// BELOW_CHART_RIGHT,
// BELOW_CHART_CENTER,
// ABOVE_CHART_LEFT,
// ABOVE_CHART_RIGHT,
// ABOVE_CHART_CENTER,
// PIECHART_CENTER;
var MPCombinedChart = requireNativeComponent('MPCombinedChart', CombinedChart);
export default CombinedChart;