I'm trying to make chart with C#/mysql which has more than two series.
original database architecture is as follows
Ticker Date Field Value
1 2001 AA 23445
1 2002 AA 34523
1 2001 BB 63456
1 2002 BB 76345
Ticker is company code AA means total asset, BB means total equity
I searched quite a lot in google, however, cannot find way to do it
last try is this.
MySqlConnection conn = new MySqlConnection(connString);
MySqlCommand cmdDataBaseKK = new MySqlCommand(" Select Date, Value as 'ValueK' from htdbmain.mainfsdb where field = 'KK' and ticker = '" + FinalTicker + "'", conn);
MySqlCommand cmdDataBaseJJ = new MySqlCommand(" Select Date, Value as 'ValueJ' from htdbmain.mainfsdb where field = 'AA' and ticker = '" + FinalTicker + "'", conn);
try
{
MySqlDataAdapter sdaK = new MySqlDataAdapter();
sdaK.SelectCommand = cmdDataBaseKK;
DataTable dbdatasetK = new DataTable();
sdaK.Fill(dbdatasetK);
BindingSource KSource = new BindingSource();
KSource.DataSource = dbdatasetK;
dataGridView1.DataSource = KSource;
sdaK.Update(dbdatasetK);
chart1.DataSource = KSource;
chart1.Series["Total Asset"].XValueMember = "Date";
chart1.Series["Total Asset"].YValueMembers = "ValueK";
chart1.DataBind();
MySqlDataAdapter sdaJ = new MySqlDataAdapter();
sdaJ.SelectCommand = cmdDataBaseJJ;
DataTable dbdatasetJ = new DataTable();
sdaJ.Fill(dbdatasetJ);
BindingSource JSource = new BindingSource();
JSource.DataSource = dbdatasetJ;
dataGridView1.DataSource = JSource;
sdaJ.Update(dbdatasetJ);
chart1.DataSource = JSource;
chart1.Series["Total Equity"].XValueMember = "Date";
chart1.Series["Total Equity"].YValueMembers = "ValueJ";
chart1.DataBind();
but I knew that chart only can have one datasource. I think, JOIN two database in one database source is one way but really don't know how to do it.(actually I spent almost 3 days in google :-), but only found join table in mysql)