Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-svg-charts

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-svg-charts

Customizable charts (Line, Bar, Area, Pie, Circle, Waterfall, Progress) for React Native

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41K
decreased by-16.52%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-svg-charts

npm version npm

Prerequisites

This library uses react-native-svg to render its graphs. Therefore this library is listed as a peerDependency and needs to be installed AND linked into your project to work.

Motivation

Creating beautiful graphs in React Native shouldn't be hard or require a ton of knowledge. With react-native-svg-charts we utilize the very popular d3 library to create our SVG paths and to calculate all coordinates.

Components

This library currently provides the following chart components

AreaChart

Example
import { AreaChart } from 'react-native-svg-charts'

const chart = () => (
    <AreaChart
        style={styles.flex1}
        dataPoints={data.map(data => data.value)}
        showPoints={false}
        strokeColor={'white'}
        strokeWidth={2}
        renderGradient={({ id }) => (
            <LinearGradient id={id} x1={'0'} y={'0'} x2={'0'} y2={`50%`}>
                <Stop offset={'0'} stopColor={'blue'} stopOpacity={0.9}/>
                <Stop offset={`1`} stopColor={'blue'} stopOpacity={0.3}/>
            </LinearGradient>
        )}
        contentInset={{ bottom: 10, left: 15, top: 10, right: 15 }}
    />
)
Props

Area chart

PropertyDefaultDescription
dataPointsrequiredAn array of integers - the data points you want plotted
strokeColor'black'PropTypes.string
strokeWidth1PropTypes.number
fillColor'none'PropTypes.string
dashArray[ 5, 5]PropTypes.arrayOf(PropTypes.number)
showPointstruePropTypes.bool
pointColor'white'PropTypes.string
renderGradient() => {}PropTypes.func (see this for more info)
pointSize5PropTypes.number
pointWidth5PropTypes.number
animatetruePropTypes.bool
animationDuration300PropTypes.number
styleundefinedPropTypes.any
curvefooPropTypes.func
contentInset{ top: 0, left: 0, right: 0, bottom: 0 }PropTypes.shape
numberOfTicks9PropTypes.number
showGridtruePropTypes.bool
gridMinundefinedPropTypes.number
gridMaxundefinedPropTypes.number
intersections[ ]PropTypes.arrayOf(PropTypes.number)
renderIntersection() => {}PropTypes.func

BarChart

Bar chart

PropertyDefaultDescription
dataPointsrequireddataPoints: PropTypes.arrayOf(PropTypes.shape({
fillColor: PropTypes.string,
strokeColor: PropTypes.string,
strokeColorNegative: PropTypes.string,
fillColorNegative: PropTypes.string,
values: PropTypes.arrayOf(PropTypes.number).isRequired,
})).isRequired,
spacing0.05PropTypes.number
strokeColor'black'PropTypes.string
strokeWidth1PropTypes.number
fillColor'none'PropTypes.string
renderGradient() => {}PropTypes.func (see this for more info)
animatetruePropTypes.bool
animationDuration300PropTypes.number
styleundefinedPropTypes.any
curvefooPropTypes.func
contentInset{ top: 0, left: 0, right: 0, bottom: 0 }PropTypes.shape
numberOfTicks9PropTypes.number
showGridtruePropTypes.bool
gridMinundefinedPropTypes.number
gridMaxundefinedPropTypes.number
intersections[ ]PropTypes.arrayOf(PropTypes.number)
renderIntersection() => {}PropTypes.func

LineChart

Line chart

PropertyDefaultDescription
dataPointsrequiredAn array of integers - the data points you want plotted
strokeColor'black'PropTypes.string
strokeWidth1PropTypes.number
shadowColor'black'PropTypes.string
fillColor'none'PropTypes.string
dashArray[ 5, 5]PropTypes.arrayOf(PropTypes.number)
showPointstruePropTypes.bool
pointColor'white'PropTypes.string
pointSize5PropTypes.number
pointWidth5PropTypes.number
animatetruePropTypes.bool
animationDuration300PropTypes.number
styleundefinedPropTypes.any
curvefooPropTypes.func
contentInset{ top: 0, left: 0, right: 0, bottom: 0 }PropTypes.shape
numberOfTicks9PropTypes.number
showGridtruePropTypes.bool
gridMinundefinedPropTypes.number
gridMaxundefinedPropTypes.number
intersections[ ]PropTypes.arrayOf(PropTypes.number)
renderIntersection() => {}PropTypes.func

PieChart

Pie chart

PropertyDefaultDescription
dataPointsrequiredPropTypes.arrayOf(PropTypes.shape({ color: PropTypes.string.isRequired, key: PropTypes.string.isRequired, value: PropTypes.number.isRequired, })).isRequired
innerRadius0.5PropTypes.number
padAnglePropTypes.number
animatetruePropTypes.bool
animationDuration300PropTypes.number
stylePropTypes.any
renderLabel() => {}PropTypes.func
labelSpacing0PropTypes.number

ProgressGauge

Progress gauge

PropertyDefaultDescription
progressrequiredPropTypes.number.isRequired
stylePropTypes.any
progressColor'black'PropTypes.any
startAngle-Math.PI * 0.8PropTypes.number
endAngleMath.PI * 0.8PropTypes.number
animatetruePropTypes.bool
animateDuration300PropTypes.number

WaterfallChart

Waterfall chart

PropertyDefaultDescription
dataPointsrequireddataPoints: PropTypes.arrayOf(PropTypes.shape({
fillColor: PropTypes.string,
strokeColor: PropTypes.string,
strokeColorNegative: PropTypes.string,
fillColorNegative: PropTypes.string,
values: PropTypes.arrayOf(PropTypes.number).isRequired,
})).isRequired,
spacing0.05PropTypes.number
strokeColor'black'PropTypes.string
strokeWidth1PropTypes.number
fillColor'none'PropTypes.string
renderGradient() => {}PropTypes.func (see this for more info)
animatetruePropTypes.bool
animationDuration300PropTypes.number
styleundefinedPropTypes.any
curvefooPropTypes.func
contentInset{ top: 0, left: 0, right: 0, bottom: 0 }PropTypes.shape
numberOfTicks9PropTypes.number
showGridtruePropTypes.bool
gridMinundefinedPropTypes.number
gridMaxundefinedPropTypes.number
intersections[ ]PropTypes.arrayOf(PropTypes.number)
renderIntersection() => {}PropTypes.func

Keywords

FAQs

Package last updated on 31 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc