1.0.21 • Published 6 years ago

react-radar-chart v1.0.21

Weekly downloads
2
License
ISC
Repository
-
Last release
6 years ago

React Radar Chart

react-radar-chart is intended to be a simple solution for those seeking a standalone radar chart for use in their project.

Installation

The easiest way to use react-radar-chart is to install it from npm and build it into your app with Webpack.

npm install react-radar-chart

Then just import react-radar-chart into your project and you're all set!

import RadarChart from 'react-radar-chart';

You may also want to use the standalone UMD build. If so, just include react-radar-chart.min.js and react-radar-chart.min.css in your page, along with it's dependencies.

<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/prop-types/prop-types.min.js"></script>

Props

PropertyTypeDefaultDescription
axisNamesarray[]Array of string values that will be used as the labels for each of the radar chart axes.
classNamesobject{}Object containing class names for the various components and sub components of the radar chart. See 'styling' section below for details.
groupsobject{}Object containing color and rating attributes for each group, by group name {groupName: {color: 'blue', attributes: {skill: 5}}}
rungsnumber10Number indicating the number of rungs the chart should have.
scaleAlignstring'bottom-left'A string indicating where to align the scale. See 'scale alignment' section below for details.
scaleRendererfunctionsee descriptionA function that can be used to render a custom chart scale. Renders a simple scale by default.

Styling

Custom classNames can be passed via the classNames prop.

Class NameUse
axischange the color / thickness of the Axes
containerstyle the containing div
keychange the text size or the position of the key
labelchange the size, color, font of the axis labels
outlinechange the opacity of the outline, size of the rating points, or width of the border
rungchange the width / color for the chart rungs
scalechange color / font size of the scale
svgParentstyle the svgParent element
wrapperstyle the wrapper div

Scale Alignment

There are 8 areas that the scale can be aligned:

  • top (right / left)
  • bottom (right / left)
  • left (top / bottom)
  • right (top / bottom)

To align in one of these areas, use the following format and pass via the scaleAlign prop.

'edge-alignment' eg. 'top-right' or 'left-bottom'

Groups

This will be the most important prop you pass to the RadarChart component. Use the following as a reference.

{
	Player1: {
		color: 'blue',
		ratings: {
			speed: 3,
			attack: 5,
			defense: 8
		}
	},
	Player2: {
		color: 'green',
		ratings: {
			speed: 10,
			attack: 3,
			defense: 3
		}
	},
	Player3: {
		color: 'red',
		ratings: {
			speed: 5,
			attack: 5,
			defense: 5
		}
	}
}

make sure that each groups' ratings are represented in the axisNames array prop.

Contributing

Please read CONTRIBUTING.md for details on submitting a pull request.

Author

Zachary Dean vanleuvenze

License

This project is licensed under the ISC License.

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago