Axes
Since 0.1.0-alpha.22Titles, a set step and grid lines
ChartValueAxis and ChartArgumentAxis set up each axis. Title puts a title beside it, and the value axis's Step sets the gap between its ticks, here $25,000.
Static
Preview
| Month | Revenue |
|---|---|
| Jan | $84,200 |
| Feb | $91,500 |
| Mar | $102,300 |
| Apr | $98,700 |
| May | $110,400 |
| Jun | $121,900 |
| Jul | $117,600 |
| Aug | $126,300 |
| Sep | $133,800 |
| Oct | $141,200 |
| Nov | $156,900 |
| Dec | $172,400 |
Code
@* Monthly revenue with titled axes, a tick every $25,000 and lines between the months. *@
<Chart Items="_months" Argument="m => m.Month" Title="Revenue by month, 2026">
<ChartValueAxis Format="C0" Title="Revenue (USD)" Step="25_000" />
<ChartArgumentAxis Title="Month" GridLines />
<ChartBarSeries Value="m => m.Revenue" />
</Chart>
{
private record MonthRevenue(string Month, decimal Revenue);
private readonly MonthRevenue[] _months =
[
new("Jan", 84_200), new("Feb", 91_500), new("Mar", 102_300), new("Apr", 98_700),
new("May", 110_400), new("Jun", 121_900), new("Jul", 117_600), new("Aug", 126_300),
new("Sep", 133_800), new("Oct", 141_200), new("Nov", 156_900), new("Dec", 172_400),
];
}The value axis ends on a multiple of its step. The argument axis's title also heads the first column of the data table.
GridLines on the argument axis adds lines between the months; on the value axis, GridLines="false" leaves only the zero line.
A log scale
For values that span several powers of ten, set Logarithmic on the ChartValueAxis: each power of ten is an equal step up, so growth from hundreds to thousands shows as clearly as from hundreds of thousands to millions. A log scale has no zero, so values at or under zero aren't drawn.
Static
Preview
| Month | Users |
|---|---|
| 1/1/2024 | 340 |
| 2/1/2024 | 610 |
| 3/1/2024 | 1,150 |
| 4/1/2024 | 2,080 |
| 5/1/2024 | 3,900 |
| 6/1/2024 | 6,400 |
| 7/1/2024 | 9,800 |
| 8/1/2024 | 15,200 |
| 9/1/2024 | 22,700 |
| 10/1/2024 | 34,100 |
| 11/1/2024 | 48,600 |
| 12/1/2024 | 69,300 |
| 1/1/2025 | 94,000 |
| 2/1/2025 | 121,500 |
| 3/1/2025 | 158,000 |
| 4/1/2025 | 204,300 |
| 5/1/2025 | 251,800 |
| 6/1/2025 | 312,400 |
| 7/1/2025 | 371,000 |
| 8/1/2025 | 446,900 |
| 9/1/2025 | 529,300 |
| 10/1/2025 | 618,000 |
| 11/1/2025 | 724,500 |
| 12/1/2025 | 851,200 |
Code
@* Active users since launch, which grew from hundreds to millions: on a log scale, each power of
ten is an equal step, so the early months' growth shows as clearly as the later ones'. *@
<Chart Items="_months" Argument="m => m.Month" Title="Monthly active users since launch">
<ChartValueAxis Logarithmic Title="Active users" />
<ChartLineSeries Value="m => m.Users" />
</Chart>
{
private record MonthUsers(DateOnly Month, int Users);
private readonly MonthUsers[] _months =
[
new(new(2024, 1, 1), 340), new(new(2024, 2, 1), 610), new(new(2024, 3, 1), 1_150), new(new(2024, 4, 1), 2_080),
new(new(2024, 5, 1), 3_900), new(new(2024, 6, 1), 6_400), new(new(2024, 7, 1), 9_800), new(new(2024, 8, 1), 15_200),
new(new(2024, 9, 1), 22_700), new(new(2024, 10, 1), 34_100), new(new(2024, 11, 1), 48_600), new(new(2024, 12, 1), 69_300),
new(new(2025, 1, 1), 94_000), new(new(2025, 2, 1), 121_500), new(new(2025, 3, 1), 158_000), new(new(2025, 4, 1), 204_300),
new(new(2025, 5, 1), 251_800), new(new(2025, 6, 1), 312_400), new(new(2025, 7, 1), 371_000), new(new(2025, 8, 1), 446_900),
new(new(2025, 9, 1), 529_300), new(new(2025, 10, 1), 618_000), new(new(2025, 11, 1), 724_500), new(new(2025, 12, 1), 851_200),
];
}Long names along the bottom
Names that don't fit side by side are skipped, every other one first. To turn them 45° before any are skipped, set the ChartArgumentAxis's LabelFit to Rotate; narrow the window to see them turn. Wrap shows every name, wrapped onto more lines in its band, which suits a few long names.
Static
Preview
| Area | Tickets |
|---|---|
| Billing and invoices | 412 |
| Sign-in and accounts | 368 |
| Data import | 291 |
| Reports and exports | 254 |
| Mobile app | 233 |
| Integrations | 198 |
| Notifications | 141 |
| Permissions and roles | 127 |
| Search | 96 |
| Other | 74 |
Code
@* Support tickets by product area: long names, turned 45° when they don't fit flat. *@
<Chart Items="_areas" Argument="a => a.Area" Title="Support tickets by product area, October">
<ChartArgumentAxis LabelFit="ChartLabelFit.Rotate" />
<ChartBarSeries Value="a => a.Tickets" />
</Chart>
{
private record AreaTickets(string Area, int Tickets);
private readonly AreaTickets[] _areas =
[
new("Billing and invoices", 412), new("Sign-in and accounts", 368), new("Data import", 291),
new("Reports and exports", 254), new("Mobile app", 233), new("Integrations", 198),
new("Notifications", 141), new("Permissions and roles", 127), new("Search", 96), new("Other", 74),
];
}Your own label text
When a format string can't say it, an axis's Formatter writes its text. Here the ChartValueAxis writes revenue in millions, and the ChartArgumentAxis names each quarter from its start date.
Static
Preview
| Start | Revenue |
|---|---|
| Q1 '25 | $3.8M |
| Q2 '25 | $4.1M |
| Q3 '25 | $4.5M |
| Q4 '25 | $5.3M |
| Q1 '26 | $5M |
| Q2 '26 | $5.7M |
| Q3 '26 | $6.1M |
| Q4 '26 | $6.9M |
Code
@* Quarterly revenue in millions, each quarter named from its start date. *@
<Chart Items="_quarters" Argument="q => q.Start" Title="Revenue by quarter">
<ChartValueAxis Formatter="(v => v == 0 ? "$0" : $"${v / 1_000_000:0.#}M")" />
<ChartArgumentAxis Formatter="(a => a is DateOnly d ? $"Q{(d.Month + 2) / 3} '{d:yy}" : "")" />
<ChartBarSeries Value="q => q.Revenue" />
</Chart>
{
private record QuarterRevenue(DateOnly Start, decimal Revenue);
private readonly QuarterRevenue[] _quarters =
[
new(new(2025, 1, 1), 3_840_000), new(new(2025, 4, 1), 4_120_000), new(new(2025, 7, 1), 4_510_000),
new(new(2025, 10, 1), 5_260_000), new(new(2026, 1, 1), 5_030_000), new(new(2026, 4, 1), 5_690_000),
new(new(2026, 7, 1), 6_140_000), new(new(2026, 10, 1), 6_870_000),
];
}The text shows on the axis, in tooltips and in the data table. Hiding a series from the legend then keeps the value axis as it is, since the browser can't run your formatter.
HideLabels leaves an axis's labels out. --ib-chart-tick-color and --ib-chart-tick-size set the labels' color and size.
Arguments right to left
To run the arguments right to left, set Reverse on ChartArgumentAxis, here January at the right and December at the left. Position="ChartAxisPosition.Right" on the ChartValueAxis moves the values to the right, beside January, where the reading starts.
Static
Preview
| الشهر | المبيعات |
|---|---|
| يناير | 412 |
| فبراير | 386 |
| مارس | 521 |
| أبريل | 468 |
| مايو | 455 |
| يونيو | 398 |
| يوليو | 372 |
| أغسطس | 409 |
| سبتمبر | 447 |
| أكتوبر | 493 |
| نوفمبر | 566 |
| ديسمبر | 618 |
Code
@* An Arabic store's monthly sales, right to left: the months run backward, January at the right, with the values beside it. *@
<Chart Items="_months" Argument="m => m.Month" Title="المبيعات الشهرية، 2026" dir="rtl" lang="ar">
<ChartValueAxis Format="N0" Title="ألف ريال" Position="ChartAxisPosition.Right" />
<ChartArgumentAxis Title="الشهر" Reverse />
<ChartBarSeries Value="m => m.Sales" Name="المبيعات" />
</Chart>
{
private record MonthSales(string Month, decimal Sales);
private readonly MonthSales[] _months =
[
new("يناير", 412), new("فبراير", 386), new("مارس", 521), new("أبريل", 468),
new("مايو", 455), new("يونيو", 398), new("يوليو", 372), new("أغسطس", 409),
new("سبتمبر", 447), new("أكتوبر", 493), new("نوفمبر", 566), new("ديسمبر", 618),
];
}On a right-to-left page the plot keeps its direction, as most charts in Arabic and Hebrew apps do; the legend, title and tooltip follow the page. Reverse works on its own, with no dir set.
With the values on the right, a second axis takes the left. On a horizontal chart, Reverse puts the first item at the bottom, and Top puts the values above the bars.