Cartesian Chart Only Shows 1 Value

2 posts, 1 answers
  1. Alfredo
    Alfredo avatar
    3 posts
    Member since:
    Dec 2013

    Posted 19 Dec 2013 Link to this post

    I have a problem working with a LineSeries in a RadCartesianChart: my binding series has 10 values, but the chart only shows 1 of them.

    What could be the problem in my code?

    <telerik:RadCartesianChart x:Name="chPrueba" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="972" Height="477">
                                        MajorXLineDashArray="10, 5"
                            <SolidColorBrush Color="#FFDFDFDF" Opacity="0.3" />
                            <SolidColorBrush Color="Transparent" />
                                        Maximum="100"  />
                    <telerik:CategoricalAxis LabelOffset="0" LastLabelVisibility="Visible"
                                             LineThickness="1" MajorTickOffset="0" MajorTickInterval="1"
                                             PlotMode="BetweenTicks" TickThickness="1" ZIndex="0" LabelFitMode="Rotate"/>
                <telerik:LineSeries x:Name="chLineSeries" CategoryBinding="fecha" ValueBinding="valor" AllowSelect="True" Stroke="#FF0DAE0D"/>
                    <telerik:ChartTrackBallBehavior ShowIntersectionPoints="True"/>

    Data Class:
    public class vAbortos
            public Double valor { get; set; }
            public String fecha {get; set;}
            public vAbortos()

    Creating the data and loading it to the chart:
    public void WindowLoaded()
                List<vAbortos> valores = new List<vAbortos> { };
                Random rnd = new Random();
                DateTime fc = new DateTime(2013, 12, 1);
                for (int i = 0; i <= 9; i++)
                    vAbortos ab = new vAbortos();
                    ab.fecha = fc.AddDays(1).ToShortDateString();
                    ab.valor = rnd.NextDouble() * 10;
                this.chPrueba.Series[0].ItemsSource = valores;
                (chPrueba.VerticalAxis as LinearAxis).Minimum = 0;
                (chPrueba.VerticalAxis as LinearAxis).Maximum = 15;

  2. Answer
    Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1237 posts

    Posted 24 Dec 2013 Link to this post

    Hi Alfredo,

    Thank you for contacting us on that matter and providing us with detailed information about your scenario. I managed to track the behavior that you report down. The reason for that rendering is the fact that you actually create all your points with the same category. Hence, the reported layout is expected.

    The reason for this is the DateTime.AddDays()  method. Please note that it returns a new instance with the added day. It does not change the already created DateTime instance.

    Please make sure that the category that you set are different and try the RadCartesianChart control again.

    Pavel R. Pavlov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top