Click here to Skip to main content
15,922,407 members
Home / Discussions / C#
   

C#

 
QuestionVS2010 chart Control [modified] Pin
kibromg6-Oct-10 4:55
kibromg6-Oct-10 4:55 
AnswerRe: VS2010 chart Control Pin
Rutvik Dave6-Oct-10 5:13
professionalRutvik Dave6-Oct-10 5:13 
GeneralRe: VS2010 chart Control Pin
kibromg6-Oct-10 5:26
kibromg6-Oct-10 5:26 
GeneralRe: VS2010 chart Control Pin
Rutvik Dave6-Oct-10 6:03
professionalRutvik Dave6-Oct-10 6:03 
GeneralRe: VS2010 chart Control [modified] Pin
kibromg6-Oct-10 6:17
kibromg6-Oct-10 6:17 
GeneralRe: VS2010 chart Control Pin
Rutvik Dave6-Oct-10 7:59
professionalRutvik Dave6-Oct-10 7:59 
GeneralRe: VS2010 chart Control Pin
kibromg7-Oct-10 3:12
kibromg7-Oct-10 3:12 
GeneralRe: VS2010 chart Control Pin
Rutvik Dave7-Oct-10 4:33
professionalRutvik Dave7-Oct-10 4:33 
OK, This is because the Axes Y, should bind same kind of values, due to same scale type. so those 0.5,0.1.. will be too small compared to 1000 (which is $ value). so you need to change few things...

i.e.

Chart1.Series.Add("Target");
Chart1.Series[0].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Bar;
Chart1.Series[0].IsValueShownAsLabel = true;
Chart1.Series[0].LabelFormat = "#"; // here you want just target money right ?

Chart1.Series.Add("Progress");
Chart1.Series[1].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Bar;
Chart1.Series[1].IsValueShownAsLabel = false; // i have changed this
Chart1.Series[1].LabelFormat = "#"; // 'i have changed this also


now in ds you will need 4 columns, or change the 3rd column from percentage to value. or just 4 columns

1.time
2.target // (this should be value like $1000)
3.progress //(this should be value like $500)
4.percentage // (this should be 50%) 


now you need to manually add the points, instead of binding it.

so,
Chart1.Series[0].Points.Clear();
Chart1.Series[1].Points.Clear();

foreach (DataRow dr in ds.Tables[0].Rows)
{
  Chart1.Series[0].Points.AddXY(dr["time"],dr["target"]) // for first bar

  Chart1.Series[1].Points.AddXY(dr["time"],dr["progress"]) // for second bar value
  Chart1.Series[1].Points[Chart1.Series[1].Points.Count - 1].Label = dr["percentage"].ToString() + "%" //we have disabled the auto label, so here we define the label value, so it will have 500 as value in scale, but it will show 50 % as a label.

}



and to change the background color

Chart1.ChartAreas[0].BackColor = System.Drawing.Color.Silver;


And for my next answer, I need MONEY... Big Grin | :-D

Just go through the sample code, I mentioned in the previous post. it has all the code. first you just run the sample project and browse the app, and if you find something interesting, look for the code.

again you can download it here[^]
GeneralRe: VS2010 chart Control [modified] Pin
kibromg7-Oct-10 6:21
kibromg7-Oct-10 6:21 
GeneralRe: VS2010 chart Control Pin
Rutvik Dave7-Oct-10 8:01
professionalRutvik Dave7-Oct-10 8:01 
GeneralRe: VS2010 chart Control Pin
kibromg12-Oct-10 6:32
kibromg12-Oct-10 6:32 
GeneralRe: VS2010 chart Control Pin
Rutvik Dave13-Oct-10 9:08
professionalRutvik Dave13-Oct-10 9:08 
Questioncalling vs2005 tool from out side Pin
prasadbuddhika5-Oct-10 23:26
prasadbuddhika5-Oct-10 23:26 
AnswerAttempt to bump post - please don't reply on this thread, reply to the original thread instead. Pin
Pete O'Hanlon5-Oct-10 23:45
mvePete O'Hanlon5-Oct-10 23:45 
QuestionExcel upload Pin
Ramkithepower5-Oct-10 22:39
Ramkithepower5-Oct-10 22:39 
Question.net 2.0 Custom Configuration Sections Pin
AndieDu5-Oct-10 20:51
AndieDu5-Oct-10 20:51 
AnswerRe: .net 2.0 Custom Configuration Sections Pin
Keith Barrow6-Oct-10 10:24
professionalKeith Barrow6-Oct-10 10:24 
GeneralRe: .net 2.0 Custom Configuration Sections Pin
AndieDu6-Oct-10 13:36
AndieDu6-Oct-10 13:36 
GeneralRe: .net 2.0 Custom Configuration Sections Pin
Keith Barrow6-Oct-10 21:11
professionalKeith Barrow6-Oct-10 21:11 
Questionmerging two word file [modified] Pin
annie_bel5-Oct-10 18:44
annie_bel5-Oct-10 18:44 
AnswerRe: merging two word file Pin
rah_sin5-Oct-10 19:22
professionalrah_sin5-Oct-10 19:22 
GeneralRe: merging two word file Pin
Thomas Krojer5-Oct-10 20:56
Thomas Krojer5-Oct-10 20:56 
GeneralRe: merging two word file Pin
Dave Kreskowiak6-Oct-10 2:32
mveDave Kreskowiak6-Oct-10 2:32 
AnswerRe: merging two word file Pin
Blue_Boy5-Oct-10 21:30
Blue_Boy5-Oct-10 21:30 
GeneralRe: merging two word file Pin
Luc Pattyn6-Oct-10 4:50
sitebuilderLuc Pattyn6-Oct-10 4:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.