0

I have the following problem:

Having list of Objects (class MyClass) with several Properties I want to bind the Chart Datasource to specific class properties:

public class myClass {
    public int a;
    public int t;
    public double v;

    myClass(int aa, int tt, double val){
        a=aa;
        t=tt;
        v=val;
    }
}

public List<myClass> myList;
myList.Add(new myClass(1,1,10));
myList.Add(new myClass(1,2,15));
myList.Add(new myClass(2,3,20));

I want now to get a chart with t mapped to the AxisX and v mapped to the AxisY. I able to get 2 arrays from the Objects List but I have no idea how to "bind" them to the Datasource:

myList(item => item.t).ToArray()
myList(item => item.v).ToArray()

// Create data binding for chart
var bs = new BindingSource();
bs.DataSource = ????????????????;

Thank you for your help!!

R.

prre72
  • 697
  • 2
  • 12
  • 23
  • See the linked post for info how to databind a Chart. Short version: Do not bind the chart but a series! – TaW Jun 18 '16 at 08:30

1 Answers1

0

You could use fluentlinqtosql for this. Refer https://github.com/JeremySkinner/FluentLinqToSql

Chandan Rai
  • 9,879
  • 2
  • 20
  • 28