XYChart and ColumnSeries classes. All three Anvil2 themes apply design-token-based colors and chart styling automatically.
For design guidelines on bar charts, see Bar Charts design guidelines.
Vertical bar chart
A basic vertical bar chart uses aCategoryAxis on the x-axis and a ValueAxis on the y-axis.
Horizontal bar chart
To create a horizontal bar chart, swap the axes: use aCategoryAxis on the y-axis and a ValueAxis on the x-axis. Set categoryYField and valueXField on the series instead of categoryXField and valueYField.
The theme detects horizontal orientation when categoryYField or valueXField is set on the series.
Grouped bar chart
Grouped bar charts display multiple series side by side for each category. Create a separateColumnSeries for each data group.
Stacked bar chart
Stacked bar charts show how parts contribute to a whole. Setstacked: true on each ColumnSeries.
Using different themes
Change the theme import to apply a different color palette. The chart structure stays the same.Monochrome theme
UseThemeMonochrome for data with a natural order or progression, or when displaying 4 or fewer variables. This is the default theme used in the examples above.
Categorical theme
UseThemeCategorical when displaying 5 or more distinct series that need maximum color differentiation.
Semantic theme
UseThemeSemantic when data represents status values. Colors follow the order: Success, Neutral, Warning, Danger.