Closed ghost closed 8 years ago
I see the same behavior when trying to plot a sequence that is lazily created:
let chart(points:(int*float32) seq) = let obs = (Observable.ofSeq points).SubscribeOn(ThreadPoolScheduler.Instance) LiveChart.FastLineIncremental(obs)
If I don't subscribe on the threadpool, I don't get any exception, but I only see the chart after all the entire sequence has been evaluated, which defeats the purpose of a live chart...
I found a workaround that at least avoids the exception:
let chart(points:(int*float32) seq) = let obs = (Observable.ofSeq points) .SubscribeOn(ThreadPoolScheduler.Instance) .ObserveOn(WindowsFormsSynchronizationContext.Current) LiveChart.FastLineIncremental(obs)
The events has to be observed on the WindowsForms thread, but can be produced on a separate thread, It is still not ideal though. The form only seems to update once per second or so and only displays one new observation at a time. Not ideal when producing many values.
I was experimenting using ExtCore async sequences as specifications of incrementally growing data sets. THis works when I use event-based sources of IObservables.
However for the asyncSeq example below I get a background exception:
val it : ChartTypes.GenericChart = (Chart)