I have trouble putting together a chart with the contents of a data table that is basically as sex, marital status, age, and DATE . Im working with a bar chart or column chart, but I can't make it work like I want. What im looking for is that each column of the chart has his name on the bottom (column name of the database) and on the header (think are called labels) display the results of a sql query but if in that query exist different data like for example in the SEX column there are two possibilites, MAN or WOMAN and I need that if there 2 results with MAN and 3 results with WOMAN on the column chart SEX header this values have to appear there in the header of that column. I get data from a SQL Server Express DB.
This is the query that I have to get the data in the chart:
SqlCommand cmd2 = new SqlCommand(string.Format("SELECT SEX, MARITAL,AGE,DATE FROM TEST WHERE (SEX IN (" + sex + ")) AND (MARITAL IN (" + marital + ")) AND (AGE (" + age + ")) AND (DATE IN (" + date + "))"), con1); SqlDataAdapter da2 = new SqlDataAdapter(cmd2); DataSet ds2 = new DataSet(); da2.Fill(ds2); chart1.DataSource = da2; chart1.Visible = true;
In case that you don't understand me, this is what i'm looking for (made with photoshop :p):
I really search all the webs related with chart in c# winforms but i can't find any solution like this.
Can anyone please help me to make the code like the chart example using the binding from my bbdd.
Thanks for the answers!.