Changes
Jump to navigation
Jump to search
Extension:Graph/Demo/Map (view source)
Revision as of 07:30, 19 February 2016
, 07:30, 19 February 2016Extension:Graph/Demo/CategoryPie based self+source-view
<includeonly>{{#tag:graph|</includeonly><noinclude>{{:{{FULLPAGENAME}} }}<br>'''<graph>'''{{#tag:syntaxhighlight|</noinclude>{
"version": 2,
"width": {{{width|1}}},
"height": {{{height|1}}},
"data": [
{
"name": "highlights",
"values": {{{1|{{#invoke:Graph:Utils|expandDict|{"BR":"pink","US":"blue","CN":"red","DZ":"green","AU":"purple"} }}}}}
},
{
"name": "countries",
"url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json",
"format": {"type": "topojson", "feature": "countries"},
"transform": [
{
"type": "geopath",
"value": "data",
"scale": {{{scale|80}}},
"translate":[0,0],
"projection": "equirectangular"
},
{
"type": "lookup",
"keys": [ "id" ],
"on": "highlights",
"onKey": "id",
"as": [ "zipped" ],
"default": {
"v": "{{{default|#C0C0C0}}}"
}
}
]
}
],
"marks": [
{
"type": "path",
"from": {
"data": "countries"
},
"properties": {
"enter": {
"path": {
"field": "layout_path"
}
},
"update": {
"fill": {
"field": "zipped.v"
}
},
"hover": {
"fill": {
"value": "#989898"
}
}
}
}
]
}<includeonly>}}</includeonly><noinclude>|lang=javascript}}'''</graph>'''</noinclude>
"version": 2,
"width": {{{width|1}}},
"height": {{{height|1}}},
"data": [
{
"name": "highlights",
"values": {{{1|{{#invoke:Graph:Utils|expandDict|{"BR":"pink","US":"blue","CN":"red","DZ":"green","AU":"purple"} }}}}}
},
{
"name": "countries",
"url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json",
"format": {"type": "topojson", "feature": "countries"},
"transform": [
{
"type": "geopath",
"value": "data",
"scale": {{{scale|80}}},
"translate":[0,0],
"projection": "equirectangular"
},
{
"type": "lookup",
"keys": [ "id" ],
"on": "highlights",
"onKey": "id",
"as": [ "zipped" ],
"default": {
"v": "{{{default|#C0C0C0}}}"
}
}
]
}
],
"marks": [
{
"type": "path",
"from": {
"data": "countries"
},
"properties": {
"enter": {
"path": {
"field": "layout_path"
}
},
"update": {
"fill": {
"field": "zipped.v"
}
},
"hover": {
"fill": {
"value": "#989898"
}
}
}
}
]
}<includeonly>}}</includeonly><noinclude>|lang=javascript}}'''</graph>'''</noinclude>