I\'m attempting to databind a Chart
to a DataTable
. I would like the chart to display new rows as they are added, but the chart is not updating whe
Try using the table as a DataSource instead:
// tableDataSource = (table as IListSource).GetList();
// chart.DataBindTable(tableDataSource, "Date");
chart.Series.Add("test");
chart.Series["test"].XValueMember = "Date";
chart.Series["test"].YValueMembers = "Percent";
chart.DataSource = table;
chart.DataBind();
and then in the tick event, call DataBind again instead of the Update:
void timer_Tick(object sender, EventArgs e) {
table.Rows.Add(date, r.NextDouble());
date = date.AddDays(1);
//chart.Update();
chart.DataBind();
}