Skip to content

Instantly share code, notes, and snippets.

@simonhearne
Created May 22, 2019 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonhearne/054e73324e32233d82f1fc110b8dae48 to your computer and use it in GitHub Desktop.
Save simonhearne/054e73324e32233d82f1fc110b8dae48 to your computer and use it in GitHub Desktop.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 900,
"height": 500,
"autosize": "none",
"padding": 0,
"title": {
"text": "Akamai CloudTest Locations",
"zindex": 10
},
"encode": {
"update": {
"fill": {"value": "white"}
}
},
"signals": [
{"name": "type", "value": "equirectangular"},
{ "name": "scale", "value": 170},
{ "name": "center0", "value": 15},
{ "name": "center1", "value": 60},
{ "name": "translate0", "update": "(width / 2)" },
{ "name": "translate1", "update": "(height / 4)" },
{
"name": "highlight_provider",
"value": null,
"on": [
{
"events": "@legendSymbol:mouseover, @legendLabel:mouseover",
"update": "datum.value"
},
{
"events": "@points:mouseover",
"update": "datum.properties.provider"
},
{
"events": "@points:mouseout, @legendSymbol:mouseout, @legendLabel:mouseout",
"update": "null"
}
]
},
{
"name": "highlight_name",
"value": null,
"on": [
{
"events": "@points:mouseover",
"update": "datum.properties.name",
"force": true
},
{
"events": "@points:mouseout",
"update": "null",
"force": true
}
]
}
],
"projections": [
{
"name": "projection",
"type": {"signal": "type"},
"scale": {"signal": "scale"},
"center": [
{"signal": "center0"},
{"signal": "center1"}
],
"translate": [
{"signal": "translate0"},
{"signal": "translate1"}
]
}
],
"data": [
{
"name": "world",
"url": "data/world-110m.json",
"format": {
"type": "topojson",
"feature": "countries"
}
},
{
"name": "locations",
"values": [
{
"type": "Feature",
"properties": {
"name": "N. Virginia",
"provider": "AWS",
"id": "us-east-1"
},
"geometry": {
"type": "Point",
"coordinates": [-77.1,38.9]
}
},
{
"type": "Feature",
"properties": {
"name": "Ohio",
"provider": "AWS",
"id": "us-east-2"
},
"geometry": {
"type": "Point",
"coordinates": [-83,40]
}
},
{
"type": "Feature",
"properties": {
"name": "N. California",
"provider": "AWS",
"id": "us-west-1"
},
"geometry": {
"type": "Point",
"coordinates": [-122.3,37.9]
}
},
{
"type": "Feature",
"properties": {
"name": "Oregon",
"provider": "AWS",
"id": "us-west-2"
},
"geometry": {
"type": "Point",
"coordinates": [-122.6,45.6]
}
},
{
"type": "Feature",
"properties": {
"name": "Canada",
"provider": "AWS",
"id": "ca-central-1"
},
"geometry": {
"type": "Point",
"coordinates": [-73.6,45.5]
}
},
{
"type": "Feature",
"properties": {
"name": "Frankfurt",
"provider": "AWS",
"id": "eu-central-1"
},
"geometry": {
"type": "Point",
"coordinates": [8.7,50.1]
}
},
{
"type": "Feature",
"properties": {
"name": "Ireland",
"provider": "AWS",
"id": "eu-west-1"
},
"geometry": {
"type": "Point",
"coordinates": [-6.3,53.3]
}
},
{
"type": "Feature",
"properties": {
"name": "London",
"provider": "AWS",
"id": "eu-west-2"
},
"geometry": {
"type": "Point",
"coordinates": [-0.1,51.5]
}
},
{
"type": "Feature",
"properties": {
"name": "Paris",
"provider": "AWS",
"id": "eu-west-3"
},
"geometry": {
"type": "Point",
"coordinates": [2.4,48.9]
}
},
{
"type": "Feature",
"properties": {
"name": "Stockholm",
"provider": "AWS",
"id": "eu-north-1",
"coming": true
},
"geometry": {
"type": "Point",
"coordinates": [18.1,59.3]
}
},
{
"type": "Feature",
"properties": {
"name": "Hong Kong",
"provider": "AWS",
"id": "ap-east-1"
},
"geometry": {
"type": "Point",
"coordinates": [114.1,22.4]
}
},
{
"type": "Feature",
"properties": {
"name": "Tokyo",
"provider": "AWS",
"id": "ap-northeast-1"
},
"geometry": {
"type": "Point",
"coordinates": [139.7,35.7]
}
},
{
"type": "Feature",
"properties": {
"name": "Seoul",
"provider": "AWS",
"id": "ap-northeast-2"
},
"geometry": {
"type": "Point",
"coordinates": [127.0,37.6]
}
},
{
"type": "Feature",
"properties": {
"name": "Osaka",
"provider": "AWS",
"id": "ap-northeast-3"
},
"geometry": {
"type": "Point",
"coordinates": [135.5,34.7]
}
},
{
"type": "Feature",
"properties": {
"name": "Singapore",
"provider": "AWS",
"id": "ap-southeast-1"
},
"geometry": {
"type": "Point",
"coordinates": [103.8,1.4]
}
},
{
"type": "Feature",
"properties": {
"name": "Sydney",
"provider": "AWS",
"id": "ap-southeast-2"
},
"geometry": {
"type": "Point",
"coordinates": [151.2,-33.9]
}
},
{
"type": "Feature",
"properties": {
"name": "Mumbai",
"provider": "AWS",
"id": "ap-south-1"
},
"geometry": {
"type": "Point",
"coordinates": [72.9,19.1]
}
},
{
"type": "Feature",
"properties": {
"name": "São Paulo",
"provider": "AWS",
"id": "sa-east-1"
},
"geometry": {
"type": "Point",
"coordinates": [-46.6,-23.6]
}
},
{
"type": "Feature",
"properties": {
"name": "Hong Kong",
"provider": "Azure",
"id": "sa-east-1"
},
"geometry": {
"type": "Point",
"coordinates": [116,23]
}
},
{
"type": "Feature",
"properties": {
"name": "Singapore",
"provider": "Azure",
"id": "sa-east-1"
},
"geometry": {
"type": "Point",
"coordinates": [103,0]
}
},
{
"type": "Feature",
"properties": {
"name": "São Paulo",
"provider": "Azure",
"id": "sa-east-1"
},
"geometry": {
"type": "Point",
"coordinates": [-45,-23]
}
},
{
"type": "Feature",
"properties": {
"name": "Amsterdam",
"provider": "Azure",
"id": "sa-east-1"
},
"geometry": {
"type": "Point",
"coordinates": [4.9,52.4]
}
},
{
"type": "Feature",
"properties": {
"name": "Ireland",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [-6,53]
}
},
{
"type": "Feature",
"properties": {
"name": "Tokyo",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [140,35]
}
},
{
"type": "Feature",
"properties": {
"name": "Osaka",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [135,34]
}
},
{
"type": "Feature",
"properties": {
"name": "Osaka",
"provider": "Azure",
"id": "ap-northeast-3"
},
"geometry": {
"type": "Point",
"coordinates": [135,34]
}
},
{
"type": "Feature",
"properties": {
"name": "Iowa",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [-93.1,41.9]
}
},
{
"type": "Feature",
"properties": {
"name": "Virginia",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [-78.7,37.4]
}
},
{
"type": "Feature",
"properties": {
"name": "Chicago",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [-87.6,41.9]
}
},
{
"type": "Feature",
"properties": {
"name": "Dallas",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [-96.8,32.8]
}
},
{
"type": "Feature",
"properties": {
"name": "California",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [-122,37]
}
},
{
"type": "Feature",
"properties": {
"name": "Paris",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [2,48]
}
},
{
"type": "Feature",
"properties": {
"name": "South Africa North",
"provider": "Azure"
},
"geometry": {
"type": "Point",
"coordinates": [28,-26.2]
}
},
{
"type": "Feature",
"properties": {
"name": "Dallas",
"provider": "Rackspace"
},
"geometry": {
"type": "Point",
"coordinates": [-96.8,32.8]
}
},
{
"type": "Feature",
"properties": {
"name": "Chicago",
"provider": "Rackspace"
},
"geometry": {
"type": "Point",
"coordinates": [-87.6,41.9]
}
},
{
"type": "Feature",
"properties": {
"name": "London",
"provider": "Rackspace"
},
"geometry": {
"type": "Point",
"coordinates": [0,52]
}
},
{
"type": "Feature",
"properties": {
"name": "Northern Virginia",
"provider": "Rackspace"
},
"geometry": {
"type": "Point",
"coordinates": [-78,38]
}
},
{
"type": "Feature",
"properties": {
"name": "Canada",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [-73,46]
}
},
{
"type": "Feature",
"properties": {
"name": "Finland",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [24.9,60.2]
}
},
{
"type": "Feature",
"properties": {
"name": "Belgium",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [4.4,50.9]
}
},
{
"type": "Feature",
"properties": {
"name": "Frankfurt",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [8.7,50.1]
}
},
{
"type": "Feature",
"properties": {
"name": "London",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [1,52]
}
},
{
"type": "Feature",
"properties": {
"name": "Netherlands",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [6.8,53.4]
}
},
{
"type": "Feature",
"properties": {
"name": "Switzerland",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [8.5,47.4]
}
},
{
"type": "Feature",
"properties": {
"name": "Hong Kong",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [114.5,24]
}
},
{
"type": "Feature",
"properties": {
"name": "Japan",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [139,35]
}
},
{
"type": "Feature",
"properties": {
"name": "Mumbai",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [72,19]
}
},
{
"type": "Feature",
"properties": {
"name": "Singapore",
"provider": "GCE"
},
"geometry": {
"type": "Point",
"coordinates": [102,1]
}
},
{
"type": "Feature",
"properties": {
"provider": "GCE",
"name": "São Paulo"
},
"geometry": {
"type": "Point",
"coordinates": [-46,-22]
}
},
{
"type": "Feature",
"properties": {
"provider": "GCE",
"name": "Sydney"
},
"geometry": {
"type": "Point",
"coordinates": [152,-33]
}
},
{
"type": "Feature",
"properties": {
"provider": "GCE",
"name": "Taiwan"
},
"geometry": {
"type": "Point",
"coordinates": [121,23.7]
}
},
{
"type": "Feature",
"properties": {
"provider": "GCE",
"name": "Idaho"
},
"geometry": {
"type": "Point",
"coordinates": [-114.7,44]
}
},
{
"type": "Feature",
"properties": {
"provider": "GCE",
"name": "Virginia"
},
"geometry": {
"type": "Point",
"coordinates": [-79.5,38]
}
},
{
"type": "Feature",
"properties": {
"provider": "GCE",
"name": "South Carolina"
},
"geometry": {
"type": "Point",
"coordinates": [-81.1,33.8]
}
},
{
"type": "Feature",
"properties": {
"provider": "GCE",
"name": "Los Angeles"
},
"geometry": {
"type": "Point",
"coordinates": [-118.2,34.1]
}
},
{
"type": "Feature",
"properties": {
"provider": "GCE",
"name": "Oregon"
},
"geometry": {
"type": "Point",
"coordinates": [-122,45]
}
}
],
"transform": [
{
"type": "geopoint",
"projection": "projection",
"fields": ["geometry.coordinates[0]","geometry.coordinates[1]"]
}
]
}
],
"scales": [
{
"name": "providercolor",
"type": "ordinal",
"range": "category",
"domain": {"data": "locations","field": "properties.provider"}
}
],
"marks": [
{
"type": "shape",
"from": {"data": "world"},
"encode": {
"update": {
"strokeWidth": {"value": 2},
"strokeOpacity": {"value": 0.1},
"zindex": {"value": 0}
}
},
"transform": [
{ "type": "geoshape", "projection": "projection" }
]
},
{
"type": "shape",
"name": "points",
"from": {"data": "locations"},
"encode": {
"enter": {
"shape": {"value": "circle"},
"fill": {"scale": "providercolor", "field": "properties.provider"},
"stroke": {"signal": "datum.properties.coming ? 'grey' : scale('providercolor',datum.properties.provider)"},
"strokeWidth": {"value": 2}
},
"update": {
"fillOpacity": {"signal": "highlight_provider ? datum.properties.provider == highlight_provider ? '1.0' : '0.1' : '0.5'"},
"strokeOpacity": {"signal": "highlight_provider ? datum.properties.provider == highlight_provider ? '1.0' : '0' : '1.0'"}
},
"hover": {
"fillOpacity": {"value": 1}
}
},
"transform": [
{
"type": "geoshape",
"projection": "projection",
"pointRadius": 5
}
]
},
{
"type": "text",
"from": {"data": "locations"},
"interactive": false,
"encode": {
"enter": {
"text": {"signal": "datum.properties.name + (datum.properties.coming ? ' (Coming Soon)' : '')"},
"fontSize": {"value": 10}
},
"update": {
"fillOpacity": {"signal": "datum.properties.provider == highlight_provider ? '1.0' : '0'"},
"x": {"field": "x", "offset": 10},
"y": {"field": "y","offset": 7}
},
"hover": {
"fillOpacity": {"signal": "datum.properties.provider == highlight_provider ? '1.0' : '0'"}
}
}
},
{
"type": "text",
"from": {"data": "locations"},
"interactive": false,
"encode": {
"enter": {
"text": {"field": "properties.provider"},
"fontSize": {"value": 10}
},
"update": {
"fillOpacity": {"signal": "datum.properties.provider == highlight_provider ? '1.0' : '0'"},
"x": {"field": "x", "offset": 10},
"y": {"field": "y","offset": -2}
},
"hover": {
"fillOpacity": {"signal": "datum.properties.provider == highlight_provider ? '1.0' : '0'"}
}
}
}
],
"legends": [
{
"type": "symbol",
"fill": "providercolor",
"orient": "none",
"zindex": 100,
"title": "Akamai CloudTest Locations",
"encode": {
"labels": {
"name": "legendLabel",
"interactive": true
},
"symbols": {
"name": "legendSymbol",
"interactive": true,
"enter": {
"size": {"value": 75},
"fillOpacity": {"value": 0.5}
},
"update": {
"stroke": {"signal": "!highlight_provider || datum.value == highlight_provider ? scale('providercolor', datum.value) : 'transparent'"}
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment