Skip to main content

Slope chart

info

Charts are available with Avalonia Pro.

Slope charts compare two points in time (or two categories) for multiple entities. They are ideal for visualizing the change in rank or value between two states.

Slope chart comparing entity values between two time points with labeled lines showing which increased or decreased.

When to use

  • Before/after analysis: Showing the impact of a policy or event across different groups.
  • Rank shifts: Visualizing how product popularity changed between two quarters.
  • Comparison of two states: Highlighting which entities improved and which declined.

Code example

XAML

<charts:SlopeChart Name="SlopeChartSample"
Title="Before vs After"
Height="300"
LabelPath="Label"
StartValuePath="Before"
EndValuePath="After"
IsCurved="True"
ShowGridLines="True"
ShowXAxis="True"
ItemsSource="{Binding SlopeData}" />

Data model (C#)

public record SlopeItem(string Label, double Before, double After);

public ObservableCollection<SlopeItem> SlopeData { get; } = new()
{
new("Sales", 100.0, 150.0),
new("Cost", 80.0, 70.0),
new("Profit", 20.0, 80.0)
};

Common properties

PropertyDescriptionDefault
ItemsSourceThe collection of items to compare.null
LabelPathPath to the entity name.null
StartValuePathPath to the first value shown on the left side.null
EndValuePathPath to the second value shown on the right side.null
StartLabelLabel displayed for the left side."Before"
EndLabelLabel displayed for the right side."After"
StrokeThicknessWidth of the connecting lines.2.0
MarkerSizeSize of the markers at the start and end of each line.8.0
ShowLabelsToggles the start and end value labels.true
IsCurvedDraws curved lines instead of straight connectors.false
ShowGridLinesWhether to draw guide lines for the start and end positions.false
ShowXAxisWhether to draw the bottom axis and move the side labels below the chart.false
IsHighlightEnabledEnables hover highlighting for slope lines.false