How to make Fsharp show Charting?

1.4k Views Asked by At
Chart.Line [ for x in 1.0 .. 100.0 -> (x, x ** 2.0) ]

I tried many times in order to see the Charting from Fsharp as F# Charting

I install some extensions which I think needed :

  • Fsharp.Charting
  • Fsharp.Chart
  • Fsharp.Charting.Gtk
  • Microsoft.Chart.Controls

But all it seems not enough for me to do . Could you give me some helpfull guide ? Thank you very much .

enter image description here

enter image description here

3

There are 3 best solutions below

4
Tomas Petricek On BEST ANSWER

If you are running this from F# Interactive and you are referencing the library using the recommended method, then the loading registers a handler with F# Interactive that will open charts automatically when you run the line that creates a chart. That is, load the library using:

#I "packages/FSharp.Charting"
#load "FSharp.Charting.fsx"

And then create chart using:

Chart.Line [ for x in 1.0 .. 100.0 -> (x, x ** 2.0) ]

If you are not inside a script, or if you are referencing just the dll (or if your editor handles F# Scripts differently than the standard editors - which I don't think should be the case), then you need to call Show method explicitly:

Chart.Line [ for x in 1.0 .. 100.0 -> (x, x ** 2.0) ]
|> Chart.Show
1
JosephStevens On

Add System.Drawing reference to your project via: Right click on references > Assemblies > FrameWork > System.Drawing

then try this code instead.

open FSharp.Charting

Chart.Line [ for x in 1.0 .. 100.0 -> (x, x ** 2.0) ]
|> Chart.Show

[<EntryPoint>]
let main argv = 0
0
AudioBubble On

If you were I , you can Uninstall + Install Visual Emprise .

This's reasons takes me many times .

Thank you everyone who help me in my difficulty .

Related Questions in F#

Related Questions in F#-DATA