scLine Series Performance

TeeChart for ActiveX, COM and ASP
Post Reply
Otokon
Newbie
Newbie
Posts: 25
Joined: Thu Sep 18, 2008 12:00 am

scLine Series Performance

Post by Otokon » Mon Oct 05, 2009 3:33 pm

Hi,

I'm adding 3 line series to my chart and adding 1440 xy values per series. It take 3 seconds for each series to complete. In total it take about 9 second for the whole chart. Is this normal...?

Here is my code...

Code: Select all

TeeChart.TChart MyChart = new TeeChart.TChart();

            MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
            MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
            MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
            MyChart.Series(0).XValues.DateTime = true;
            int intCounter = 1;
            DateTime Mydatetime = DateTime.Now;
            while(intCounter < 1441)
            {

                Mydatetime =Mydatetime.AddMinutes(30);
                double dStartDate =  Convert.ToDouble(Convert.ToDateTime(Convert.ToDateTime(Mydatetime).ToString("yyyy-MM-dd HH:mm")).ToOADate());
                MyChart.Series(0).AddXY(dStartDate,intCounter,"",(uint)TeeChart.EConstants.clTeeColor);
                MyChart.Series(1).AddXY(dStartDate,intCounter/2,"",(uint)TeeChart.EConstants.clTeeColor);
                MyChart.Series(2).AddXY(dStartDate,intCounter/3,"",(uint)TeeChart.EConstants.clTeeColor);
               
                intCounter++;
            }
             string ServerPath;
             ServerPath = Server.MapPath("~/");
           
            //***********Export Chart to tee file in Temp Dir
            MyChart.Export.asNative.SaveToFile(ServerPath+"Temp\\TeeData_Sample.txt",true);
Thanks in advance...

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: scLine Series Performance

Post by Yeray » Tue Oct 06, 2009 8:43 am

Hi Otokon,

I've tested your code in a Core 2 Quad Q8200 @2.33GHz, 3GB RAM, under Windows 7 and it executed instantaneously (both in Release and Debug mode).
Then I thought that it could be due to machine differences so I executed the same exe in an AMD Athlon 3000+, 1GB RAM, under Win2003, but I got the same result: It seems to execute almost instantaneously.
Attachments
CAXtest.zip
AX test with 1441x3 points
(3.97 KiB) Downloaded 563 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Otokon
Newbie
Newbie
Posts: 25
Joined: Thu Sep 18, 2008 12:00 am

Re: scLine Series Performance

Post by Otokon » Tue Oct 06, 2009 10:10 am

HI Yeray,

Thanks for your help.

This is such simple code I don't understand what the problem could be, and I have tested it on a Intel Pentuim 3GHz, 3Gb Ram.

I actually downloaded the .Net version, and the performance is excellent. But I really like to know what the issue is with the activeX at my side.

P.S I'm using it in 'n asp.net web application (VS2005), where I generate the Chart object at server-side and there after import at client-side.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: scLine Series Performance

Post by Yeray » Tue Oct 06, 2009 11:30 am

Hi Otokon,

To see if the problem is in the server/client communication, you could compare the results of:

1. The application I attached above. If it runs slowly, the problem could be your machine performance, because here it works fine.

2. The same code in a simple test web application running both sides in the same machine (calling the server side as localhost). If it is slow, please, try to send to us both parts and we'll test them here to see what's happening (That's the reason why the test application should be as simple as possible, to be runnable and testable for us here "as-is").

3. The same application in the step 2, running each part in the final location. If it is slow, the problem should be a communication problem.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Otokon
Newbie
Newbie
Posts: 25
Joined: Thu Sep 18, 2008 12:00 am

Re: scLine Series Performance

Post by Otokon » Tue Oct 06, 2009 12:15 pm

Hi,

I have tested it all the ways you recommended, but with no luck. Here is the way I'm doing it at the moment. Please note that the start and end time for the processing is only where I add the data to the series and not the page load time.

Create a "Temp" directory in the web application project for the *.tee file.
Note: I use the endRequest method to load my tee file after a asynchronous postback from my button.

Default.aspx

Code: Select all

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TeeChartSample._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>TeeChart Sample</title>
     

    
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                &nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Generate" />
                <br />
                <br />
                <asp:Label ID="lblTime" runat="server" Text="Label"></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
    <div>
            <object id="TChart1" classid="clsid:BDEB0088-66F9-4A55-ABD2-0BF8DEEC1196" codebase="http://localhost/teechart8.cab#Version=8,0,0,5"
            style="z-index: 100; width: 980px; height: 600px">
            <param name="Base64" value="VFBGMAtUQ2hhcnRDaGFydAAETGVmdAIAA1RvcAIABVdpZHRoA14CBkhlaWdodAORARJUaXRsZS5U&#13;&#10;ZXh0LlN0cmluZ3MBBghUZWVDaGFydAAAAAAAAAACAAAAAP////8=">
            </object>
            
             <script type="text/javascript" language="javascript">
                    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                    function EndRequestHandler()
                    {
                          document.getElementById("TChart1").ClearChart();
                          var shref = location.href;
                          var sURLRev = shref.substring(0,shref.lastIndexOf('/') + 1);    
                          document.getElementById("TChart1").Import.LoadFromURL(sURLRev+"Temp/TeeData_Sample.txt");

                    }
            </script>
    </div>
    </form>
</body>
</html>
Default.aspx.cs

Code: Select all

protected void Button1_Click(object sender, EventArgs e)
        {
            TeeChart.TChart MyChart = new TeeChart.TChart();

            MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
            MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
            MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
            MyChart.Series(0).XValues.DateTime = true;
            int intCounter = 1;
            DateTime Mydatetime = DateTime.Now;
            while(intCounter < 1441)
            {

                Mydatetime =Mydatetime.AddMinutes(30);
                double dStartDate =  Convert.ToDouble(Convert.ToDateTime(Convert.ToDateTime(Mydatetime).ToString("yyyy-MM-dd HH:mm")).ToOADate());
                MyChart.Series(0).AddXY(dStartDate,intCounter,"",(uint)TeeChart.EConstants.clTeeColor);
                MyChart.Series(1).AddXY(dStartDate,intCounter/2,"",(uint)TeeChart.EConstants.clTeeColor);
                MyChart.Series(2).AddXY(dStartDate,intCounter/3,"",(uint)TeeChart.EConstants.clTeeColor);
               
                intCounter++;
            }
             lblTime.Text ="Start Time: "+Mydatetime.ToString("yyyy-MM-dd HH:mm:ss")+" End Time: "+DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            //MyChart.Series(0).FillSampleValues(30000);

             string ServerPath;
             ServerPath = Server.MapPath("~/");
            //****Delete all files in Dir
            foreach(string sFile in System.IO.Directory.GetFiles(ServerPath+"Temp\\", "*.txt"))
                    {
                         if(System.IO.Path.GetFileName(sFile)!= "TeeData_Sample.txt")
                        {
                            System.IO.File.Delete(sFile);
                        }
                    }

            //***********Export Chart to tee file in Temp Dir
            MyChart.Export.asNative.SaveToFile(ServerPath+"Temp\\TeeData_Sample.txt",true);
        }

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: scLine Series Performance

Post by Yeray » Tue Oct 06, 2009 2:14 pm

Hi Otokon,

I've modified your button1 to load the series data from an array, using the method AddArray and it looks much faster:

Code: Select all

    protected void Button1_Click(object sender, EventArgs e)
    {
        TeeChart.TChart MyChart = new TeeChart.TChart();

        MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
        MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
        MyChart.AddSeries(TeeChart.ESeriesClass.scLine);        
        DateTime Mydatetime = DateTime.Now;

        int nValues = 1441;
        double[] YVal1 = new double[nValues];
        double[] YVal2 = new double[nValues];
        double[] YVal3 = new double[nValues];

        for (int i = 0; i < nValues; i++)
        {
            YVal1[i] = i;
            YVal2[i] = i / 2;
            YVal3[i] = i / 3;
        }

        MyChart.Series(0).AddArray(nValues, YVal1, YVal1);
        MyChart.Series(1).AddArray(nValues, YVal2, YVal1);
        MyChart.Series(2).AddArray(nValues, YVal3, YVal1);

        lblTime.Text = "Start Time: " + Mydatetime.ToString("yyyy-MM-dd HH:mm:ss") + " End Time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");        

        string ServerPath;
        ServerPath = Server.MapPath("~/");
        //****Delete all files in Dir
        foreach (string sFile in System.IO.Directory.GetFiles(ServerPath + "Temp\\", "*.txt"))
        {
            if (System.IO.Path.GetFileName(sFile) != "TeeData_Sample.txt")
            {
                System.IO.File.Delete(sFile);
            }
        }

        //***********Export Chart to tee file in Temp Dir
        MyChart.Export.asNative.SaveToFile(ServerPath + "Temp\\TeeData_Sample.txt", true);
    }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Otokon
Newbie
Newbie
Posts: 25
Joined: Thu Sep 18, 2008 12:00 am

Re: scLine Series Performance

Post by Otokon » Tue Oct 06, 2009 2:47 pm

Hi,

That's the kind of speed I was looking for. Thanks for the help.

Otokon
Newbie
Newbie
Posts: 25
Joined: Thu Sep 18, 2008 12:00 am

Re: scLine Series Performance

Post by Otokon » Wed Oct 07, 2009 7:24 am

Hi,

Sorry, I need help regarding the AddArray method. I used to add nulls with the AddNullXY method, how do I go about adding a Null in a double array when using the AddArray method?

Yours Truly

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: scLine Series Performance

Post by Yeray » Wed Oct 07, 2009 9:35 am

Hi Otokon,

For the nulls I'm afraid I can't think on an alternative to adding or setting them manually. So after adding the array to your series, I think you have to loop your "null points array" and use SetNull(), AddNull() or AddNullXY() method.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply