MSChart - Drilldown Charts: Part I


Using the GetCallbackEventReference method of the ClientScriptManager class.

Source code with two MSChart controls (Chart1 and Chart2). We start by creating a simple chart (Chart1) plotted using random numbers. While clicking a Series on Chart1, another chart (or a drill downed chart - Chart2) will show with Chart1 Series point value.

On Page Load following things happening:

1. Applying color for Chart1 Series, later using for Chart2 Series.

2. Plotting Chart1.

3. Setting onclick event attributes for Chart1 Series, will pass Series Name, Point Value, Series Color.

series.MapAreaAttributes = "onclick= \"" + sHandler + "\"";

Also, can use onmouseover, onmousedown, ondblclick etc...

4. Registering a JavaScript function named UseCallback(), which will used for calling server side code from client script for plotting Chart2.

Download the sample pages with images from above link.

Page Load - Chart1:

Figure1.JPG

Onclick - Chart1:

Figure2.JPG

Chart2 plotted:

Image3.jpg

Please post comments about this article.

My other articles will help you in creating charts using database interaction, refer links:

How to draw a Line chart using MSChart

http://www.c-sharpcorner.com/UploadFile/suthish_nair/2860/

Creating a column graph with MS Chart

http://www.c-sharpcorner.com/UploadFile/suthish_nair/2855/
 

Up Next
    Ebook Download
    View all
    Learn
    View all