Bar Chart
Bar charts are data visualization components for displaying categorical data with rectangular bars.
Demo
API
Tag
| Name | Description |
|---|---|
<aui-barchart>
|
Custom HTML tag |
Attributes
| Name | Value | Required | Description |
|---|---|---|---|
data |
Number[] | Number[][] | String |
|
Sets the data values for the bar chart. Can be a single array of numbers for one dataset, an array of arrays for multiple datasets (grouped bars), or a JSON string representation. For multiple datasets, each inner array represents a separate series of bars. |
formattedLabels |
String[] | String |
Optional array of formatted strings to display instead of numeric values. Used in tooltips and value display above bars. If a formatted label is not provided for a data point (null or empty), the numeric value will be displayed instead. Can be an array of strings or a JSON string representation. The formatted labels are shared across all datasets at the same x position. |
|
formattedTotalLabels |
String[] | String |
Optional array of formatted strings to display as the total value at the top of each stack. Only applies
when |
|
colors |
String[] | String |
Optional array of colors for each dataset. Can be provided as an array or JSON string. Colors can be named
colors (e.g., |
|
hideLegend |
Boolean |
When |
|
hideVerticalAxis |
Boolean |
When |
|
hideBarValues |
Boolean |
When |
|
horizontal |
Boolean |
When |
|
i18n |
string |
A stringified JSON object which defines a list of localized strings. The keys must be one of the string IDs defined below. |
|
labels |
String[] | String |
|
Sets the labels for each x-axis datapoint. Required. Can be an array of strings or a JSON string representation of an array. The number of labels should match the number of data points. |
legendLabels |
String[] | String |
Optional array of strings to use as labels for the legend. Only applies when there are multiple datasets (grouped bars). If not provided, default labels will be generated (e.g., "Series 1", "Series 2"). Can be an array of strings or a JSON string representation. The number of legend labels should match the number of datasets. |
|
legendSubLabels |
String[] | String |
Optional array of strings to use as sublabels for the legend, displayed 8px to the right of the primary legend labels. Only applies when there are multiple datasets (grouped bars). When provided, the Chart.js built-in legend is replaced with a custom HTML legend that displays both labels and sublabels. Can be an array of strings or a JSON string representation. The number of legend sublabels should match the number of datasets. |
|
showValuesAsTooltips |
Boolean |
When |
|
stacked |
Boolean |
When |
Properties
| Name | Value | Required | Description |
|---|---|---|---|
data |
Number[] | Number[][] | String |
|
Sets the data values for the bar chart. Can be a single array of numbers for one dataset, an array of arrays for multiple datasets (grouped bars), or a JSON string representation. For multiple datasets, each inner array represents a separate series of bars. |
formattedLabels |
String[] | String |
Optional array of formatted strings to display instead of numeric values. Used in tooltips and value display above bars. If a formatted label is not provided for a data point (null or empty), the numeric value will be displayed instead. Can be an array of strings or a JSON string representation. The formatted labels are shared across all datasets at the same x position. |
|
formattedTotalLabels |
String[] | String |
Optional array of formatted strings to display as the total value at the top of each stack. Only applies
when |
|
hideLegend |
Boolean |
When |
|
hideVerticalAxis |
Boolean |
When |
|
horizontal |
Boolean |
When |
|
i18n |
object |
A JSON object which defines a list of localized strings. The keys must be one of the string IDs defined below. |
|
labels |
String[] | String |
|
Sets the labels for each x-axis datapoint. Required. Can be an array of strings or a JSON string representation of an array. The number of labels should match the number of data points. |
legendLabels |
String[] | String |
Optional array of strings to use as labels for the legend. Only applies when there are multiple datasets (grouped bars). If not provided, default labels will be generated (e.g., "Series 1", "Series 2"). Can be an array of strings or a JSON string representation. The number of legend labels should match the number of datasets. |
|
showValuesAsTooltips |
Boolean |
When |
|
stacked |
Boolean |
When |
Demo
Tag
| Name |
|---|
<AuiBarchart>
|
Props
| Name | Value | Required | Description |
|---|---|---|---|
data |
Number[] | Number[][] | String |
|
Sets the data values for the bar chart. Can be a single array of numbers for one dataset, an array of arrays for multiple datasets (grouped bars), or a JSON string representation. For multiple datasets, each inner array represents a separate series of bars. |
formattedLabels |
String[] | String |
Optional array of formatted strings to display instead of numeric values. Used in tooltips and value display above bars. If a formatted label is not provided for a data point (null or empty), the numeric value will be displayed instead. Can be an array of strings or a JSON string representation. The formatted labels are shared across all datasets at the same x position. |
|
formattedTotalLabels |
String[] | String |
Optional array of formatted strings to display as the total value at the top of each stack. Only applies when
|
|
hideLegend |
Boolean |
When |
|
hideVerticalAxis |
Boolean |
When |
|
horizontal |
Boolean |
When |
|
i18n |
object |
A JSON object which defines a list of localized strings. The keys must be one of the string IDs defined below. |
|
labels |
String[] | String |
|
Sets the labels for each x-axis datapoint. Required. Can be an array of strings or a JSON string representation of an array. The number of labels should match the number of data points. |
legendLabels |
String[] | String |
Optional array of strings to use as labels for the legend. Only applies when there are multiple datasets (grouped bars). If not provided, default labels will be generated (e.g., "Series 1", "Series 2"). Can be an array of strings or a JSON string representation. The number of legend labels should match the number of datasets. |
|
legendSubLabels |
String[] | String |
Optional array of strings to use as sublabels for the legend, displayed 8px to the right of the primary legend labels. Only applies when there are multiple datasets (grouped bars). When provided, the Chart.js built-in legend is replaced with a custom HTML legend that displays both labels and sublabels. Can be an array of strings or a JSON string representation. The number of legend sublabels should match the number of datasets. |
|
showValuesAsTooltips |
Boolean |
When |
|
stacked |
Boolean |
When |
Skylab React links
i18n Strings
| ID | Description | Default value |
|---|---|---|
barchart.emptyMessage |
The message displayed when the chart has no data to display. |
This chart updates when data arrives |
Guidelines
Accessibility
Bar charts should include appropriate ARIA labels and descriptions to make the data accessible to screen readers.
Usage
Bar charts are used to compare values across different categories. They are most effective when displaying discrete data points.
Design
Design resources can be found on the Skylab design documentation site: skylab.avalara.com