I have a column chart and it is working fine with the following code. Now I want to make it a stack column chart by adding Crickettime, Hockeytime, with the existing football time. I have similar procedures to find Crickettime and Hockeytime. I think I need to specify series in the following method so that series1 is football time, and series2 is Cricket time, and series 3 is hockey time. Any help on how to specify the series.
private void GetChartData2(){
SqlConnection con2 = new System.Data.SqlClient.SqlConnection();
con2.ConnectionString = "connectionstring";
SqlCommand cmd2 = new SqlCommand("Execute spGetFootballTimeOftheUsersPerDay_Updated '" + currentUser + "'", con2);
cmd2.CommandTimeout = 0;
System.Data.SqlClient.SqlDataAdapter sqldataadap2 = new System.Data.SqlClient.SqlDataAdapter();
sqldataadap2.SelectCommand = cmd2;
DataTable dtable = new DataTable();
dtable.Locale = System.Globalization.CultureInfo.InvariantCulture;
sqldataadap2.Fill(dtable);
Chart2.DataSource = dtable;
Chart2.DataBind();
}
I have face this type of prbolem. I get the solution.
Following Step below.
you can manage your data using only one series with all column(Football,Hocky,Cricket)
Stacked chart work series 1 means all column data display same time
you go through manage data column wise like you get First point cricket column data than add another column data is 0 your table first row(cricket) get 100 than add balnk another row for football and hocky
below type of table
No Game Score
1 Cricket 100
2 hocky 0
3 Football 0
4 Cricket 0
5 hocky 200
6 Football 0
7 Cricket 0
8 hocky 0
9 Football 300
Example - cricket data(0)= 100 Football(0)= 0 Hocky(0) = 0
Series.Points(0) X=0,Y=100 Cricket
(1) X=0,Y=0 Football
(2) X=0,Y=0 Hocky
you have to mange this type of data.
Series Data Cricket data 1 to 100 than generate SRno 1 to 100 Hocky data 1 to 100 than generate SRno 1 to 100 Football data 1 to 100 than generate srno 1 to 100
Below code