I'm trying to simply invert the Y Axis so this graph it goes up instead of down.
Starting at 6 going up to 1.
This is the user doc on inverted graphs
https://lvcharts.net/App/examples/v1/wpf/Inverted%20Series
This is the example I used to build the chart
https://lvcharts.net/App/examples/v1/wpf/Date%20Time
The user doc states every live series has an inverted class and for the LineSeries class its simply VerticalLineSeries which I've changed the DateTime example to. However the graph still goes upwards from 1-6. What am I missing?
public partial class MainWindow : Window
{
public Func<double, string> Formatter { get; set; }
public SeriesCollection Series { get; set; }
public MainWindow()
{
InitializeComponent();
var dayConfig = Mappers.Xy<DateModel>()
.X(dayModel => (double)dayModel.DateTime.Ticks / TimeSpan.FromHours(1).Ticks)
.Y(dayModel => dayModel.Value);
Series = new SeriesCollection(dayConfig)
{
new VerticalLineSeries
{
Values = new ChartValues<DateModel>
{
new DateModel
{
DateTime = System.DateTime.Now,
Value = 6
},
new DateModel
{
DateTime = System.DateTime.Now.AddHours(1),
Value = 5
},
new DateModel
{
DateTime = System.DateTime.Now.AddHours(2),
Value = 4
},
new DateModel
{
DateTime = System.DateTime.Now.AddHours(3),
Value = 3
},
new DateModel
{
DateTime = System.DateTime.Now.AddHours(4),
Value = 2
},
new DateModel
{
DateTime = System.DateTime.Now.AddHours(5),
Value = 1
}
},
Fill = Brushes.Transparent
}
};
Formatter = value => new System.DateTime((long)(value * TimeSpan.FromHours(1).Ticks)).ToString("t");
DataContext = this;
}
}
XAML
<Grid>
<lvc:CartesianChart Series="{Binding Series}">
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding Formatter}"></lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
</Grid>
Producing the graph below