Skip to content
daisyBlazor

ParetoChart

Which few causes make up most of the total: bars sorted largest first, the cumulative share as a line on a 0–100 % axis, and a reference line at 80 %. The bars needed to reach it stay solid. D3 computes the sort, the scales and the line.
Composition and progress
Cover · <ParetoChart>
Pareto chartA: 412, cumulative 43.8%; B: 268, cumulative 72.3%; C: 155, cumulative 88.8%; D: 64, cumulative 95.6%; E: 41, cumulative 100%. The first 3 reach 80% of the total.ABCDE01002003004000%20%40%60%100%A: 412 (43.8%, cumulative 43.8%)B: 268 (28.5%, cumulative 72.3%)C: 155 (16.5%, cumulative 88.8%)D: 64 (6.8%, cumulative 95.6%)E: 41 (4.4%, cumulative 100%)80% of the total 80%Up to A: 43.8%Up to B: 72.3%Up to C: 88.8%Up to D: 95.6%Up to E: 100%

Examples

Basic

Pass the categories in any order; the chart sorts them and fades the bars past the threshold.

Failed requests by cause
Failed requests by causeTimeout: 412, cumulative 42%; Auth expired: 268, cumulative 69.4%; Rate limited: 155, cumulative 85.2%; DNS: 64, cumulative 91.7%; Bad payload: 41, cumulative 95.9%; TLS: 22, cumulative 98.2%; Other: 18, cumulative 100%. The first 3 reach 80% of the total.TimeoutAuth expiredRate limitedDNSBad payloadTLSOther01002003004000%20%40%60%100%Timeout: 412 (42%, cumulative 42%)Auth expired: 268 (27.3%, cumulative 69.4%)Rate limited: 155 (15.8%, cumulative 85.2%)DNS: 64 (6.5%, cumulative 91.7%)Bad payload: 41 (4.2%, cumulative 95.9%)TLS: 22 (2.2%, cumulative 98.2%)Other: 18 (1.8%, cumulative 100%)80% of the total 80%Up to Timeout: 42%Up to Auth expired: 69.4%Up to Rate limited: 85.2%Up to DNS: 91.7%Up to Bad payload: 95.9%Up to TLS: 98.2%Up to Other: 100%
website/Examples/Charts/ParetoChartBasicExample.razor Source

Threshold moves the reference line (0.9 here); BarColor, LineColor and ThresholdColor take any CSS colour.

Pareto chartTimeout: 412, cumulative 42%; Auth expired: 268, cumulative 69.4%; Rate limited: 155, cumulative 85.2%; DNS: 64, cumulative 91.7%; Bad payload: 41, cumulative 95.9%; TLS: 22, cumulative 98.2%; Other: 18, cumulative 100%. The first 4 reach 90% of the total.TimeoutAuth expiredRate limitedDNSBad payloadTLSOther01002003004000%20%40%60%80%100%Timeout: 412 (42%, cumulative 42%)Auth expired: 268 (27.3%, cumulative 69.4%)Rate limited: 155 (15.8%, cumulative 85.2%)DNS: 64 (6.5%, cumulative 91.7%)Bad payload: 41 (4.2%, cumulative 95.9%)TLS: 22 (2.2%, cumulative 98.2%)Other: 18 (1.8%, cumulative 100%)90% of the total 90%Up to Timeout: 42%Up to Auth expired: 69.4%Up to Rate limited: 85.2%Up to DNS: 91.7%Up to Bad payload: 95.9%Up to TLS: 98.2%Up to Other: 100%
website/Examples/Charts/ParetoChartThresholdExample.razor Source

Playground

Failed requests by cause
Failed requests by causeTimeout: 412, cumulative 42%; Auth expired: 268, cumulative 69.4%; Rate limited: 155, cumulative 85.2%; DNS: 64, cumulative 91.7%; Bad payload: 41, cumulative 95.9%; TLS: 22, cumulative 98.2%; Other: 18, cumulative 100%. The first 3 reach 80% of the total.TimeoutAuth expiredRate limitedDNSBad payloadTLSOther01002003004000%20%40%60%100%Timeout: 412 (42%, cumulative 42%)Auth expired: 268 (27.3%, cumulative 69.4%)Rate limited: 155 (15.8%, cumulative 85.2%)DNS: 64 (6.5%, cumulative 91.7%)Bad payload: 41 (4.2%, cumulative 95.9%)TLS: 22 (2.2%, cumulative 98.2%)Other: 18 (1.8%, cumulative 100%)80% of the total 80%Up to Timeout: 42%Up to Auth expired: 69.4%Up to Rate limited: 85.2%Up to DNS: 91.7%Up to Bad payload: 95.9%Up to TLS: 98.2%Up to Other: 100%
<ParetoChart
             ValueFormat="{0:N0}"
             Title="Failed requests by cause"
             Data="@_causes" />

@code {
    private readonly ChartDataPoint[] _causes =
    [
        new("DNS", 64),
        new("Timeout", 412),
        new("TLS", 22),
        new("Auth expired", 268),
        new("Bad payload", 41),
        new("Rate limited", 155),
        new("Other", 18),
    ];
}

API

<ParetoChart>

DaisyBlazor.Charts

Parameters

  • AspectRatio double
    = 1.78

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

  • BarColor string
    = "var(--color-primary)"

    CSS colour of the bars.

  • Data IReadOnlyList<ChartDataPoint>
    = []

    The categories. They are sorted by value, largest first; only positive values count.

  • LineColor string
    = "var(--color-secondary)"

    CSS colour of the cumulative line.

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

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

  • Threshold double
    = 0.8

    The cumulative share (0 to 1) marked by the reference line; bars up to the one that reaches it stay solid.

  • ThresholdColor string
    = "var(--color-warning)"

    CSS colour of the threshold line.

  • 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 on the left axis and in 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.

Something went wrong while running the docs. Reload