hello, i am trying to replace my radchart with a radchartview,
but i stumble on this problem : the lines connecting my values are not drawn ( using line series)
( i am using a DateTimeCategoricalAxis because i only want ticks for dates with actual records in my itemsource,
and don't need the distance between 2 values to be an indication of the time between, the production environment wil have multiple values on some day, and none on others, but i dont think is the cause of my problem )
( screenshot to show the resulting window)
viewmodel :
public class ViewModel
{
public ViewModel()
{
List<TestItem> items = new List<TestItem>();
for (int i = 1 ; i< 20; i++){
var r = new TestItem();
r.Datum = DateTime.Now.AddDays(-1 * i * i /** 10 / 3*/);
if (( i % 2) == 0){
r.Waarde1 = DateTime.Now.Second / i;
}
if ((i % 3) == 0)
r.Waarde2 = DateTime.Now.Millisecond / i;
if ((i % 5) == 0)
r.Waarde3 = DateTime.Now.Second;
items.Add(r);
}
Items = items;
}
public List<TestItem> Items { get; set; }
}
public class TestItem {
public DateTime Datum { get; set; }
public decimal? Waarde1 { get; set; }
public decimal? Waarde2 { get; set; }
public decimal? Waarde3 { get; set; }
public override string ToString()
{
return string.Format(" {0:d} : {1} - {2} - {3} ", Datum,Waarde1,Waarde2, Waarde3);
}
}
<Window x:Class="testChart.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Test="clr-namespace:testChart"
Title="MainWindow" Height="568" Width="828" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<Window.Resources>
<Test:ViewModel x:Key="Vm"/>
<SolidColorBrush x:Key="TempColor" Color="Brown" />
<SolidColorBrush x:Key="GewichtColor" Color="#FF25A0DA" />
<SolidColorBrush x:Key="PijnColor" Color="#FFFF6900" />
</Window.Resources>
<Grid DataContext="{StaticResource Vm}" Height="517" Width="783">
<telerik:RadCartesianChart HorizontalAlignment="Left" Margin="0,12,0,0" Name="radCartesianChart1" VerticalAlignment="Top" Height="465" Width="654">
<telerik:RadCartesianChart.Behaviors>
<telerik:ChartPanAndZoomBehavior />
</telerik:RadCartesianChart.Behaviors>
<telerik:RadCartesianChart.Grid>
<telerik:CartesianChartGrid MajorLinesVisibility="XY" MajorXLineDashArray="5, 5" MajorYLineDashArray="5, 5">
</telerik:CartesianChartGrid>
</telerik:RadCartesianChart.Grid>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:DateTimeCategoricalAxis LineThickness="1" MajorTickInterval="1" MajorTickLength="5" TickThickness="1" LabelFormat="ddMMyyyy" LabelFitMode="Rotate" />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:LineSeries ItemsSource="{Binding Path=Items}" CategoryBinding="Datum" ValueBinding="Waarde1" CombineMode="Stack" StrokeThickness="1" ShowLabels="True" Stroke="Red">
<telerik:LineSeries.StrokeShapeStyle>
<Style TargetType="Path">
<Setter Property="Stroke" Value="Red"/>
<Setter Property="StrokeDashArray" Value="10 5"/>
<Setter Property="StrokeThickness" Value="3"/>
</Style>
</telerik:LineSeries.StrokeShapeStyle>
<telerik:LineSeries.VerticalAxis>
<telerik:LinearAxis LineStroke="Red" Background="Red" BorderThickness="1">
</telerik:LinearAxis>
</telerik:LineSeries.VerticalAxis>
<telerik:LineSeries.PointTemplate>
<DataTemplate>
<Ellipse Fill="AliceBlue" Height="10" Width="10"/>
</DataTemplate>
</telerik:LineSeries.PointTemplate>
</telerik:LineSeries>
<telerik:LineSeries ItemsSource="{Binding Path=Items}" StrokeThickness="10" ShowLabels="False" Stroke="Blue" CombineMode="Stack" BorderThickness="1">
<telerik:LineSeries.CategoryBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Datum" />
</telerik:LineSeries.CategoryBinding>
<telerik:LineSeries.ValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Waarde2" />
</telerik:LineSeries.ValueBinding>
<telerik:LineSeries.PointTemplate>
<DataTemplate>
<Ellipse Fill="Blue" Height="10" Width="10"/>
</DataTemplate>
</telerik:LineSeries.PointTemplate>
<telerik:LineSeries.VerticalAxis>
<telerik:LinearAxis LineStroke="Green" Background="#FF001900" BorderThickness="1" />
</telerik:LineSeries.VerticalAxis>
</telerik:LineSeries>
<telerik:LineSeries ItemsSource="{Binding Path=Items}" StrokeThickness="10" ShowLabels="True" Stroke="#FF000019">
<telerik:LineSeries.CategoryBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Datum" />
</telerik:LineSeries.CategoryBinding>
<telerik:LineSeries.ValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Waarde3" />
</telerik:LineSeries.ValueBinding>
<telerik:LineSeries.VerticalAxis>
<telerik:LinearAxis LineStroke="Red" Background="#FF001900" BorderThickness="1" />
</telerik:LineSeries.VerticalAxis>
<telerik:LineSeries.PointTemplate>
<DataTemplate>
<Ellipse Fill="Red" Height="10" Width="10"/>
</DataTemplate>
</telerik:LineSeries.PointTemplate>
</telerik:LineSeries>
</telerik:RadCartesianChart>
</Grid>
</Window>
but i stumble on this problem : the lines connecting my values are not drawn ( using line series)
( i am using a DateTimeCategoricalAxis because i only want ticks for dates with actual records in my itemsource,
and don't need the distance between 2 values to be an indication of the time between, the production environment wil have multiple values on some day, and none on others, but i dont think is the cause of my problem )
( screenshot to show the resulting window)
viewmodel :
public class ViewModel
{
public ViewModel()
{
List<TestItem> items = new List<TestItem>();
for (int i = 1 ; i< 20; i++){
var r = new TestItem();
r.Datum = DateTime.Now.AddDays(-1 * i * i /** 10 / 3*/);
if (( i % 2) == 0){
r.Waarde1 = DateTime.Now.Second / i;
}
if ((i % 3) == 0)
r.Waarde2 = DateTime.Now.Millisecond / i;
if ((i % 5) == 0)
r.Waarde3 = DateTime.Now.Second;
items.Add(r);
}
Items = items;
}
public List<TestItem> Items { get; set; }
}
public class TestItem {
public DateTime Datum { get; set; }
public decimal? Waarde1 { get; set; }
public decimal? Waarde2 { get; set; }
public decimal? Waarde3 { get; set; }
public override string ToString()
{
return string.Format(" {0:d} : {1} - {2} - {3} ", Datum,Waarde1,Waarde2, Waarde3);
}
}
<Window x:Class="testChart.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Test="clr-namespace:testChart"
Title="MainWindow" Height="568" Width="828" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<Window.Resources>
<Test:ViewModel x:Key="Vm"/>
<SolidColorBrush x:Key="TempColor" Color="Brown" />
<SolidColorBrush x:Key="GewichtColor" Color="#FF25A0DA" />
<SolidColorBrush x:Key="PijnColor" Color="#FFFF6900" />
</Window.Resources>
<Grid DataContext="{StaticResource Vm}" Height="517" Width="783">
<telerik:RadCartesianChart HorizontalAlignment="Left" Margin="0,12,0,0" Name="radCartesianChart1" VerticalAlignment="Top" Height="465" Width="654">
<telerik:RadCartesianChart.Behaviors>
<telerik:ChartPanAndZoomBehavior />
</telerik:RadCartesianChart.Behaviors>
<telerik:RadCartesianChart.Grid>
<telerik:CartesianChartGrid MajorLinesVisibility="XY" MajorXLineDashArray="5, 5" MajorYLineDashArray="5, 5">
</telerik:CartesianChartGrid>
</telerik:RadCartesianChart.Grid>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:DateTimeCategoricalAxis LineThickness="1" MajorTickInterval="1" MajorTickLength="5" TickThickness="1" LabelFormat="ddMMyyyy" LabelFitMode="Rotate" />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:LineSeries ItemsSource="{Binding Path=Items}" CategoryBinding="Datum" ValueBinding="Waarde1" CombineMode="Stack" StrokeThickness="1" ShowLabels="True" Stroke="Red">
<telerik:LineSeries.StrokeShapeStyle>
<Style TargetType="Path">
<Setter Property="Stroke" Value="Red"/>
<Setter Property="StrokeDashArray" Value="10 5"/>
<Setter Property="StrokeThickness" Value="3"/>
</Style>
</telerik:LineSeries.StrokeShapeStyle>
<telerik:LineSeries.VerticalAxis>
<telerik:LinearAxis LineStroke="Red" Background="Red" BorderThickness="1">
</telerik:LinearAxis>
</telerik:LineSeries.VerticalAxis>
<telerik:LineSeries.PointTemplate>
<DataTemplate>
<Ellipse Fill="AliceBlue" Height="10" Width="10"/>
</DataTemplate>
</telerik:LineSeries.PointTemplate>
</telerik:LineSeries>
<telerik:LineSeries ItemsSource="{Binding Path=Items}" StrokeThickness="10" ShowLabels="False" Stroke="Blue" CombineMode="Stack" BorderThickness="1">
<telerik:LineSeries.CategoryBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Datum" />
</telerik:LineSeries.CategoryBinding>
<telerik:LineSeries.ValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Waarde2" />
</telerik:LineSeries.ValueBinding>
<telerik:LineSeries.PointTemplate>
<DataTemplate>
<Ellipse Fill="Blue" Height="10" Width="10"/>
</DataTemplate>
</telerik:LineSeries.PointTemplate>
<telerik:LineSeries.VerticalAxis>
<telerik:LinearAxis LineStroke="Green" Background="#FF001900" BorderThickness="1" />
</telerik:LineSeries.VerticalAxis>
</telerik:LineSeries>
<telerik:LineSeries ItemsSource="{Binding Path=Items}" StrokeThickness="10" ShowLabels="True" Stroke="#FF000019">
<telerik:LineSeries.CategoryBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Datum" />
</telerik:LineSeries.CategoryBinding>
<telerik:LineSeries.ValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Waarde3" />
</telerik:LineSeries.ValueBinding>
<telerik:LineSeries.VerticalAxis>
<telerik:LinearAxis LineStroke="Red" Background="#FF001900" BorderThickness="1" />
</telerik:LineSeries.VerticalAxis>
<telerik:LineSeries.PointTemplate>
<DataTemplate>
<Ellipse Fill="Red" Height="10" Width="10"/>
</DataTemplate>
</telerik:LineSeries.PointTemplate>
</telerik:LineSeries>
</telerik:RadCartesianChart>
</Grid>
</Window>