2
  1. Create a new FSharp Console project via VS2015
  2. Add FSharp.Data and FSharp.Charting nuget package.
  3. In Program.fs import both the packages

open FSharp.Charting open Fsharp.Data

After the import I am able to use functions provided in FSharp.Data package but not in FSharp.Charting.

NOTE: In case of script (.fsx) file, which created in the same project, I am able to use both after adding their reference.

I just wanted to to know if there are any steps i am missing for adding any reference in a .fs file. If yes then why does it work with respect to FSharp.Data package.

s952163
  • 6,276
  • 4
  • 23
  • 47
Parshuram
  • 67
  • 1
  • 8

1 Answers1

0

I think if you search SO you'll find a few examples of displaying charts with FSharp.Charting. It's not exactly clear what sort of error are you getting. Assuming you are on Windows this should work:

open FSharp.Charting
open System

[<STAThread>]
[<EntryPoint>]
let main argv = 
    Chart.Line [ for x in 0 .. 10 -> x, x*x ] |> Chart.Show
    printfn "%A" argv
    0 // return an integer exit code

You will need to add references to System.Windows.Forms, System.Windows.Forms.DataVisualization and System.Drawing.

s952163
  • 6,276
  • 4
  • 23
  • 47
  • I had not added the System references... But in case of .fsx files I had not added those references and still the Charting functions were available. – Parshuram Feb 19 '17 at 15:58
  • @Parshuram Well, you never show how you actually reference FSharp.Charting. Two things to keep in mind, if you`re `#load`-ing FSLab or the FSharp.Charting fsx scripts it will do some set up for you. Also, FSI itself might open System and a couple of other namespaces (I haven't tested the latter). – s952163 Feb 19 '17 at 23:08