Skip to content
daisyBlazor

ContourChart

Where a cloud of points is densest, drawn as nested bands like a contour map: the darker the band, the more points there. Useful when a scatter plot has too many dots to read. D3 (d3-contour) estimates the density; the chart fills the bands in one theme colour. In value mode it draws a measured value interpolated between the points instead (a scatter area), optionally with labelled contour lines.
Distribution
Cover · <ContourChart>
Density contour chartDensity of 350 points; darker bands mark where points are most concentrated. 0204005101520253035Density level 1 of 9Density level 2 of 9Density level 3 of 9Density level 4 of 9Density level 5 of 9Density level 6 of 9Density level 7 of 9Density level 8 of 9Density level 9 of 9

Examples

Basic

Pass ScatterPoint values; X and Y are used and the rest ignored. Two clusters show up as two peaks.

Sessions by length and pages viewed
Sessions by length and pages viewedDensity of 600 points, Pages viewed against Session length (min); darker bands mark where points are most concentrated. 05101520253035404551015202530Session length (min)Pages viewedDensity level 1 of 9Density level 2 of 9Density level 3 of 9Density level 4 of 9Density level 5 of 9Density level 6 of 9Density level 7 of 9Density level 8 of 9Density level 9 of 9
website/Examples/Charts/ContourChartBasicExample.razor Source

Bandwidth sets how far each point's influence spreads (in chart units), Levels how many bands to draw, and ShowPoints overlays the observations.

Density contour chartDensity of 150 points, Response time (ms) against Payload (KB); darker bands mark where points are most concentrated. 0102030405060708090406080100120140160180200220240260Payload (KB)Response time (ms)Density level 1 of 7Density level 2 of 7Density level 3 of 7Density level 4 of 7Density level 5 of 7Density level 6 of 7Density level 7 of 7Payload (KB) 17.4, Response time (ms) 51Payload (KB) 29.1, Response time (ms) 141.1Payload (KB) 40.9, Response time (ms) 133.7Payload (KB) 25.1, Response time (ms) 107.1Payload (KB) 39.4, Response time (ms) 150.6Payload (KB) 9.6, Response time (ms) 127.9Payload (KB) 24.3, Response time (ms) 149.8Payload (KB) 14.5, Response time (ms) 54.4Payload (KB) 22.7, Response time (ms) 112.2Payload (KB) 45.8, Response time (ms) 181Payload (KB) 47, Response time (ms) 177.8Payload (KB) 43.7, Response time (ms) 162.3Payload (KB) 38.9, Response time (ms) 154.5Payload (KB) 46.3, Response time (ms) 161.5Payload (KB) 43.9, Response time (ms) 152.7Payload (KB) 34.8, Response time (ms) 138.6Payload (KB) 39.1, Response time (ms) 183.1Payload (KB) 28.9, Response time (ms) 102.2Payload (KB) 31.7, Response time (ms) 130.7Payload (KB) 50.4, Response time (ms) 176.3Payload (KB) 46.8, Response time (ms) 142.7Payload (KB) 24.8, Response time (ms) 103.7Payload (KB) 17.4, Response time (ms) 95Payload (KB) 58.7, Response time (ms) 196.3Payload (KB) 43.1, Response time (ms) 138.7Payload (KB) 38.1, Response time (ms) 151.4Payload (KB) 11.3, Response time (ms) 96.4Payload (KB) 47.3, Response time (ms) 161.2Payload (KB) 20.8, Response time (ms) 117.2Payload (KB) 17.3, Response time (ms) 59.7Payload (KB) 21.1, Response time (ms) 99.9Payload (KB) 51.3, Response time (ms) 229.3Payload (KB) 45.1, Response time (ms) 182.8Payload (KB) 38.5, Response time (ms) 173.2Payload (KB) 11.9, Response time (ms) 119.1Payload (KB) 52.2, Response time (ms) 172.6Payload (KB) 28.7, Response time (ms) 152.5Payload (KB) 72, Response time (ms) 205.5Payload (KB) 34.3, Response time (ms) 114.3Payload (KB) 38.1, Response time (ms) 187.4Payload (KB) 53.3, Response time (ms) 222.2Payload (KB) 49.4, Response time (ms) 197.1Payload (KB) 42, Response time (ms) 151.8Payload (KB) 44.9, Response time (ms) 157.6Payload (KB) 31.6, Response time (ms) 169.3Payload (KB) 56.3, Response time (ms) 186.3Payload (KB) 41, Response time (ms) 183.7Payload (KB) 75.6, Response time (ms) 255.1Payload (KB) 39.5, Response time (ms) 137.7Payload (KB) 35.4, Response time (ms) 110.9Payload (KB) 8.5, Response time (ms) 74Payload (KB) 61.9, Response time (ms) 155.3Payload (KB) 33.3, Response time (ms) 139.3Payload (KB) 64.7, Response time (ms) 189Payload (KB) 35.6, Response time (ms) 178.7Payload (KB) 34.4, Response time (ms) 138.7Payload (KB) 54.6, Response time (ms) 214.2Payload (KB) 30.9, Response time (ms) 140.6Payload (KB) 5.6, Response time (ms) 122.2Payload (KB) 10.3, Response time (ms) 103.8Payload (KB) 43.5, Response time (ms) 133.4Payload (KB) 58.8, Response time (ms) 180.3Payload (KB) 29.6, Response time (ms) 114.9Payload (KB) 34.7, Response time (ms) 126.4Payload (KB) 40.2, Response time (ms) 142.9Payload (KB) 45.5, Response time (ms) 155.7Payload (KB) 30.1, Response time (ms) 110Payload (KB) 38.2, Response time (ms) 126.4Payload (KB) 45.4, Response time (ms) 194.1Payload (KB) 37.3, Response time (ms) 131.2Payload (KB) 61.7, Response time (ms) 237.3Payload (KB) 24.5, Response time (ms) 91.9Payload (KB) 36.7, Response time (ms) 131.9Payload (KB) 39.6, Response time (ms) 102.4Payload (KB) 48.1, Response time (ms) 178.7Payload (KB) 45.4, Response time (ms) 137.8Payload (KB) 14.2, Response time (ms) 64.3Payload (KB) 22.1, Response time (ms) 127.4Payload (KB) 33.6, Response time (ms) 91.2Payload (KB) 44.9, Response time (ms) 155.4Payload (KB) 47.2, Response time (ms) 150.7Payload (KB) 49.5, Response time (ms) 144.6Payload (KB) 39, Response time (ms) 179Payload (KB) 85.3, Response time (ms) 237.4Payload (KB) 48.7, Response time (ms) 175.3Payload (KB) 43.3, Response time (ms) 143.1Payload (KB) 32.9, Response time (ms) 138.5Payload (KB) 16.1, Response time (ms) 117.6Payload (KB) 34.5, Response time (ms) 147.8Payload (KB) 30.9, Response time (ms) 135.6Payload (KB) 49.3, Response time (ms) 173.4Payload (KB) 48.3, Response time (ms) 174.7Payload (KB) 44, Response time (ms) 170Payload (KB) 16, Response time (ms) 122.5Payload (KB) 38.1, Response time (ms) 147.4Payload (KB) 28.1, Response time (ms) 95.8Payload (KB) 19.5, Response time (ms) 98.6Payload (KB) 31.3, Response time (ms) 177.7Payload (KB) 27.6, Response time (ms) 157.5Payload (KB) 55, Response time (ms) 206.6Payload (KB) 28.5, Response time (ms) 82.2Payload (KB) 28, Response time (ms) 114.3Payload (KB) 38, Response time (ms) 178Payload (KB) 30.4, Response time (ms) 104.8Payload (KB) 49.5, Response time (ms) 181.2Payload (KB) 49, Response time (ms) 165.5Payload (KB) 43.9, Response time (ms) 137.9Payload (KB) 27.8, Response time (ms) 128.3Payload (KB) 67.3, Response time (ms) 238.1Payload (KB) 64.5, Response time (ms) 188.4Payload (KB) 55.2, Response time (ms) 170Payload (KB) 49.7, Response time (ms) 204.6Payload (KB) 71.8, Response time (ms) 200Payload (KB) 24.6, Response time (ms) 92.5Payload (KB) 32.1, Response time (ms) 147.4Payload (KB) 31.9, Response time (ms) 108.4Payload (KB) 35.5, Response time (ms) 127Payload (KB) 38.7, Response time (ms) 137.4Payload (KB) 58, Response time (ms) 186.2Payload (KB) 58.7, Response time (ms) 167.5Payload (KB) 38.7, Response time (ms) 115.2Payload (KB) 18.5, Response time (ms) 75.6Payload (KB) 51.2, Response time (ms) 175.8Payload (KB) 35.8, Response time (ms) 148.5Payload (KB) 53.2, Response time (ms) 162.5Payload (KB) 37.9, Response time (ms) 136.6Payload (KB) 28.1, Response time (ms) 107.8Payload (KB) 14.6, Response time (ms) 128.3Payload (KB) 36.5, Response time (ms) 167.6Payload (KB) 85.8, Response time (ms) 229.8Payload (KB) 45.9, Response time (ms) 191Payload (KB) 18.2, Response time (ms) 99.9Payload (KB) 57.9, Response time (ms) 173.2Payload (KB) 63, Response time (ms) 189Payload (KB) 50.2, Response time (ms) 154.3Payload (KB) 45.8, Response time (ms) 188.5Payload (KB) 33, Response time (ms) 135.7Payload (KB) 41.7, Response time (ms) 117.1Payload (KB) 55.4, Response time (ms) 201.6Payload (KB) 46.2, Response time (ms) 187.7Payload (KB) 69.5, Response time (ms) 247.2Payload (KB) 38.3, Response time (ms) 142.4Payload (KB) 40.2, Response time (ms) 185.4Payload (KB) 52, Response time (ms) 152.6Payload (KB) 50, Response time (ms) 204.3Payload (KB) 31.5, Response time (ms) 108.8Payload (KB) 80.5, Response time (ms) 241Payload (KB) 56.6, Response time (ms) 233.1Payload (KB) 33.4, Response time (ms) 108.2Payload (KB) 20.6, Response time (ms) 141.9
website/Examples/Charts/ContourChartPointsExample.razor Source

Value surface

Mode="ContourMode.Value" draws a measurement instead of density: each point's Value is interpolated linearly between the points (on their Delaunay triangles, exact at each point) and filled in bands of equal value, with a legend.

p95 latency by concurrent sessions and payload
p95 latency by concurrent sessions and payloadp95 latency (ms) measured at 60 points over Concurrent sessions (thousands) and Payload (KB), interpolated between them; darker bands mark higher values. 0123456789100100200300400500Concurrent sessions (thousands)Payload (KB)p95 latency (ms) 92–120p95 latency (ms) 120–140p95 latency (ms) 140–160p95 latency (ms) 160–180p95 latency (ms) 180–200p95 latency (ms) 200–220p95 latency (ms) 220–240p95 latency (ms) 240–260p95 latency (ms) 260–281Concurrent sessions (thousands) 3.8, Payload (KB) 436: p95 latency (ms) 174Concurrent sessions (thousands) 6.6, Payload (KB) 26: p95 latency (ms) 143Concurrent sessions (thousands) 3.7, Payload (KB) 338: p95 latency (ms) 182Concurrent sessions (thousands) 0.4, Payload (KB) 477: p95 latency (ms) 141Concurrent sessions (thousands) 8.4, Payload (KB) 427: p95 latency (ms) 214Concurrent sessions (thousands) 4.5, Payload (KB) 466: p95 latency (ms) 183Concurrent sessions (thousands) 4.4, Payload (KB) 56: p95 latency (ms) 127Concurrent sessions (thousands) 8.8, Payload (KB) 201: p95 latency (ms) 191Concurrent sessions (thousands) 8, Payload (KB) 168: p95 latency (ms) 182Concurrent sessions (thousands) 8.7, Payload (KB) 13: p95 latency (ms) 160Concurrent sessions (thousands) 7.5, Payload (KB) 283: p95 latency (ms) 248Concurrent sessions (thousands) 1.7, Payload (KB) 239: p95 latency (ms) 125Concurrent sessions (thousands) 3.9, Payload (KB) 14: p95 latency (ms) 117Concurrent sessions (thousands) 9.5, Payload (KB) 12: p95 latency (ms) 167Concurrent sessions (thousands) 4.8, Payload (KB) 359: p95 latency (ms) 229Concurrent sessions (thousands) 7.7, Payload (KB) 149: p95 latency (ms) 176Concurrent sessions (thousands) 1.1, Payload (KB) 82: p95 latency (ms) 100Concurrent sessions (thousands) 0.9, Payload (KB) 33: p95 latency (ms) 92Concurrent sessions (thousands) 8.3, Payload (KB) 76: p95 latency (ms) 164Concurrent sessions (thousands) 5.4, Payload (KB) 466: p95 latency (ms) 196Concurrent sessions (thousands) 8.8, Payload (KB) 330: p95 latency (ms) 214Concurrent sessions (thousands) 1.2, Payload (KB) 33: p95 latency (ms) 95Concurrent sessions (thousands) 6, Payload (KB) 480: p95 latency (ms) 200Concurrent sessions (thousands) 7.2, Payload (KB) 283: p95 latency (ms) 260Concurrent sessions (thousands) 8.3, Payload (KB) 73: p95 latency (ms) 164Concurrent sessions (thousands) 2.2, Payload (KB) 437: p95 latency (ms) 153Concurrent sessions (thousands) 7.1, Payload (KB) 457: p95 latency (ms) 210Concurrent sessions (thousands) 6, Payload (KB) 409: p95 latency (ms) 228Concurrent sessions (thousands) 7, Payload (KB) 91: p95 latency (ms) 156Concurrent sessions (thousands) 6.7, Payload (KB) 169: p95 latency (ms) 186Concurrent sessions (thousands) 7.2, Payload (KB) 9: p95 latency (ms) 146Concurrent sessions (thousands) 4.7, Payload (KB) 62: p95 latency (ms) 130Concurrent sessions (thousands) 0.8, Payload (KB) 76: p95 latency (ms) 96Concurrent sessions (thousands) 8.2, Payload (KB) 140: p95 latency (ms) 175Concurrent sessions (thousands) 0.2, Payload (KB) 408: p95 latency (ms) 131Concurrent sessions (thousands) 5.7, Payload (KB) 327: p95 latency (ms) 281Concurrent sessions (thousands) 7.9, Payload (KB) 467: p95 latency (ms) 212Concurrent sessions (thousands) 1.5, Payload (KB) 43: p95 latency (ms) 99Concurrent sessions (thousands) 4.4, Payload (KB) 55: p95 latency (ms) 127Concurrent sessions (thousands) 8.8, Payload (KB) 213: p95 latency (ms) 194Concurrent sessions (thousands) 3.1, Payload (KB) 193: p95 latency (ms) 137Concurrent sessions (thousands) 1.9, Payload (KB) 167: p95 latency (ms) 118Concurrent sessions (thousands) 5, Payload (KB) 449: p95 latency (ms) 194Concurrent sessions (thousands) 5.9, Payload (KB) 99: p95 latency (ms) 149Concurrent sessions (thousands) 5.7, Payload (KB) 135: p95 latency (ms) 160Concurrent sessions (thousands) 3.7, Payload (KB) 323: p95 latency (ms) 183Concurrent sessions (thousands) 4.9, Payload (KB) 102: p95 latency (ms) 140Concurrent sessions (thousands) 2.1, Payload (KB) 431: p95 latency (ms) 151Concurrent sessions (thousands) 1.9, Payload (KB) 500: p95 latency (ms) 157Concurrent sessions (thousands) 9.8, Payload (KB) 223: p95 latency (ms) 197Concurrent sessions (thousands) 1.4, Payload (KB) 219: p95 latency (ms) 119Concurrent sessions (thousands) 5.4, Payload (KB) 8: p95 latency (ms) 130Concurrent sessions (thousands) 5.7, Payload (KB) 285: p95 latency (ms) 281Concurrent sessions (thousands) 0.8, Payload (KB) 386: p95 latency (ms) 134Concurrent sessions (thousands) 7.7, Payload (KB) 255: p95 latency (ms) 229Concurrent sessions (thousands) 3.8, Payload (KB) 293: p95 latency (ms) 185Concurrent sessions (thousands) 3, Payload (KB) 120: p95 latency (ms) 122Concurrent sessions (thousands) 0.3, Payload (KB) 169: p95 latency (ms) 103Concurrent sessions (thousands) 8.2, Payload (KB) 70: p95 latency (ms) 163Concurrent sessions (thousands) 6.3, Payload (KB) 93: p95 latency (ms) 151
p95 latency (ms)
92–120 120–140 140–160 160–180 180–200 200–220 220–240 240–260 260–281
website/Examples/Charts/ContourChartValueExample.razor Source

Contour lines

ShowLines outlines each value band and prints its value on the line, like the isolines of a map.

Disk temperature across a rack row
Disk temperature across a rack rowTemperature (°C) measured at 35 points over Position along the row (m) and Height (U), interpolated between them; darker bands mark higher values. 024681012010203040Position along the row (m)Height (U)Temperature (°C) 24.5–30Temperature (°C) 30–35Temperature (°C) 35–40Temperature (°C) 40–43.5303540
Temperature (°C)
24.5–30 30–35 35–40 40–43.5
website/Examples/Charts/ContourChartValueLinesExample.razor Source

Playground

Sessions by length and pages viewed
Sessions by length and pages viewedDensity of 600 points, Pages viewed against Session length (min); darker bands mark where points are most concentrated. 05101520253035404551015202530Session length (min)Pages viewedDensity level 1 of 9Density level 2 of 9Density level 3 of 9Density level 4 of 9Density level 5 of 9Density level 6 of 9Density level 7 of 9Density level 8 of 9Density level 9 of 9
Mode ContourMode
<ContourChart
              XTitle="Session length (min)"
              YTitle="Pages viewed"
              Title="Sessions by length and pages viewed"
              Points="@_sessions" />

@code {
    // Two habits show up as two peaks: quick check-ins and long working sessions.
    private readonly ScatterPoint[] _sessions =
    [
        .. DistributionSamples.Cloud(seed: 21, count: 300, xMean: 7, xSd: 2, intercept: 4, slope: 0.6, noise: 1.2),
        .. DistributionSamples.Cloud(seed: 22, count: 300, xMean: 30, xSd: 5, intercept: 6, slope: 0.5, noise: 2.5),
    ];
}

API

<ContourChart>

DaisyBlazor.Charts

Parameters

  • AspectRatio double
    = 1.78

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

  • Bandwidth double
    = 20

    Smoothing radius of the density estimate, in chart units: larger gives rounder, broader bands.

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

    Colour of the bands (any CSS colour); deeper levels are more opaque.

  • Levels int
    = 10

    About how many density levels to draw (D3 rounds to nice thresholds).

  • Mode ContourMode
    = ContourMode.Density

    What to draw: the density of the points (the default), or in Value a surface of each point's Value, interpolated linearly on the points' Delaunay triangles (and, outside them, taken from the nearest edge of their hull), so it is exact at each point and never beyond the smallest and largest value, and filled in bands of equal value from light to Color, with a legend. Points without a finite Value are skipped in value mode; Bandwidth only applies to density.

  • Points IReadOnlyList<ScatterPoint>
    = []

    The points whose density is drawn. Size, Series and Label are ignored; points without a finite X and Y are skipped.

  • 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 the colour key of the value bands under the chart (value mode only).

  • ShowLines bool
    = false

    In value mode, outline each band and print its value on the line (a scatter contour).

  • ShowPoints bool
    = false

    Draw the points themselves over the bands.

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

  • Title string
    = null

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

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

    Format string for X and Y in point tooltips, and for values in value mode.

  • ValueTitle string
    = null

    Name of the measured value in value mode, used in tooltips and the description, e.g. "Latency (ms)".

  • Width string
    = "100%"

    CSS width of the chart wrapper.

  • XTitle string
    = null

    Title of the horizontal axis.

  • YTitle string
    = null

    Title of the vertical axis.

  • Class string
    = null

    Additional CSS classes merged onto the w-full wrapper.

  • Style string
    = null

    Inline styles appended after the width on the wrapper.

ScatterPoint

DaisyBlazor.Charts

One observation of a ScatterChart, ContourChart or HexbinChart. Points whose X or Y is not a finite number are skipped.

Properties

  • Label string

    Optional name shown first in the point's tooltip (ScatterChart only).

  • Series string

    Optional series name (ScatterChart only); each series gets its own colour and legend entry.

  • Size double?

    Optional bubble size (ScatterChart only); the bubble's area is proportional to it.

  • Value double?

    Optional measured value at (X, Y), interpolated over the plot by a ContourChart in Value mode.

  • X double

    Horizontal value.

  • XError double?

    Optional symmetric error on X (ScatterChart only): a horizontal error bar from X − XError to X + XError. Ignored unless above zero.

  • Y double

    Vertical value.

  • YError double?

    Optional symmetric error on Y (ScatterChart only): a vertical error bar from Y − YError to Y + YError. Ignored unless above zero.

Methods

  • <Clone>$ () → ScatterPoint
  • Deconstruct (Double& X, Double& Y, Nullable`1& Size, String& Series, String& Label) → void
  • Equals (object obj) → bool
  • Equals (ScatterPoint other) → bool
  • GetHashCode () → int
  • ToString () → string

ContourMode

DaisyBlazor.Charts

What a ContourChart draws.

Something went wrong while running the docs. Reload