In this tutorial we will walk through creating a chart in the browser, from an F# script running in Visual Studio Code.
We assume that:
- VS Code is already installed,
- F# is already installed (see fsharp.org under "Use"), and
- VS Code extensions Ionide FSharp and Ionide Paket are installed.
Choose a folder where you want to work, and open it in VS Code.
P to bring up the command palette and type the command
This will create a file called
paket.dependencies so that it looks like this:
1: 2: 3:
Bring up the command palette again with
P and type
This installs the package in your folder. You will see two things:
- a paket.lock file,
- and a "packages" directory, with the following structure:
1: 2: 3: 4: 5: 6: 7: 8:
Now you are ready to start creating a chart.
First, create a new F# script file:
Copy-paste the following code into the editor:
1: 2: 3: 4: 5: 6: 7:
Select all of the code you pasted in and press
Enter to execute it.
That's it! You should see a chart popping up in your browser.
in the path
#r "XPlot.GoogleCharts/lib/net45/, make sure "net45" is right, this is based on
paket.dependencies, specifically the .NET 4.5 framework part (
- you will need an internet connection for the chart to render, as the code relies on Google-hosted services.