1

I am trying to use F# Charting: Library for Data Visualization https://fslab.org/FSharp.Charting/

I am experiencing basic trouble I've posted my issue on GitHub but I'm cross-posting here https://github.com/fslaborg/FSharp.Charting/issues/126

I am running on Xamarin 6.3 on MacOS Sierra on a recent iMAC

I have loaded FSharp.Charting.Gtk (0.90.14)

BTW is it open FSharp.Charting that i need to use or open FSharp.Charting.Gtk ?

doc says the first one, FSI doesn't complain immediately after the 2nd command, but if i try a method Chart.Line for example then i get the message

System.Exception: Operation could not be completed due to earlier error  The namespace or module 'Chart' is not defined at 3,0

1) Problem when executing after compilation

open System

open FSharp.Charting

let ch = Chart.Line [ for x in 0 .. 10 -> x, x*x ]
ch.ShowChart()


[<EntryPoint>]
let main args =
    printfn "Arguments passed to function : %A" args
    printfn "hello world"
    0

this is what I get

The beginning of the error log looks like

Last login: Thu Apr 20 00:55:57 on ttys000 59x159x64x204:~ ...$ clear; cd "/Users/.../bin/Debug"; export PKG_CONFIG_PATH="/Applications/Xamarin Studio.app/Contents/Resources/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/4.8.1/lib/pkgconfig"; export PKG_CONFIG_LIBDIR=""; export PATH="/Library/Frameworks/Mono.framework/Commands:/Applications/Xamarin Studio.app/Contents/Resources:/Applications/Xamarin Studio.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin"; export MONO_GAC_PREFIX="/Applications/Xamarin Studio.app/Contents/Resources"; export XBUILD_FRAMEWORK_FOLDERS_PATH=""; "/Library/Frameworks/Mono.framework/Versions/4.8.1/bin/mono32" --debug "/Users/.../bin/Debug/The42project.exe" ; echo $? > /var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmp1493d63.tmp; echo; read -p 'Press any key to continue...' -n1; exit

(process:14805): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(process:14805): GLib-GObject-CRITICAL **: gulong g_signal_connect_data(gpointer, const gchar *, GCallback, gpointer, GClosureNotify, GConnectFlags): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(process:14805): Gtk-WARNING **: Screen for GtkWindow not set; you must always set a screen for a GtkWindow before using the window

(process:14805): Gdk-CRITICAL **: GdkColormap *gdk_screen_get_default_colormap(GdkScreen *): assertion `GDK_IS_SCREEN (screen)' failed

full error message here https://gist.github.com/FaguiCurtain/a70fb8d894199f0a65de3a9006fb4758

2) problem when executing in FSI

[Loading /Users/.../packages/FSharp.Charting.Gtk.0.90.14/FSharp.Charting.Gtk.fsx]
 namespace FSI_0001.FSharp.Charting
   val verifyMac : unit -> bool
   val isMac : bool
   module FsiAutoShow = begin
   end
 The search directory '/usr/lib/mono/gtk-sharp-2.0' could not be found at 28,0
 The search directory '/usr/lib/mono/gtk-sharp-2.0' could not be found at 28,0

open FSharp.Charting;;

Chart.Line [ for x in 0 .. 10 -> x, x*x ];;
 Binding session to '/Users/.../packages/FSharp.Charting.Gtk.0.90.14/lib/net40/OxyPlot.dll'...
 Binding session to '/Users/.../packages/FSharp.Charting.Gtk.0.90.14/lib/net40/OxyPlot.GtkSharp.dll'...
 val it : ChartTypes.GenericChart = (Chart)

chart without buttons

in FSI, the chart window opens immediately but it takes 20-30 sec for the chart to actually appear. is it normal it takes so long ? When i hover on the chart, i see no coordinates, is it normal ? i cannot close this window. As you can see on the screenshot, the 3 buttons on the upperleft of the chart window are not activated. I cannot find a way to make this window disappear. is it normal ?

thanks

3) in FSI still if i type a command starting by Chart. i get only a few options, much less than there is in the Library.

Not surprisingly then, if i type for example using Combine which doesn't appear with IntelliSense

     Chart.Combine   [ Chart.Line(msft?Difference |> Series.observations) 
                       Chart.Line(fb?Difference |> Series.observations) ]

System.Exception: Operation could not be completed due to earlier error  The field, constructor or member 'Combine' is not defined at 2,6

enter image description here

Fagui Curtain
  • 1,867
  • 2
  • 19
  • 34
  • 3
    Please don't post code or error messages in the form of screenshots: they're impossible for someone else to Google later on. Screenshots are acceptable to show a specific graphical feature, such as the three buttons on the chart window, but even so they should be trimmed down to just the relevant portion of the screenshot since not everyone has a 2362x1329 screen. Please edit your question and put the error message in the question itself (or if it's really long, in a Gist and quote part of it), put the code in your question as actual text, and trim the screenshot size. Thanks! – rmunn Apr 19 '17 at 16:32
  • @rmunn i edited the question – Fagui Curtain Apr 20 '17 at 00:21
  • Thanks! Now that the question is useful, I've removed my downvote and given it an upvote instead. – rmunn Apr 20 '17 at 00:39
  • thank you for your comment. I added a new point as well. – Fagui Curtain Apr 20 '17 at 03:15
  • my issue is still open. My practical answer to this problem was to use XPlot instead (which is part of FsLab) – Fagui Curtain Apr 24 '17 at 13:32

0 Answers0