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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-xsy-mpchart

v1.0.0

Published

upgrade React Version import PropTypes from 'prop-types';

Downloads

9

Readme

THIS LIBRARY IS NO LONGER MAINTAINED.

See https://github.com/hongyin163/react-native-chart-android and https://github.com/Jpadilla1/react-native-ios-charts

react-native-mpchart

A React Native chart library

This module is a bridge between React Native and MPAndroidChart. Eventually, iOS will be supported via the iOS port of MPAndroidChart, ios-charts.

All charts and properties come from MPAndroidChart.

Installation

Android

Install the node package

npm install --save https://github.com/mikemonteith/react-native-mpchart

Import the java library from node_modules/react-native-mpchart/android

android/settings.gradle

include ':react-native-mpchart', ':app'

project(':react-native-mpchart').projectDir = new File(settingsDir, '../node_modules/react-native-mpchart/android')

Add the project to your gradle dependencies

android/app/build.gradle

apply plugin: 'com.android.application'

android {
  ...
}

dependencies {
  compile fileTree(dir: "libs", include: ["*.jar"])
  compile "com.android.support:appcompat-v7:23.0.0"
  compile "com.facebook.react:react-native:0.19.+"
  compile project(":react-native-mpchart")
}

Add the package to your ReactInstanceManager

MainActivity.java


//import chart package (usually, your IDE will do this for you)
import com.mikemonteith.reactnativempchart.MPChartPackage;

// ...

/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
	return Arrays.<ReactPackage>asList(
		new MainReactPackage(),
		new MPChartPackage() // <-- add this line
	);
}

// ...

Basic Usage

var React = require('react-native');
var Charts = require('react-native-mpchart');

var ExampleComponent = React.createClass({
  render: function(){
    return (
      <Charts.BarChart
        style={{flex: 1}}
        data={{
          dataSets: [{
            values: [1, 2, 3, 4, 5],
          }],
          xValues: ["one", "two", "three", "four", "five"],
        }}
      />
    );
  },
});

Charts

  • PieChart
  • BarChart
  • LineChart

Props

(inherits from React.View)

| Prop | Description | Type | Charts | |------|-------------|------|--------| | data | see data properties | object | All | touchEnabled | handle touch gestures on the chart | boolean | All | xAxis | see xaxis properties | object | Bar, Line | leftAxis | see yaxis properties | object | Bar, Line | rightAxis | see yaxis properties | object | Bar, Line | gridBackgroundColor | color of the grid background | string | Bar, Line | holeRadius | percentage radius of the pie hole | number | Pie | transparentCircleRadius | percentage radius of the transparent overlay | number | Pie | transparentCircleColor | color of the transparent overlay | string | Pie | transparentCircleAlpha | alpha of the transparent overlay between 0 and 1 | number | Pie | rotationAngle | clockwise angle in degrees where the first segment starts (0 = 3 o'clock) | number | Pie

data properties

| Property | Description | Type | Charts | |----------|-------------|------|--------| | dataSets | see dataSet properties | array of DataSet objects | All | | xValues | strings specifying x axis labels | array of strings | All |

dataSet properties

| Property | Description | Type | Charts | |----------|-------------|------|--------| | values | values to plot on the graph | array of numbers | All | colors | colors to draw the chart data | array of strings | All | drawValues | draw value text | boolean | All | drawCircles | draw circles on data points | boolean | Line | drawCubic | draw a smooth line-of-best-fit | boolean | Line | lineWidth | width of the line-of-best-fit | number | Line | drawFill | draw a colored area underneath the line | boolean | Line | fillColor | color of fill underneath the line | string | Line | fillAlpha | alpha of the fill underneath the line between 0 and 1 | number | Line

axis properties

| Property | Description | Type | Charts | |----------|-------------|------|--------| | enabled | draw the axis | boolean | Bar, Line | | drawAxisLine | draw the main axis line | boolean | Bar, Line | drawGridLines | draw grid lines that are parallel to this axis | boolean | Bar, Line

x axis properties

(inherits from axis properties)

| Property | Description | Type | Charts | |----------|-------------|------|--------| | position | where to draw the axis | string 'bottom', 'top' or 'bothSided' | Bar, Line

y axis properties

(inherits from axis properties)

| Property | Description | Type | Charts | |----------|-------------|------|--------| | minValue | minimum value | number | Bar, Line | maxValue | maximum value | number | Bar, Line | inverted | if true, draw the data upside-down | boolean | Bar, Line

TODO

  • Support all MPAndroidChart charts
  • Support all MPAndroidChart properties
  • Support iOS
  • Release as npm package