Search code examples
.netf#fsharpchart

FSharpChart blank output


I'm currently trying to get FSharpChart to work. Unfortunately after compiling the library and feeding any FSharpChart with data I only get blank outputs, whether I use FSharpChart.WithCreate, FSharpChart.SaveAs or FSharpChart.CopyToClipboard.

Even the included examples produce blank output. Of course I've got Visual Studio 2010 SP1 installed, .NET Framework 4.0 with all the latest patches etc. The code is hosted on Windows 7 x64.

What am I missing?


Solution

  • I know it has been a long time but after having the same issue i found that form refreshing do the trick:

    open System.Windows.Forms
    open MSDN.FSharp.Charting
    
    [<EntryPoint>]
    let main argv = 
        let myChart = [for x in 0.0 .. 0.1 .. 6.0 -> sin x + cos (2.0 * x)]
                      |> FSharpChart.Line
        let form = new Form(Visible = true, TopMost = true, Width = 700, Height = 500)
        let ctl = new ChartControl(myChart, Dock = DockStyle.Fill)
        form.Controls.Add(ctl)
        form.Refresh()
        System.Console.ReadKey() |> ignore
        0