Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiveChart throws exception (despite working ostensibly ok) #65

Open
anton-pt opened this issue Jan 20, 2015 · 1 comment
Open

LiveChart throws exception (despite working ostensibly ok) #65

anton-pt opened this issue Jan 20, 2015 · 1 comment

Comments

@anton-pt
Copy link

When run, the following code silently throws an exception at the line:

let chartControl = new ChartControl(chart),

despite ostensibly running just fine. The message in the output window is:
"A first chance exception of type 'System.InvalidOperationException' occurred in FSharp.Core.dll"

open System
open System.Drawing
open System.Reactive.Linq
open System.Threading
open System.Windows.Forms
open FSharp.Charting
open FSharp.Charting.ChartTypes

// Learn more about F# at http://fsharp.net
// See the 'F# Tutorial' project for more help.

[<EntryPoint>]
let main argv = 
    printfn "%A" argv

    let form = new Form()
    form.Size <- new Size(800, 600)

    let step =
        let gen = new Random()
        (fun () -> 2.0 * (gen.NextDouble() - 0.5))

    let randomWalk =
        Observable
            .Interval(TimeSpan.FromMilliseconds 200.0)
            .ObserveOn SynchronizationContext.Current 
        |> Observable.scan (fun (x, y) _ -> (x + 1.0, y + step())) (0.0, 0.0)

    let chart = LiveChart.FastLineIncremental randomWalk

    let chartControl = new ChartControl(chart)
    chartControl.Dock <- DockStyle.Fill

    form.Controls.Add chartControl

    Application.Run(form)
    0 // return an integer exit code

Am I doing something that I shouldn't be doing?

@dsyme
Copy link
Member

dsyme commented Jul 7, 2015

This may be relevant: #33 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants