ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Delayed chart
Posted by Steven on Aug-02-2010 22:13
Hello there,

I'm using ChartDirector with ASP.Net to create yield-charts. The processing of the chart sometimes needs a lot of time (up to 15sec.) so I want to show a waiting-picture before the real chart is ready.

Is it possible to view a waiting-picture first (gif or something) and replace it if the chart-processing is finished.

If somebody know, please help out.

Thanx, Steven

  Re: Delayed chart
Posted by Peter Kwan on Aug-03-2010 00:59
Hi Steven,

ChartDirector should generate charts very quickly (typically in the order of 100 ms). So unless your chart is very large in pixel size (much much larger than the screen size), or contains millions of data points, it should not need 15 seconds.

For an ASP.NET web page containing the chart, the processing steps on the server are:

(a) The ASP.NET web page is generated with the chart

(b) The HTML part of the web page is transmitted to the browser.

(c) When the browse receives the HTML, it will process the <IMG> tag to get the image.

Step (c) should be very fast, as it does not require any significant processing. (The chart has already been generated in step (a).)

If step (a) or (b) is slow, it is usually because of two things:

(i) the database code is slow - in some applications, creating a chart may involve a lot of data.

(ii) a HTML image map is generated with the chart, and the HTML image map is very large.

To test if (ii) is the cause of the problem, you may disable the image map too see if the web page is loaded significantly faster. If the speed is in fact related to the image map, you may use WebChartViewer.MakeDelayedMap method to delay the image map loading.

(Note: If you use WebChartViewer.MakeDelayedMap, you would need to include the ChartDirector Javascript library "cdjcv.js" in your web page. The "Zoomable and Scrollable Demonstration" sample code is using delayed image map.)

Regards
Peter Kwan

  Re: Delayed chart
Posted by Steven on Aug-03-2010 15:04
Hello Peter,

thx for the quick answer. The code to generate the chart is the slow part, because I have to generate the data from a database with lots of data. I already increased the performance of that step but sometimes it needs up to the 15sec. This is not a problem if I'll be able to show the customer the waiting picture.

Maybe someone has another idea.

Thx and bye Steven

  Re: Delayed chart
Posted by Peter Kwan on Aug-03-2010 22:43
Hi Steven,

In ASP.NET, an ASPX may not output anything until the entire ASPX is executed on the server. If as you mentioned, it is the code in the ASPX that is slow, there is no reliable method for that ASPX to send a "wait image" to be browser, because the ASPX will not send anything (not even a "wait image") to the browser until it completes execution.

To work around, you may consider to use two separate ASPX page. In the first page, you may load the "wait image" but do not create the chart or access the database. You may put Javascript code in the first page so that it loads the second page. When the second page is completed loaded, you may use it to replace the first page (or replace part of the first page).

A very basic implementation would be like:

(a) In the first page, just put a "wait image" and an IFRAME. The second page can be loaded in the IFRAME.

(b) When the IFRAME is completely loaded (can be detected by the onload event), Javascript can be used to hide the "wait image".

Hope this can help.

Regards
Peter Kwan