Skip to content

Instantly share code, notes, and snippets.

@domoritz
Last active March 5, 2018 21:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save domoritz/d6702fa42ec0e3087021302175f6e4bd to your computer and use it in GitHub Desktop.
VL Issue #3467
license: mit
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="https://cdn.jsdelivr.net/npm/vega@3"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@2"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@3"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/vega-tooltip@0/build/vega-tooltip.min.css">
<script src="https://cdn.jsdelivr.net/npm/vega-tooltip@0"></script>
</head>
<body>
<div id="visMap"></div>
<script>
var map2 = {
"$schema": "https://vega.github.io/schema/vega-lite/v2.1.json",
"description": "the population per state, engineers per state, and hurricanes per state",
"repeat": { "row": ["Asthma Hospitalizations (Children 5 to 14 Yrs Old) - Rate 1998","Asthma Hospitalizations (Children 5 to 14 Yrs Old) - Rate 2008","Asthma Hospitalizations (Children 5 to 14 Yrs Old) - Rate 2009"] },
"resolve": {
"scale": {
"color": "independent"
}
},
"spec": {
"width": 800,
"height": 300,
"data": {
"url": "http://a816-dohbesp.nyc.gov/IndicatorPublic/files/Data.json",
},
"transform": [
{
"lookup": "Geo Entity ID",
"from": {
"data": {
"url": "http://a816-dohbesp.nyc.gov/IndicatorPublic/files/UHF42.json",
"format": {
"type": "topojson",
"feature": "collection"
}
},
"key": "id",
},
"as": "geo"
},
],
"projection": {
"type": "mercator"
},
"mark": "geoshape",
"encoding": {
// "tooltip": { "field": "row", "type": "quantitative" },
"shape": {
"field": "geo",
"type": "geojson"
},
"color": {
"field": { "repeat": "row" },
"type": "quantitative",
"bin": { "maxbins": 5 },
}
}
},
"config": {
"legend": {
titleLimit: "5000"
}
}
}
var opt = {
mode: "vega-lite",
"renderer": "svg",
actions: false
};
vegaEmbed('#visMap', map2, opt).then(function (result) {
vegaTooltip.vegaLite(result.view, map2);
}).catch(console.error);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment