npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-simple-charts

v0.0.5

Published

Simple charts with gradient for react-native

Readme

ReactNativeSimpleCharts

npm version npm version

Simple charts with gradient for react-native.

  • Allow to use multiple charts.
  • Use chart with gradient filling.
  • Customize charts: axis, height, steps OY and more other things.
  • Chart automatically scale OY axis data and round OY values to usual perception.

Installation

Just paste in terminal npm install react-native-simple-charts --save && react-native link react-native-simple-charts && react-native link react-native-svg && react-native link react-native-blur

Usage

Simple Charts


import Chart from 'react-native-simple-charts'
...

  render() {
    let greenChartProps = {
      "strokeWidth": 2,
      "renderPoints": true,
      "strokeColor": 'green',
      "pointColor1": 'green',
      "pointColor2": 'green',
    }
    let blueChartProps = {
      "strokeWidth": 2,
      "renderPoints": true,
      "strokeColor": 'blue',
      "pointColor1": 'blue',
      "pointColor2": 'blue',
    }
    let data = [
      {
        "chart": [
          {
            "x": '1',
            "y": 10,
            "props": greenChartProps
          },
          {
            "x": '2',
            "y": 45,
            "props": greenChartProps
          },
          {
            "x": '3',
            "y": 10,
            "props": greenChartProps
          },
          {
            "x": '4',
            "y": 55,
            "props": greenChartProps
          },
          {
            "x": '5',
            "y": 20,
            "props": greenChartProps
          },
          {
            "x": '6',
            "y": 65,
            "props": greenChartProps
          },
        ],
      },
      {
        "chart": [
          {
            "x": '1',
            "y": 89,
            "props": blueChartProps
          },
          {
            "x": '2',
            "y": 67,
            "props": blueChartProps
          },
          {
            "x": '3',
            "y": 55,
            "props": blueChartProps
          },
          {
            "x": '4',
            "y": 23,
            "props": blueChartProps
          },
          {
            "x": '5',
            "y": 44,
            "props": blueChartProps
          },
          {
            "x": '6',
            "y": 55,
            "props": blueChartProps
          },
        ],
      }
    ]

    return (
      <Chart
          data={data}
          stepsOY={5}
      />
    );
  }

Gradient Chart

Note if you want to use chart with gradient filling it should be only one.


import Chart from 'react-native-simple-charts'
...

  render() {
    let greenChartProps = {
      "strokeWidth": 2,
      "renderPoints": true,
      "strokeColor": 'green',
      "pointColor1": 'green',
      "pointColor2": 'green',
    }
    let data = [
      {
        "chart": [
          {
            "x": '1',
            "y": 10,
            "props": greenChartProps
          },
          {
            "x": '2',
            "y": 45,
            "props": {
              ...greenChartProps,
              fillGradient: true,
              gradientEndColor: 'green',
              gradientStartColor: 'yellow'
            }
          },
          {
            "x": '3',
            "y": 10,
            "props": {
              ...greenChartProps,
              fillGradient: true,
              gradientEndColor: 'green',
              gradientStartColor: 'yellow'
            }
          },
          {
            "x": '4',
            "y": 55,
            "props": greenChartProps
          },
          {
            "x": '5',
            "y": 20,
            "props": greenChartProps
          },
          {
            "x": '6',
            "y": 65,
            "props": greenChartProps
          },
        ],
      }
    ]

    return (
      <Chart
          data={data}
          stepsOY={5}
          axisTextColorActive={'red'}
          activeAxisXTextArray={['2', '3', '4']}
      />
    );
  }

Props


    data: React.PropTypes.array.isRequired,
    height: React.PropTypes.number,
    width: React.PropTypes.number,
    backgroundColor: React.PropTypes.any,
    gradientOpacityStart: React.PropTypes.string,
    gradientOpacityEnd: React.PropTypes.string,
    axisTextColor: React.PropTypes.any,
    axisTextOpacity: React.PropTypes.number,
    activeAxisXTextArray: React.PropTypes.array, // you can set unique text color for special OX axis values
    axisTextColorActive: React.PropTypes.any, //there is this color
    hideXAxe: React.PropTypes.bool,
    hideYAxe: React.PropTypes.bool,
    axisStrokeWidth: React.PropTypes.number,
    axisColor: React.PropTypes.any,
    axisOpacity: React.PropTypes.number,
    pointRadius: React.PropTypes.number, // chart point radius
    axisLinesColor: React.PropTypes.string, // horizontal and vertical chart lines
    axisLinesOpacity: React.PropTypes.number,
    axisLinesWidth: React.PropTypes.number,
    renderAxisXSectors: React.PropTypes.bool,
    axisXSectorsColor: React.PropTypes.string,
    axisXSectorsOpacity: React.PropTypes.number,
    renderAxisXLines: React.PropTypes.bool, // vertical lines
    renderAxisYLines: React.PropTypes.bool, //horizontal lines
    leftPanelBG: React.PropTypes.any, // OY axis text backgroundColor
    renderBlur: React.PropTypes.bool, // IOS only blured OY axis text
    blurProps: React.PropTypes.any,
    leftPanelWidth: React.PropTypes.number,
    stepsOY: React.PropTypes.number, // number of section on axis Y
    scaleXAxis: React.PropTypes.number, // define chart condensation
    maxYValue: React.PropTypes.number // set max OY value that can be rendered

## Default Props

    height: 150,
    backgroundColor: 'white',
    stepsOY: 4,
    axisTextColor: 'black',
    axisTextOpacity: 1,
    axisColor: 'black',
    axisOpacity: 1,
    axisLinesOpacity: 1,
    axisLinesWidth: 1,
    axisStrokeWidth: 2,
    axisLinesColor: 'black',
    scaleXAxis: 5.5,
    renderAxisXLines: true,
    renderAxisYLines: true,
    leftPanelWidth: 50,
    leftPanelBG: 'white',
    renderBlur: true,
    gradientOpacityStart: '0.0',
    gradientOpacityEnd: '0.55'

data

An array of points. This should be provided with an array of objects.

[
      {
        "chart": [
          {
            "x": '1',
            "y": 10,
            "props": {
              "strokeWidth": 2, // chart stroke width
              "strokeColor": 'green',
              "renderPoints": true,
              "pointColor1": 'green', // this define 1:10 point color
              "pointColor2": 'green', // this define 2:Y point color (next point)
              "fillGradient": false, // if you set true then gradient will fill area from 1 to 2 OX value
              "gradientStartColor": 'green',
              "gradientEndColor": 'green',
            }
          },
          ...
        ]
      },
  ...
]

Questions or suggestions?

Feel free to open an issue