I try to use RadCartesianChart with numerical vertical axis and DateTimes on horizontal axis.
The dates only cover the current year.
The month labels should be placed evry quater: January, April, July, October (Maybe December as the end of the scale).
Here is a minimal code example:
<
telerikChart:RadCartesianChart
Grid.Row
=
"1"
x:Name
=
"line_chart"
VerticalOptions
=
"FillAndExpand"
>
<
telerikChart:RadCartesianChart.BindingContext
>
<
local:ViewModel
/>
</
telerikChart:RadCartesianChart.BindingContext
>
<
telerikChart:RadCartesianChart.HorizontalAxis
>
<
telerikChart:DateTimeContinuousAxis
Maximum
=
"{Binding MinDate}"
Maximum
=
"{Binding MaxDate}"
PlotMode
=
"OnTicks"
LabelFormat
=
"MMM"
MajorStepUnit
=
"Month"
LabelFitMode
=
"Rotate"
MajorStep
=
"3"
/>
</
telerikChart:RadCartesianChart.HorizontalAxis
>
<
telerikChart:RadCartesianChart.VerticalAxis
>
<
telerikChart:NumericalAxis
/>
</
telerikChart:RadCartesianChart.VerticalAxis
>
<
telerikChart:RadCartesianChart.Series
>
<
telerikChart:LineSeries
ValueBinding
=
"Value"
CategoryBinding
=
"Date"
ItemsSource
=
"{Binding
public
class
ViewModel
{
public
ObservableCollection<CategoricalData> Dates {
get
;
set
; }
public
DateTime MinDate {
get
;
set
; } =
new
DateTime(DateTime.Now.Year, 1, 1);
public
DateTime MaxDate {
get
;
set
; } =
new
DateTime(DateTime.Now.Year, 12, 31);
public
ViewModel()
{
Dates =
new
ObservableCollection<CategoricalData>();
Dates.Add(
new
CategoricalData() { Date = MinDate, Value = 40 });
Dates.Add(
new
CategoricalData() { Date = MaxDate, Value = 40 });
}
}
}"
/>
</
telerikChart:RadCartesianChart.Series
>
</
telerikChart:RadCartesianChart
>
It looks exactly correct on Android but on iOS MaxDate and MajorStep are not respected and the distances are not equidistant.