Skip to content

Instantly share code, notes, and snippets.

@ashic
Created October 24, 2013 13:02
Show Gist options
  • Save ashic/7136850 to your computer and use it in GitHub Desktop.
Save ashic/7136850 to your computer and use it in GitHub Desktop.
F# Console app (tried .NET 4.5 and 4.5.1). Chart seems to hang with Not Responding on Windows 8.1.
open FSharp.Charting
open System
[<EntryPoint>]
let main argv =
printfn "%A" argv
Chart.Line([ for x in 0 .. 10 -> x, x*x ]).ShowChart()
Console.ReadLine() |> ignore
0 // return an integer exit code
@ashic
Copy link
Author

ashic commented Oct 24, 2013

Changing ShowChart to

Chart.Line([ for x in 0 .. 10 -> x, x*x ]).SaveChartAs("Foo.png", ChartTypes.ChartImageFormat.Png)

doesn't hang, but results in an empty white rectangle.

@vcsjones
Copy link

You're blocking the message pump. Change ReadLine to System.Windows.Forms.Application.Run() Not sure why this is only happening on 8.1 for you though, I would expect this to fail on any Windows version.

@ashic
Copy link
Author

ashic commented Oct 24, 2013

It probably will...just happen to be running on Windows 8.1. Haven't tried other versions. Any idea how to terminate the app when using Run()? Launch on separate thread? Easier?

@ashic
Copy link
Author

ashic commented Oct 24, 2013

Also, SaveToImage() still gives empty rectangle :(

@ashic
Copy link
Author

ashic commented Oct 24, 2013

Hmmm...seems like you need to call ShowChart() before SaveChartAs() otherwise nothing gets rendered.

Copy link

ghost commented Oct 24, 2013

Please add a bug to http://fsharp.github.io/FSharp.Charting/ and if possible fix it as well :)

@ImaginaryDevelopment
Copy link

hack, but works

   use form = new Form(Width=400, Height=300, Visible=true, Text="Hello charting")
   Chart.Line([for x in 0 ..10 -> x, x+x]).ShowChart()
   System.Windows.Forms.Application.Run(form)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment