Skip to content
daisyBlazor

ComboChart

Bars and lines over the same categories, so a count and a rate read together: deployments per week as bars and the change failure rate as a line. The lines can take their own scale on a right-hand axis. D3 computes the scales, bands and ticks; the chart draws them in theme colours.
Compare
Cover · <ComboChart>
Combo chart6 categories; grouped bars: Deployments; lines: Failure rate (right axis).W1W2W3W4W5W60102030405060700246810W1 · Deployments: 42W2 · Deployments: 51W3 · Deployments: 38W4 · Deployments: 57W5 · Deployments: 63W6 · Deployments: 66W1 · Failure rate: 7.1W2 · Failure rate: 9.1W3 · Failure rate: 5.3W4 · Failure rate: 6.5W5 · Failure rate: 4.3W6 · Failure rate: 2.8

Examples

Basic

Labels names the categories; value i of each series in Bars and Lines belongs to label i. Bar series sit side by side and colours run through the palette across the bars, then the lines.

Deployments and rollbacks per week
Deployments and rollbacks per week8 categories; grouped bars: Deployments, Rollbacks; lines: Hotfixes.W14W15W16W17W18W19W20W21020406080W14 · Deployments: 42W14 · Rollbacks: 3W15 · Deployments: 51W15 · Rollbacks: 5W16 · Deployments: 38W16 · Rollbacks: 2W17 · Deployments: 57W17 · Rollbacks: 6W18 · Deployments: 63W18 · Rollbacks: 4W19 · Deployments: 48W19 · Rollbacks: 3W20 · Deployments: 66W20 · Rollbacks: 5W21 · Deployments: 71W21 · Rollbacks: 2W14 · Hotfixes: 8W15 · Hotfixes: 11W16 · Hotfixes: 6W17 · Hotfixes: 12W18 · Hotfixes: 9W19 · Hotfixes: 7W20 · Hotfixes: 10W21 · Hotfixes: 8
Deployments Rollbacks Hotfixes
website/Examples/Charts/ComboChartBasicExample.razor Source

SecondaryAxis="true" gives the lines their own scale on the right, formatted with SecondaryValueFormat; StackBars stacks the bar series and Smooth curves the lines. A series' Color overrides the palette.

Deployments per week and change failure rate
Deployments per week and change failure rate8 categories; stacked bars: Production, Staging; lines: Change failure rate (right axis).W14W15W16W17W18W19W20W210204060800%2%4%6%8%10%12%W14 · Production: 18W14 · Staging: 24W15 · Production: 22W15 · Staging: 29W16 · Production: 15W16 · Staging: 23W17 · Production: 24W17 · Staging: 33W18 · Production: 27W18 · Staging: 36W19 · Production: 20W19 · Staging: 28W20 · Production: 29W20 · Staging: 37W21 · Production: 31W21 · Staging: 40W14 · Change failure rate: 7.1%W15 · Change failure rate: 9.1%W16 · Change failure rate: 5.3%W17 · Change failure rate: 10.5%W18 · Change failure rate: 6.3%W19 · Change failure rate: 6.3%W20 · Change failure rate: 7.6%W21 · Change failure rate: 2.8%
Production Staging Change failure rate (right axis)
website/Examples/Charts/ComboChartSecondaryAxisExample.razor Source

Playground

Deployments and rollbacks per week
Deployments and rollbacks per week8 categories; grouped bars: Deployments, Rollbacks; lines: Hotfixes.W14W15W16W17W18W19W20W21020406080W14 · Deployments: 42W14 · Rollbacks: 3W15 · Deployments: 51W15 · Rollbacks: 5W16 · Deployments: 38W16 · Rollbacks: 2W17 · Deployments: 57W17 · Rollbacks: 6W18 · Deployments: 63W18 · Rollbacks: 4W19 · Deployments: 48W19 · Rollbacks: 3W20 · Deployments: 66W20 · Rollbacks: 5W21 · Deployments: 71W21 · Rollbacks: 2W14 · Hotfixes: 8W15 · Hotfixes: 11W16 · Hotfixes: 6W17 · Hotfixes: 12W18 · Hotfixes: 9W19 · Hotfixes: 7W20 · Hotfixes: 10W21 · Hotfixes: 8
Deployments Rollbacks Hotfixes
<ComboChart
            Title="Deployments and rollbacks per week"
            Labels="@_weeks"
            Bars="@_bars"
            Lines="@_lines" />

@code {
    // Bar series sit side by side in each week; the line shares their scale.
    private readonly string[] _weeks = ["W14", "W15", "W16", "W17", "W18", "W19", "W20", "W21"];

    private readonly ChartSeries[] _bars =
    [
        new("Deployments", [42, 51, 38, 57, 63, 48, 66, 71]),
        new("Rollbacks", [3, 5, 2, 6, 4, 3, 5, 2]),
    ];

    private readonly ChartSeries[] _lines =
    [
        new("Hotfixes", [8, 11, 6, 12, 9, 7, 10, 8]),
    ];
}

API

<ComboChart>

DaisyBlazor.Charts

Parameters

  • AspectRatio double
    = 1.78

    Width divided by height. The chart keeps this shape at any width; its text keeps its size.

  • Bars IReadOnlyList<ChartSeries>
    = []

    Series drawn as bars, side by side in each category (or stacked with StackBars).

  • Labels IReadOnlyList<string>
    = []

    The categories along the horizontal axis; value i of every series belongs to label i.

  • Lines IReadOnlyList<ChartSeries>
    = []

    Series drawn as lines through the category centres, over the bars.

  • RowHeight double?
    = null

    Height of each row in px, for a chart that lays its categories out as rows (horizontal bars, a Gantt's lanes, a heatmap's rows…): its height then follows its number of rows instead of AspectRatio, so a long list keeps readable rows at any width. A chart, or an orientation, without rows ignores it.

  • SecondaryAxis bool
    = false

    Give the lines their own value scale, labelled right of the plot.

  • SecondaryAxisFormat string
    = "{0} (right axis)"

    Format string for a line series' name in the legend and the description when SecondaryAxis is on; {0} is the name.

  • SecondaryValueFormat string
    = "{0:#,0.##}"

    Format string for the secondary axis ticks and the line tooltips when SecondaryAxis is on, e.g. "{0:0.#}%".

  • ShowLegend bool
    = true

    Show a legend of the bar and line series.

  • ShowTitle bool
    = true

    Draw Title as a visible heading above the chart (the default); false keeps it only as the chart's accessible name, for a chart inside a card that already has a heading.

  • Smooth bool
    = false

    Draw the lines as smooth curves (monotone, so they never overshoot a value).

  • StackBars bool
    = false

    Stack the bar series in one bar per category instead of side by side.

  • Title string
    = null

    Optional heading rendered above the chart; it is also the chart's accessible name.

  • ValueFormat string
    = "{0:#,0.##}"

    Format string for bar values (and line values without a secondary axis) in ticks and tooltips.

  • Width string
    = "100%"

    CSS width of the chart wrapper.

  • Class string
    = null

    Additional CSS classes merged onto the w-full wrapper.

  • Style string
    = null

    Inline styles appended after the width on the wrapper.

ChartSeries

DaisyBlazor.Charts

A named numeric series for multi-series line, area and bar charts. The ordinal index of each value lines up with the chart's X labels.

Properties

  • Color string
    = null

    Optional CSS color override; falls back to the cycling palette when null.

  • Data IReadOnlyList<double>
    = []

    Ordered values; index i aligns with X label i.

  • Name string
    = ""

    Series display name (legend / tooltip label).

  • Stack string
    = null

    Optional stack name for a stacked BarChart: series with the same name stack together and different stacks stand side by side in each category. Series without one share a single stack. Ignored by other charts and when the bars are not stacked.

Something went wrong while running the docs. Reload