0.36.1 • Published 5 months ago

react-native-simple-line-chart v0.36.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

License

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

Click here for docs and type defs

0.36.1

5 months ago

0.36.0

5 months ago

0.35.1

7 months ago

0.35.0

10 months ago

0.34.4

1 year ago

0.34.3

1 year ago

0.34.2

1 year ago

0.34.1

1 year ago

0.34.0

1 year ago

0.33.0

1 year ago

0.32.0

2 years ago

0.30.1

2 years ago

0.30.0

2 years ago

0.31.0

2 years ago

0.29.0

2 years ago

0.28.6

2 years ago

0.29.4

2 years ago

0.28.5

2 years ago

0.29.3

2 years ago

0.28.4

2 years ago

0.29.2

2 years ago

0.28.3

2 years ago

0.29.1

2 years ago

0.28.2

2 years ago

0.28.1

2 years ago

0.28.0

2 years ago

0.27.0

2 years ago

0.26.0

2 years ago

0.25.0

2 years ago

0.24.2

2 years ago

0.24.1

2 years ago

0.24.0

2 years ago

0.23.0

2 years ago

0.22.2

2 years ago

0.22.1

2 years ago

0.22.0

2 years ago

0.21.0

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.18.0

2 years ago

0.17.0

2 years ago

0.16.0

2 years ago

0.15.0

2 years ago

0.14.0

2 years ago

0.13.0

2 years ago

0.12.0

2 years ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago