首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何让XPlot在Linux / Mono上工作?

如何让XPlot在Linux / Mono上工作?
EN

Stack Overflow用户
提问于 2018-05-26 06:52:49
回答 1查看 463关注 0票数 2

我在Linux上使用F#的图表库XPlot时遇到了问题。例如,当我使用"fsharpi"-command为烛台图运行一个标准示例脚本时,脚本本身运行时没有任何错误,但是没有打开浏览器,也没有显示任何内容。

示例-脚本:

代码语言:javascript
复制
#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

如果我通过以下方式运行它:

代码语言:javascript
复制
fsharpi "test.fsx"

什么也没发生,过了一段时间后,命令提示符的另一行出现了,但也没有发生错误。如果我通过以下方式运行它:

代码语言:javascript
复制
fsharpi
#load "test.fsx";;

将显示以下输出:

代码语言:javascript
复制
[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

我使用VS Code和Ionide扩展。我通过Fake安装了FsLab-Package,通常工作得很好(图表除外)。我在VS代码中通过“新项目”-command创建了这个项目,但我没有找到一种方法也可以通过VS代码命令来运行它,而是使用了(集成的)控制台。我试着使用NetCore而不是Mono,但也没有找到一种方法。我使用的F#交互版本是4.1,这是我所知道的最新版本。

我希望我的问题现在足够具体,以满足社区的指导方针。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-28 18:19:20

正如评论中所指出的,您必须将图表通过管道传输到Chart.Show。因此,下面的脚本应该可以正常工作:

代码语言:javascript
复制
#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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50537760

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档