BT

Introducing XPlot, a Chart Generation Library for F#

| by Pierre-Luc Maheu Follow 4 Followers on Dec 31, 2015. Estimated reading time: 1 minute |

XPlot is a cross-platform data visualization package for F# powered by JavaScript charting libraries Google Charts and Plotly. The XPlot library can be used interactively from F# Interactive, but charts can also be embedded in F# applications and in HTML reports.

XPlot acts as a F# wrapper around Javascript libraries. Using the API to generate a chart using Google Charts or Plotly as a provider, XPlot produces Html and Javascript code.

XPlot charts can be created dynamically and rendered in a web application.  For example, this code produces a bar chart displaying statuses with their respective occurrence:

open XPlot.GoogleCharts

let statusCount () =
  let series = [("Open",23); ("In Progress",5); ("Resolved", 58); ("Closed",5)]

  let options =
      Options(title = "Status", orientation = "horizontal")

  if series |> Seq.isEmpty then "no data" else
      let chart = 
        series
        |> Chart.Bar
        |> Chart.WithOptions options
        |> Chart.WithLabels ["Count"]
      chart.InlineHtml

The html output can then be embedded in a web application. The code above would produce this chart:

The charts generated by XPlot can be rendered from an F# application, but they can also be used from C#. This means a web or WPF application written in C# could use XPlot to generate a chart and then render the output.

Xplot is also available as part of the data science package FsLab. FsLab also contains librairies for data access and analysis, which can then be rendered using XPlot.

 

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT