1.0.0 • Published 4 years ago

rn-bubble-chart v1.0.0

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

React-Native-Bubble-Chart

Uses d3 and react-native-svg

A simple bubble chart generated with d3 and react-native-svg. Motivation from https://github.com/weknowinc/react-bubble-chart-d3 Supports Android:alien: and iOS:iphone:

preview

How to install

npm i --save rn-bubble-chart

npm i --save d3

npm i --save react-native-svg

cd ios

pod install

How to use

import BubbleChart from 'rn-bubble-chart';

class ChartView extends React.Component {

  const data = [
    { name: "King Douchebag", color: "yellow", value: 90 },
    { name: "Princess Kenny", color: "pink", value: 60 },
    { name: "Heidi Turner", color: "red", value: 30 },
    { name: "Eric Cartman", color: "purple", value: 80 },
    { name: "Bart", color: "green", value: 40 }
  ]
  
  render() {
    return(
      <BubbleChart
        width={400}
        height={300}
        data={data}
      />
    )
  }
}

Properties

namedescriptionexample
widthwidth of the chart containerwidth={400}
heightheight of the chart containerheight={300}
datadata for the chartdata={{name: ..., color: ..., value: ... }}
textPropsproperties for SVG Text component rendered in the bubbletextProps={{fontFamily: ... , fill: ...}}
circlePropsproperties for the SVG Circle component (bubble)circleProps={{ ... }}