@urvish-procare/react-native-charts-wrapper 0.6.0
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/README.md +258 -0
- package/android/build.gradle +43 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/MPAndroidChartPackage.java +49 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/BarChartManager.java +46 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/BarLineChartBaseManager.java +415 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/BubbleChartManager.java +32 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/CandleStickChartManager.java +31 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/ChartBaseManager.java +605 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/ChartGroupHolder.java +80 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/CombinedChartManager.java +62 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/ConfigurableMinimumLinePositionFillFormatter.java +19 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/CustomFormatter.java +25 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/DateFormatter.java +34 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/HorizontalBarChartManager.java +23 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/IndexValueFormatter.java +102 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/LabelByXValueFormatter.java +25 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/LineChartManager.java +31 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/PieChartManager.java +147 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/RadarChartManager.java +118 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/ScatterChartManager.java +32 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/charts/YAxisChartBase.java +51 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/BarDataExtract.java +106 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/BubbleDataExtract.java +74 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/CandleDataExtract.java +102 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/CombinedDataExtract.java +70 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/DataExtract.java +77 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/LineDataExtract.java +130 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/PieDataExtract.java +101 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/RadarDataExtract.java +58 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/data/ScatterDataExtract.java +75 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/listener/RNOnChartGestureListener.java +129 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/listener/RNOnChartValueSelectedListener.java +52 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/markers/RNCircleMarkerView.java +19 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/markers/RNRectangleMarkerView.java +134 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/utils/BridgeUtils.java +52 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/utils/ChartDataSetConfigUtils.java +197 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/utils/ConversionUtil.java +144 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/utils/DrawableUtils.java +51 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/utils/EasingFunctionHelper.java +128 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/utils/EntryToWritableMapUtils.java +147 -0
- package/android/src/main/java/com/github/wuxudong/rncharts/utils/TypefaceUtils.java +47 -0
- package/android/src/main/res/drawable-nodpi/circle_marker.xml +8 -0
- package/android/src/main/res/drawable-nodpi/oval_marker.png +0 -0
- package/android/src/main/res/drawable-nodpi/rectangle_marker.9.png +0 -0
- package/android/src/main/res/drawable-nodpi/rectangle_marker_left.9.png +0 -0
- package/android/src/main/res/drawable-nodpi/rectangle_marker_right.9.png +0 -0
- package/android/src/main/res/drawable-nodpi/rectangle_marker_top.9.png +0 -0
- package/android/src/main/res/drawable-nodpi/rectangle_marker_top_left.9.png +0 -0
- package/android/src/main/res/drawable-nodpi/rectangle_marker_top_right.9.png +0 -0
- package/android/src/main/res/layout/circle_marker.xml +13 -0
- package/android/src/main/res/layout/oval_marker.xml +24 -0
- package/android/src/main/res/layout/rectangle_marker.xml +21 -0
- package/index.js +21 -0
- package/ios/ReactNativeCharts/BalloonMarker.swift +240 -0
- package/ios/ReactNativeCharts/ChartGroupHolder.swift +70 -0
- package/ios/ReactNativeCharts/CircleMarker.swift +108 -0
- package/ios/ReactNativeCharts/ConfigurableMinimumLinePositionFillFormatter.swift +19 -0
- package/ios/ReactNativeCharts/CustomChartDateFormatter.swift +64 -0
- package/ios/ReactNativeCharts/DataExtract.swift +80 -0
- package/ios/ReactNativeCharts/IndexValueFormatter.swift +49 -0
- package/ios/ReactNativeCharts/RNBarLineChartBaseManager.swift +115 -0
- package/ios/ReactNativeCharts/RNBarLineChartManagerBridge.h +40 -0
- package/ios/ReactNativeCharts/RNBarLineChartViewBase.swift +294 -0
- package/ios/ReactNativeCharts/RNChartManagerBridge.h +36 -0
- package/ios/ReactNativeCharts/RNChartViewBase.swift +593 -0
- package/ios/ReactNativeCharts/RNCharts-Bridging-Header.h +9 -0
- package/ios/ReactNativeCharts/RNYAxisChartManagerBridge.h +17 -0
- package/ios/ReactNativeCharts/RNYAxisChartViewBase.swift +53 -0
- package/ios/ReactNativeCharts/ReactNativeCharts.xcodeproj/project.pbxproj +376 -0
- package/ios/ReactNativeCharts/bar/BarDataExtract.swift +89 -0
- package/ios/ReactNativeCharts/bar/RNBarChartManager.swift +53 -0
- package/ios/ReactNativeCharts/bar/RNBarChartManagerBridge.m +17 -0
- package/ios/ReactNativeCharts/bar/RNBarChartView.swift +41 -0
- package/ios/ReactNativeCharts/bar/RNBarChartViewBase.swift +27 -0
- package/ios/ReactNativeCharts/bar/RNHorizontalBarChartManager.swift +45 -0
- package/ios/ReactNativeCharts/bar/RNHorizontalBarChartManagerBridge.m +16 -0
- package/ios/ReactNativeCharts/bar/RNHorizontalBarChartView.swift +41 -0
- package/ios/ReactNativeCharts/bubble/BubbleDataExtract.swift +61 -0
- package/ios/ReactNativeCharts/bubble/RNBubbleChartManager.swift +53 -0
- package/ios/ReactNativeCharts/bubble/RNBubbleChartManagerBridge.m +15 -0
- package/ios/ReactNativeCharts/bubble/RNBubbleChartView.swift +39 -0
- package/ios/ReactNativeCharts/candlestick/CandleDataExtract.swift +101 -0
- package/ios/ReactNativeCharts/candlestick/RNCandleStickChartManager.swift +53 -0
- package/ios/ReactNativeCharts/candlestick/RNCandleStickChartManagerBridge.m +16 -0
- package/ios/ReactNativeCharts/candlestick/RNCandleStickChartView.swift +44 -0
- package/ios/ReactNativeCharts/combine/CombinedDataExtract.swift +81 -0
- package/ios/ReactNativeCharts/combine/RNCombinedChartManager.swift +53 -0
- package/ios/ReactNativeCharts/combine/RNCombinedChartManagerBridge.m +19 -0
- package/ios/ReactNativeCharts/combine/RNCombinedChartView.swift +61 -0
- package/ios/ReactNativeCharts/formatters/ChartDateFormatter.swift +38 -0
- package/ios/ReactNativeCharts/formatters/LabelByXValueFormatter.swift +35 -0
- package/ios/ReactNativeCharts/formatters/LargeValueFormatter.swift +72 -0
- package/ios/ReactNativeCharts/line/LineDataExtract.swift +178 -0
- package/ios/ReactNativeCharts/line/RNLineChartManager.swift +53 -0
- package/ios/ReactNativeCharts/line/RNLineChartManagerBridge.m +14 -0
- package/ios/ReactNativeCharts/line/RNLineChartView.swift +41 -0
- package/ios/ReactNativeCharts/pie/PieDataExtract.swift +97 -0
- package/ios/ReactNativeCharts/pie/RNPieChartManager.swift +19 -0
- package/ios/ReactNativeCharts/pie/RNPieChartManagerBridge.m +30 -0
- package/ios/ReactNativeCharts/pie/RNPieChartView.swift +192 -0
- package/ios/ReactNativeCharts/radar/RNRadarChartManager.swift +19 -0
- package/ios/ReactNativeCharts/radar/RNRadarChartManagerBridge.m +25 -0
- package/ios/ReactNativeCharts/radar/RNRadarChartView.swift +99 -0
- package/ios/ReactNativeCharts/radar/RadarDataExtract.swift +50 -0
- package/ios/ReactNativeCharts/scatter/RNScatterChartManager.swift +53 -0
- package/ios/ReactNativeCharts/scatter/RNScatterChartManagerBridge.m +15 -0
- package/ios/ReactNativeCharts/scatter/RNScatterChartView.swift +43 -0
- package/ios/ReactNativeCharts/scatter/ScatterDataExtract.swift +76 -0
- package/ios/ReactNativeCharts/utils/BridgeUtils.swift +333 -0
- package/ios/ReactNativeCharts/utils/ChartDataSetConfigUtils.swift +147 -0
- package/ios/ReactNativeCharts/utils/EntryToDictionaryUtils.swift +66 -0
- package/ios/ReactNativeCharts/utils/FontUtils.swift +29 -0
- package/ios/ReactNativeCharts/utils/HighlightUtils.swift +41 -0
- package/lib/AxisIface.js +102 -0
- package/lib/BarChart.js +43 -0
- package/lib/BarLineChartBase.js +86 -0
- package/lib/BubbleChart.js +40 -0
- package/lib/CandleStickChart.js +40 -0
- package/lib/ChartBase.js +131 -0
- package/lib/ChartDataConfig.js +263 -0
- package/lib/ChartDataSetConfig.js +80 -0
- package/lib/CombinedChart.js +43 -0
- package/lib/HighlightEnhancer.js +15 -0
- package/lib/HorizontalBarChart.js +43 -0
- package/lib/LineChart.js +39 -0
- package/lib/MoveEnhancer.js +49 -0
- package/lib/PieChart.js +64 -0
- package/lib/PieRadarChartBase.js +18 -0
- package/lib/RadarChart.js +52 -0
- package/lib/ScaleEnhancer.js +16 -0
- package/lib/ScatterChart.js +38 -0
- package/lib/ScrollEnhancer.js +15 -0
- package/package.json +40 -0
- package/react-native-charts-wrapper.podspec +26 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import {
|
|
3
|
+
requireNativeComponent,
|
|
4
|
+
View
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const chartDataSetConfig = {
|
|
9
|
+
common: {
|
|
10
|
+
color: PropTypes.number,
|
|
11
|
+
colors: PropTypes.arrayOf(PropTypes.number),
|
|
12
|
+
highlightEnabled:PropTypes.bool,
|
|
13
|
+
drawValues: PropTypes.bool,
|
|
14
|
+
valueTextSize:PropTypes.number,
|
|
15
|
+
valueTextColor:PropTypes.number,
|
|
16
|
+
visible:PropTypes.bool,
|
|
17
|
+
valueFormatter: PropTypes.oneOfType([
|
|
18
|
+
PropTypes.oneOf(['largeValue', 'percent', 'date', 'labelByXValue']),
|
|
19
|
+
PropTypes.string,
|
|
20
|
+
PropTypes.arrayOf(PropTypes.string)
|
|
21
|
+
]),
|
|
22
|
+
valueFormatterPattern: PropTypes.string,
|
|
23
|
+
valueFormatterLabels: PropTypes.arrayOf(PropTypes.shape({
|
|
24
|
+
x: PropTypes.number.isRequired,
|
|
25
|
+
label: PropTypes.string.isRequired,
|
|
26
|
+
})),
|
|
27
|
+
axisDependency:PropTypes.oneOf(['LEFT', 'RIGHT'])
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
barLineScatterCandleBubble: {
|
|
31
|
+
highlightColor: PropTypes.number
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
lineScatterCandleRadar: {
|
|
35
|
+
drawVerticalHighlightIndicator: PropTypes.bool,
|
|
36
|
+
drawHorizontalHighlightIndicator: PropTypes.bool,
|
|
37
|
+
highlightLineWidth: PropTypes.number
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
lineRadar: {
|
|
41
|
+
fillGradient: PropTypes.shape({
|
|
42
|
+
colors: PropTypes.arrayOf(PropTypes.number),
|
|
43
|
+
// iOS
|
|
44
|
+
positions: PropTypes.arrayOf(PropTypes.number),
|
|
45
|
+
angle: PropTypes.number,
|
|
46
|
+
// Android
|
|
47
|
+
orientation: PropTypes.oneOf([
|
|
48
|
+
// draw the gradient from the top to the bottom
|
|
49
|
+
'TOP_BOTTOM',
|
|
50
|
+
// draw the gradient from the top-right to the bottom-left
|
|
51
|
+
'TR_BL',
|
|
52
|
+
// draw the gradient from the right to the left
|
|
53
|
+
'RIGHT_LEFT',
|
|
54
|
+
// draw the gradient from the bottom-right to the top-left
|
|
55
|
+
'BR_TL',
|
|
56
|
+
// draw the gradient from the bottom to the top
|
|
57
|
+
'BOTTOM_TOP',
|
|
58
|
+
// draw the gradient from the bottom-left to the top-right
|
|
59
|
+
'BL_TR',
|
|
60
|
+
// draw the gradient from the left to the right
|
|
61
|
+
'LEFT_RIGHT',
|
|
62
|
+
// draw the gradient from the top-left to the bottom-right
|
|
63
|
+
'TL_BR',
|
|
64
|
+
]),
|
|
65
|
+
}),
|
|
66
|
+
fillColor: PropTypes.number,
|
|
67
|
+
fillAlpha: PropTypes.number,
|
|
68
|
+
drawFilled: PropTypes.bool,
|
|
69
|
+
lineWidth: (props, propName, componentName) => {
|
|
70
|
+
let lineWidth = props[propName];
|
|
71
|
+
if (lineWidth && (typeof lineWidth !== 'number' || lineWidth < 0.2 || lineWidth > 10)) {
|
|
72
|
+
return new Error(
|
|
73
|
+
`Invalid prop ${propName} supplied to '${componentName}'. Value must be number and between 0.2f and 10f`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default chartDataSetConfig;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, {Component} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
requireNativeComponent,
|
|
5
|
+
View
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
import BarLineChartBase from './BarLineChartBase';
|
|
9
|
+
import {combinedData} from './ChartDataConfig';
|
|
10
|
+
import MoveEnhancer from './MoveEnhancer'
|
|
11
|
+
import ScaleEnhancer from "./ScaleEnhancer";
|
|
12
|
+
import HighlightEnhancer from "./HighlightEnhancer";
|
|
13
|
+
import ScrollEnhancer from "./ScrollEnhancer";
|
|
14
|
+
|
|
15
|
+
class CombinedChart extends React.Component {
|
|
16
|
+
getNativeComponentName() {
|
|
17
|
+
return 'RNCombinedChart'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getNativeComponentRef() {
|
|
21
|
+
return this.nativeComponentRef
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
return <RNCombinedChart {...this.props} ref={ref => this.nativeComponentRef = ref} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
CombinedChart.propTypes = {
|
|
31
|
+
...BarLineChartBase.propTypes,
|
|
32
|
+
drawOrder: PropTypes.arrayOf(PropTypes.oneOf(['BAR', 'BUBBLE', 'LINE', 'CANDLE', 'SCATTER'])),
|
|
33
|
+
drawValueAboveBar: PropTypes.bool,
|
|
34
|
+
highlightFullBarEnabled: PropTypes.bool,
|
|
35
|
+
drawBarShadow: PropTypes.bool,
|
|
36
|
+
data: combinedData
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var RNCombinedChart = requireNativeComponent('RNCombinedChart', CombinedChart, {
|
|
40
|
+
nativeOnly: {onSelect: true, onChange: true}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default ScrollEnhancer(HighlightEnhancer(ScaleEnhancer(MoveEnhancer(CombinedChart))))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, {Component} from 'react';
|
|
2
|
+
import { UIManager, findNodeHandle} from 'react-native';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function HighlightEnhancer(Chart) {
|
|
6
|
+
return class HighlightExtended extends Chart {
|
|
7
|
+
highlights(config) {
|
|
8
|
+
UIManager.dispatchViewManagerCommand(
|
|
9
|
+
findNodeHandle(this.getNativeComponentRef()),
|
|
10
|
+
UIManager.getViewManagerConfig(this.getNativeComponentName()).Commands.highlights,
|
|
11
|
+
[config]
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, {Component} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
requireNativeComponent,
|
|
5
|
+
View
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
import BarLineChartBase from './BarLineChartBase';
|
|
9
|
+
import {barData} from './ChartDataConfig';
|
|
10
|
+
import MoveEnhancer from './MoveEnhancer'
|
|
11
|
+
import ScaleEnhancer from "./ScaleEnhancer";
|
|
12
|
+
import HighlightEnhancer from "./HighlightEnhancer";
|
|
13
|
+
|
|
14
|
+
class HorizontalBarChart extends React.Component {
|
|
15
|
+
getNativeComponentName() {
|
|
16
|
+
return 'RNHorizontalBarChart'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getNativeComponentRef() {
|
|
20
|
+
return this.nativeComponentRef
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return <RNHorizontalBarChart {...this.props} ref={ref => this.nativeComponentRef = ref} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
HorizontalBarChart.propTypes = {
|
|
30
|
+
...BarLineChartBase.propTypes,
|
|
31
|
+
|
|
32
|
+
drawValueAboveBar: PropTypes.bool,
|
|
33
|
+
drawBarShadow: PropTypes.bool,
|
|
34
|
+
highlightFullBarEnabled: PropTypes.bool,
|
|
35
|
+
|
|
36
|
+
data: barData
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var RNHorizontalBarChart = requireNativeComponent('RNHorizontalBarChart', HorizontalBarChart, {
|
|
40
|
+
nativeOnly: {onSelect: true, onChange: true}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default HighlightEnhancer(ScaleEnhancer(MoveEnhancer(HorizontalBarChart)))
|
package/lib/LineChart.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, {Component} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
requireNativeComponent,
|
|
5
|
+
View
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
import BarLineChartBase from './BarLineChartBase';
|
|
9
|
+
import {lineData} from './ChartDataConfig';
|
|
10
|
+
import MoveEnhancer from './MoveEnhancer'
|
|
11
|
+
import ScaleEnhancer from "./ScaleEnhancer";
|
|
12
|
+
import HighlightEnhancer from "./HighlightEnhancer";
|
|
13
|
+
import ScrollEnhancer from "./ScrollEnhancer";
|
|
14
|
+
|
|
15
|
+
class LineChart extends React.Component {
|
|
16
|
+
getNativeComponentName() {
|
|
17
|
+
return 'RNLineChart'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getNativeComponentRef() {
|
|
21
|
+
return this.nativeComponentRef
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
return <RNLineChart {...this.props} ref={ref => this.nativeComponentRef = ref} />;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
LineChart.propTypes = {
|
|
30
|
+
...BarLineChartBase.propTypes,
|
|
31
|
+
|
|
32
|
+
data: lineData,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var RNLineChart = requireNativeComponent('RNLineChart', LineChart, {
|
|
36
|
+
nativeOnly: {onSelect: true, onChange: true}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default ScrollEnhancer(HighlightEnhancer(ScaleEnhancer(MoveEnhancer(LineChart))))
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, {Component} from 'react';
|
|
2
|
+
import { UIManager, findNodeHandle} from 'react-native';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function MoveEnhancer(Chart) {
|
|
6
|
+
return class MoveExtended extends Chart {
|
|
7
|
+
// x, y, left/right
|
|
8
|
+
moveViewTo(x, y, axisDependency) {
|
|
9
|
+
UIManager.dispatchViewManagerCommand(
|
|
10
|
+
findNodeHandle(this.getNativeComponentRef()),
|
|
11
|
+
UIManager.getViewManagerConfig(this.getNativeComponentName()).Commands.moveViewTo,
|
|
12
|
+
[x, y, axisDependency]
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
moveViewToX(x) {
|
|
18
|
+
UIManager.dispatchViewManagerCommand(
|
|
19
|
+
findNodeHandle(this.getNativeComponentRef()),
|
|
20
|
+
UIManager.getViewManagerConfig(this.getNativeComponentName()).Commands.moveViewToX,
|
|
21
|
+
[x]
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
moveViewToAnimated(x, y, axisDependency, duration) {
|
|
26
|
+
UIManager.dispatchViewManagerCommand(
|
|
27
|
+
findNodeHandle(this.getNativeComponentRef()),
|
|
28
|
+
UIManager.getViewManagerConfig(this.getNativeComponentName()).Commands.moveViewToAnimated,
|
|
29
|
+
[x, y, axisDependency, duration]
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
centerViewTo(x, y, axisDependency) {
|
|
34
|
+
UIManager.dispatchViewManagerCommand(
|
|
35
|
+
findNodeHandle(this.getNativeComponentRef()),
|
|
36
|
+
UIManager.getViewManagerConfig(this.getNativeComponentName()).Commands.centerViewTo,
|
|
37
|
+
[x, y, axisDependency]
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
centerViewToAnimated(x, y, axisDependency, duration) {
|
|
42
|
+
UIManager.dispatchViewManagerCommand(
|
|
43
|
+
findNodeHandle(this.getNativeComponentRef()),
|
|
44
|
+
UIManager.getViewManagerConfig(this.getNativeComponentName()).Commands.centerViewToAnimated,
|
|
45
|
+
[x, y, axisDependency, duration]
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
package/lib/PieChart.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, {Component} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
requireNativeComponent,
|
|
5
|
+
View
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
import PieRadarChartBase from './PieRadarChartBase';
|
|
9
|
+
import {pieData} from './ChartDataConfig';
|
|
10
|
+
|
|
11
|
+
class PieChart extends React.Component {
|
|
12
|
+
getNativeComponentName() {
|
|
13
|
+
return 'RNPieChart'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getNativeComponentRef() {
|
|
17
|
+
return this.nativeComponentRef
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
return <RNPieChart {...this.props} ref={ref => this.nativeComponentRef = ref} />;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
PieChart.propTypes = {
|
|
26
|
+
...PieRadarChartBase.propTypes,
|
|
27
|
+
|
|
28
|
+
extraOffsets: PropTypes.shape({
|
|
29
|
+
left: PropTypes.number,
|
|
30
|
+
top: PropTypes.number,
|
|
31
|
+
right: PropTypes.number,
|
|
32
|
+
bottom: PropTypes.number
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
drawEntryLabels: PropTypes.bool,
|
|
36
|
+
usePercentValues: PropTypes.bool,
|
|
37
|
+
|
|
38
|
+
centerText: PropTypes.string,
|
|
39
|
+
styledCenterText: PropTypes.shape({
|
|
40
|
+
text: PropTypes.string,
|
|
41
|
+
color: PropTypes.number,
|
|
42
|
+
fontFamily: PropTypes.string,
|
|
43
|
+
size: PropTypes.number
|
|
44
|
+
}),
|
|
45
|
+
centerTextRadiusPercent: PropTypes.number,
|
|
46
|
+
holeRadius: PropTypes.number,
|
|
47
|
+
holeColor: PropTypes.number,
|
|
48
|
+
transparentCircleRadius: PropTypes.number,
|
|
49
|
+
transparentCircleColor: PropTypes.number,
|
|
50
|
+
|
|
51
|
+
entryLabelColor: PropTypes.number,
|
|
52
|
+
entryLabelTextSize: PropTypes.number,
|
|
53
|
+
entryLabelFontFamily: PropTypes.string,
|
|
54
|
+
maxAngle: PropTypes.number,
|
|
55
|
+
|
|
56
|
+
// TODO PieChart should have only one dataset
|
|
57
|
+
data: pieData
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var RNPieChart = requireNativeComponent('RNPieChart', PieChart, {
|
|
61
|
+
nativeOnly: {onSelect: true, onChange: true}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export default PieChart
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import {
|
|
3
|
+
View
|
|
4
|
+
} from 'react-native';
|
|
5
|
+
|
|
6
|
+
import ChartBase from './ChartBase';
|
|
7
|
+
|
|
8
|
+
const iface = {
|
|
9
|
+
propTypes: {
|
|
10
|
+
...ChartBase.propTypes,
|
|
11
|
+
|
|
12
|
+
minOffset: PropTypes.number,
|
|
13
|
+
rotationEnabled: PropTypes.bool,
|
|
14
|
+
rotationAngle: PropTypes.number
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default iface;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, {Component} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
requireNativeComponent,
|
|
5
|
+
View
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
import PieRadarChartBase from './PieRadarChartBase';
|
|
9
|
+
import {yAxisIface} from './AxisIface';
|
|
10
|
+
import {radarData} from './ChartDataConfig';
|
|
11
|
+
|
|
12
|
+
class RadarChart extends React.Component {
|
|
13
|
+
getNativeComponentName() {
|
|
14
|
+
return 'RNRadarChart'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getNativeComponentRef() {
|
|
18
|
+
return this.nativeComponentRef
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
render() {
|
|
22
|
+
return <RNRadarChart {...this.props} ref={ref => this.nativeComponentRef = ref} />;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
RadarChart.propTypes = {
|
|
27
|
+
...PieRadarChartBase.propTypes,
|
|
28
|
+
|
|
29
|
+
yAxis: PropTypes.shape(yAxisIface),
|
|
30
|
+
|
|
31
|
+
drawWeb: PropTypes.bool,
|
|
32
|
+
skipWebLineCount: PropTypes.number,
|
|
33
|
+
|
|
34
|
+
webLineWidth: PropTypes.number,
|
|
35
|
+
webLineWidthInner: PropTypes.number,
|
|
36
|
+
webAlpha: PropTypes.number,
|
|
37
|
+
webColor: PropTypes.number,
|
|
38
|
+
webColorInner: PropTypes.number,
|
|
39
|
+
extraOffsets: PropTypes.shape({
|
|
40
|
+
left: PropTypes.number,
|
|
41
|
+
top: PropTypes.number,
|
|
42
|
+
right: PropTypes.number,
|
|
43
|
+
bottom: PropTypes.number
|
|
44
|
+
}),
|
|
45
|
+
data: radarData
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var RNRadarChart = requireNativeComponent('RNRadarChart', RadarChart, {
|
|
49
|
+
nativeOnly: {onSelect: true, onChange: true}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export default RadarChart
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, {Component} from 'react';
|
|
2
|
+
import { UIManager, findNodeHandle} from 'react-native';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function ScaleEnhancer(Chart) {
|
|
6
|
+
return class ScaleExtended extends Chart {
|
|
7
|
+
fitScreen() {
|
|
8
|
+
UIManager.dispatchViewManagerCommand(
|
|
9
|
+
findNodeHandle(this.getNativeComponentRef()),
|
|
10
|
+
UIManager.getViewManagerConfig(this.getNativeComponentName()).Commands.fitScreen,
|
|
11
|
+
[]
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, {Component} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
requireNativeComponent,
|
|
4
|
+
View
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
import BarLineChartBase from './BarLineChartBase';
|
|
8
|
+
import {scatterData} from './ChartDataConfig';
|
|
9
|
+
import MoveEnhancer from './MoveEnhancer'
|
|
10
|
+
import ScaleEnhancer from "./ScaleEnhancer";
|
|
11
|
+
import HighlightEnhancer from "./HighlightEnhancer";
|
|
12
|
+
import ScrollEnhancer from "./ScrollEnhancer";
|
|
13
|
+
|
|
14
|
+
class ScatterChart extends React.Component {
|
|
15
|
+
getNativeComponentName() {
|
|
16
|
+
return 'RNScatterChart'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getNativeComponentRef() {
|
|
20
|
+
return this.nativeComponentRef
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return <RNScatterChart {...this.props} ref={ref => this.nativeComponentRef = ref} />;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ScatterChart.propTypes = {
|
|
29
|
+
...BarLineChartBase.propTypes,
|
|
30
|
+
|
|
31
|
+
data: scatterData
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var RNScatterChart = requireNativeComponent('RNScatterChart', ScatterChart, {
|
|
35
|
+
nativeOnly: {onSelect: true, onChange: true}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export default ScrollEnhancer(HighlightEnhancer(ScaleEnhancer(MoveEnhancer(ScatterChart))))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, {Component} from 'react';
|
|
2
|
+
import { UIManager, findNodeHandle} from 'react-native';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function ScrollEnhancer(Chart) {
|
|
6
|
+
return class ScrollExtended extends Chart {
|
|
7
|
+
setDataAndLockIndex(data) {
|
|
8
|
+
UIManager.dispatchViewManagerCommand(
|
|
9
|
+
findNodeHandle(this.getNativeComponentRef()),
|
|
10
|
+
UIManager.getViewManagerConfig(this.getNativeComponentName()).Commands.setDataAndLockIndex,
|
|
11
|
+
[data]
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@urvish-procare/react-native-charts-wrapper",
|
|
3
|
+
"repository": {
|
|
4
|
+
"type": "git",
|
|
5
|
+
"url": "https://github.com/wuxudong/react-native-charts-wrapper.git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.6.0",
|
|
8
|
+
"description": "A react-native charts support both android and iOS.",
|
|
9
|
+
"author": "wuxudong",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"nativePackage": true,
|
|
12
|
+
"homepage": "https://github.com/wuxudong/react-native-charts-wrapper",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"react native",
|
|
15
|
+
"chart",
|
|
16
|
+
"android",
|
|
17
|
+
"MPAndroidChart",
|
|
18
|
+
"ios",
|
|
19
|
+
"Charts"
|
|
20
|
+
],
|
|
21
|
+
"files": [
|
|
22
|
+
"android/src",
|
|
23
|
+
"android/build.gradle",
|
|
24
|
+
"android/gradle.properties",
|
|
25
|
+
"ios/**/*.h",
|
|
26
|
+
"ios/**/*.m",
|
|
27
|
+
"ios/**/*.swift",
|
|
28
|
+
"lib",
|
|
29
|
+
"index.js",
|
|
30
|
+
"react-native-charts-wrapper.podspec",
|
|
31
|
+
"ios/ReactNativeCharts/ReactNativeCharts.xcodeproj/project.pbxproj"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"deprecated-react-native-prop-types": "^2.3.0",
|
|
35
|
+
"prop-types": "^15.8.1"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": ">=16.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'react-native-charts-wrapper'
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.author = package["author"]
|
|
10
|
+
|
|
11
|
+
s.homepage = package["homepage"]
|
|
12
|
+
|
|
13
|
+
s.license = package["license"]
|
|
14
|
+
s.platform = :ios, "12.0"
|
|
15
|
+
|
|
16
|
+
s.source = { :git => "https://github.com/wuxudong/react-native-charts-wrapper.git", :tag => "#{s.version}" }
|
|
17
|
+
s.source_files = "ios/ReactNativeCharts/**/*.{h,m,swift}"
|
|
18
|
+
s.static_framework = true
|
|
19
|
+
|
|
20
|
+
s.swift_version = '5.0'
|
|
21
|
+
s.dependency 'React'
|
|
22
|
+
s.dependency 'SwiftyJSON', '5.0'
|
|
23
|
+
s.dependency 'DGCharts', '5.0.0'
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
end
|