Spread for ASP.NET 8.0 Product Documentation
Rendering or Saving the Chart Control to an Image

You can specify how to render the Chart control as an image. The Chart control has two built-in image render classes:

The HttpHandlerImageRender class should be used when the charts are easy to generate or when there will be requests for many different charts. The images can be saved to the server using a session or cache. You can specify the storage type with the ImageTransferStorage property.

The FileImageRender class renders the chart image to the client using temporary files. Since repeated requests for the same chart use the same file, this reduces the load on the server. New requests create new files as needed. Files are not cleaned up automatically. This class should be used when charts are complex and expensive to generate or when you expect a large number of requests for a small number of different charts. You can select the image type with the ChartImageType property.

Use the ImageRender property to specify which image render class to use.

There are several server Chart events that can be used when working with a chart image:

The MapAreaClick event can be used to determine which chart element the user clicked on. Each map area on the client side corresponds to a chart element (plot area, legend, series, and so on). The BeforeRenderMapAreas event can be used to customize client behavior of the map area.

There is an ImageClick client event as well. If the MapAreaClick event is used, then the ImageClick event will not occur. The RenderMapArea property should be set to true to use the MapAreaClick event. The HitTest method can be used to get information about the chart element that is clicked.

The EnableClickEvent property specifies whether the Click event fires.

The MapAreaClick event fires if the RenderMapArea property is true and the EnableClickEvent property is false. If the RenderMapArea property is false and the EnableClickEvent property is true, only the Click event fires. If the RenderMapArea property is true and the EnableClickEvent property is true, the MapAreaClick event fires if the user clicks on a chart element. The Click event fires if the user clicks on the chart background.

The HotSpotMode property is used if RenderMapArea is true. HotSpotMode determines the behavior when the user clicks in a map area. The options are inactive, navigate, and post back. The inactive option is useful if you wish to display a tooltip in the map area. If the HotSpotMode is set to post back, the MapAreaClick and Client events are fired. If the RenderMapArea property is false, the HotSpotMode property has no effect.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback