Performance in Radchart

Thread is closed for posting
4 posts, 0 answers
  1. Harin Yadav
    Harin Yadav avatar
    31 posts
    Member since:
    Jan 2011

    Posted 14 Mar 2011 Link to this post

    Hi,

    I am new for telerik charting. i want to display a chart , in which values are binding from DB.  i tried using following code but am facing performance issue - it is very very  slow. can u suggest the needful

    Here is the code which i used:
    aspx code
    <telerik:RadChart ID="RadChart1"  runat="server"  ChartImageFormat="Jpeg"  ChartTitle-Visible="True">
                        <Appearance BarWidthPercent="60"  ></Appearance>
                        <Legend Appearance-Position-AlignedPosition="BottomLeft" Appearance-Location="OutsidePlotArea" >
                                <TextBlock Appearance-Position-AlignedPosition="BottomLeft"></TextBlock>
                        </Legend
                        <ChartTitle TextBlock-Text="Forecast Vs Plan" > </ChartTitle>
               
                        <Series>
                             <telerik:ChartSeries  DataYColumn="Base"  Name="Base">
                                    <Appearance  FillStyle-MainColor="#ffff66"  FillStyle-SecondColor="#ffff66" Border-Color="#000000" Border-PenStyle="Solid">
                                    </Appearance>
                       </telerik:ChartSeries>
            
                       <telerik:ChartSeries DataYColumn="Plan" Name="Plan">
                                 <Appearance  FillStyle-MainColor="#ff0033" FillStyle-SecondColor="#ff0033"  Border-Color="#000000" Border-PenStyle="Solid">
                                </Appearance>
                       </telerik:ChartSeries>
             
                        <telerik:ChartSeries DataYColumn="ForeCast"  Name="ForeCast" >
                                <Appearance   FillStyle-MainColor="#6600cc" FillStyle-SecondColor="#6600cc"  Border-Color="#000000" Border-PenStyle="Solid">
                                </Appearance>
                        </telerik:ChartSeries>
                        </Series>
      
              <PlotArea  Appearance-Position-Y="100"
              <XAxis VisibleValues="Positive">
              <Appearance  MajorGridLines-PenStyle="Solid" MajorGridLines-Color="#000000">
               <TextAppearance AutoTextWrap="True" ></TextAppearance>
              </Appearance>
              </XAxis>
              <YAxis VisibleValues="Positive" >
              <Appearance  MajorGridLines-PenStyle="Solid"  MajorGridLines-Color="#000000"></Appearance>
              </YAxis>
                </PlotArea>
               </telerik:RadChart>
    aspx.cs code:
    protected void Graph_Load()
       {
           decimal Plan, Base, Fore, max = 0;
           DataSet dsResults = new DataSet();
           dsResults = ForeCastBO.loadForeCast(Setinputvalues());
           DataTable dt_Graph = new DataTable();
           dt_Graph.Columns.Add("Division", typeof(String));
           dt_Graph.Columns.Add("Plan", typeof(String));
           dt_Graph.Columns.Add("Base", typeof(String));
           dt_Graph.Columns.Add("ForeCast", typeof(String));
           if (dsResults.Tables[0].Rows.Count > 0)
           {
               for (int i = 0; i < dsResults.Tables[0].Rows.Count; i++)
               {
                   dt_Graph.Rows.Add(dsResults.Tables[0].Rows[i][3].ToString(), Decimal.Round(Convert.ToDecimal(dsResults.Tables[0].Rows[i][2].ToString())),
                                        Decimal.Round(Convert.ToDecimal(dsResults.Tables[0].Rows[i][4].ToString())), Decimal.Round(Convert.ToDecimal(dsResults.Tables[0].Rows[i][5].ToString())));
                   Plan = Decimal.Round(Convert.ToDecimal(dsResults.Tables[0].Rows[i][2].ToString()));
                   Base = Decimal.Round(Convert.ToDecimal(dsResults.Tables[0].Rows[i][4].ToString()));
                   Fore = Decimal.Round(Convert.ToDecimal(dsResults.Tables[0].Rows[i][5].ToString()));
                   if (Plan > Base)
                       max = Plan;
                   else
                       max = Base;
                   if (Fore > max)
                       max = Fore;
               }
               RadChart1.DataSource = dt_Graph;
               RadChart1.PlotArea.XAxis.DataLabelsColumn = dt_Graph.Rows[0].ToString();
               int width;
               width = 120 * (dt_Graph.Rows.Count);
               RadChart1.Width = width;
               RadChart1.Height = 400;
               RadChart1.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.Color.White;
               RadChart1.PlotArea.Appearance.FillStyle.SecondColor = System.Drawing.Color.White;
               RadChart1.PlotArea.YAxis.AutoScale = false;
               RadChart1.PlotArea.YAxis.MaxValue = Convert.ToDouble(max);
               RadChart1.PlotArea.YAxis.ScaleBreaks.MaxCount = 7;
               RadChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black;
               RadChart1.PlotArea.Appearance.Dimensions.Margins.Bottom = Telerik.Charting.Styles.Unit.Pixel(100);
               // bind to the datasource
               RadChart1.DataBind();
           }
       }


    Thanks,
    Harin
  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 17 Mar 2011 Link to this post

    Hello Harin,

    Is this all the code related to RadChart? One reason for performance issues is setting the IntelligentLabelsEnabled property to true. While this works fine to a certain amount of labels, at some point positioning all of them without overlapping becomes a very hard or impossible task, so it might take a really long time. Your code, however, does not show this.

    Another possible reason might be the number of items, you are trying to display in RadChart. It will have problems with more than 1000 items on screen. While the product was designed to be easily customizable and feature rich it does not cope well with extremely busy charts. It mainly targets casual situations which do not require a high performance solution. There is a trade off to make between high customization and high performance and we've gone the rich features path as it is what most of our customers are interested in.

    Best regards,
    Ves
    the Telerik team
  3. Harin Yadav
    Harin Yadav avatar
    31 posts
    Member since:
    Jan 2011

    Posted 29 Mar 2011 Link to this post

    though total number of items are less than 5(or even 1)the performance is hitting.
    when i see the performance in Task manager , it shows 100 % CPU Utilization. n  Nothing else is working on the machine.
     i think it is causing Memory Leakage...

    i am not able to get Y it is happening.. ?
    Please suggest the needful

    Thanks.
    Harin
  4. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 01 Apr 2011 Link to this post

    Hello Harin,

    Taking another look at your code, I noticed that the YAxis.Step is never set. Its default value is 1, so if you plot large values (e.g. millions or billions) this will force RadChart to draw millions of labels and ticks along the Y axis, which might cause this high CPU usage. Please, set the YAxis.Step property with appropriate value, so that there are only several labels e.g. if values  reach as high as 1000000, a value of 200000 seems reasonable, so that you get 5 steps and a total of 6 labels for Y axis values.

    Best regards,
    Ves
    the Telerik team
Back to Top