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

Very long time on 10000 points

1 Answer 41 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Raphael
Top achievements
Rank 1
Raphael asked on 05 Mar 2013, 04:35 PM
Hi !

I'm trying telerik charts and I wanted to test the performance. I saw the sample with 15000 points and I wanted to do the same with much more. Unfortunately, my computer got very hard to print a 10000 points line. I guess something is wrong with my code compared to the sample one but I don't really realise what.

class DataListViewModel : ViewModelBase
{
    private RadObservableCollection<int> dataList;
    private Random random = new Random((int) DateTime.Now.Ticks);
 
    public DataListViewModel()
    {
        this.Data = this.FillRandomlyList();
    }
 
    public RadObservableCollection<int> Data
    {
        get { return dataList; }
        set
        {
            if (value != dataList)
            {
                dataList = value;
                this.OnPropertyChanged("Data");
            }
        }
    }
 
    private RadObservableCollection<int> FillRandomlyList()
    {
        var res = new RadObservableCollection<int>();
 
        for (int i = 0; i < 10000; i++)
        {
            res.Add(random.Next(500));
        }
 
        return res;
    }
}

<Window x:Class="PerfTest.MainWindow"
        Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <Grid>
        <telerik:RadCartesianChart Margin="12,12,270,12">
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="XY" MajorXLineDashArray="5, 5" MajorYLineDashArray="5, 5">
                    <telerik:CartesianChartGrid.MajorXLineStyle>
                        <Style TargetType="Line">
                            <Setter Property="Shape.Stroke" Value="Gray" />
                        </Style>
                    </telerik:CartesianChartGrid.MajorXLineStyle>
                    <telerik:CartesianChartGrid.MajorYLineStyle>
                        <Style TargetType="Line">
                            <Setter Property="Shape.Stroke" Value="Gray" />
                        </Style>
                    </telerik:CartesianChartGrid.MajorYLineStyle>
                </telerik:CartesianChartGrid>
            </telerik:RadCartesianChart.Grid>
 
 
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:LinearAxis Visibility="Hidden"/>
            </telerik:RadCartesianChart.HorizontalAxis>
 
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:CategoricalAxis Title="Test2" Visibility="Visible" IsInverse="True" />
            </telerik:RadCartesianChart.VerticalAxis>
 
 
            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartPanAndZoomBehavior />
                <telerik:ChartSelectionBehavior />
            </telerik:RadCartesianChart.Behaviors>
 
 
            <telerik:RadCartesianChart.Series>
                <telerik:LineSeries Stroke="IndianRed" CategoryBinding="X" ValueBinding="Y"
                                    ItemsSource="{Binding Path=Data}" RenderMode="Light" >
                    <telerik:LineSeries.PointTemplate>
                        <DataTemplate>
                            <Ellipse Fill="DeepPink" Height="5" Width="5" />
                        </DataTemplate>
                    </telerik:LineSeries.PointTemplate>
                </telerik:LineSeries>
            </telerik:RadCartesianChart.Series>
        </telerik:RadCartesianChart>
    </Grid>
</Window>

Does someone have an idea ?
Thank you !

Edit : It does the same without PointTemplate

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 08 Mar 2013, 02:52 PM
Hi Raphael,

Thanks for the attached code. I was able to quickly reproduce the issue.

The main performance hit you are experiencing is caused by the excessive number of axis ticks and labels that are being generated. You can control this number by the MajorStep (for the LinearAxisand 
MajorTickInterval (for the CategoricalAxis) properties. A suitable number for your test dataset is 1000.

The second hit is actually caused by the PointTemplates. Most probably you did not notice it because, the Ticks/Labels problem had a much larger impact. 

Give these recommendations a try and let us know how it goes.
 

Regards,
Petar Kirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ChartView
Asked by
Raphael
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or