I have problems using the charting library XPlot for F# on Linux. When I use the "fsharpi"-command to run a standard example script for the candlestick chart, for instance, the script itself runs without any complains but no browser is opened and nothing is shown.
example-script:
#load "../packages/FsLab/FsLab.fsx"
open XPlot.GoogleCharts
let data =
[
"Mon", 20, 28, 38, 45
"Tue", 31, 38, 55, 66
"Wed", 50, 55, 77, 80
"Thu", 77, 77, 66, 50
"Fri", 68, 66, 22, 15
]
Chart.Candlestick data
If I run it via:
fsharpi "test.fsx"
nothing happens, after some time just another line of the command prompt appears, but also no error occurs. If I run it via:
fsharpi
#load "test.fsx";;
the following output is shown:
[Loading /home/flo/Copy/Mono/FSharp/FinalHashtagVisualizer/packages/FsLab/Shared/Server.fsx
Loading /home/flo/Copy/Mono/FSharp/FinalHashtagVisualizer/packages/FsLab/Shared/Styles.fsx
Loading /home/flo/Copy/Mono/FSharp/FinalHashtagVisualizer/packages/FsLab/Text/FsLab.fsx
Loading /home/flo/Copy/Mono/FSharp/FinalHashtagVisualizer/packages/FsLab/FsLab.fsx
Loading /home/flo/Copy/Mono/FSharp/FinalHashtagVisualizer/HashtagVisualizer/test.fsx]
namespace FSI_0003.FsLab.Formatters
type SimpleServer =
class
new : unit -> SimpleServer
member AddPage : page:string -> string
member
AddPart : part:(Suave.Http.HttpContext ->
Async<Suave.Http.HttpContext option>) -> string
member Port : Suave.Sockets.Port
end
val instance : System.Lazy<SimpleServer>
namespace FSI_0003.FsLab.Formatters
val private defaultStyles :
System.Collections.Generic.IDictionary<string,string>
namespace FSI_0003.FsLab.Formatters
val private displayHtml : html:string -> unit
namespace FSI_0003.FSharp.Charting
type Chart with
static member
Line : data:Deedle.Series<'K,#FSharp.Charting.value> * ?Name:string *
?Title:string * ?Labels:#seq<string> *
?Color:System.Drawing.Color * ?XTitle:string * ?YTitle:string ->
FSharp.Charting.ChartTypes.GenericChart
when 'K : equality and 'K :> FSharp.Charting.key
type Chart with
static member
Column : data:Deedle.Series<'K,#FSharp.Charting.value> * ?Name:string *
?Title:string * ?Labels:#seq<string> *
?Color:System.Drawing.Color * ?XTitle:string * ?YTitle:string ->
FSharp.Charting.ChartTypes.GenericChart
when 'K : equality and 'K :> FSharp.Charting.key
type Chart with
static member
Pie : data:Deedle.Series<'K,#FSharp.Charting.value> * ?Name:string *
?Title:string * ?Labels:#seq<string> * ?Color:System.Drawing.Color *
?XTitle:string * ?YTitle:string ->
FSharp.Charting.ChartTypes.PieChart
when 'K : equality and 'K :> FSharp.Charting.key
type Chart with
static member
Area : data:Deedle.Series<'K,#FSharp.Charting.value> * ?Name:string *
?Title:string * ?Labels:#seq<string> *
?Color:System.Drawing.Color * ?XTitle:string * ?YTitle:string ->
FSharp.Charting.ChartTypes.GenericChart
when 'K : equality and 'K :> FSharp.Charting.key
type Chart with
static member
Bar : data:Deedle.Series<'K,#FSharp.Charting.value> * ?Name:string *
?Title:string * ?Labels:#seq<string> * ?Color:System.Drawing.Color *
?XTitle:string * ?YTitle:string ->
FSharp.Charting.ChartTypes.GenericChart
when 'K : equality and 'K :> FSharp.Charting.key
namespace FSI_0003.MathNet.Numerics.LinearAlgebra
val inline toFrame :
matrix:MathNet.Numerics.LinearAlgebra.Matrix<'a> -> Deedle.Frame<int,int>
when 'a : (new : unit -> 'a) and 'a : struct and
'a :> System.IEquatable<'a> and 'a :> System.IFormattable and
'a :> System.ValueType
val inline ofFrame :
frame:Deedle.Frame<'a,'b> -> MathNet.Numerics.LinearAlgebra.Matrix<float>
when 'a : equality and 'b : equality
val inline ofFrame :
frame:Deedle.Frame<'a,'b> -> MathNet.Numerics.LinearAlgebra.Matrix<float>
when 'a : equality and 'b : equality
val inline toSeries :
vector:MathNet.Numerics.LinearAlgebra.Vector<'a> -> Deedle.Series<int,'a>
when 'a : (new : unit -> 'a) and 'a : struct and
'a :> System.IEquatable<'a> and 'a :> System.IFormattable and
'a :> System.ValueType
val inline ofSeries :
series:Deedle.Series<'a, ^b> ->
MathNet.Numerics.LinearAlgebra.Vector<float>
when 'a : equality and ^b : (static member op_Explicit : ^b -> float)
val inline ofSeries :
series:Deedle.Series<'a, ^b> ->
MathNet.Numerics.LinearAlgebra.Vector<float>
when 'a : equality and ^b : (static member op_Explicit : ^b -> float)
namespace FSI_0003.Deedle
val inline ofMatrix :
matrix:MathNet.Numerics.LinearAlgebra.Matrix<'a> -> Deedle.Frame<int,int>
when 'a : (new : unit -> 'a) and 'a : struct and
'a :> System.IEquatable<'a> and 'a :> System.IFormattable and
'a :> System.ValueType
val inline toMatrix :
frame:Deedle.Frame<'a,'b> -> MathNet.Numerics.LinearAlgebra.Matrix<float>
when 'a : equality and 'b : equality
val ofCsvRows :
data:FSharp.Data.Runtime.CsvFile<'T> -> Deedle.Frame<int,string>
val inline ofVector :
vector:MathNet.Numerics.LinearAlgebra.Vector<'a> -> Deedle.Series<int,'a>
when 'a : (new : unit -> 'a) and 'a : struct and
'a :> System.IEquatable<'a> and 'a :> System.IFormattable and
'a :> System.ValueType
val inline toVector :
series:Deedle.Series<'a, ^b> ->
MathNet.Numerics.LinearAlgebra.Vector<float>
when 'a : equality and ^b : (static member op_Explicit : ^b -> float)
namespace FSI_0003
val data : (string * int * int * int * int) list
I use VS Code and the Ionide-Extension. I installed the FsLab-Package via Fake and generally works well (except for the charting). I created the project via the "new project"-command within VS Code, but I didn't find a way to also run it via a VS Code-command but used the (integrated) console instead. I tried to use NetCore instead of Mono, but didn't find a way to make it work either. The F# Interactive version I use is 4.1, the latest as far as I know.
I hope my question is now specific enough to meet the community guidelines.
As it has been pointed out in the comments you have to pipe the chart to Chart.Show. Thus the following script should work as intended:
#load "../packages/FsLab/FsLab.fsx"
open XPlot.GoogleCharts
let data =
[
"Mon", 20, 28, 38, 45
"Tue", 31, 38, 55, 66
"Wed", 50, 55, 77, 80
"Thu", 77, 77, 66, 50
"Fri", 68, 66, 22, 15
]
Chart.Candlestick data |> Chart.Show