0.0.14 • Published 5 years ago

react-gear-chart v0.0.14

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

A Gear-style Chart Component for React

sample

Actively maintained. Welcome to PR/Issue.  🤡👉 Demo 👈🤡

Instal

npm install react-gear-chart

Usage

import GearListChart from 'react-gear-chart'

// in your render() or whatever
<GearListChart 
  startAngle={110} endAngle={250} 
  outerRadius={300} innerRadius={200}
  margin={7}
  onClick={yourClickHandler}
  clockwise={false}
  items={items} // items to be rendered as teeth on the gear
  />

Props

NameTypeDefaultDescription
startAnglenumberRequired. Start angle of your chart in degree with this convention
endAnglenumberRequired. End angle of your chart.
innerRadiusnumberRequired. Inner radius of your chart in pixel.
outerRadiusnumberRequired. Outer radius of your chart in pixel.
itemsArray<ToothOption>Required. Chart data. See ToothOption
marginnumber0Default angle between teeth.
modestring
clockwisebooleantrueThe line-up direction of your items(teeth).
animatebooleantrueIn-Out animation on/off. Turn off animation to gain performance.
clockwiseAnimatebooleantrueTeeth In/out animation direction.
motionConfigobject{}Config for react-motion. See SpringHelperConfig
onClickfunctionclick event handler. Strip data is passed with the event, access it by evt.stripData & evt.strips
onMouseMove/Leave/Enter/OverfunctionSimilar to prop onClick
extraReact$Elementprops of a tooth is sent to this function and allow you to render whatever you want over the chart.

ToothOption

ToothOption is a configuration object with following properties

NameTypeDefaultDescription
modestringspokeribspokerib, layer or bar. See demo for details
labelstringText to show on a tooth
stripsobject or arraySee StripOption. Can be a single StripOption or an array of StripOption

StripOption

StripOption is a configuration object with following properties

NameTypeDefaultDescription
colorstringValid css color, to fill current strip.
weightnubmerAlone with the tooth height (outerRadius - innerRadius), determine the "size" of the current strip, like bar height, or Annulus portion in different mode.

Note: other properties can be attached to ToothOption/StripOption and accessed n every mouse event hanlder from the event object.

0.0.14

5 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago