piechart - Create a Pie Chart
Creates a pie chart with custom data and styling. Output can be an image or a PDF.
data
array<object>
An array of data to be displayed
Minimum: 1
Example:
[
{
"label": "January",
"value": 65,
"backgroundColor": "#FF6384"
},
{
"label": "February",
"value": 39,
"backgroundColor": "#FF9F40"
},
{
"label": "March",
"value": 49,
"backgroundColor": "#FFCD56"
},
{
"label": "April",
"value": 72,
"backgroundColor": "#4BC0C0"
},
{
"label": "May",
"value": 93,
"backgroundColor": "#36A2EB"
},
{
"label": "June",
"value": 84,
"backgroundColor": "#9966FF"
}
]
backgroundColor
HEX Color
The background color of your pie slice. Defaults to #000000 if no color is provided.
Example:
#FF9F4033
label
string
The text to associate with your value
Example:
January
value
number
The value of your entry
Example:
100
options
object
Options to customize your chart.
Example:
{
"title": "PieChart / Donut Generation for Automation Platforms with 1001fx",
"titleAlignment": "center",
"titleColor": "#2563EB",
"subtitle": "Automatic piechart / donut generation from your data as image and PDF. Highly customizable.",
"subtitleAlignment": "center",
"subtitleColor": "#333333",
"fontFamily": "Roboto",
"titleFontSize": 32,
"subtitleFontSize": 16,
"dataLabelAnchor": "end",
"dataLabelAlignment": "end",
"dataLabelFontSize": 18,
"legendPosition": "top",
"legendFontSize": 18
}
legendHidden
boolean
When true hides the legend. Defaults to false.
Example:
legendPosition
string
Where to place your legend. Defaults to top.
Possible values are: left, top, right, bottom
Example:
bottom
legendFontSize
number
The legend's font size.
Example:
18
title
string
The title to be displayed above your chart.
Example:
Anual Report
titleAlignment
string
Where to place your chart title. Defaults to center.
Possible values are: start, center, end
Example:
left
titleColor
HEX Color
The title's color. Defaults to #000000 if no color is provided.
Example:
#36A2EB
titleFontSize
number
The title's font size.
Example:
18
subtitle
string
The subtitle to be displayed above your chart.
Example:
Anual Report
subtitleAlignment
string
Where to place your chart subtitle. Defaults to center.
Possible values are: start, center, end
Example:
left
subtitleColor
HEX Color
The subtitle's color. Defaults to #000000 if no color is provided.
Example:
#4BC0C0
subtitleFontSize
number
The subtitleFontSize's font size.
Example:
18
backgroundColor
HEX Color
The chart's backgroundColor. Defaults to #ffffff if no color is provided.
Example:
#FFCD56
padding
number
The padding around your chart. Defaults to 50.
Example:
25
fontFamily
string
The font to use in your chart.
Possible values are: Alegreya, Barlow, Inter, Lato, Montserrat, OpenSans, Oswald, Poppins, PTSans, Raleway, Roboto
Example:
Roboto
dataLabelAnchor
string
Anchor position of your element. Defaults to center.
Possible values are: start, center, end
Example:
start
dataLabelAlignment
string
Defines the position of the label relative to the anchor point. Defaults to center.
Possible values are: start, center, end, left, top, right, bottom
Example:
top
dataLabelFontSize
number
The data label's font size
Example:
10
dataLabelOffset
number
Offset from the anchor point. Defaults to 0.
Example:
10
dataLabelsHidden
boolean
When true hides all data labels. Defaults to false.
Example:
dataLabelClamp
boolean
When true enforces the anchor position to be calculated based on the visible geometry of the associated element. Defaults to false.
Example:
type
string
How to display your chart. Defaults to pie.
Possible values are: pie, donut
Example:
pie
outputFormat
string
The desired output format.
Possible values are: pdf, png, jpg
Example:
png