@byu-oit/pie-chart

1.1.0 • Public • Published

pie-chart

Generate a pie chart in svg format to be used as an API response.

example output

svg output svg output

usage

import pieChart from '@byu-oit/pie-chart'

const myData = [10, 12, 14, 24, 38]
const myDataLabels = ['A', 'B', 'C', 'D', 'E']
const chartSvg = pieChart({data: myData, labels: myDataLabels})

parameter definition

The pie chart function takes a single configuration parameter.

key value required? description
data [numerical values] required An array of values to chart. The values do not need to be normalized. For example, if you want to chart Android vs iOS usage, your data array could be [45002, 38201] with the labels array set to ['Android', 'iOS'].
labels [string labels] required An array of string labels corresponding by index to the associated data element.

Readme

Keywords

Package Sidebar

Install

npm i @byu-oit/pie-chart

Weekly Downloads

2

Version

1.1.0

License

Apache-2.0

Unpacked Size

121 kB

Total Files

11

Last publish

Collaborators

  • mjweather
  • yoshutch
  • lehinpm
  • oscea
  • stuft2
  • mhailstone
  • arasmus8
  • garygsc
  • martingarn
  • snelg
  • byu-oit-bot