XPlot


Google Geo charts

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:

1: 
2: 
3: 
4: 
5: 
6: 
7: 
let pop =
  [ "Germany", 200; "United States", 300
    "Brazil", 400;  "Canada", 500
    "France", 600;  "RU", 700 ]
pop
|> Chart.Geo
|> Chart.WithLabel "Popularity"
namespace XPlot
namespace XPlot.GoogleCharts
val pop : (string * int) list

Full name: Google-geo-chart.pop
type Chart =
  static member Annotation : data:seq<#seq<DateTime * 'V * string * string>> * ?Labels:seq<string> * ?Options:Options -> GoogleChart (requires 'V :> value)
  static member Annotation : data:seq<DateTime * #value * string * string> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
  static member Area : data:seq<#seq<'K * 'V>> * ?Labels:seq<string> * ?Options:Options -> GoogleChart (requires 'K :> key and 'V :> value)
  static member Area : data:seq<#key * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
  static member Area : data:seq<#value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
  static member Bar : data:seq<#seq<'K * 'V>> * ?Labels:seq<string> * ?Options:Options -> GoogleChart (requires 'K :> key and 'V :> value)
  static member Bar : data:seq<#key * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
  static member Bar : data:seq<#value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
  static member Bubble : data:seq<string * #value * #value * #value * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
  static member Bubble : data:seq<string * #value * #value * #value> * ?Labels:seq<string> * ?Options:Options -> GoogleChart
  ...

Full name: XPlot.GoogleCharts.Chart
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
Fork me on GitHub