Improving 3D performance

2 posts, 0 answers
  1. Tim
    Tim avatar
    1 posts
    Member since:
    May 2011

    Posted 12 May 2011 Link to this post

    Hi I have a chart with 3D lines on it that I am manually adding series to

    SeriesMapping sm = new SeriesMapping();
       sm.LegendLabel = record.StartDate.ToString();
       sm.ItemsSource = GetDataPoints(record);
       sm.ChartArea = this.RadChart1.DefaultView.ChartArea;
       sm.SeriesDefinition = new Line3DSeriesDefinition();
       sm.SeriesDefinition.ShowItemToolTips = false;
       sm.SeriesDefinition.ShowItemLabels = false;
       sm.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
       sm.ItemMappings.Add(new ItemMapping("XCategory", DataPointMember.XCategory));
     
       this.RadChart1.SeriesMappings.Add(sm);

    If I add 8 lines that each have 30 points it is grindingly slow to draw.  30+ seconds

    If I swap the  Line3DSeriesDefinition    for a  LineSeriesDefinition it only takes a second to draw.
    I have looked at the Performance Improvements thread and page

    1) Should I try and Simplify the chart ControlTemplate ? Is there an example of this for 3D?

    I dont have any PointMarks to turn off, All animations are turned off

    I have set the Axis range manually for the Y axis.
    2) The X axis is an XCategory, is there a way I can specify the XCategories manually?
    There are 30 different frequencies(16Hz, 24Hz etc), 1 category for each.

    And a non performance related question
    3) Is it possible to set the orientation of the 3D graph in the XAML, I am struggling to get CameraExtension.RotateY(-45) to work. I want to rotate the graph on start so that the Y axis is at the rear.


  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 17 May 2011 Link to this post

    Hello Tim,

    1) Currently Silverlight doesn't support accelerated 3D graphics and this is the cause of this performance hit when using 3D chart. If you need real time user experience consider switching to our 2D chart.

    2) What do you mean by specifying the XCategory manually? Do you want to set custom XAxis Labels? If that is the case - you can subscribe to the DataBound event of the Chart and set the Labels for the Axis TickPoints manually like this:

    private void RadChart1_DataBound(object sender, ChartDataBoundEventArgs e)
            {
                string[] months = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", };
      
                for (int i = 0; i < months.Length; i++)
                {
                    RadChart1.DefaultView.ChartArea.AxisX.TickPoints[i].Label = months[i];
                
            }

    3) You can handle the Loaded event of the ChartArea and set the wanted rotation angle there:
    void ChartArea_Loaded(object sender, System.Windows.RoutedEventArgs e)
           {
               CameraExtension cameraExtension = new CameraExtension();
               cameraExtension.SpinAxis = SpinAxis.X;
               cameraExtension.RotateX(180);
               (sender as ChartArea).Extensions.Add(cameraExtension);
           }

    Regards,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top