Chart
The RzChart component provides a fluent C# API for rendering Chart.js visualizations in SSR workflows.
Looking for bar-specific patterns? See the Chart Bar Examples page. A chart fills the height of its parent when the parent has one ( The chart's type comes from its first dataset ( Colors given as CSS variables (<RzChart Configure=@(c => c
.Data(d => d
.Labels("January", "February", "March", "April", "May", "June", "July")
.Datasets(ds => ds
.Line()
.Label("Monthly Sales")
.Data(65, 59, 80, 81, 56, 55, 40)
.BackgroundColor("var(--chart-1)")
.BorderColor("var(--chart-1)")
.Tension(0.4)
)
)
.Options(o => o
.Responsive(true)
.MaintainAspectRatio(false)
.Plugins(p => p.Legend(l => l.Position(LegendPosition.Top)))
)) />h-64, a grid cell, a card with a fixed height), so it never grows past it. In a parent without a height it is half as tall as it is wide, Chart.js's default 2:1 ratio. Override the slots to change either, for example class="h-80" on the chart..Doughnut(), .Bar(), ...), so Chart.js applies that type's defaults, such as a doughnut legend with one entry per slice. For a mixed chart whose first dataset is not the base type, set it with .Type("bar") on the builder.var(--chart-1)) are resolved again when the theme changes, so a chart follows dark mode without being re-rendered. A chart removed from the page, for example by an htmx swap, destroys its Chart.js instance.