Examples
Pass ScatterPoint values; X and Y are used and the rest ignored. Two clusters show up as two peaks.
Bandwidth sets how far each point's influence spreads (in chart units), Levels how many bands to draw, and ShowPoints overlays the observations.
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.
ShowLines outlines each value band and prints its value on the line, like the isolines of a map.
Playground
<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.ChartsParameters
- 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.ChartsOne 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.ChartsWhat a ContourChart draws.