Performance: Time scale chart takes a long time to generate

Expand / Collapse
 

Performance: Time scale chart takes a long time to generate


SYMPTOM

The chart has many elements with DateTime value and takes a very long time to render.

CAUSE

The likely cause of this is that the DateTime values of each element are not recognized as such and are evaluated as text. This causes a category x axis to be used. When this happens, an axis tick with gridlines and other overhead is created and processed for each data point, which can dramatically increase the chart execution time.

Another possible cause is that the chart is using a true time scale but a very small axis time interval is set which causes many axis ticks to be generated. In that case, removing this setting and allowing the chart to set it automatically will help.

Tip: Enable the chart mentor, it can tell you if your axis uses a true time or category scale.  

SOLUTION / SUMMARY

The first step in solving this is to ensure that the x values in your database are of DateTime data type. Then setting Chart.XAxis.Scale = Scale.Time.

If this does not work, use the DataEngine to get a populated series collection first. It's likely the time value will be set as text in the element's name property. Iterate the elements and parse the element name into a DateTime value and set it for Element.XDateTime similar to:

Element.XDateTime = DateTime.Parse(Element.Name);

(While iterating the elements you can also determine whether this is the issue.)

Then set the Element.Name = "". This will help ensure a time scale is used for the axis. When both XDateTime and Name properties of Element are set, specifying the axis scale will be necessary:

Chart.XAxis.Scale = Scale.Time

 



Rate this Article:
     

Add Your Comments


Comment require login or registration.

Details
Last Modified:Friday, March 26, 2010
Last Modified By: Support
Type: PRB
Rated 5 stars based on 1 vote
Article has been viewed 9,946 times.
Options