1.0.4 • Published 2 years ago

react-gauge-ultimate v1.0.4

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

react-gauge-ultimate

Powerful gauge chart for React

NPM JavaScript Style Guide react-gauge-ultimate Banner

Install

npm i react-gauge-ultimate

or

yarn add react-gauge-ultimate

Usage

import React from 'react'

import { Gauge } from 'react-gauge-ultimate'
import 'react-gauge-ultimate/dist/index.css'

const App = () => {
  return (
    <Gauge
      id='gauge id'
      className='Gauge'
      label='label text'
      percent={1}
      darkMode={false}
    />
  )
}

export default App

API

Warning: Do not use the same id for multiple charts, as it will put multiple charts in the same container

NamePropTypeDescriptionDefault value
idPropTypes.string.isRequiredUsed for the identification of the div surrounding the chart
classNamePropTypes.stringAdd className to the div container
stylePropTypes.objectAdd style to the div container{ width: '100%' }
darkModePropTypes.boolSet dark mode style to Gaugefalse
marginInPercentPropTypes.numberMargin for the chart inside the containing SVG element0.05
cornerRadiusPropTypes.numberCorner radius for the elements in the chart6
nrOfLevelsPropTypes.numberThe number of elements displayed in the arc3
percentPropTypes.numberThe number where the pointer should point to (between 0 and 1)0.4
labelPropTypes.stringThe text that displays above the percent''
arcPaddingPropTypes.numberThe distance between the elements in the arc0.05
arcWidthPropTypes.numberThe thickness of the arc0.2
colorsPropTypes.arrayAn array of colors in HEX format displayed in the arc"#00FF00", "#FF0000"
textColorPropTypes.stringThe color of the text"#FFFFFF"
needleColorPropTypes.stringThe color of the needle triangle"#464A4F"
needleBaseColorPropTypes.stringThe color of the circle at the base of the needle"#464A4F"
hideTextPropTypes.boolWhether or not to hide the percentage displayfalse
arcsLengthPropTypes.arrayAn array specifying the length of each individual arc. If this prop is set, the nrOfLevels prop will have no effectnone
animatePropTypes.boolWhether or not to animate the needle when loadedtrue
animDelayPropTypes.numberDelay in ms before starting the needle animation500
animateDurationPropTypes.numberDuration in ms for the needle animation3000
formatTextValuePropTypes.funcFormat you own text value (example: value => value+'%')null

License

MIT © boof-tech