This project is read-only.

Problem creating a plot with ObservableDataSource

Nov 3, 2011 at 3:04 PM

How come this works:

using (DataContext context = new DataContext())
{
    var data = from x in context.Table1
               select (new GraphPoint(x.Field1, x.Table2.Field1));

    ObservableDataSource points = new ObservableDataSource();
    points.AppendMany(data);
    plotter.AddLineGraph(points, 2.0f);
}

And this doesn't:

using (DataContext context = new DataContext())
{
    var data = from x in context.Table1
               select (new GraphPoint(x.Field1, x.Table2.Field1));

    ObservableDataSource points = new ObservableDataSource(data);
    plotter.AddLineGraph(points, 2.0f);
}

It compiles and runs without errors but just doesn't add the graph to the plot.

Does this make sense to anyone?

 

 

Nov 3, 2011 at 3:18 PM

Nevermind. I think the problem is due to the "data" variable being disposed when the context goes out of scope.