-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Multi-line example Thanks to Saman Kumara on StackOverflow for this example: https://stackoverflow.com/a/59207977/1437016 * Added multi-line image * Updated readme for multi-line example
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react' | ||
import { LineChart, Path, Grid } from 'react-native-svg-charts' | ||
|
||
class LineChartExample extends React.PureComponent { | ||
|
||
render() { | ||
|
||
const data1 = [ 50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80 ] | ||
const data2 = [ -87, 66, -69, 92, -40, -61, 16, 62, 20, -93, -54, 47, -89, -44, 18 ] | ||
|
||
//Array of datasets, following this syntax: | ||
const data = [ | ||
{ | ||
data: data1, | ||
svg: { stroke: 'purple' }, | ||
}, | ||
{ | ||
data: data2, | ||
svg: { stroke: 'green' }, | ||
}, | ||
] | ||
|
||
return ( | ||
<LineChart | ||
style={{ height: 200 }} | ||
data={ data } | ||
contentInset={{ top: 20, bottom: 20 }} | ||
> | ||
<Grid /> | ||
</LineChart> | ||
) | ||
} | ||
} | ||
|
||
export default LineChartExample |