react-native-histogram

0.2.0 • Public • Published

react-native-histogram

histogram component for React Native

npmnpm

NPM

Demo

Installation

in Cli

npm i react-native-histogram

in JavaScirpt

import Histogram from 'react-native-histogram';

Usage

var HistogramExample = React.createClass({
  getInitialState: function() {
    return {data: [{}]}
  },
  componentWillMount: function() {
    var row_datas = [];
    for (var i=0; i<500; i++) {
      row_datas[i] = Math.random() * 100;
    }
    this.setState({
      data: [{ data: row_datas }]
    })
  },
  render: function() {
    return (
      <View style={styles.container}>
        <View>
          <Histogram
            data={this.state.data}
            height={200}
            width={300}
            split={20}
          />
        </View>
      </View>
    );
  }
});

Simple

<Histogram data={this.state.data} />

Props

data(Array) Default: []

The value of histogram like a [{data: [10, 13, 8, 19, 17]}]

TODO

  • show simple histogram
  • show values
  • show balloon
  • show multiple historgams
  • show unit

Contributing

Of course! Welcome :)

License

MIT

Package Sidebar

Install

npm i react-native-histogram

Weekly Downloads

9

Version

0.2.0

License

MIT

Last publish

Collaborators

  • moschan