Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-gear-chart

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-gear-chart

![sample](./img/sample.png)

  • 0.0.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by60%
Maintainers
1
Weekly downloads
 
Created
Source

A Gear-style Chart Component for React

sample

Demo

Install

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 Strip
marginnumber0Default angle between teeth.
modestring
clockwisebooleantrueThe line-up direction of your items(teeth).
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.

Keywords

FAQs

Package last updated on 16 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc