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

RadChart performance

3 Answers 91 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Wenli
Top achievements
Rank 1
Wenli asked on 21 May 2013, 02:48 PM
hi,

I have a page with a line chart of 9 series, each will have 360 points, so totally more than 3000 points. When I hard refresh this page, the cpu usage is raising from 12% to 70% then to 100%. I have Intel Core 2 Duo cpu with 3.16GHz, 8G memory, 64- bit Win7 system. Any suggestion for improvement is appreciated. I am using version 2012.2.626.40.

here is my code:

<telerik:RadChart ID="radchart1" runat="server" OnBeforeLayout="radchart1_OnBeforeLayout"

AutoLayout="true" Skin="Vista" IntelligentLabelsEnabled="false" PlotArea-XAxis-AutoScale="false"
    <Legend Appearance-ItemTextAppearance-TextProperties-Font="Arial, 7pt" Appearance-ItemTextAppearance-    AutoTextWrap="False"></Legend
    <ChartTitle TextBlock-Appearance-TextProperties-Font="Arial, 10pt, style=Bold"> </ChartTitle>

    <PlotArea>

        <XAxis>

            <Appearance

                <TextAppearance TextProperties-Font="Arial, 8.25pt, style=Bold" />

                <LabelAppearance RotationAngle="60"> </LabelAppearance>

            </Appearance
                </XAxis
                <YAxis AxisMode="Extended" AutoScale="false"> 
                        <Appearance
                                <TextAppearance TextProperties-Font="Arial, 8.25pt" /> 
                        </Appearance
                </YAxis
        </PlotArea>
</telerik:RadChart>

code to load chart series:

 

chartseries.Type = ChartSeriesType.Line;

chartseries.Appearance.PointMark.Visible = true;

chartseries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;

chartseries.Appearance.LabelAppearance.Visible = false;

for (int i = 0; i < data.Count(); i++)

{

    if (radchart1.PlotArea.XAxis.Items.Count() < data.Count())

        radchart1.PlotArea.XAxis.AddItem(data[i].Date.ToString());
                chartseries.AddItem(Convert.ToDouble(data[i].Count) > 100 ? 101 : Convert.ToDouble(data[i].Count), data[i].Count.ToString());

                chartseries.Items.Last().ActiveRegion.Tooltip = data[i].Count.ToString("#,##0");
}

function to customize xaxis labels 

protected void radchart1_OnBeforeLayout(object sender, EventArgs e)

{

         foreach (var item in radchart1.PlotArea.XAxis.Items)

        {

        DateTime xaxis = Convert.ToDateTime(item.TextBlock.Text); 
                if (xaxis.Minute > 0)

                {

                        item.Visible = false;

                }

        else

                {

                        item.TextBlock.Text = xaxis.ToString("h tt");

                        item.Visible = true
                }

        }

}

3 Answers, 1 is accepted

Sort by
0
msigman
Top achievements
Rank 2
answered on 22 May 2013, 07:40 PM
Please try disabling AutoLayout. 

I also recommend switching to RadHtmlChart, they are much faster and do the work client side so your server is unloaded from the burden: http://www.telerik.com/help/aspnet-ajax/htmlchart-overview.html

If you convert to RadHtmlChart, you can also disable the animations ("transitions").  That should help even more.
RadHtmlChart.Transitions = false;
0
Wenli
Top achievements
Rank 1
answered on 28 May 2013, 07:48 PM
hi, msigman, thanks for your suggestion.

I have switched to radHtmlchart, but found two new issues.

1. my chart is monitoring exceptions, it is refreshed every one minute using Timer. however, I didn't find a demo/help topic for RadHtmlChart Asynchronous Update. is there a way I can achieve the same thing like RadChart Asynchronous Update?

2. I got an exception of "Out of memory" after the chart is loaded 20 minutes. Every minute when I reload the chart, I removed all series and x-axis (y-axis is fixed) using the below code:

for (int i = 0; i< rdHtmlChart.PlotArea.Series.Count; i++)

    rdHtmlChart.PlotArea.Series.RemoveAt(i);

for (int i = 0; i < rdHtmlChart.PlotArea.XAxis.Items.Count; i++)

    rdHtmlChart.PlotArea.XAxis.Items.RemoveAt(i);

any advice is appreciated.

0
msigman
Top achievements
Rank 2
answered on 28 May 2013, 08:13 PM
Hi Wenli,

Since the new chart control is client-side based, I would follow that approach.  In a JavaScript timer (setTimeout) you can rebind the chart using the client side API provided by the chart (see: http://www.telerik.com/help/aspnet-ajax/htmlchart-client-side-api.html).  Hopefully that will resolve both issues.

Thanks,
Matt
Tags
Chart (Obsolete)
Asked by
Wenli
Top achievements
Rank 1
Answers by
msigman
Top achievements
Rank 2
Wenli
Top achievements
Rank 1
Share this question
or