Wired behavior of RadChart

3 posts, 1 answers
  1. Yang
    Yang avatar
    16 posts
    Member since:
    Apr 2012

    Posted 05 Jun 2012 Link to this post

    Hi,

    Sorry for my bad English.

    I found a similar issue at here: Weird behavior in RadChart (2011Q3) when specifying a max and min value

    But I haven't set the max and min value, but still get the same result.

    See the following code. When count == 30, everything is fine (see image chart-30.png), but when count > 30, I got wired behavior as illustrated in the image chart-31.png.

    Code behind:

    public MainPage()
    {
        InitializeComponent();
        var count = 31;
        var date = new DateTime(2010, 4, 1);
        var r = new Random();
        AreaSeries series;
        for (int i = 0; i < count; i++)
            for (int j = 0; j < this.radChart.Series.Count; j++)
            {
                series = this.radChart.Series[j] as AreaSeries;
                series.DataPoints.Add(new CategoricalDataPoint()
                                      {
                                          Value = r.Next(10, 21),
                                          Category = date.AddDays(i)
                                      });
            }
    }

    XAML:

    <Grid x:Name="LayoutRoot" Background="Transparent">
     
        <telerikChart:RadCartesianChart x:Name="radChart">
     
            <telerikChart:RadCartesianChart.HorizontalAxis>
                <telerikChart:DateTimeCategoricalAxis LabelInterval="10" />
            </telerikChart:RadCartesianChart.HorizontalAxis>
     
            <telerikChart:RadCartesianChart.VerticalAxis>
                <telerikChart:LinearAxis />
            </telerikChart:RadCartesianChart.VerticalAxis>
     
            <telerikChart:AreaSeries Fill="Red" CombineMode="Stack" />
            <telerikChart:AreaSeries Fill="Green" CombineMode="Stack" />
            <telerikChart:AreaSeries Fill="Blue" CombineMode="Stack" />
     
        </telerikChart:RadCartesianChart>
     
    </Grid>

  2. Answer
    Victor
    Admin
    Victor avatar
    1351 posts

    Posted 08 Jun 2012 Link to this post

    Hi Yang,

    Thank you for writing.
    Please set the DateTimeComponent property of the DateTimeCategoricalAxis to Ticks. This happens because you have multiple data points in the same category.
    Please write again if you have other questions.

    Regards,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Yang
    Yang avatar
    16 posts
    Member since:
    Apr 2012

    Posted 08 Jun 2012 Link to this post

    Thanks for your answer. It works perfectly!
Back to Top