Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have this problem where all my column bars is clustered together, i tried changing the order by fields and other fields, it seems not to be working.
http://stackoverflow.com/questions/10828465/what-to-prevent-clustering-using-databindcrosstable-in-c-sharp-for-chart[^]
C#
try 
            { 
                MultiView1.Visible = true; 
                Chart1.Series.Clear(); 
                Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; 
                Chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray; 
                MultiView1.Visible = true; 
                DataTable table = new DataTable(); 
                table.Columns.Add("AverageGrading"); 
                table.Columns.Add("Date"); 
                ArrayList listofdates = dbmanager.GetListofDatesViaAll(); 
 
                foreach (DateTime date in listofdates) 
                { 
                    double gradingresult = dbmanager.GetAverageAppraisalForSectionALL(date); 
 
                    string monthname = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(date.Month); 
                    table.Rows.Add(gradingresult, monthname.Substring(0, 3) + "/" + date.Year.ToString().Substring(2, 2)); 
                } 
                DataTableReader datareader = table.CreateDataReader(); 
                Chart1.ChartAreas[0].AxisX.Title = "Period of appraisal"; 
                Chart1.ChartAreas[0].AxisY.Title = "Average grade"; 
                Chart1.DataBindCrossTable(datareader, "Date", "Date", "AverageGrading", ""); 
                Chart1.Legends.Add("Legend"); 
                Chart1.Legends[0].Enabled = true; 
                Chart1.Legends[0].BackColor = System.Drawing.Color.Transparent; 
                Chart1.Width = 1000; 
                Chart1.Height = 600; 
 
                MultiView1.ActiveViewIndex = 0; 
            } 
            catch (Exception e) 
            { 
                MultiView1.Visible = false; 
                MessageBoxShowWithoutredirect(e.Message); 
            } 
Posted
Comments
Ganesan Senthilvel 31-May-12 23:02pm    
Did you get any answer from StackOverFlow?
huatsin 1-Jun-12 1:56am    
nope!

1 solution

I can see only Chart1 instance; not sure who is the provider of this chart control?

Usually, chart providers is the right candidate to answer your question because it is more of chart functionality.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900