This is the query result that I get and using excel the chart that I plotted is below:
|
Names |
Count |
Goal |
Difference |
|
A |
40 |
50 |
10 |
|
B |
20 |
50 |
30 |
|
C |
10 |
50 |
40 |
|
D |
4 |
50 |
46 |
chart1.Series.Add("Series1");//goal,names
chart1.Series.Add("Series2");//count,names
chart1.Series["Series1"].ChartType = SeriesChartType.StackedBar;
chart1.Series["Series2"].ChartType = SeriesChartType.StackedBar;
chart1.Series["Series1"].Points.DataBindXY(dr, "names", dr, "Goal");//Since this is the larger of the series
chart1.Series["Series2"].Points.DataBindXY(dr, "names", dr, "Count");
chart1.Series["Series1"]["BarLabelStyle"] = "Outside";
chart1.Series["Series2"]["BarLabelStyle"] = "Center";
chart1.Series["Series1"].Color = Color.FromArgb(130, Color.Red); //Color.Red; 130 is transparency
chart1.Series["Series2"].Color = Color.FromArgb(130, 180, 151, 90);
chart1.Series["Series1"]["PointWidth"] = "0.6";
chart1.Series["Series2"]["PointWidth"] = "0.6";
chart1.Series["Series1"].IsValueShownAsLabel = true;
chart1.Series["Series2"].IsValueShownAsLabel = true;
chart1.Series[0].SetCustomProperty("DrawSideBySide", "false");
chart1.Series[1].SetCustomProperty("DrawSideBySide", "false");
chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
chart1.ChartAreas[0].AxisX.MinorGrid.Enabled = false;
chart1.ChartAreas[0].AxisY.LabelStyle.Enabled = false;
chart1.ChartAreas[0].AxisX.MajorTickMark.Enabled = false;
chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
chart1.ChartAreas[0].AxisY.MinorGrid.Enabled = false;
chart1.ChartAreas[0].AxisY.MajorTickMark.Enabled = false;
ChartArea area = this.chart1.ChartAreas[0];
I can only see the Goal bars and not the Count.
Any help will be appreciated.
Thanks
Answers
Know the answer? Post it. Somebody with the same question will find it here.