Nevron Forum

Using BindingList as datasource X axis

https://www.nevron.com/Forum/Topic3362.aspx

By Dan Schubel - Thursday, April 15, 2010

I am setting the data source for a line chart to a Bindinglist of custom objects like this:
nChartControl1.DataBindingManager.AddBinding(0, 1, "Values", TableIVT.rowList, "im");

This works fine but how can I specify which property to supply the X coordinates?
It appears to use the 1st property by default.
I am looking for a way to specify both x and y values at design time and run time.

The properties of my object are:
public int point;
public Double time;
public Double vf;
public Double im;
public Double vu;
public Double sig;
public Double ach;
public int ierange;

Suppose I want to plot vf versus time???
By Milen - Thursday, April 15, 2010

Hi Dan,

You can add several bindings at a time, for example:

nChartControl1.DataBindingManager.AddBinding(0, 1, "Values", TableIVT.rowList, "im");
nChartControl1.DataBindingManager.AddBinding(0, 1, "XValues", TableIVT.rowList, "vf");

You also have to set the UseXValues property of the series to true.

You can take a look at the following example in our Windows Forms demo application:

All Examples > Data Manipulation > Data Binding > Binding to IBindingList

Best Regards,
Milen

By Dan Schubel - Friday, April 16, 2010

Thanks, that is exactly what I was looking for.