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
Hello, I'm trying to play with the F# in PROJECT mode NOT a script. So far I have the code above as well as it told me to add a reference to System.Drawing which I also did.
I have 0 errors or warnings when I compile and it runs perfectly fine. The console screen appears but nothing else happens. The graph just doesn't show up or anything.
I HAVE tried this in the interactive window and it works perfectly fine there. Any ideas?
F-Secure Corporation (formerly Data Fellows) is a global cyber security and privacy company with over 30 offices around the world and is headquartered in Helsinki, Finland.
F‑Secure FREEDOME VPN is the best VPN service for safeguarding your privacy. F-Secure FREEDOME VPN has been made to protect your privacy on the net. It encrypts your traffic and conceals your actual IP address. In addition, it includes features which actively block trackers that follow you on the internet.
Is F-Secure Antivirus Software Good? F-Secure antivirus software is good and did well in our rating. F-Secure provides browsing and safe banking protections, parental controls, and a unique Finder Android/iPhone smartphone locator function to its mid-range SAFE plan.
Log in to My F-Secure. On the My F-Secure page, you can view the details of your subscription (subscription period, remaining days left, and number of free licenses). For more subscription-related information, select Subscription in the top bar.
As @s952163 mentioned, you could wrap it to Winforms. However, ShowChart()
already returns System.Windows.Form
value. So, as long as you're pumping events with Application.Run(f)
, this code works fine too:
[<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
You should just wrap it in Winforms. Please see: How to display an FSharp.Charting graph in an existing form?
A very barebones example:
open FSharp.Charting
open System
open System.Windows.Forms
[<STAThread>]
[<EntryPoint>]
let main argv =
printfn "%A" argv
let chart = Chart.Line [ for x in -100 .. 100 -> x, pown x 3]
let f1 = new Form(Visible = true, TopMost = true, Width = 700, Height = 500)
f1.Controls.Add(new ChartTypes.ChartControl(chart, Dock = DockStyle.Fill))
Application.Run(f1)
0 // return an integer exit code
Please reference System.Drawing, System.Windows.Forms, System.Windows.Forms.DataVisualization
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With