I am trying to do a Line Series chart based on DateTimeAxis. Here is my XAML:
<StackLayout>
<telerik:RadCartesianChart
VerticalOptions="FillAndExpand">
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:DateTimeContinuousAxis LabelFitMode="Rotate"
MajorStepUnit="Month" />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:NumericalAxis
Maximum="{Binding StartWeight}"
Minimum="{Binding GoalWeight}"/>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.Series>
<telerik:LineSeries ValueBinding="Weight"
CategoryBinding="Date"
ItemsSource="{Binding SeriesData}" />
</telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>
</StackLayout>
Here is where I create the observable collection:
private async Task<ObservableCollection<ProgressSeriesData>> GetCategoricalDataFromDbAsync(){
var entries = await _database.GetItemsAsync(); // Retrieve all entries from database
ObservableCollection<ProgressSeriesData> data = new();
var ID = 0;
foreach (var entry in entries)
{
ProgressSeriesData progressSeriesData = new()
{
Date = entry.Date,
Weight = entry.Weight,
ID = ID
};
data.Add(progressSeriesData);
ID++;
}
return data;
}
and here is what is displayed in the app:
I'm not sure why it won't plot the line for me? Here is what the data looks like in the model:
Any and all help is appreciated :)
Thanks!