1.0.12 • Published 5 years ago

bar-chart-selector-react v1.0.12

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

bar-chart-selector-react

This component is a button selector system that will re-draw bar charts from a JSON on click. Supports arbitrary number of chart elements along with vertical scaling. Useful for displaying scientific data along an interactive second dimension.

Demo

A demo using CDC survey data on childhood vaccination levels by insurance type is here: https://marcmuon.github.io/react-barchart-selector-components/index.html

Installation

npm install --save bar-chart-selector-react   # using NPM

Example use

import React, {Component} from 'react'
import { BarChart } from 'bar-chart-selector-react';

class App extends Component {
  state = {
    vac: [
  [ 
      {
        "insurance": "Private Only",
        "pct_est": 95.2,
        "vaccine": "Poliovirus"
      },
      {
        "insurance": "Any Medicaid",
        "pct_est": 91.2,
        "vaccine": "Poliovirus"
      },
      {
        "insurance": "No Insurance",
        "pct_est": 77.9,
        "vaccine": "Poliovirus"
      }
  ],
  [ 
      {
        "insurance": "Private Only",
        "pct_est": 81.8,
        "vaccine": "Rotavirus"
      },
      {
        "insurance": "Any Medicaid",
        "pct_est": 66.8,
        "vaccine": "Rotavirus"
      },
      {
        "insurance": "No Insurance",
        "pct_est": 51.5,
        "vaccine": "Rotavirus"
      }
  
  ]],
    track: 0,
    mult: 1,
  }
 

  barGen = (index) => {
    this.setState({
      track: index,
    });
  }

  render() {    
    return (
        <BarChart
          array={this.state.vac}
          multiplier={this.state.mult}
          track={this.state.track}
          gotClicked={this.barGen}
        >
        </BarChart>
      </div>
    );
  }
}

License

bar-chart-selector-react is licensed under a MIT license.

Authors

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago