XPlot


Google Geo charts

Binder

This example shows how to create geo charts and line charts using the XPlot.GoogleCharts library.

To create a geo chart, use the Chart.Geo function. As usual, you can specify additional options of the chart using Chart.WithOptions including properties such as title, legend and so on. More interestingly, this also lets you specify color axis (for filling countries with a range of colors) and it lets you provide the region parameter for displaying only a part of the world.

A simple geo chart

The following example calls Chart.Geo with a list of key value pairs. Google Charts automatically recognize country names and country codes, so the following readable code works just fine:

open XPlot.GoogleCharts

let pop =
  [ "Germany", 200; "United States", 300
    "Brazil", 400;  "Canada", 500
    "France", 600;  "RU", 700 ]

let chart =
    pop
    |> Chart.Geo
    |> Chart.WithLabel "Popularity"
Google Chart
namespace XPlot
namespace XPlot.GoogleCharts
val pop : (string * int) list
val chart : GoogleChart
type Chart =
  static member Annotation : data:seq<DateTime * #value * string * string> * ?Labels:seq<string> * ?Options:Options -> GoogleChart + 1 overload
  static member Area : data:seq<#value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart + 2 overloads
  static member Bar : data:seq<#value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart + 2 overloads
  static member Bubble : data:seq<string * #value * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart + 2 overloads
  static member Calendar : data:seq<DateTime * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
  static member Candlestick : data:seq<#key * #value * #value * #value * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart + 1 overload
  static member Column : data:seq<#value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart + 2 overloads
  static member Combo : data:seq<#seq<'K * 'V>> * ?Labels:seq<string> * ?Options:Options -> GoogleChart (requires 'K :> key and 'V :> value)
  static member private Create : data:seq<#seq<'T>> -> labels:seq<string> option -> options:Options option -> chartType:ChartGallery -> datumNew:('T -> Datum) -> GoogleChart
  static member private Create' : data:seq<#value> -> labels:seq<string> option -> options:Options option -> chartType:ChartGallery -> GoogleChart
  ...
static member Chart.Geo : data:seq<float * float * #value * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
static member Chart.Geo : data:seq<float * float * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
static member Chart.Geo : data:seq<float * float> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
static member Chart.Geo : data:seq<string * #value * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
static member Chart.Geo : data:seq<string * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
static member Chart.WithLabel : label:string -> chart:GoogleChart -> GoogleChart
member GoogleChart.GetHtml : unit -> string