Carl Nolan’s ramblings on development
The new version of FSharp.Chart (formely FSharpChart) can now be found on GitHib at: http://fsharp.github.io/FSharp.Charting/
In the recent version of FSharpChart several examples are given around using FSharpChart and Windows Presentation Foundation (WPF).
The first sample is included in the sample script file SampleChartingForms.fsx. This sample demonstrates how to render a FSharpChart using WPF from within a fsx script file:
Thanks to Keith Battocchi for this code snippet.
The second sample is a WPF project that demonstrates how to use FSharpChart through Windows Forms Integration. A sample is given with and without the use of a XAML file. Thanks to Ryan Simpson for these samples.
The code to render a FSharpChart without XAML is very similar to that of the scripting sample:
When using a XAML file things are a little different.
Firstly one has to define the XAML that will be loaded:
The idea is that the WindowsFormsHost element is defined with the ChartControl:
As you can see rendering a FSharpChart is easily rendered within a WPF application.