pie-chart
Generate a pie chart in svg format to be used as an API response.
example 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. |