1.1.0 • Published 2 years ago

@byu-oit/pie-chart v1.1.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
2 years ago

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.

keyvaluerequired?description
datanumerical valuesrequiredAn 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'].
labelsstring labelsrequiredAn array of string labels corresponding by index to the associated data element.
1.1.0

2 years ago

1.0.0

6 years ago