barchart - Create a Bar Chart
Creates a bar chart with custom data and styling. Output can be an image or a PDF.
dataarray<object>
An array of data to be displayed
Minimum: 1
Example:
[
{
"label": "January",
"value": 65,
"backgroundColor": "#FF638433",
"borderColor": "#FF6384"
},
{
"label": "February",
"value": 39,
"backgroundColor": "#FF9F4033",
"borderColor": "#FF9F40"
},
{
"label": "March",
"value": 49,
"backgroundColor": "#FFCD5633",
"borderColor": "#FFCD56"
},
{
"label": "April",
"value": 72,
"backgroundColor": "#4BC0C033",
"borderColor": "#4BC0C0"
},
{
"label": "May",
"value": 93,
"backgroundColor": "#36A2EB33",
"borderColor": "#36A2EB"
},
{
"label": "June",
"value": 84,
"backgroundColor": "#9966FF33",
"borderColor": "#9966FF"
}
]backgroundColorHEX Color
The background color of your bar. Defaults to #000000 if no color is provided.
Example:
#FF9F4033borderColorHEX Color
The border color of your bar. Defaults to #000000 if no color is provided.
Example:
#FF9F40labelstring
The text to associate with your value
Example:
Januaryvaluenumber
The value of your entry
Example:
100optionsobject
Options to customize your chart.
Example:
{
"title": "Barchart Generation for Automation Platforms with 1001fx",
"titleAlignment": "center",
"titleColor": "#2563EB",
"subtitle": "Automatic barchart generation from your data as image and PDF. Highly customizable.",
"subtitleAlignment": "center",
"subtitleColor": "#333333",
"gridColor": "#f2f2f2",
"fontFamily": "Roboto",
"titleFontSize": 20,
"subtitleFontSize": 16,
"axisTitleFontSize": 16,
"axisFontSize": 16,
"padding": 0,
"dataLabelAnchor": "center",
"dataLabelAlignment": "center",
"dataLabelFontSize": 16,
"indexAxis": "y"
}borderWidthnumber
The border width of your bars. Defaults to 0.
Example:
1borderRadiusnumber
The border radius of your bars. Defaults to 0.
Example:
5indexAxisstring
The base axis. x for vertical bars. y for horizontal bars. Defaults to x.
Possible values are: x, y
Example:
ytitlestring
The title to be displayed above your chart.
Example:
Anual ReporttitleAlignmentstring
Where to place your chart title. Defaults to center.
Possible values are: start, center, end
Example:
lefttitleColorHEX Color
The title's color. Defaults to #000000 if no color is provided.
Example:
#36A2EBtitleFontSizenumber
The title's font size.
Example:
18subtitlestring
The subtitle to be displayed above your chart.
Example:
Anual ReportsubtitleAlignmentstring
Where to place your chart subtitle. Defaults to center.
Possible values are: start, center, end
Example:
leftsubtitleColorHEX Color
The subtitle's color. Defaults to #000000 if no color is provided.
Example:
#4BC0C0subtitleFontSizenumber
The subtitleFontSize's font size.
Example:
18backgroundColorHEX Color
The chart's backgroundColor. Defaults to #ffffff if no color is provided.
Example:
#FFCD56paddingnumber
The padding around your chart. Defaults to 50.
Example:
25fontFamilystring
The font to use in your chart.
Possible values are: Alegreya, Barlow, Inter, Lato, Montserrat, OpenSans, Oswald, Poppins, PTSans, Raleway, Roboto
Example:
RobotodataLabelAnchorstring
Anchor position of your element. Defaults to center.
Possible values are: start, center, end
Example:
startdataLabelAlignmentstring
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:
topdataLabelFontSizenumber
The data label's font size
Example:
10dataLabelOffsetnumber
Offset from the anchor point. Defaults to 0.
Example:
10dataLabelsHiddenboolean
When true hides all data labels. Defaults to false.
Example:
dataLabelClampboolean
When true enforces the anchor position to be calculated based on the visible geometry of the associated element. Defaults to false.
Example:
yAxisTitlestring
Text to be displayed on the y axis.
Example:
MonthxAxisTitlestring
Text to be displayed on the x axis.
Example:
ValueaxisTitleFontSizenumber
The axis title's font size.
Example:
18axisTitleColorHEX Color
The axis title's color. Defaults to #000000 if no color is provided.
Example:
#4BC0C0gridColorHEX Color
The grid's color. Defaults to #f2f2f2 if no color is provided. Hide by setting to same as chart background color.
Example:
#4BC0C0axisColorHEX Color
The grid's color. Defaults to #a0a0a0 if no color is provided. Hide by setting to same as chart background color.
Example:
#9966FFaxisFontSizenumber
The axis's font size.
Example:
18outputFormatstring
The desired output format.
Possible values are: pdf, png, jpg
Example:
png