From e205fe5693922759044be74a156eaa7cf264a9a1 Mon Sep 17 00:00:00 2001 From: Abhinandan Kushwaha Date: Sat, 14 Aug 2021 19:07:21 +0530 Subject: [PATCH] Added examples --- App.js | 79 +++++++++++++++++++++++++----- examples/LineChart/AnimatedArea.js | 42 ++++++++++++++++ examples/LineChart/AreaTwo.js | 55 +++++++++++++++++++++ examples/LineChart/LineChartTwo.js | 51 +++++++++++++++++++ examples/PieChart/ProgressPie.js | 24 +++++++++ examples/PieChart/SplitPie.js | 13 +++++ examples/PieChart/ThreeDPie.js | 33 +++++++++++++ package.json | 2 +- 8 files changed, 287 insertions(+), 12 deletions(-) create mode 100644 examples/LineChart/AnimatedArea.js create mode 100644 examples/LineChart/AreaTwo.js create mode 100644 examples/LineChart/LineChartTwo.js create mode 100644 examples/PieChart/ProgressPie.js create mode 100644 examples/PieChart/SplitPie.js create mode 100644 examples/PieChart/ThreeDPie.js diff --git a/App.js b/App.js index 86a9842..30cf71d 100644 --- a/App.js +++ b/App.js @@ -113,6 +113,26 @@ const App = () => { {value: 250, label: 'Apr', frontColor: '#4ADDBA'}, {value: 320, label: 'May', frontColor: '#91E3E3'}, ]; + // const lineData = [ + // {value: 0}, + // {value: 10}, + // {value: 8}, + // {value: 58}, + // {value: 56}, + // {value: 78}, + // {value: 74}, + // {value: 98}, + // ]; + // const lineData2 = [ + // {value: 0}, + // {value: 20}, + // {value: 18}, + // {value: 40}, + // {value: 36}, + // {value: 60}, + // {value: 54}, + // {value: 85}, + // ]; const lineData = [ {value: 0}, {value: 20}, @@ -123,15 +143,27 @@ const App = () => { {value: 54}, {value: 85}, ]; + const pieData = [ + {value: 70, color: '#177AD5' /*text: '54%'*/}, + {value: 30, color: 'lightgray' /*text: '30%'*/}, + // {value: 20, color: '#ED6665' /*text: '26%'*/}, + ]; return ( {/* */} + { + return 70%; + }} + /> {/* { color="#0BA5A4" /> */} - { verticalLinesColor="rgba(14,164,164,0.5)" xAxisColor="#0BA5A4" color="#0BA5A4" - /> + /> */} + + {/* */} {/* { capThickness={2} capColor="gray" /> */} - {/* */} {/* */} {/* { + const lineData = [ + {value: 0}, + {value: 20}, + {value: 18}, + {value: 40}, + {value: 36}, + {value: 60}, + {value: 54}, + {value: 85}, + ]; + return ( + + + + ); +}; + +export default AnimatedArea; diff --git a/examples/LineChart/AreaTwo.js b/examples/LineChart/AreaTwo.js new file mode 100644 index 0000000..c1dd206 --- /dev/null +++ b/examples/LineChart/AreaTwo.js @@ -0,0 +1,55 @@ +import React from 'react'; +import {View} from 'react-native'; +import {LineChart} from '../../src/LineChart'; + +const LineChartTwo = () => { + const lineData = [ + {value: 0}, + {value: 10}, + {value: 8}, + {value: 58}, + {value: 56}, + {value: 78}, + {value: 74}, + {value: 98}, + ]; + const lineData2 = [ + {value: 0}, + {value: 20}, + {value: 18}, + {value: 40}, + {value: 36}, + {value: 60}, + {value: 54}, + {value: 85}, + ]; + return ( + + + + ); +}; + +export default LineChartTwo; diff --git a/examples/LineChart/LineChartTwo.js b/examples/LineChart/LineChartTwo.js new file mode 100644 index 0000000..aeff720 --- /dev/null +++ b/examples/LineChart/LineChartTwo.js @@ -0,0 +1,51 @@ +import React from 'react'; +import {View} from 'react-native'; +import {LineChart} from '../../src/LineChart'; + +const LineChartTwo = () => { + const lineData = [ + {value: 0, dataPointText: '0'}, + {value: 10, dataPointText: '10'}, + {value: 8, dataPointText: '8'}, + {value: 58, dataPointText: '58'}, + {value: 56, dataPointText: '56'}, + {value: 78, dataPointText: '78'}, + {value: 74, dataPointText: '74'}, + {value: 98, dataPointText: '98'}, + ]; + + const lineData2 = [ + {value: 0, dataPointText: '0'}, + {value: 20, dataPointText: '20'}, + {value: 18, dataPointText: '18'}, + {value: 40, dataPointText: '40'}, + {value: 36, dataPointText: '36'}, + {value: 60, dataPointText: '60'}, + {value: 54, dataPointText: '54'}, + {value: 85, dataPointText: '85'}, + ]; + return ( + + + + ); +}; + +export default LineChartTwo; diff --git a/examples/PieChart/ProgressPie.js b/examples/PieChart/ProgressPie.js new file mode 100644 index 0000000..389ac67 --- /dev/null +++ b/examples/PieChart/ProgressPie.js @@ -0,0 +1,24 @@ +import React from 'react'; +import {View, Text} from 'react-native'; +import {PieChart} from '../../src/PieChart'; + +const ProgressPie = () => { + const pieData = [ + {value: 70, color: '#177AD5'}, + {value: 30, color: 'lightgray'}, + ]; + return ( + + { + return 70%; + }} + /> + + ); +}; + +export default ProgressPie; diff --git a/examples/PieChart/SplitPie.js b/examples/PieChart/SplitPie.js new file mode 100644 index 0000000..15b2a15 --- /dev/null +++ b/examples/PieChart/SplitPie.js @@ -0,0 +1,13 @@ +import React from 'react'; +import {PieChart} from '../../src/PieChart'; + +const SplitPie = () => { + const pieData = [ + {value: 54, color: '#177AD5'}, + {value: 40, color: '#79D2DE'}, + {value: 20, color: '#ED6665', shiftX: 28, shiftY: -18}, + ]; + return ; +}; + +export default SplitPie; diff --git a/examples/PieChart/ThreeDPie.js b/examples/PieChart/ThreeDPie.js new file mode 100644 index 0000000..9e110dd --- /dev/null +++ b/examples/PieChart/ThreeDPie.js @@ -0,0 +1,33 @@ +import React from 'react'; +import {View} from 'react-native'; +import {PieChart} from '../../src/PieChart'; + +const ThreeDPie = () => { + const pieData = [ + {value: 54, color: '#177AD5', text: '54%'}, + {value: 40, color: '#79D2DE', text: '30%'}, + {value: 20, color: '#ED6665', text: '26%'}, + ]; + + return ( + + + + ); +}; + +export default ThreeDPie; diff --git a/package.json b/package.json index d394ff6..2d6bb6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-gifted-charts", - "version": "0.1.2", + "version": "0.1.3", "description": "The most complete library for Bar, Line, Area, Pie and Donut charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.", "main": "src/index.tsx", "files": [