I have a Vega-Lite map, and I'm confused by Vega-Lite's behavior coloring areas with a conditional statement. Some input would be greatly appreciated. Thanks in advance.
Goals: In my data, some of the neighborhoods' values are suppressed; I'm trying to display these suppressed values as gray (#808080
in the spec) and keep the tooltip the same as on the non-suppressed neighborhoods. For the map's color encoding, I have a condition, testing for isValid(datum.Value)
, and if that's true, applying the color scale, and if it's false, applying #808080
.
Question: In Vega 5.30.0, one change from 5.29.0 makes vega format null
as "null." As a result, my conditional statement that tests for null data and styles accordingly doesn't work - instead of treating these as nulls, it treats these as 0 values. Using Vega 5.30.0, how can I keep null data as null, so that conditionals checking for it can accurately find and style null data how I want to?
Further background: a spec is here - one of the neighborhoods to be suppressed is the northern neighborhood on the south-western island ("Northern SI"). For invalid data (where datum.Value == null
), it's not applying #808080
, the value in the else part of the statement - it's just treating those nulls as 0s and applying the lowest part of the color scale in the test part of the condition. I've tried "test": "isValid(datum.Value)"
(isValid should return true if value is not null, undefined, or NaN, and false otherwise), but it colors neighborhoods where Value == null
. The same goes for "test": "datum.Value != null"
.
I've tried a handful of other things, too (including adding a separate true/false Suppressed
field), but each approach seems to involve Vega-Lite treating nulls like 0s, or struggling with a conditional test involving null data. While experimenting, if I reverse the logic (eg with "test": "datum.Suppressed == true"
), the 'else' works as expected but styles for satisfying the test condition do not.
(Curiously - though this may be a separate issue - when I use "test": "isValid(datum.DisplayValue"
it colors neighborhoods where datum.DisplayValue
is alphanumeric; there's something happening that I do not understand.)
Input is greatly appreciated here! Again, thanks in advance.
Edit: updating with complete spec.
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": {
"text": "Adults with asthma (past 12 months)",
"subtitlePadding": 10,
"fontWeight": "normal",
"anchor": "start",
"fontSize": 18,
"font": "sans-serif",
"baseline": "top",
"subtitle": "Percent",
"subtitleFontSize": 13
},
"data": {
"values": [
{
"MeasureID": 363,
"GeoID": 101,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 7.8,
"CI": "(3.0, 18.8)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "7.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Kingsbridge - Riverdale",
"Lat": 40.8926,
"Long": -73.9012,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 102,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.1,
"CI": "(1.7, 9.4)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.1*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Northeast Bronx",
"Lat": 40.8806,
"Long": -73.8448,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 103,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 6.8,
"CI": "(4.3, 10.5)",
"Note": "",
"DisplayValue": "6.8",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Fordham - Bronx Pk",
"Lat": 40.8721,
"Long": -73.8807,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 104,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 7.7,
"CI": "(4.9, 11.7)",
"Note": "",
"DisplayValue": "7.7",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Pelham - Throgs Neck",
"Lat": 40.8405,
"Long": -73.8338,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 201,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 1.3,
"CI": "(0.4, 4.1)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "1.3*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Greenpoint",
"Lat": 40.7202,
"Long": -73.9497,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 202,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.8,
"CI": "(1.8, 7.7)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Downtown - Heights - Slope",
"Lat": 40.6836,
"Long": -73.9864,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 203,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.3,
"CI": "(2.6, 6.9)",
"Note": "",
"DisplayValue": "4.3",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Bedford Stuyvesant - Crown Heights",
"Lat": 40.6735,
"Long": -73.9334,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 204,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 6.9,
"CI": "(2.8, 15.9)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "6.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "East New York",
"Lat": 40.6721,
"Long": -73.883,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 205,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Sunset Park",
"Lat": 40.6477,
"Long": -74.0091,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 206,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 2,
"CI": "(0.8, 4.9)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "2.0*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Borough Park",
"Lat": 40.6284,
"Long": -73.9804,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 207,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 5.2,
"CI": "(2.5, 10.6)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "5.2*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "East Flatbush - Flatbush",
"Lat": 40.6464,
"Long": -73.9484,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 208,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.8,
"CI": "(2.2, 10.1)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Canarsie - Flatlands",
"Lat": 40.6203,
"Long": -73.9037,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 209,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.5,
"CI": "(1.7, 7.3)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.5*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Bensonhurst - Bay Ridge",
"Lat": 40.6118,
"Long": -74.0126,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 210,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 2.8,
"CI": "(1.1, 7.5)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "2.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Coney Island - Sheepshead Bay",
"Lat": 40.5904,
"Long": -73.9612,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 211,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 8.8,
"CI": "(4.7, 15.8)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "8.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Williamsburg - Bushwick",
"Lat": 40.6986,
"Long": -73.9316,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 301,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 5.8,
"CI": "(2.4, 13.4)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "5.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Washington Heights",
"Lat": 40.8495,
"Long": -73.9351,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 302,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Central Harlem - Morningside Heights",
"Lat": 40.8132,
"Long": -73.9484,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 303,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.9,
"CI": "(1.5, 9.8)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "East Harlem",
"Lat": 40.794,
"Long": -73.935,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 304,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 7.9,
"CI": "(2.9, 19.6)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "7.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Upper West Side",
"Lat": 40.7884,
"Long": -73.9756,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 401,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Long Island City - Astoria",
"Lat": 40.7575,
"Long": -73.9278,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 402,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.1,
"CI": "(1.6, 6.0)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.1*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "West Queens",
"Lat": 40.7441,
"Long": -73.8879,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 403,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 1.7,
"CI": "(0.8, 3.7)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "1.7*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Flushing - Clearview",
"Lat": 40.7707,
"Long": -73.8151,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 405,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 2,
"CI": "(0.7, 5.7)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "2.0*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Ridgewood - Forest Hills",
"Lat": 40.7112,
"Long": -73.8723,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 407,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4,
"CI": "(2.1, 7.7)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.0*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Southwest Queens",
"Lat": 40.6795,
"Long": -73.8355,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 408,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.7,
"CI": "(2.3, 9.3)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.7*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Jamaica",
"Lat": 40.696,
"Long": -73.7831,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 409,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Southeast Queens",
"Lat": 40.7022,
"Long": -73.7371,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 410,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.9,
"CI": "(1.8, 8.3)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Rockaways",
"Lat": 40.59,
"Long": -73.8228,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 305307,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.6,
"CI": "(2.0, 6.4)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.6*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Upper East Side-Gramercy",
"Lat": 40.7609,
"Long": -73.9648,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 306308,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 1.9,
"CI": "(0.8, 4.4)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "1.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Chelsea-Village ",
"Lat": 40.7448,
"Long": -73.9972,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 309310,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.3,
"CI": "(2.1, 8.6)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.3*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Union Square-Lower Manhattan",
"Lat": 40.7164,
"Long": -73.9948,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 404406,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Bayside Little Neck-Fresh Meadows",
"Lat": 40.7471,
"Long": -73.7763,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 501502,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Northern SI",
"Lat": 40.6178,
"Long": -74.1076,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 503504,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.3,
"CI": "(1.5, 7.2)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.3*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Southern SI",
"Lat": 40.5652,
"Long": -74.1727,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 105106107,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 6.3,
"CI": "(4.4, 8.9)",
"Note": "",
"DisplayValue": "6.3",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "South Bronx",
"Lat": 40.8274,
"Long": -73.9018,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
}
],
"format": {"parse": {"Value": "number"}}
},
"config": {
"concat": {"spacing": 20},
"view": {"stroke": "transparent"},
"axisY": {"domain": false, "ticks": false},
"legend": {"disable": true}
},
"projection": {"type": "mercator"},
"transform": [{"calculate": "datum.DisplayValue + ' %'", "as": "valueLabel"}],
"vconcat": [
{
"layer": [
{
"height": 500,
"width": "container",
"data": {
"url": "https://raw.githubusercontent.com/nychealth/EHDP-data/production/geography/borough.topo.json",
"format": {"type": "topojson", "feature": "collection"}
},
"mark": {
"type": "geoshape",
"stroke": "#fafafa",
"fill": "#C5C5C5",
"strokeWidth": 0.5
}
},
{
"height": 500,
"width": "container",
"data": {
"url": "https://raw.githubusercontent.com/nychealth/EHDP-data/production/geography/UHF34.topo.json",
"format": {"type": "topojson", "feature": "collection"}
},
"mark": {
"type": "geoshape",
"stroke": "#a2a2a2",
"fill": "#e7e7e7",
"strokeWidth": 0.5
}
},
{
"height": 500,
"width": "container",
"mark": {"type": "geoshape", "invalid": null},
"params": [
{
"name": "highlight",
"select": {
"type": "point",
"on": "mouseover",
"clear": "mouseout"
}
}
],
"transform": [
{
"lookup": "GeoID",
"from": {
"data": {
"url": "https://raw.githubusercontent.com/nychealth/EHDP-data/production/geography/UHF34.topo.json",
"format": {"type": "topojson", "feature": "collection"}
},
"key": "properties.GEOCODE"
},
"as": "geo"
}
],
"encoding": {
"shape": {"field": "geo", "type": "geojson"},
"color": {
"condition": {
"test": "isValid(datum.Value)",
"bin": false,
"field": "Value",
"type": "quantitative",
"scale": {"scheme": {"name": "reds", "extent": [0.125, 1.25]}},
"legend": {
"direction": "horizontal",
"orient": "top-left",
"title": null,
"tickCount": 3,
"offset": -25,
"gradientLength": 200
}
},
"value": "#808080"
},
"stroke": {
"condition": [
{"param": "highlight", "empty": false, "value": "cyan"}
],
"value": "#2d2d2d"
},
"strokeWidth": {
"condition": [
{"param": "highlight", "empty": false, "value": 1.25}
],
"value": 0.5
},
"order": {
"condition": [{"param": "highlight", "empty": false, "value": 1}],
"value": 0
},
"tooltip": [
{"field": "Geography", "title": "Neighborhood"},
{"field": "valueLabel", "title": "Percent"},
{"field": "TimePeriod", "title": "Time period"}
]
}
}
]
},
{
"height": 150,
"width": "container",
"config": {"axisY": {"labelAngle": 0, "labelFontSize": 13}},
"mark": {"type": "bar", "tooltip": true, "stroke": "#161616"},
"params": [
{
"name": "highlight",
"select": {"type": "point", "on": "mouseover", "clear": "mouseout"}
}
],
"encoding": {
"y": {
"field": "Value",
"type": "quantitative",
"title": null,
"axis": {"labelAngle": 0, "labelFontSize": 11, "tickCount": 3}
},
"tooltip": [
{"field": "Geography", "title": "Neighborhood"},
{"field": "valueLabel", "title": "Percent"},
{"field": "TimePeriod", "title": "Time period"}
],
"x": {"field": "GeoID", "sort": "y", "axis": null},
"color": {
"bin": false,
"field": "Value",
"type": "quantitative",
"scale": {"scheme": {"name": "reds", "extent": [0.125, 1.25]}},
"legend": false
},
"stroke": {
"condition": [
{"param": "highlight", "empty": false, "value": "cyan"}
],
"value": "white"
},
"strokeWidth": {
"condition": [{"param": "highlight", "empty": false, "value": 3}],
"value": 0
}
}
}
]
}
Update 2:
This also seems fine and doesn't need the hidden point.
"color": {
"condition": {
"test": "datum.Value != null",
"field": "Value",
"scale": {"scheme": {"name": "reds", "extent": [0.125, 1.25]}}
},
"value": "#808080"
},
Update:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": {
"text": "Adults with asthma (past 12 months)",
"subtitlePadding": 10,
"fontWeight": "normal",
"anchor": "start",
"fontSize": 18,
"font": "sans-serif",
"baseline": "top",
"subtitle": "Percent",
"subtitleFontSize": 13
},
"data": {
"values": [
{
"MeasureID": 363,
"GeoID": 101,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 7.8,
"Suppressed": false,
"CI": "(3.0, 18.8)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "7.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Kingsbridge - Riverdale",
"Lat": 40.8926,
"Long": -73.9012,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 102,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.1,
"Suppressed": false,
"CI": "(1.7, 9.4)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.1*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Northeast Bronx",
"Lat": 40.8806,
"Long": -73.8448,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 103,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 6.8,
"Suppressed": false,
"CI": "(4.3, 10.5)",
"Note": "",
"DisplayValue": "6.8",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Fordham - Bronx Pk",
"Lat": 40.8721,
"Long": -73.8807,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 104,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 7.7,
"Suppressed": false,
"CI": "(4.9, 11.7)",
"Note": "",
"DisplayValue": "7.7",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Pelham - Throgs Neck",
"Lat": 40.8405,
"Long": -73.8338,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 201,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 1.3,
"Suppressed": false,
"CI": "(0.4, 4.1)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "1.3*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Greenpoint",
"Lat": 40.7202,
"Long": -73.9497,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 202,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.8,
"Suppressed": false,
"CI": "(1.8, 7.7)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Downtown - Heights - Slope",
"Lat": 40.6836,
"Long": -73.9864,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 203,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.3,
"Suppressed": false,
"CI": "(2.6, 6.9)",
"Note": "",
"DisplayValue": "4.3",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Bedford Stuyvesant - Crown Heights",
"Lat": 40.6735,
"Long": -73.9334,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 204,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 6.9,
"Suppressed": false,
"CI": "(2.8, 15.9)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "6.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "East New York",
"Lat": 40.6721,
"Long": -73.883,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 205,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"Suppressed": true,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Sunset Park",
"Lat": 40.6477,
"Long": -74.0091,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 206,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 2,
"Suppressed": false,
"CI": "(0.8, 4.9)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "2.0*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Borough Park",
"Lat": 40.6284,
"Long": -73.9804,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 207,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 5.2,
"Suppressed": false,
"CI": "(2.5, 10.6)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "5.2*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "East Flatbush - Flatbush",
"Lat": 40.6464,
"Long": -73.9484,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 208,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.8,
"Suppressed": false,
"CI": "(2.2, 10.1)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Canarsie - Flatlands",
"Lat": 40.6203,
"Long": -73.9037,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 209,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.5,
"Suppressed": false,
"CI": "(1.7, 7.3)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.5*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Bensonhurst - Bay Ridge",
"Lat": 40.6118,
"Long": -74.0126,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 210,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 2.8,
"Suppressed": false,
"CI": "(1.1, 7.5)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "2.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Coney Island - Sheepshead Bay",
"Lat": 40.5904,
"Long": -73.9612,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 211,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 8.8,
"Suppressed": false,
"CI": "(4.7, 15.8)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "8.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Williamsburg - Bushwick",
"Lat": 40.6986,
"Long": -73.9316,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 301,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 5.8,
"Suppressed": false,
"CI": "(2.4, 13.4)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "5.8*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Washington Heights",
"Lat": 40.8495,
"Long": -73.9351,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 302,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"Suppressed": true,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Central Harlem - Morningside Heights",
"Lat": 40.8132,
"Long": -73.9484,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 303,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.9,
"Suppressed": false,
"CI": "(1.5, 9.8)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "East Harlem",
"Lat": 40.794,
"Long": -73.935,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 304,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 7.9,
"Suppressed": false,
"CI": "(2.9, 19.6)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "7.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Upper West Side",
"Lat": 40.7884,
"Long": -73.9756,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 401,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"Suppressed": true,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Long Island City - Astoria",
"Lat": 40.7575,
"Long": -73.9278,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 402,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.1,
"Suppressed": false,
"CI": "(1.6, 6.0)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.1*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "West Queens",
"Lat": 40.7441,
"Long": -73.8879,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 403,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 1.7,
"Suppressed": false,
"CI": "(0.8, 3.7)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "1.7*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Flushing - Clearview",
"Lat": 40.7707,
"Long": -73.8151,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 405,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 2,
"Suppressed": false,
"CI": "(0.7, 5.7)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "2.0*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Ridgewood - Forest Hills",
"Lat": 40.7112,
"Long": -73.8723,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 407,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4,
"Suppressed": false,
"CI": "(2.1, 7.7)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.0*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Southwest Queens",
"Lat": 40.6795,
"Long": -73.8355,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 408,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.7,
"Suppressed": false,
"CI": "(2.3, 9.3)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.7*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Jamaica",
"Lat": 40.696,
"Long": -73.7831,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 409,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"Suppressed": true,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Southeast Queens",
"Lat": 40.7022,
"Long": -73.7371,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 410,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.9,
"Suppressed": false,
"CI": "(1.8, 8.3)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Rockaways",
"Lat": 40.59,
"Long": -73.8228,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 305307,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.6,
"Suppressed": false,
"CI": "(2.0, 6.4)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.6*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Upper East Side-Gramercy",
"Lat": 40.7609,
"Long": -73.9648,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 306308,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 1.9,
"Suppressed": false,
"CI": "(0.8, 4.4)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "1.9*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Chelsea-Village ",
"Lat": 40.7448,
"Long": -73.9972,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 309310,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 4.3,
"Suppressed": false,
"CI": "(2.1, 8.6)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "4.3*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Union Square-Lower Manhattan",
"Lat": 40.7164,
"Long": -73.9948,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 404406,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"Suppressed": true,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Bayside Little Neck-Fresh Meadows",
"Lat": 40.7471,
"Long": -73.7763,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 501502,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": null,
"Suppressed": true,
"CI": "",
"Note": "** Estimate is suppressed due to insufficient data.",
"DisplayValue": "**",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Northern SI",
"Lat": 40.6178,
"Long": -74.1076,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 503504,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 3.3,
"Suppressed": false,
"CI": "(1.5, 7.2)",
"Note": "* Estimate is based on small numbers so should be interpreted with caution.",
"DisplayValue": "3.3*",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "Southern SI",
"Lat": 40.5652,
"Long": -74.1727,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
},
{
"MeasureID": 363,
"GeoID": 105106107,
"GeoType": "UHF34",
"TimePeriodID": 296,
"Value": 6.3,
"Suppressed": false,
"CI": "(4.4, 8.9)",
"Note": "",
"DisplayValue": "6.3",
"GeoRank": 3,
"GeoTypeDesc": "UHF 34",
"GeoTypeShortDesc": "Neighborhood (UHF 34)",
"Geography": "South Bronx",
"Lat": 40.8274,
"Long": -73.9018,
"TimePeriod": "2022",
"start_period": 1640995200000,
"end_period": 1672444800000
}
],
"format": {"parse": {"Value": "number"}}
},
"config": {
"concat": {"spacing": 20},
"view": {"stroke": "transparent"},
"axisY": {"domain": false, "ticks": false},
"legend": {"disable": true}
},
"projection": {"type": "mercator"},
"transform": [{"calculate": "datum.DisplayValue + ' %'", "as": "valueLabel"}],
"vconcat": [
{
"layer": [
{
"height": 500,
"width": "container",
"data": {
"url": "https://raw.githubusercontent.com/nychealth/EHDP-data/production/geography/borough.topo.json",
"format": {"type": "topojson", "feature": "collection"}
},
"mark": {
"type": "geoshape",
"stroke": "#fafafa",
"fill": "#f2f2f2",
"strokeWidth": 0.5
}
},
{
"height": 1,
"width": 1,
"mark": {"type": "point"},
"encoding": {
"color": {
"field": "Value",
"type": "quantitative",
"scale": {"scheme": {"name": "reds", "extent": [0.125, 1.25]}}
}, "opacity":{"value":0}
}
},
{
"height": 500,
"width": "container",
"mark": {"type": "geoshape", "invalid": null},
"params": [
{
"name": "highlight",
"select": {
"type": "point",
"on": "mouseover",
"clear": "mouseout"
}
}
],
"transform": [
{
"lookup": "GeoID",
"from": {
"data": {
"url": "https://raw.githubusercontent.com/nychealth/EHDP-data/production/geography/UHF34.topo.json",
"format": {"type": "topojson", "feature": "collection"}
},
"key": "properties.GEOCODE"
},
"as": "geo"
}
],
"encoding": {
"shape": {"field": "geo", "type": "geojson"},
"fill": {"value":{"expr":"datum.Value ==null?'#808080':scale('color', datum.Value)"}},
"stroke": {
"condition": [
{"param": "highlight", "empty": false, "value": "cyan"}
],
"value": "#2d2d2d"
},
"strokeWidth": {
"condition": [
{"param": "highlight", "empty": false, "value": 1.25}
],
"value": 0.5
},
"order": {
"condition": [{"param": "highlight", "empty": false, "value": 1}],
"value": 0
},
"tooltip": [
{"field": "Geography", "title": "Neighborhood"},
{"field": "valueLabel", "title": "Percent"},
{"field": "TimePeriod", "title": "Time period"}
]
}
}
]
}
]
}