Time for action — creating a drill-down chart in ASP.NET using data from an SQL Server
1. In
AnnualRevenues.aspx.cs
, modify this line of code:strXML.AppendFormat("<set label='{0}' value='{1}' link='{2}' />", ret_value["YEAR"].ToString(), ret_value["SUM"].ToString(), "Quarterly.aspx?year=" + ret_value["YEAR"].ToString());
2. And this line as well:
strXML.Append("<chart caption='Annual Revenue - last 3 years' subcaption='Click on a column to view revenue for each quarter for that year' numberPrefix='$'>");
3. Add another file to this project and name it as
Quarterly.aspx
.4. In this file, include
FusionCharts.js
by adding:<script type="text/javascript" src="Charts/FusionCharts.js"></script>
5. Create a Literal control in the form tag, named as
literal1
.<form id="form1" runat="server"> <asp:Literal ID="l1" runat="server"></asp:Literal> </form>
6. Open the code-behind file
Quarterly.aspx.cs
and type the following code in it:using System; using...