I’m just back from giving an F# talk at Microsoft TechDays in Sweden, which was a very enjoyable trip.
One of the things I show in my talks these days is the use of the .NET 4.0 charting controls with F# to display some data from F# Interactive in Visual Studio 2010. This uses a sample set of wrappers we’ve developed which we’re calling FSharpChart. This was inspired by the LChart sample started by Luca Bolognese. These are thin F# wrappers over the charting types in the System.Windows.Forms.DataVisualization.Charting namespace.
In FSharpChart. we’ve used a number of interesting F# techniques to get the design to scale to the full set of .NET 4.0 charting controls. This is one of the reasons we’re releasing this sample – to show interesting F# design techniques, as well as to light up useful .NET 4.0 functionality with F# 2.0 in Visual Studio 2010.
[ for f in 1.0 .. 0.1 .. 10.0 -> f, sin (f * 2.0) + cos f ]
gives the chart below. Many more samples are shown in the documentation,
The sample itself is interesting from a number of persepctives
- Charts display automatically in F# interactive when you evaluate an expression of “chart” type
- There are numerous interesting F# coding techniques displayed. We’ll walk through some of those in future blog posts.
- The same basic shape of charting controls is supported by ASP.NET. This sample doesn’t wrap those, but we may do that in future versions.