我正在尝试将新的组合框值绑定到VS2015 C#中的现有图表/图形,但是这种情况根本没有发生,也不知道该怎么做。我的目标是能够基于包含一个表的多个列的2个组合框选择来更改X和Y轴。谁能帮忙吗?我的想法用光了
下面是我的组合框方法之一的代码和图表的代码。
private void cmbxRow_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbxRow.SelectedIndex < 0 || cmbxColumn.SelectedIndex < 0)
return;
using (csc8008Entities4 ddb = new csc8008Entities4())
{
Fchart1.DataSource = ddb.products.ToList();
Fchart1.Series["Gen View"].YValueMembers =
cmbxRow.SelectedItem.ToString();
}
}
图表代码;
using (csc8008Entities4 ddb = new csc8008Entities4())
{
Fchart1.DataSource = ddb.products.ToList();
Fchart1.Series["Gen View"].XValueMember = "productName";
Fchart1.Series["Gen View"].XValueType =
System.Windows.Forms.DataVisualization.Charting.ChartValueType.String;
Fchart1.Series["Gen View"].YValueMembers = "price";
Fchart1.Series["Gen View"].YValueType =
System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
}