react-native-simple-line-chart v0.36.1
React Native Simple Line Chart
A simple, interactive, animated, and fast Line Chart component for React Native.
š¦ Features
- ā Supports RTL languages
- ā Customizable active point component
- ā Linear gradient line color
- ā Supports different curve types
- ā Full utilization of reanimated and shared values
- ā Supports area chart presentation
ā Supports transition animations
How we use it in Malaa App
š® Example App Demo
- run it your self using
yarn example [ios/andriod]
or watch this Video
š¦ Installation
npm install react-native-simple-line-chart
or
yarn add react-native-simple-line-chart
ā ļø Make sure you have react-native-reanimated + react-native-gesture-handler + react-native-svg installed in your project.
āļø Usage
import * as React from 'react';
import { View, Dimensions, Text } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import LineChart from 'react-native-simple-line-chart';
export default function App() {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<LineChart
lines={[
{
data: [
{
y: 10,
x: new Date('2020-01-01').getTime(),
extraData: {
formattedValue: '0',
formattedTime: '2020-01-01',
},
},
{
y: 20,
x: new Date('2020-01-02').getTime(),
extraData: {
formattedValue: '20',
formattedTime: '2020-01-02',
},
},
{
y: 15,
x: new Date('2020-01-03').getTime(),
extraData: {
date: new Date('2020-01-03').getTime(),
formattedValue: '15$',
formattedTime: '2020-01-03',
},
},
{
y: 35,
x: new Date('2020-01-04').getTime(),
extraData: {
formattedValue: '35$',
formattedTime: '2020-01-04',
},
},
{
y: 5,
x: new Date('2020-01-06').getTime(),
extraData: {
formattedValue: '35$',
formattedTime: '2020-01-04',
},
},
],
activePointConfig: {
color: 'black',
showVerticalLine: true,
},
lineColor: 'pink',
curve: 'linear',
endPointConfig: {
color: 'pink',
radius: 5,
animated: true,
},
activePointComponent: (point) => {
return (
<View
style={{
backgroundColor: 'pink',
padding: 10,
borderRadius: 10,
}}
>
<Text style={{ color: 'white' }}>
{point?.extraData?.formattedValue}
</Text>
<Text style={{ color: 'white' }}>
{point?.extraData?.formattedTime}
</Text>
</View>
);
},
},
]}
backgroundColor={undefined}
height={200}
width={Dimensions.get('screen').width}
/>
</View>
</GestureHandlerRootView>
);
}
š Docs
5 months ago
5 months ago
7 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago