0 people like it.

Course 1: World bank

F# introduction course - Exploring World Bank data in Try F#

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
// Load charting and WorldBank type provider
open Samples.Charting.DojoChart
#r "Samples.WorldBank.dll"

// Initiate connection to the WorldBank 
let data = Samples.WorldBank.GetDataContext()

// ------------------------------------------------------------------
// DEMO: Plotting university enrollment data
// ------------------------------------------------------------------

// Get University enrollment from OECD and CZ
let oecd = data.Countries.``OECD members``.Indicators.``School enrollment, tertiary (% gross)``
let cz = data.Countries.``Czech Republic``.Indicators.``School enrollment, tertiary (% gross)``

// Pass data as arguments to chart
Chart.Line(oecd)
Chart.Line(cz)

// Alternative using F# "pipelining"
oecd |> Chart.Line
cz |> Chart.Line

let charts = [ Chart.Line(cz, Name="CZ"); Chart.Line(oecd, Name="OECD") ]
Chart.Combine(charts).WithLegend()

// ------------------------------------------------------------------
// TASK: Compare "Central government debt" of UK, USA, Greece, ...
// ------------------------------------------------------------------

// (...)
val data : obj

Full name: Script.data
val oecd : obj

Full name: Script.oecd
val cz : obj

Full name: Script.cz
val charts : obj list

Full name: Script.charts
Raw view Test code New version

More information

Link:http://fssnip.net/j9
Posted:11 years ago
Author:Tomas Petricek
Tags: worldbank , type provider , try f#