Coder Social home page Coder Social logo

malaa-tech / react-native-simple-line-chart Goto Github PK

View Code? Open in Web Editor NEW
64.0 3.0 1.0 1.49 MB

A fast, interactive and simple line chart component for React Native ๐Ÿ“ˆ

License: MIT License

JavaScript 3.22% TypeScript 96.78%
android chart ios line react-native reanimated reanimated3

react-native-simple-line-chart's Introduction

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

react-native-simple-line-chart's People

Contributors

wadhahessam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

aljadan

react-native-simple-line-chart's Issues

Chart not showing up on Android

I've noticed a weird issue on Android where the chart isn't visible the first time it's supposed to render. However, when the chart data gets updated, it shows up and seems to work just fine
Looks like it might only be a problem on the first render and only on Android.

For more details, here's a Simple Example of what I'm talking about.

2024-01-05.08.18.06.mp4
Screen.Recording.2024-01-05.at.8.48.22.AM.mov

React Native 0.70.0

Hello,

I am looking forward to trying your library out, but I am using react-native 0.68.

Is there a particular reason for putting react-native >= 0.70.0 in your peerDependencies list?

Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.