Create Multi Series Chart in VB.net based on the dropdownlist selection.
Here is the coding:
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="main.aspx.vb" Inherits="NQI_CHART._Default" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<p>
<table class="style2">
<tr>
<td align="center" class="style19" valign="middle" colspan="5">
<asp:Label ID="Label4" runat="server" ForeColor="#660066"
style="font-size: medium; font-weight: 700; font-family: 'Bodoni Bd BT'; color: #FF0000"
Text="Please Select" Width="248px"></asp:Label>
</td>
</tr>
<tr>
<td align="right" class="style19" valign="middle">
<asp:Label ID="Label1" runat="server" CssClass="style5" Text="TYPE OF CASE:"></asp:Label>
</td>
<td class="style8" colspan="4" valign="middle">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_CaseType" DataTextField="CaseDesc"
DataValueField="CaseType" Height="30px" Width="450px"
DataMember="DefaultView">
</asp:DropDownList>
<asp:Label ID="Label20" runat="server" Text="Label" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="center" class="style21" valign="middle">
<asp:DropDownList ID="DropDownList4" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_selectMonth" DataTextField="Show_Name"
DataValueField="pValue" Height="20px">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_selectyear" DataTextField="Show_Name"
DataValueField="pValue" Height="20px">
</asp:DropDownList>
<br />
<asp:Label ID="Label23" runat="server" Text="Label" Visible="False"></asp:Label>
<asp:Label ID="Label24" runat="server" Text="Label" Visible="False"></asp:Label>
</td>
<td align="center" class="style21" valign="middle">
<asp:DropDownList ID="DropDownList6" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_selectMonth" DataTextField="Show_Name"
DataValueField="pValue" Height="20px">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList5" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_selectyear" DataTextField="Show_Name"
DataValueField="pValue" Height="20px">
</asp:DropDownList>
<br />
<asp:Label ID="Label25" runat="server" Text="Label" Visible="False"></asp:Label>
<asp:Label ID="Label26" runat="server" Text="Label" Visible="False"></asp:Label>
</td>
<td align="center" class="style21" valign="middle">
<asp:DropDownList ID="DropDownList8" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_SelectQuarter" DataTextField="Show_Name"
DataValueField="pValue" Height="20px">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList7" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_selectyear" DataTextField="Show_Name"
DataValueField="pValue" Height="20px">
</asp:DropDownList>
<br />
<asp:Label ID="Label27" runat="server" Text="Label" Visible="False"></asp:Label>
<asp:Label ID="Label28" runat="server" Text="Label" Visible="False"></asp:Label>
</td>
<td align="center" class="style21" valign="middle">
<asp:DropDownList ID="DropDownList10" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_SelectQuarter" DataTextField="Show_Name"
DataValueField="pValue" Height="20px">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList9" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource_selectyear" DataTextField="Show_Name"
DataValueField="pValue" Height="20px">
</asp:DropDownList>
<br />
<asp:Label ID="Label29" runat="server" Text="Label" Visible="False"></asp:Label>
<asp:Label ID="Label30" runat="server" Text="Label" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td class="style21" align="center" valign="middle">
</td>
<td colspan="2" align="center" valign="middle">
<asp:Label ID="Label13" runat="server" ForeColor="#660066"
style="font-size: medium; font-weight: 700; font-family: 'Bodoni Bd BT'; color: #CC0099"
Text="Year" Width="150px"></asp:Label>
</td>
<td class="style21" align="center" valign="middle">
</td>
</tr>
<tr>
<td>
<asp:Button ID="btn_Reset" runat="server" Height="30px" Text="Reset" CssClass="bold" />
<asp:Button ID="btn_Rate" runat="server" BackColor="#CC00CC" ForeColor="White"
Height="30px" Text="Generate Chart (By Rate Incidents)" Width="280px"
CssClass="bold" />
<asp:Button ID="btn_Int" runat="server" BackColor="Red" ForeColor="White"
Height="30px" Text="Generate Chart (By Number of Incident)" Width="280px"
CssClass="bold" />
<asp:Button ID="btn_Print" runat="server" BackColor="#FFFF66" ForeColor="Red"
Height="30px" Text="Print" CssClass="bold" />
</td>
</tr>
</table>
</p>
<p>
</p>
<table class="style2">
<tr>
<td align="center" colspan="2">
<asp:Label ID="Label37" runat="server"
style="font-size: large; font-family: Arial; font-weight: 700"
Text="Label" Visible="False" CssClass="style31"></asp:Label>
<br />
<asp:Label ID="Label39" runat="server"
style="font-size: large; font-family: Arial; font-weight: 700"
Text="Label" Visible="False" CssClass="style31"></asp:Label>
<br />
<asp:Label ID="Label48" runat="server"
style="font-size: large; font-family: Arial; font-weight: 700"
Text="Label" Visible="False" CssClass="style31"></asp:Label>
<br />
<asp:Label ID="Label49" runat="server"
style="font-size: large; font-family: Arial; font-weight: 700"
Text="Label" Visible="False" CssClass="style31"></asp:Label>
<br />
<table class="style23">
<tr>
<td class="style26">
<asp:Chart ID="RateChart" runat="server" Height="500px" Width="900px">
<Series>
<asp:Series Name="Series1" ChartType="Line">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
<asp:Chart ID="IntChart" runat="server" Height="500px" Width="900px">
<Series>
<asp:Series Name="Series1" ChartType="Line">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
<br />
</td>
</tr>
<tr>
<td class="style28" align="center">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="style26">
<asp:GridView ID="gvRate" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource_RateChart" Visible="False">
<Columns>
<asp:BoundField DataField="Department" HeaderText="Department"
SortExpression="Department" />
<asp:BoundField DataField="Period_Shown" HeaderText="Period_Shown"
SortExpression="Period_Shown" />
<asp:BoundField DataField="Rate_Int" HeaderText="Rate_Int"
SortExpression="Rate_Int" />
</Columns>
</asp:GridView>
</td>
<td class="style26">
<asp:GridView ID="gvInt" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource_IntChart" Visible="False">
<Columns>
<asp:BoundField DataField="Department" HeaderText="Department"
SortExpression="Department" />
<asp:BoundField DataField="Period_Shown" HeaderText="Period_Shown"
SortExpression="Period_Shown" />
<asp:BoundField DataField="Num_Int" HeaderText="Num_Int"
SortExpression="Num_Int" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
<br />
<asp:SqlDataSource ID="SqlDataSource_IntChart" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT CaseType, Department, Period_Shown, Period, Num_Int FROM NQI_TABLE WHERE (CaseType = @CaseType) AND (Department LIKE '%' + @Department + '%' OR Department LIKE '%' + @Department2 + '%') AND (Period BETWEEN @Period AND @Period2) Order by Department,Period">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="CaseType"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList2" Name="Department"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList13" Name="Department2" PropertyName="SelectedValue"
Type="String" />
<asp:ControlParameter ControlID="Label32" Name="Period" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="Label33" Name="Period2" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="SqlDataSource_CaseType" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT * FROM [CaseType] ORDER BY [CaseDesc]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource_UserDepartments" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT * FROM [UCH_Departments] ORDER BY [DepartmentKey]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource_Compare" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT * FROM [Compare]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource_selectyear" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT * FROM [Year_Period] ORDER BY [pIndex]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource_selectMonth" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT * FROM [Month_Period] ORDER BY [pIndex]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource_SelectQuarter" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT * FROM [Quarter_Period] ORDER BY [pIndex]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource_SelectStartYear" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT * FROM [Start_Year] ORDER BY [pIndex]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource_SelectEndYear" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT * FROM [End_Year] ORDER BY [pIndex]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource_RateChart" runat="server"
ConnectionString="<%$ ConnectionStrings:nqidataConnectionString %>"
SelectCommand="SELECT CaseType, Department, Period_Shown, Period, Rate_Int FROM NQI_TABLE WHERE (CaseType = @CaseType) AND (Department LIKE '%' + @Department + '%' OR Department LIKE '%' + @Department2 + '%') AND (Period BETWEEN @Period AND @Period2) Order by Department,Period">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="CaseType"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList2" Name="Department"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList13" Name="Department2" PropertyName="SelectedValue"
Type="String" />
<asp:ControlParameter ControlID="Label32" Name="Period" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="Label33" Name="Period2" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
<asp:Label ID="Label31" runat="server" Visible="False"
CssClass="style22"></asp:Label>
<asp:Label ID="Label32" runat="server" Visible="False"
CssClass="style22"></asp:Label>
<asp:Label ID="Label33" runat="server" Visible="False"
CssClass="style22"></asp:Label>
<asp:Label ID="Label38" runat="server"
style="font-family: Arial; color: #660066; font-weight: 700"
Visible="False" CssClass="style22"></asp:Label>
<asp:Label ID="Label40" runat="server"
style="font-family: Arial; color: #660066; font-weight: 700"
Visible="False" CssClass="style22"></asp:Label>
<asp:Label ID="Label41" runat="server"
style="font-family: Arial; color: #660066; font-weight: 700"
Visible="False" CssClass="style22"></asp:Label>
<asp:Label ID="Label42" runat="server"
style="font-family: Arial; color: #660066; font-weight: 700"
Visible="False" CssClass="style22"></asp:Label>
<asp:Label ID="Label43" runat="server"
style="font-family: Arial; color: #660066; font-weight: 700"
Visible="False" CssClass="style22"></asp:Label>
<asp:Label ID="Label44" runat="server"
style="font-family: Arial; color: #660066; font-weight: 700"
Visible="False" CssClass="style22"></asp:Label>
<asp:Label ID="Label45" runat="server"
style="font-family: Arial; color: #660066; font-weight: 700"
Visible="False" CssClass="style22"></asp:Label>
<asp:Label ID="Label46" runat="server"
style="font-family: Arial; color: #660066; font-weight: 700"
Visible="False" CssClass="style22"></asp:Label>
<asp:Label ID="Label47" runat="server"
style="font-family: Arial; font-weight: 700" Visible="False"
CssClass="style30"></asp:Label>
</p>
</asp:Content>