Changing Graph Display using Combobox Values, ADO Model

  • Thread starter Thread starter Jazmin25
  • Start date Start date
J

Jazmin25

Guest
Hi All,

I am pretty new at programming and I am having a massive problem changing the display of a chart using combobox values. I have created an ADO model that feeds my chart and have 2 comboboxes that should control the X and Y axis based on the columns of the entity.

The problem is that I can't manage to change the display of the initial graph once I choose a different column in one of the comboboxes. below is the snippet of one of my method


private void cmbxColumn_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"].XValueMember = cmbxColumn.SelectedItem.ToString();
}
} And below is the code that feeds the initial chart. 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 = ystem.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;

}

Can any one help me in this instance? I would love to make my system dynamic so to be able report on multiple columns of a table or even tables/entities. Does anyone know how to make the code above dynamic so to reach the goal? Thank you in advance.



jazztheman33

Continue reading...
 
Back
Top