@hackoregon/component-library
Version:
Official repo for Hack Oregon React component library
888 lines (876 loc) • 26.2 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.slides = exports.foundations = void 0;
var _d = require("d3");
var _index = require("../_Themes/index");
var categoricalColors = _index.VisualizationColors.categorical;
var _VisualizationColors$ = _index.VisualizationColors.sequential,
thermal = _VisualizationColors$.thermal,
planet = _VisualizationColors$.planet,
space = _VisualizationColors$.space,
earth = _VisualizationColors$.earth,
ocean = _VisualizationColors$.ocean;
var earthquakeColorScheme = [[49, 54, 149, 200], [69, 117, 180, 200], [116, 173, 209, 200], [171, 217, 233, 200], [224, 243, 248, 200], [254, 224, 144, 200], [253, 174, 97, 200], [244, 109, 67, 200], [215, 48, 39, 200], [165, 0, 38, 200]];
var purpleGreenDivergent10 = [[64, 0, 75, 200], [118, 42, 131, 200], [153, 112, 171, 200], [194, 165, 207, 200], [231, 212, 232, 200], [217, 240, 211, 200], [166, 219, 160, 200], [90, 174, 97, 200], [27, 120, 55, 200], [0, 68, 27, 200]];
var civicBlue = categoricalColors.blue.mapFormatRGBA;
var civicGreen = categoricalColors.green.mapFormatRGBA;
var civicPurple = categoricalColors.purple.mapFormatRGBA;
var civicPink = categoricalColors.pink.mapFormatRGBA;
var civicYellow = categoricalColors.yellow.mapFormatRGBA;
var foundations = function foundations(data) {
return {
"Total Population": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-007-total-population",
data: data.slide_data.features,
scaleType: "equal",
color: earth,
getPropValue: function getPropValue(f) {
return f.properties.total_population;
},
propName: "total_population"
},
"Median Household Income": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-018-median-household-income",
data: data.slide_data.features,
scaleType: "equal",
color: space,
getPropValue: function getPropValue(f) {
return f.properties.median_household_income;
},
propName: "median_household_income"
},
"Median Gross Rent": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-019-median-gross-rent",
data: data.slide_data.features,
scaleType: "equal",
color: planet,
getPropValue: function getPropValue(f) {
return f.properties.Median_gross_rent;
},
propName: "Median_gross_rent"
},
Evictions: {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-020-evictions",
data: data.slide_data.features,
scaleType: "equal",
color: thermal,
getPropValue: function getPropValue(f) {
return f.properties.evictions;
},
propName: "evictions"
},
"Renter Occupied Households": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-021-renter-occupied-households",
data: data.slide_data.features,
scaleType: "equal",
color: ocean,
getPropValue: function getPropValue(f) {
return f.properties.renter_occupied_households;
},
propName: "renter_occupied_households"
},
"Rent Burden": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-022-rent-burden",
data: data.slide_data.features,
scaleType: "equal",
color: thermal,
getPropValue: function getPropValue(f) {
return f.properties.rent_burden;
},
propName: "rent_burden"
},
"Households with Children": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-024-households-children",
data: data.slide_data.features,
scaleType: "equal",
color: space,
getPropValue: function getPropValue(f) {
return f.properties.pc_household_with_children_under_18;
},
propName: "pc_household_with_children_under_18"
},
"Households with Seniors": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-025-households-seniors",
data: data.slide_data.features,
scaleType: "equal",
color: ocean,
getPropValue: function getPropValue(f) {
return f.properties.pc_household_with_individuals_65_ovr;
},
propName: "pc_household_with_individuals_65_ovr"
},
"Householders Living Alone": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-026-householders-living-alone",
data: data.slide_data.features,
scaleType: "equal",
color: planet,
getPropValue: function getPropValue(f) {
return f.properties.pc_householders_living_alone;
},
propName: "pc_householders_living_alone"
},
"Owner Occupied Households": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-027-owner-occupied-households",
data: data.slide_data.features,
scaleType: "equal",
color: space,
getPropValue: function getPropValue(f) {
return f.properties.pc_owner_occupied_housing_units;
},
propName: "pc_owner_occupied_housing_units"
},
"Percent Renter Occupied": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-028-percent-renter-occupied",
data: data.slide_data.features,
scaleType: "equal",
color: thermal,
getPropValue: function getPropValue(f) {
return f.properties.pctrenter_occupied;
},
propName: "pctrenter_occupied"
},
"Shaking Intensity": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-029-shaking-intensity",
data: data.slide_data.features,
scaleType: "ordinal",
color: [earthquakeColorScheme[7], earthquakeColorScheme[9]],
propName: "pgv_site_mean_mmi_txt",
categories: ["Very strong (VII)", "Severe (VIII)"]
},
"Wet Season Mean Deformation Intensity": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-030-wet-season-mean-deformation-intensity",
data: data.slide_data.features,
scaleType: "ordinal",
color: [earthquakeColorScheme[5], earthquakeColorScheme[6], earthquakeColorScheme[7], earthquakeColorScheme[9]],
propName: "pgd_total_wet_mean_di",
categories: ["Low", "Moderate", "High", "Very High"]
},
"Dry Season Mean Deformation Intensity": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-033-dry-season-mean-deformation-intensity",
data: data.slide_data.features,
scaleType: "ordinal",
color: [earthquakeColorScheme[4], earthquakeColorScheme[5]],
propName: "pgd_landslide_dry_mean_di",
categories: ["None", "Low"]
},
"Census Reponse Rate": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-034-census-reponse-rate",
data: data.slide_data.features,
scaleType: "equal",
color: thermal,
getPropValue: function getPropValue(f) {
return f.properties.census_response_rate;
},
propName: "census_response_rate"
},
"Voters 18 to 25": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-037-voters-18-25",
data: data.slide_data.features,
scaleType: "equal",
color: earth,
getPropValue: function getPropValue(f) {
return f.properties.pct_18_25;
},
propName: "pct_18_25"
},
"Voters 26 to 32": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-038-voters-26-32",
data: data.slide_data.features,
scaleType: "equal",
color: earth,
getPropValue: function getPropValue(f) {
return f.properties.pct_26_32;
},
propName: "pct_26_32"
},
"Voters 33 to 39": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-039-voters-33-39",
data: data.slide_data.features,
scaleType: "equal",
color: earth,
getPropValue: function getPropValue(f) {
return f.properties.pct_33_39;
},
propName: "pct_33_39"
},
"Voters 40 to 49": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-040-voters-40-49",
data: data.slide_data.features,
scaleType: "equal",
color: earth,
getPropValue: function getPropValue(f) {
return f.properties.pct_40_49;
},
propName: "pct_40_49"
},
"Voters 50 plus": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-041-voters-50-plus",
data: data.slide_data.features,
scaleType: "equal",
color: earth,
getPropValue: function getPropValue(f) {
return f.properties.pct_50_plus;
},
propName: "pct_50_plus"
},
"Change in Ridership by Census Block": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-042-change-ridership",
data: data.slide_data.features,
scaleType: "threshold",
color: purpleGreenDivergent10,
propName: "stops_pct_change",
categories: [-100, -75, -50, -25, 0, 25, 50, 75, 100]
},
"Eviction Rate": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-043-eviction-rate",
data: data.slide_data.features,
scaleType: "equal",
color: space,
getPropValue: function getPropValue(f) {
return f.properties.eviction_rate;
},
propName: "eviction_rate"
},
"Poverty Rate": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-044-poverty-rate",
data: data.slide_data.features,
scaleType: "equal",
color: ocean,
getPropValue: function getPropValue(f) {
return f.properties.poverty_rate;
},
propName: "poverty_rate"
},
"Camp Reports": {
mapType: "ChoroplethMap",
id: "choropleth-layer-foundation-045-camp-reports",
data: data.slide_data.features,
scaleType: "equal",
color: ocean,
getPropValue: function getPropValue(f) {
return f.properties.count;
},
propName: "count"
}
};
};
exports.foundations = foundations;
var poiIconMapping = {
School: {
x: 0,
y: 0,
width: 250,
height: 250,
mask: true
},
Hospital: {
x: 250,
y: 0,
width: 250,
height: 250,
mask: true
},
BEECN: {
x: 500,
y: 0,
width: 250,
height: 250,
mask: true
},
"Fire Station": {
x: 0,
y: 250,
width: 250,
height: 250,
mask: true
},
Pin: {
x: 250,
y: 250,
width: 250,
height: 250,
mask: true
},
COMMCTR: {
x: 500,
y: 250,
width: 250,
height: 250,
mask: true
}
};
var poiIconZoomScale = function poiIconZoomScale(zoom) {
return zoom > 11.5 ? 5.5 : zoom > 10.5 ? 5 : zoom > 9.5 ? 4 : zoom > 8.5 ? 3 : zoom > 7.5 ? 2 : 1;
};
var poiGetIconColor = function poiGetIconColor(f) {
return f.properties.type === "BEECN" ? [0, 0, 0, 255] : f.properties.type === "COMMCTR" ? civicPurple : f.properties.type === "Fire Station" ? civicPink : f.properties.type === "School" ? civicYellow : f.properties.type === "Hospital" ? civicBlue : [0, 0, 0, 255];
};
var divergingScale = (0, _d.scaleThreshold)().domain([-100, -75, -50, -25, 0, 25, 50, 75, 100]).range(purpleGreenDivergent10);
var ridershipRouteGetColor = function ridershipRouteGetColor(f) {
var value = f.properties.pct_change;
return divergingScale(value);
};
var slides = function slides(data) {
return {
"bike parking": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-001-bike-parking",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicBlue;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-001-bike-parking",
data: data.slide_data.features,
getFillColor: function getFillColor() {
return civicBlue;
},
getLineColor: function getLineColor() {
return civicBlue;
},
getRadius: function getRadius() {
return 50;
}
}
},
"bike lanes": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-002-bike-lanes",
data: data.slide_meta.boundary,
opacity: 0,
getLineColor: function getLineColor() {
return civicYellow;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "PathMap",
id: "path-layer-slide-002-bike-lanes",
data: data.slide_data.features,
getColor: function getColor() {
return civicYellow;
},
getWidth: function getWidth() {
return 25;
}
}
},
parks: {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-003-parks",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicGreen;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "SmallPolygonMap",
id: "polygon-layer-slide-003-parks",
data: data.slide_data.features,
getPolygon: function getPolygon(f) {
return f.geometry.coordinates;
},
getLineColor: function getLineColor() {
return civicGreen;
},
getLineWidth: function getLineWidth() {
return 7.5;
},
getFillColor: function getFillColor() {
return civicGreen;
}
}
},
"multi-use trails": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-004-multi-use-trails",
data: data.slide_meta.boundary,
opacity: 0,
getLineColor: function getLineColor() {
return civicPink;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "PathMap",
id: "path-layer-slide-004-multi-use-trails",
data: data.slide_data.features,
getColor: function getColor() {
return civicPink;
},
getWidth: function getWidth() {
return 25;
}
}
},
"community gardens": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-005-community-gardens",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicGreen;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "SmallPolygonMap",
id: "polygon-layer-slide-005-community-gardens",
data: data.slide_data.features,
getLineColor: function getLineColor() {
return civicGreen;
},
getLineWidth: function getLineWidth() {
return 5;
},
getFillColor: function getFillColor() {
return civicGreen;
}
}
},
"bike greenways": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-008-bike-greenways",
data: data.slide_meta.boundary,
opacity: 0,
getLineColor: function getLineColor() {
return civicGreen;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "PathMap",
id: "path-layer-slide-008-bike-greenways",
data: data.slide_data.features,
getColor: function getColor() {
return civicGreen;
},
getWidth: function getWidth() {
return 25;
}
}
},
"rail stops": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-009-rail-stops",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicPurple;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-009-rail-stops",
data: data.slide_data.features,
getFillColor: function getFillColor() {
return civicPurple;
},
getLineColor: function getLineColor() {
return civicPurple;
},
getRadius: function getRadius() {
return 40;
}
}
},
"grocery stores": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-010-grocery-stores",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicYellow;
},
getLineWidth: function getLineWidth() {
return 100;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-010-grocery-stores",
data: data.slide_data.features,
getFillColor: function getFillColor() {
return civicYellow;
},
getLineColor: function getLineColor() {
return civicYellow;
},
getRadius: function getRadius() {
return 100;
},
highlightColor: [255, 140, 0, 155]
}
},
demolitions: {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-011-demolitions",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicPink;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-011-demolitions",
data: data.slide_data.features,
getFillColor: function getFillColor() {
return civicPink;
},
getLineColor: function getLineColor() {
return civicPink;
},
getRadius: function getRadius() {
return 100;
}
}
},
"camp sweeps": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-012-camps-sweeps",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicBlue;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-012-camps-sweeps",
data: data.slide_data.features,
getFillColor: function getFillColor() {
return civicBlue;
},
getLineColor: function getLineColor() {
return civicBlue;
},
getRadius: function getRadius() {
return 100;
}
}
},
"camp reports": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-013-camp-reports",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicPurple;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-013-camp-reports",
data: data.slide_data.features,
opacity: 0.1,
getFillColor: function getFillColor() {
return civicPurple;
},
getLineColor: function getLineColor() {
return civicPurple;
},
getRadius: function getRadius() {
return 100;
}
}
},
"bus stops": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-014-bus-stops",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicBlue;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-014-bus-stops",
data: data.slide_data.features,
getFillColor: function getFillColor() {
return civicBlue;
},
getLineColor: function getLineColor() {
return civicBlue;
},
getRadius: function getRadius() {
return 40;
}
}
},
"Change in Ridership by Route": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-015-change-ridership-route",
data: data.slide_meta.boundary,
opacity: 0,
getLineColor: function getLineColor() {
return [0, 0, 0, 0];
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "PathMap",
id: "path-layer-slide-015-change-ridership-route",
data: data.slide_data.features,
opacity: 0.8,
getColor: ridershipRouteGetColor,
getWidth: function getWidth() {
return 25;
},
rounded: true
}
},
"points of interest": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-016-poi",
data: data.slide_meta.boundary,
opacity: 0,
getLineColor: function getLineColor() {
return [0, 0, 0, 255];
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "IconMap",
id: "icon-layer-slide-016-poi",
data: data.slide_data.features,
opacity: 0.75,
iconAtlas: "https://i.imgur.com/xgTAROe.png",
iconMapping: poiIconMapping,
sizeScale: poiIconZoomScale,
getPosition: function getPosition(f) {
return f.geometry === null ? [0, 0] : f.geometry.coordinates;
},
getIcon: function getIcon(f) {
return f.properties.type;
},
getSize: function getSize() {
return 11;
},
getColor: poiGetIconColor
}
},
"Building Permits": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-017-building-permits",
data: data.slide_meta.boundary,
opacity: 0,
getLineColor: function getLineColor() {
return [0, 0, 0, 255];
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScreenGridMap",
id: "screengrid-layer-slide-017-building-permits",
data: data.slide_data.features,
opacity: 0.75,
colorRange: earth,
cellSizePixels: 35
}
},
"Safety Hotline": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-031-safety-hotline",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicBlue;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-031-safety-hotline",
data: data.slide_data.features,
opacity: 0.15,
getFillColor: function getFillColor() {
return civicBlue;
},
getLineColor: function getLineColor() {
return civicBlue;
},
getRadius: function getRadius() {
return 30;
}
}
},
Crashes: {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-032-crashes",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicPink;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-032-crashes",
data: data.slide_data.features,
opacity: 0.15,
getFillColor: function getFillColor() {
return civicPink;
},
getLineColor: function getLineColor() {
return civicPink;
},
getRadius: function getRadius() {
return 30;
}
}
},
"Bike Counts": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-035-bike-counts",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicPink;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-035-bike-counts",
data: data.slide_data.features,
getPosition: function getPosition(f) {
return f.geometry === null ? [0, 0] : f.geometry.coordinates;
},
opacity: 0.6,
getFillColor: function getFillColor() {
return civicPink;
},
getLineColor: function getLineColor() {
return civicPink;
},
getRadius: function getRadius(f) {
return Math.sqrt(f.properties.year_2017 / Math.PI) * 10;
}
}
},
"Bike Estimates": {
boundary: {
mapType: "BoundaryMap",
id: "boundary-layer-slide-036-bike-estimates",
data: data.slide_meta.boundary,
opacity: 1,
getLineColor: function getLineColor() {
return civicPurple;
},
getLineWidth: function getLineWidth() {
return 45;
}
},
map: {
mapType: "ScatterPlotMap",
id: "scatterplot-layer-slide-036-bike-estimates",
data: data.slide_data.features,
getPosition: function getPosition(f) {
return f.geometry === null ? [0, 0] : f.geometry.coordinates;
},
opacity: 0.3,
getFillColor: function getFillColor() {
return civicPurple;
},
getLineColor: function getLineColor() {
return civicPurple;
},
getRadius: function getRadius(f) {
return Math.sqrt(f.properties.year_2016 / Math.PI) * 10;
}
}
}
};
};
exports.slides = slides;