.netCHARTING v6.0 Documentation Send comments on this topic.
Performance
Getting Started > General Tutorials > Performance

Glossary Item Box

Introduction

This section will go over a number of issues that affect the performance of chart rendering. Please note that these tips are not necessarily required in normal scenarios. They are shown here in order to improve performance when it is crucial. There are several things to consider when creating charts that require high availability and performance.

 

WinForms Performance
When a WinForms application is run in debug mode with Visual Studio, it executes the app.vshost.exe application in the bin folder and runs much slower than the app.exe file which is also available in the bin folder.

 

Charts with less than 200 Elements.

When there are few data elements on a chart, the data processing time is largely minimal. Drawing the image takes the majority of time. The more fancy the chart, the slower it will render. Not to say that charts render showily, however, in certain circumstances every millisecond counts. So, how can this process be sped up? Consider this, everything that is drawn on a chart requires time and the more complicated the drawing (shading effects, gradients, shadows etc.) the longer it takes.

 

Another very important fact to consider is the chart size. The larger the chart becomes the longer it will take for GDI to generate it. There is however an exception to this rule. When charts are so small that they have to be scaled down to fit into the image they are actually drawn at a larger size than specified, then scaled down so this will require more processing time. You'll be able to tell how much a chart is scaled by looking at text labels and compare their size to non-scaled versions of the chart.

The following chart grid demonstrates the performance impact of some settings.

 

Tips & Summary

  1. Dont use chart features that are not useful like element labels that are too small to read.
  2. Use less visually complex elements. (Square markers instead of circles or no shading effects.
  3. Set box background, line, and box shadow colors to Color.Empty.
  4. Use color transparency sparingly.
    A more complex algorithm is necessary to blend backgrounds with partially transparent color fills.
  5. Using Chart.PrinterOptimizedText may seem like it will improve performance because text is not anti-aliased, however, the performance gain is trivial.
  6. Chart size can make a dramatic difference in performance but the gain is lost when the chart gets too small to fit into the image in which case, it is rendered at a larger size and scaled down to the image size.
  7. Using Label.Shadow and Label.GlowColor may introduce a reduction in performance as these operations are CPU intensive.
  8. Use SeriesType.Line instead of SeriesType.Spline if possible. The line type is much faster than spline.

 

Charts with 200+ elements.

With a large number of elements the performance scale begins to tip towards data processing. Certain element features may take a few extra cpu ticks due to processing such as token replacement for element tool tips, labels and other hotspot attributes. The more tokens used in element properties the longer processing may take. Using element markers for series with thousands of elements might also be a bad idea because each marker must be drawn individually.

 

 

Memory performance.

If memory usage is a factor there are a few things to be aware of. First, memory usage can be tweaked only when charts are showing a large number of elements, otherwise, these tips will provide marginal benefits.

Element properties such as smart label, markers and hotspots are not instantiated by default. They are instantiated when the properties of those objects are used. For instance using code such as: Chart.DefaultElement.SmartLabel.Text = "%Name" will create a SmartLabel instance for the default element and eventually for each element on the chart.  

 

©2010. All Rights Reserved.