1

使用 FSharp.Charting 绘制 Deedle DataFrame 或 Series 时,FSLAB 可以方便地重载各种 Chart 函数以直接使用 Series。所以我可以做Series(x,y) |> Chart.Column例子。但是在编译 Deedle 和 FSharp.Charting 时直接引用,并且需要将 Series 转换为 Series.observationsSeries(x,y) |> Series.observations |> Chart.Column

有没有办法避免Series.observations?还是我需要为所有不同的图表功能定义扩展方法?这是Plotting Deedle 框架中建议的内容

这是我在 FSI 或 .exe 中使用的代码:

#if INTERACTIVE
#load @"..\..\FSLAB\packages\FsLab\FsLab.fsx"
#r @"Deedle"
#r @"Fsharp.Charting"
#endif

open System
open Deedle
open FSharp.Charting
open FSharp.Charting.ChartTypes
open System.Drawing
open System.Windows.Forms

   [<STAThread>]
   [<EntryPoint>]
   let main argv = 
        let x = ['a'..'j'] |> List.map string     
        let y = [1..10]
        let chart1 = Series(x,y) |> Series.observations |>  Chart.Column
        let myChartControl = new ChartControl(chart1, Dock=DockStyle.Fill)
        let form = new Form(Visible = true, TopMost = true, Width = 700, Height = 500)
        form.Controls.Add(myChartControl)
        do Application.Run(form) |> ignore
4

1 回答 1

2

FsLab.fsx当您从脚本文件中引用 FsLab 时,在加载的文件中定义了方便的重载。您可以在此处的源代码中看到它们

我们想将它们移动到dll您可以参考的位置,但目前,最简单的选择是将帮助程序复制到项目中的单独文件中,并且只拥有一个本地副本。

于 2016-05-12T18:29:40.183 回答