在Linqpad F#中显示DataVisualization中的图表,可以按照以下步骤进行操作:
System.Windows.Forms.DataVisualization.Charting
和System.Drawing
。#r "System.Windows.Forms.DataVisualization"
#r "System.Drawing"
open System.Windows.Forms.DataVisualization.Charting
open System.Drawing
let chart = new Chart()
chart.Size <- new Size(500, 300)
chart.ChartAreas.Add(new ChartArea())
let series = new Series()
series.ChartType <- SeriesChartType.Column
series.Points.AddXY("Category 1", 10)
series.Points.AddXY("Category 2", 20)
series.Points.AddXY("Category 3", 15)
chart.Series.Add(series)
let form = new Form()
form.Controls.Add(chart)
form.Show()
完整的代码如下:
#r "System.Windows.Forms.DataVisualization"
#r "System.Drawing"
open System.Windows.Forms.DataVisualization.Charting
open System.Drawing
let chart = new Chart()
chart.Size <- new Size(500, 300)
chart.ChartAreas.Add(new ChartArea())
let series = new Series()
series.ChartType <- SeriesChartType.Column
series.Points.AddXY("Category 1", 10)
series.Points.AddXY("Category 2", 20)
series.Points.AddXY("Category 3", 15)
chart.Series.Add(series)
let form = new Form()
form.Controls.Add(chart)
form.Show()
这样,你就可以在Linqpad F#中显示DataVisualization中的图表了。
领取专属 10元无门槛券
手把手带您无忧上云