This is a migrated thread and some comments may be shown as answers.

Wired behavior of RadChart

2 Answers 105 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yang
Top achievements
Rank 1
Yang asked on 05 Jun 2012, 12:59 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Victor
Telerik team
answered on 08 Jun 2012, 12:03 PM
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 >>

0
Yang
Top achievements
Rank 1
answered on 08 Jun 2012, 12:21 PM
Thanks for your answer. It works perfectly!
Tags
Chart
Asked by
Yang
Top achievements
Rank 1
Answers by
Victor
Telerik team
Yang
Top achievements
Rank 1
Share this question
or