登录论坛

查看完整版本 : 如何在F#中绘制数据序列?


poster
2019-12-10, 20:48
在FSHUB上 (http://cs.hubfs.net/forums/post/16161.aspx) , LethalLavaLand (http://cs.hubfs.net/members/LethalLavaLand.aspx)说,

让我画出我的价值观!

所以问题是,如何使用内置的.NET 4.0控件在F#中绘制数据序列?



回答:

由于我最近一直在使用.NET 4.0中的内置Microsoft Charting Controls(并且喜欢它的每一分钟!),所以我认为我会努力回答自己的问题...

#r "System.Windows.Forms.DataVisualization" open System.Windows.Forms open System.Windows.Forms.DataVisualization.Charting type LineChartForm( title, xs : float seq ) = inherit Form( Text=title ) let chart = new Chart(Dock=DockStyle.Fill) let area = new ChartArea(Name="Area1") let series = new Series() do series.ChartType Seq.iter (series.Points.Add >> ignore) do series.ChartArea