1.0.8-beta • Published 8 years ago

react-native-chart v1.0.8-beta

Weekly downloads
219
License
-
Repository
-
Last release
8 years ago

react-native-chart

Join the chat at https://gitter.im/tomauty/react-native-chart npm version

react-native-chart is a simple module for adding line charts, area charts, or bar charts to your React Native app.

NOTE! The current major version (1.X.Y) is still being developed. If you are looking for the most recent iOS-only version, please download ^0.1.4.

Screenshot

Getting Started

NPM

  1. npm i react-native-chart --save

Link ART to your project

  1. Right click Libraries and click 'Add Files to {YourProject}'
  1. Navigate to your project's node_modules/react-native/Libraries/ART and select 'ART.xcodeproj'
  1. Go to Build Phases -> Link Binary With Libraries

4 Click the '+', and add libART.a

Then rebuild.

Usage

import React, { StyleSheet, View, Component } from 'react-native';
import Chart from 'react-native-chart';

const styles = StyleSheet.create({
	container: {
		flex: 1,
		justifyContent: 'center',
		alignItems: 'center',
		backgroundColor: 'white',
	},
	chart: {
		width: 200,
		height: 200,
	},
});

const data = [
	[0, 1],
	[1, 3],
	[3, 7],
	[4, 9],
];

class SimpleChart extends Component {
	render() {
		return (
			<View style={styles.container}>
				<Chart
					style={styles.chart}
					data={data}
					verticalGridStep={5}
					type="line"
				 />
			</View>
		);
	}
}

Properties

PropertyTypeDescriptionRequiredDefault
dataArray< number, number >An array of x, y pairs.Yes
typestringpie/bar/lineYesbar
colorstringColor of bars/line in line chartNo#4DC4E6
cornerRadiusnumberCorner radius of bars in bar chartNo0
fillColorstringFill area color in line chartNo
dataPointColorstringStroke color for line chart data pointNo
dataPointFillColorstringFill color for line chart data pointNo
dataPointRadiusnumberRadius of the data pointNo3
lineWidthnumberWidth of line chart lineNo1
showDataPointbooleanShow data points on line chartNofalse
sliceColorsArray < string >Array of colors for pie chart slicesYes < random colors >
axisColorstringColor of axis linesNo#333333
axisLabelColorstringColor of axis testNo#333333
axisLineWidthnumberWidth of axis linesNo1
gridColorstringColor of grid linesNo#333333
gridLineWidthnumberWidth of grid linesNo0.5
hideHorizontalGridLinesbooleanHide grid lines going from LTRNofalse
hideVerticalGridLinesbooleanHide grid lines going up -> downNofalse
showAxisbooleanShow the X and Y axesNotrue
showGridbooleanShow the gridNotrue
showXAxisLabelsbooleanShow X-Axis labelsNotrue
showYAxisLabelsbooleanShow Y-Axis labelsNotrue
styleobjectStyle on the containerNo{}
tightBoundsbooleanTighten min and max bounds strictly to min/max in datasetNofalse
verticalGridStepnumberHow many vertical grid lines to showNo4
xAxisHeightnumberHeight of X-axis containerNo20
yAxisTransformFunctionTransform data point to y-axis labelNo() =>
xAxisTransformFunctionTransform data point to x-axis labelNo() =>
yAxisWidthnumberWidth of the Y-axis containerNo30

TODO

  • Code cleanup
  • Multi-line chart
  • Horizontal line chart
  • Scatter chart

Info/Support

Work prior to repo transfer on Feb 1, 2015 was the work of Hyun Cho @ OneFold.

Email tom.auty@gmail.com for support.

1.0.8-beta

8 years ago

1.0.7-beta

8 years ago

1.0.6-beta

8 years ago

1.0.5-beta

8 years ago

1.0.4-beta

8 years ago

1.0.3-beta

8 years ago

1.0.2-beta

8 years ago

1.0.1-beta

8 years ago

1.0.0-beta

8 years ago

0.1.14

8 years ago

0.1.13

8 years ago

0.1.12

8 years ago

0.1.10

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago