Skip to main content

Density plot chart

info

Charts are available with Avalonia Pro.

Density plots smooth a numeric distribution into a continuous curve so peaks and spread are easier to see than in raw point lists.

When to use

  • Distribution shape: Inspect concentration, skew, and multiple peaks.
  • Smoother histograms: Show the same story as a histogram with a continuous curve.
  • Sampling comparisons: Present the overall shape of a dataset without plotting every point.

Code example

XAML

<charts:DensityPlotChart Title="Response time density"
Height="300"
ItemsSource="{Binding DensityData}"
ValuePath="Value" />

Data model (C#)

public record Measurement(double Value);

public ObservableCollection<Measurement> DensityData { get; } = new()
{
new(12),
new(15),
new(18),
new(19),
new(24)
};

Common properties

PropertyDescriptionDefault
ItemsSourceCollection of numeric samples.null
ValuePathPath to the numeric sample value.null
BandwidthKernel bandwidth. Automatically calculated if set to 0.0.0.0
FillOpacityOpacity of the filled area under the curve.0.3
ShowAreaWhether to fill the area under the curve.true
ShowGridLinesWhether to draw background grid lines.true
StrokeBrush used for the density curve.null

See also