Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
GeneralRe: Question about Chart in C# Pin
pongpanut28-Jan-12 22:20
pongpanut28-Jan-12 22:20 
AnswerRe: Question about Chart in C# Pin
Luc Pattyn28-Jan-12 22:38
sitebuilderLuc Pattyn28-Jan-12 22:38 
GeneralRe: Question about Chart in C# Pin
pongpanut29-Jan-12 0:10
pongpanut29-Jan-12 0:10 
GeneralRe: Question about Chart in C# Pin
OriginalGriff28-Jan-12 23:08
mveOriginalGriff28-Jan-12 23:08 
GeneralRe: Question about Chart in C# Pin
pongpanut29-Jan-12 1:58
pongpanut29-Jan-12 1:58 
GeneralRe: Question about Chart in C# Pin
OriginalGriff29-Jan-12 2:06
mveOriginalGriff29-Jan-12 2:06 
GeneralRe: Question about Chart in C# Pin
pongpanut29-Jan-12 2:16
pongpanut29-Jan-12 2:16 
GeneralRe: Question about Chart in C# Pin
OriginalGriff29-Jan-12 2:58
mveOriginalGriff29-Jan-12 2:58 
Ah. Ok. that makes some sense.

You are using the same data values for each series: I'm not sure exactly what you need to do to fix that (I don't use the Microsoft Chart control) but it looks like a Chart control always takes it's data from a single table. This is taken and adapted from their example:

C#
// Create an empty table.
DataTable table = new System.Data.DataTable("Table1");

// Add three columns to the table.
table.Columns.Add("Category", typeof(String));
table.Columns.Add("Value", typeof(Double));
table.Columns.Add("SecondValue", typeof(Double));

// Add data rows to the table.
table.Rows.Add(new object[] { "Lost", 0, 17 });
table.Rows.Add(new object[] { "Very Good", 1, 5 });
table.Rows.Add(new object[] { "Good", 2, 0 });
table.Rows.Add(new object[] { "Unlikely", 3, 9 });
table.Rows.Add(new object[] { "Firm Order", 4, 1 });
DataSet set = new DataSet();

set.Tables.Add(table);
chart1.DataSource = set.Tables[0].DefaultView;
//chart1.DataSource = dv3;

chart1.Series["Series1"].XValueMember = "Category";
chart1.Series["Series1"].YValueMembers = "Value";
chart1.Series.Add("Series2");
chart1.Series["Series2"].XValueMember = "Category";
chart1.Series["Series2"].YValueMembers = "SecondValue";
chart1.DataBind();
This does show two independent data plots, but from the same table. If it is the case that it always works from the same table, then you will have to either change your SELECT statement to return multiple columns (a PITA when you are dealing with user-selectable columns) or manually create a table, create the columns you need and add the data points to the appropriate columns. Not difficult, but fiddly and a bit messy. There may be an easier way, but I don't know what it is.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

AnswerRe: Question about Chart in C# Pin
Luc Pattyn29-Jan-12 8:35
sitebuilderLuc Pattyn29-Jan-12 8:35 
GeneralRe: Question about Chart in C# Pin
Luc Pattyn28-Jan-12 22:12
sitebuilderLuc Pattyn28-Jan-12 22:12 
GeneralRe: Question about Chart in C# Pin
pongpanut28-Jan-12 22:23
pongpanut28-Jan-12 22:23 
QuestionWriting source code in seperate files Pin
Fred 3427-Jan-12 22:27
Fred 3427-Jan-12 22:27 
AnswerRe: Writing source code in seperate files Pin
Richard MacCutchan27-Jan-12 22:37
mveRichard MacCutchan27-Jan-12 22:37 
GeneralRe: Writing source code in seperate files Pin
Eddy Vluggen27-Jan-12 23:44
professionalEddy Vluggen27-Jan-12 23:44 
GeneralRe: Writing source code in seperate files Pin
Richard MacCutchan28-Jan-12 0:19
mveRichard MacCutchan28-Jan-12 0:19 
GeneralRe: Writing source code in seperate files Pin
Eddy Vluggen28-Jan-12 5:19
professionalEddy Vluggen28-Jan-12 5:19 
GeneralRe: Writing source code in seperate files Pin
Richard MacCutchan28-Jan-12 5:26
mveRichard MacCutchan28-Jan-12 5:26 
GeneralRe: Writing source code in seperate files Pin
AmitGajjar28-Jan-12 21:35
professionalAmitGajjar28-Jan-12 21:35 
GeneralRe: Writing source code in seperate files Pin
Richard MacCutchan28-Jan-12 22:06
mveRichard MacCutchan28-Jan-12 22:06 
GeneralRe: Writing source code in seperate files Pin
Luc Pattyn28-Jan-12 22:16
sitebuilderLuc Pattyn28-Jan-12 22:16 
AnswerRe: Writing source code in seperate files Pin
Dean Oliver27-Jan-12 22:38
Dean Oliver27-Jan-12 22:38 
AnswerRe: Writing source code in seperate files Pin
jschell28-Jan-12 4:35
jschell28-Jan-12 4:35 
GeneralRe: Writing source code in seperate files Pin
PIEBALDconsult28-Jan-12 13:34
mvePIEBALDconsult28-Jan-12 13:34 
AnswerRe: Writing source code in seperate files PinPopular
Eddy Vluggen28-Jan-12 5:29
professionalEddy Vluggen28-Jan-12 5:29 
GeneralRe: Writing source code in seperate files Pin
PIEBALDconsult28-Jan-12 13:37
mvePIEBALDconsult28-Jan-12 13:37 

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.