gpt4 book ai didi

charts - 我的 F# 图表库在项目中不起作用

转载 作者:行者123 更新时间:2023-12-02 04:20:19 25 4
gpt4 key购买 nike

open FSharp.Charting
open System

[<EntryPoint>]
let main argv =
printfn "%A" argv
let x = Chart.Line [ for x in -100 .. 100 -> x, pown x 3]
let y = Console.ReadKey();
0 //return an integer exit code

您好,我正在尝试在项目模式下使用F#,不是脚本。到目前为止,我已经有了上面的代码,它告诉我添加对 System.Drawing 的引用,我也这样做了。

编译时出现 0 个错误或警告,并且运行得很好。控制台屏幕出现,但没有任何其他 react 。图表只是不显示或任何东西。

我已经在交互窗口中尝试过这个,它在那里工作得非常好。有什么想法吗?

最佳答案

正如 @s952163 提到的,您可以将其包装到 Winforms。但是,ShowChart() 已经返回 System.Windows.Form 值。因此,只要您使用 Application.Run(f) 泵送事件,此代码也可以正常工作:

[<EntryPoint>]
let main argv =
printfn "%A" argv
let f = (Chart.Line [ for x in -100 .. 100 -> x, pown x 3]).ShowChart()
System.Windows.Forms.Application.Run(f)
0

关于charts - 我的 F# 图表库在项目中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35762194/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com