January 10th, 2012 09:39 AM
#1
Charting problems
I'm having some problems putting a "company goal" on my column chart. I am doing it as a line graph, but the line needs to extend more left, and more right. I've tried setting the x to before where my column chart starts but that doesnt help, it still doesnt start on y axis and and shifts all my info over. this is what i'm getting : http://i.imgur.com/iqz2z.jpg
and this is sort of the idea i'm going for : http://i.imgur.com/HyG5X.jpg
i realize that i probably wont be able to get individual goals on there because it's one point, but if someone has an idea...i'm all ears...other than 3d column chart with company and individual goals behind the first 2 series..already though of that, but its not the look i'm going for.
Edit: got the line to go across, but its messing with my column x axis titles. Any way to fix?
Code:
Code:
int x=0;
Chart1.Series.Add("currmonth");
Chart1.Series["currmonth"].ChartType = SeriesChartType.Column;
Chart1.Series["currmonth"].SmartLabelStyle.Enabled = true;
Chart1.Series.Add("prevmonth");
Chart1.Series["prevmonth"].ChartType = SeriesChartType.Column;
Chart1.Series["prevmonth"].SmartLabelStyle.Enabled = true;
Chart1.Series.Add("compgoal");
Chart1.Series["compgoal"].ChartType = SeriesChartType.Line;
Chart1.ChartAreas[0].AxisX.Minimum = 0;
Chart1.ChartAreas[0].AxisX.Maximum = 5;
DataPoint dp3 = new DataPoint();
dp3.SetValueXY(0, 115);
dp3.BorderWidth = 3;
Chart1.Series["compgoal"].Points.Add(dp3);
DataPoint dp4 = new DataPoint();
dp4.SetValueXY(5, 115);
dp4.BorderWidth = 3;
Chart1.Series["compgoal"].Points.Add(dp4);
while (x < 4)
{
/*DataPoint dp3 = new DataPoint();
//dp3.XValue = x;
dp3.YValues = new double[] { Convert.ToDouble(115) };
dp3.BorderWidth = 3;
Chart1.Series["compgoal"].Points.Add(dp3);*/
//---------------------------------------------------------------------------
DataPoint dp = new DataPoint();
dp.AxisLabel = username[x];
//dp.XValue = x+1;
dp.YValues = new double[] { Convert.ToDouble(average[x]) };
dp.Label = average[x].ToString() + " || " + count[x];
dp.LabelForeColor = Color.DarkGreen;
//dp.Color = Color.CornflowerBlue;
dp.Font = new System.Drawing.Font(FontFamily.GenericSerif, 10, FontStyle.Bold);
Chart1.Series["currmonth"].Points.Add(dp);
//-----------------------------------
DataPoint dp2 = new DataPoint();
dp2.AxisLabel = username2[x];
//dp.XValue = x+1;
dp2.YValues = new double[] { Convert.ToDouble(average2[x]) };
dp2.Label = average2[x].ToString() + " || " + count2[x];
dp2.LabelForeColor = Color.Brown;
//dp2.Color = Color.MediumSeaGreen;
//dp2.BorderColor = Color.DarkGreen;
dp2.Font = new System.Drawing.Font(FontFamily.GenericSerif, 10, FontStyle.Bold);
Chart1.Series["prevmonth"].Points.Add(dp2);
x++;
}
//new data point for company goal
Chart1.Palette = ChartColorPalette.BrightPastel;
//Chart1.Palette = ChartColorPalette.Pastel;
Chart1.Titles[0].Text = "name";
Chart1.ChartAreas[0].AxisX.Title = ddlMonths.SelectedValue;
Chart1.ChartAreas[0].AxisY.Title = "$";
Chart1.Legends.Add(new Legend() { Name = "Legend" });
Chart1.Legends[0].Docking = Docking.Bottom;
Chart1.Series["currmonth"].Name = "Current Month";
Chart1.Series["prevmonth"].Name = "Previous Month";
Chart1.Series["compgoal"].Name = "Company Goal";
//-------------------------------------------------------------------------
any help is appreciated!
Last edited by irconfused2001; January 10th, 2012 at 11:47 AM .
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks