F# Charting


F# Charting: Library for Data Visualization

The F# Charting library implements charting suitable for use from F# scripting. Once you load the library as documented in referencing the library document, you can use the members of the Chart type to easily build charts. The following example creates a candlestick chart for a time series and sets the range of the Y axis:

1: 
Chart.Candlestick(priceSeries).WithYAxis(Max = 29.0, Min = 25.0)

Chart

The library provides a composable API for creating charts. For example, you can use the Chart.Combine function to create a chart consisting of multiple line charts. The following example creates a single area showing sample income, expenses and profit in a single chart:

1: 
2: 
3: 
4: 
Chart.Combine(
   [ Chart.Line(expectedIncome,Name="Income")
     Chart.Line(expectedExpenses,Name="Expenses") 
     Chart.Line(computedProfit,Name="Profit") ])

Chart

How to get F# Charting

F# Charting features

  • Cross-platform 2D charting and support for pseudo-3D charts on .NET.
  • Many cross-platform chart types: Area, Bar, Bubble, Column, Line, Point and more.
  • Create charts directly from F# data such as lists and tuples.
  • Use either fluent or pipelined chart specifications.
  • Create updating 'LiveChart' charts from F# or Rx observables.
  • Can be used in conjunction with the FSharp.Data library.
  • Many extra chart types (Windows-only): BoxPlot, Candlestick, Doughnut, ErrorBar, FastLine, FastPoint, Funnel, Kagi and more.

Approach, history and future

This library is a successor to FSharpChart. The last version of FSharpChart was version 0.61.

F# Charting uses simple, declarative chart specifications. On Windows, F# Charting is implemented using the Data Visualization charting controls available on Windows in .NET 4.x. On OSX, F# Charting is implemented using the OxyPlot.GtkSharp charting library.

F# Charting is designed so that the same charting specifications can be supported when using different charting implementations. For example, the Try F# charts use similar charting specifications, implemented using in HTML5 using Dojo Charts.

The next step we would like to try is to implement cross-platform Javascript-based charting using embedded browser controls.

Contributing

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding new public API, please also contribute examples that can be turned into a documentation.

  • If you want to discuss an issue or feature that you want to add the to the library, then you can submit an issue or feature request via Github or you can send an email to the F# open source mailing list.

  • For more information about the library architecture, organization and more see the contributing page.

  • The documentation is automatically generated from *.fsx files in the docs/content folder. If you find a typo, please submit a pull request!

Library license

The library is available under the MIT licence. For more information see the License file in the GitHub repository. In summary, this means that you can use the library for commercial purposes, fork it, modify it as you wish.

type Chart =
  static member Area : data:seq<#value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> GenericChart
  static member Area : data:seq<#key * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> GenericChart
  static member Bar : data:seq<#value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> GenericChart
  static member Bar : data:seq<#key * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> GenericChart
  static member BoxPlotFromData : data:seq<#key * #seq<'a2>> * ?Name:string * ?Title:string * ?Color:Color * ?XTitle:string * ?YTitle:string * ?Percentile:int * ?ShowAverage:bool * ?ShowMedian:bool * ?ShowUnusualValues:bool * ?WhiskerPercentile:int -> GenericChart (requires 'a2 :> value)
  static member BoxPlotFromStatistics : data:seq<#key * #value * #value * #value * #value * #value * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string * ?Percentile:int * ?ShowAverage:bool * ?ShowMedian:bool * ?ShowUnusualValues:bool * ?WhiskerPercentile:int -> GenericChart
  static member Bubble : data:seq<#value * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string * ?BubbleMaxSize:int * ?BubbleMinSize:int * ?BubbleScaleMax:float * ?BubbleScaleMin:float * ?UseSizeForLabel:bool -> GenericChart
  static member Bubble : data:seq<#key * #value * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string * ?BubbleMaxSize:int * ?BubbleMinSize:int * ?BubbleScaleMax:float * ?BubbleScaleMin:float * ?UseSizeForLabel:bool -> GenericChart
  static member Candlestick : data:seq<#value * #value * #value * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> CandlestickChart
  static member Candlestick : data:seq<#key * #value * #value * #value * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> CandlestickChart
  ...

Full name: FSharp.Charting.Chart
static member Chart.Candlestick : data:seq<#value * #value * #value * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Drawing.Color * ?XTitle:string * ?YTitle:string -> ChartTypes.CandlestickChart
static member Chart.Candlestick : data:seq<#key * #value * #value * #value * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Drawing.Color * ?XTitle:string * ?YTitle:string -> ChartTypes.CandlestickChart
val priceSeries : (string * float * float * float * float) list

Full name: Index.priceSeries
static member Chart.Combine : charts:seq<ChartTypes.GenericChart> -> ChartTypes.GenericChart
static member Chart.Line : data:seq<#value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Drawing.Color * ?XTitle:string * ?YTitle:string -> ChartTypes.GenericChart
static member Chart.Line : data:seq<#key * #value> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Drawing.Color * ?XTitle:string * ?YTitle:string -> ChartTypes.GenericChart
val expectedIncome : (DateTime * float) list

Full name: Index.expectedIncome
val expectedExpenses : (DateTime * float) list

Full name: Index.expectedExpenses
val computedProfit : (DateTime * float) list

Full name: Index.computedProfit
Fork me on GitHub