Skip to content
daisyBlazor

RangeBarChart

A bar from a low to a high value per category: seats allowed per plan, response time from median to worst case, optionally with groups side by side. D3 computes the scale, ticks and bands; the chart draws the bars in theme colours.
Compare
Cover · <RangeBarChart>
Range bar chartMon: 8 to 18; Tue: 7 to 19; Wed: 9 to 17; Thu: 8 to 20; Fri: 9 to 15MonTueWedThuFri68101214161820Mon: 8 to 18Tue: 7 to 19Wed: 9 to 17Thu: 8 to 20Fri: 9 to 15

Examples

Basic

Each RangeBarItem spans from Low to High; ShowValues writes both ends beside the bar.

Seats per plan, minimum to maximum
Seats per plan, minimum to maximumStarter: 1 to 5; Team: 5 to 50; Business: 25 to 250; Scale: 100 to 1,00002004006008001,000StarterTeamBusinessScaleStarter: 1 to 515Team: 5 to 50550Business: 25 to 25025250Scale: 100 to 1,0001001,000
website/Examples/Charts/RangeBarChartBasicExample.razor Source

Grouped

Items with the same Label share a band and each Group gets its own slot, colour and legend entry; GroupColors maps a group to any CSS colour.

Response time by region, p50 to p99 (ms)
Response time by region, p50 to p99 (ms)Europe West, Before 4.2: 120 to 410; Europe West, After 4.2: 95 to 300; US East, Before 4.2: 110 to 380; US East, After 4.2: 90 to 290; Asia Pacific, Before 4.2: 160 to 520; Asia Pacific, After 4.2: 170 to 5400100200300400500600Europe WestUS EastAsia PacificEurope West, Before 4.2: 120 to 410Europe West, After 4.2: 95 to 300US East, Before 4.2: 110 to 380US East, After 4.2: 90 to 290Asia Pacific, Before 4.2: 160 to 520Asia Pacific, After 4.2: 170 to 540
Before 4.2 After 4.2
website/Examples/Charts/RangeBarChartGroupedExample.razor Source

Time of day

ValueFormatter writes the values on the axis, beside the bars and in tooltips; RangeBarChart.TimeOfDay prints hours past midnight as a time (25 as 01:00), and RangeBarItem.FromTimes builds an item from two TimeOnly values, past midnight when the end is before the start.

Night shifts
Night shiftsWard A: 19:00 to 03:00; Ward B: 21:30 to 06:00; Emergency: 18:00 to 07:30; Pharmacy: 22:00 to 23:5918:0020:0022:0000:0002:0004:0006:0008:00Ward AWard BEmergencyPharmacyWard A: 19:00 to 03:0019:0003:00Ward B: 21:30 to 06:0021:3006:00Emergency: 18:00 to 07:3018:0007:30Pharmacy: 22:00 to 23:5922:0023:59
website/Examples/Charts/RangeBarChartTimeOfDayExample.razor Source

Playground

Seats per plan, minimum to maximum
Seats per plan, minimum to maximumStarter: 1 to 5; Team: 5 to 50; Business: 25 to 250; Scale: 100 to 1,00002004006008001,000StarterTeamBusinessScaleStarter: 1 to 515Team: 5 to 50550Business: 25 to 25025250Scale: 100 to 1,0001001,000
<RangeBarChart
               ShowValues="true"
               ValueFormat="{0:N0}"
               Title="Seats per plan, minimum to maximum"
               Items="@_plans" />

@code {
    private readonly RangeBarItem[] _plans =
    [
        new("Starter", 1, 5),
        new("Team", 5, 50),
        new("Business", 25, 250),
        new("Scale", 100, 1000),
    ];
}

API

<RangeBarChart>

DaisyBlazor.Charts

Parameters

  • AspectRatio double
    = 1.78

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

  • GroupColors IReadOnlyDictionary<string, string>
    = null

    Optional colour per group name (any CSS colour); other groups cycle through the theme palette.

  • Horizontal bool
    = true

    Lay the bars out as rows (the default); false stands them up as columns.

  • Items IReadOnlyList<RangeBarItem>
    = []

    The bars. Items with the same Label share a category; Group splits it into side-by-side slots. Items whose Low or High is not a finite number are skipped.

  • Max double?
    = null

    End of the value axis, e.g. 0 for "now". Defaults to the highest value, rounded; spans are clipped to it, and spans entirely after it are left out.

  • Min double?
    = null

    Start of the value axis, e.g. -24 for "the last 24 hours". Defaults to the lowest value, rounded; spans are clipped to it, and spans entirely before it are left out.

  • 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.

  • ShowLegend bool
    = true

    Show a legend when there is more than one group.

  • 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.

  • ShowValues bool
    = false

    Write the low and high values at the ends of each bar.

  • Title string
    = null

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

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

    Format string for values in labels and tooltips, e.g. "{0:N0} GB".

  • ValueFormatter Func<double, string>
    = null

    Optional function writing a value, used for the value axis ticks, labels and tooltips instead of ValueFormat. TimeOfDay prints hours past midnight as a time of day (25 as 01:00).

  • 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.

Something went wrong while running the docs. Reload