Skip to main content

Diverging bar chart

info

Charts are available with Avalonia Pro.

Diverging bar charts use a centered baseline so values can extend in opposite directions from the same origin.

When to use

  • Sentiment splits: Show positive and negative responses around zero.
  • Variance views: Compare over- and under-performance against a baseline.
  • Balanced comparisons: Highlight directional differences without two separate charts.

Code example

XAML

<charts:DivergingBarChart Title="Net sentiment"
Height="300"
ItemsSource="{Binding SentimentData}"
LabelPath="Label"
ValuePath="Score" />

Data model (C#)

public record SentimentPoint(string Label, double Score);

public ObservableCollection<SentimentPoint> SentimentData { get; } = new()
{
new("Product A", 24),
new("Product B", -12),
new("Product C", 8)
};

Common properties

PropertyDescriptionDefault
ItemsSourceCollection of items to compare.null
ValuePathPath to the value plotted relative to the baseline.null
LabelPathPath to the category label.null
BaselineCenter baseline value.0.0
PositiveBrushBrush used for values above the baseline.null
NegativeBrushBrush used for values below the baseline.null
BarHeightBar height as a fraction of the row height.0.7
ShowValuesWhether to draw value labels inside the bars.true
IsHighlightEnabledEnables hover highlighting for bars.false

See also