This question is locked. New answers and comments are not allowed.
Hi,
I tried to bind a RadCartesianChart to an ObservableCollection of objects.
The Objects have a DateTime field and an interger value field.
First problem - binding the integer value field doesn't work.
So I changed the type to double which works - at least with design time data.
At runtime I get problems.
When I add my first record my apps hangs somewhere in RadCharting.
I guess this is because I have a single value in there.
By the way - I didn't even want to take the DateTimeContinousAxis, but I couldnt get the things to run with a linear Axis.
Unfortunately there is no example with XAML binding.
Maybe you can help me.
I have an object looking like this:
class TheDataEntry {
public int AgeInSeconds { get; }
public double AgeInSecondsDouble { get { return(AgeInSeconds); //helper for chart binding }
public int TheValue { get; }
public double TheValueDouble { get { return(TheValue); //helper for chart binding }
public DateTime RecordDate { get; }
}
And further I have
class DataHolder {
public ObservableCollection<TheDataEntry> Records { get; }
}
The code (working with design time data) looks like this:
My approach is to bind this data to a LineChart.
So XAxis should be "AgeInSeconds" and YAxis TheValue.
I have no problems using doubles - but ATM I get nothing when I try to use LinearAxis.
Thanks in advance
Manfred
PS: I attached a screenshot of what I get with design time data and the above XAML
I tried to bind a RadCartesianChart to an ObservableCollection of objects.
The Objects have a DateTime field and an interger value field.
First problem - binding the integer value field doesn't work.
So I changed the type to double which works - at least with design time data.
At runtime I get problems.
When I add my first record my apps hangs somewhere in RadCharting.
I guess this is because I have a single value in there.
By the way - I didn't even want to take the DateTimeContinousAxis, but I couldnt get the things to run with a linear Axis.
Unfortunately there is no example with XAML binding.
Maybe you can help me.
I have an object looking like this:
class TheDataEntry {
public int AgeInSeconds { get; }
public double AgeInSecondsDouble { get { return(AgeInSeconds); //helper for chart binding }
public int TheValue { get; }
public double TheValueDouble { get { return(TheValue); //helper for chart binding }
public DateTime RecordDate { get; }
}
And further I have
class DataHolder {
public ObservableCollection<TheDataEntry> Records { get; }
}
The code (working with design time data) looks like this:
<telerikChart:RadCartesianChart Grid.Row="3" x:Name="radChart1" > <telerikChart:RadCartesianChart.XAxis> <telerikChart:DateTimeContinuousAxis MajorTickStep="10" LabelFormat="HH:mm:ss" PlotMode="OnTicks" Style="{StaticResource timeLineAxisStyle}"> <telerikChart:DateTimeContinuousAxis.LabelStyle> <Style TargetType="TextBlock" BasedOn="{StaticResource textBlockStyle}"> <Setter Property="Width" Value="50"/> </Style> </telerikChart:DateTimeContinuousAxis.LabelStyle> </telerikChart:DateTimeContinuousAxis> </telerikChart:RadCartesianChart.XAxis> <telerikChart:RadCartesianChart.YAxis> <telerikChart:LinearAxis Minimum="0" LineStroke="Transparent" Style="{StaticResource linearAxisStyle}"/> </telerikChart:RadCartesianChart.YAxis> <telerikChart:RadCartesianChart.Grid> <telerikChart:CartesianChartGrid MajorLinesVisibility="XY" Style="{StaticResource gridStyleDashedAll}" MajorXLinesRenderMode="All"/> </telerikChart:RadCartesianChart.Grid> <telerikChart:LineSeries Stroke="{StaticResource Series1Brush}" ItemsSource="{Binding TheRecorder.Records}"> <telerikChart:LineSeries.ValueBinding> <telerikChart:PropertyNameDataPointBinding PropertyName="TheValueDouble" /> </telerikChart:LineSeries.ValueBinding> <telerikChart:LineSeries.CategoryBinding> <telerikChart:PropertyNameDataPointBinding PropertyName="RecordDate" /> </telerikChart:LineSeries.CategoryBinding> </telerikChart:LineSeries> </telerikChart:RadCartesianChart>My approach is to bind this data to a LineChart.
So XAxis should be "AgeInSeconds" and YAxis TheValue.
I have no problems using doubles - but ATM I get nothing when I try to use LinearAxis.
Thanks in advance
Manfred
PS: I attached a screenshot of what I get with design time data and the above XAML