Skip to main content

Filtering nodes

The map was quite cluttered when all the players were shown, so lets filter to only show those who have been World Champions.

Visualization

NetPanorama specification


{
"data": [
{
"name": "players",
"format": {"type": "csv"},
"url": "/data/tulip/chess.candidates.1948.1990.csv",
"transform": [
{"type": "addIndex", "as": "id"},
{"type": "geocode", "locationField": "Birth Place" }
]
},
{
"name": "games",
"format": {"type": "csv"},
"url": "/data/tulip/wcc.games.1948.1990.csv"
}
],

"networks": [
{
"name": "net",
"nodes": "players",
"links": "games",
"directed": false,
"source_node": [ "Name", "Player 1" ],
"target_node": [ "Name", "Player 2" ],

We apply a filter transform.


"transform": [
{"type": "filterNodes", "expression": "datum.Status == '2' "}
]


}
],



"maps": [
{
"name": "my_map",
"tiles": "Stamen_TerrainBackground",
"zoomLevel": 3,
"center": [51.5062, -0.1263]
}
],

"layouts": [
{
"name": "net-layout",
"network": "net",

"map": "my_map",
"lat": {"field": "lat"},
"lng": {"field": "lon"}
}

],


"vis": [
{
"entries": "net.links",
"layout": "net-layout",
"mark": {
"type": "linkpath",
"start": "source",
"end": "target"
}
},
{
"entries": "net.nodes",
"layout": "net-layout",
"mark": {
"type": "circle",
"area": 70,
"fill": "steelblue",
"tooltip": { "field": "Name" }
}
},


{

"mark":{
"type": "map",
"map": "my_map"
},

},

]

}