Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated pop estimate table and created constant with estimates #942

Merged
merged 7 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion atd-vzv/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion atd-vzv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@
"devDependencies": {
"react-axe": "^3.5.3"
}
}
}
Binary file removed atd-vzv/src/Components/Popover/byYearTable.png
Binary file not shown.
49 changes: 39 additions & 10 deletions atd-vzv/src/Components/Popover/popoverConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from "react";
import raceEthnicityTable2018 from "./raceEthnicityTable2018.png";
import byYearTable from "./byYearTable.png";
import { populationEstimates } from "../../constants/populationEstimates";

const formatNumber = (num) => {
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
};

export const popoverConfig = {
summary: {
Expand Down Expand Up @@ -113,22 +117,47 @@ export const popoverConfig = {
individual city's population over time. Below is a table showing how
Austin's population continues to increase each year.
<div>
<img
className="mt-2 img-fluid"
src={byYearTable}
alt="Table showing how Austin's population continues to increase each year"
/>
<div className="mt-2">
<table className="table">
<thead>
<tr>
<th scope="col">Year</th>
<th scope="col">Population</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">{populationEstimates[0].year}</th>
<td>{formatNumber(populationEstimates[0].estimate)}</td>
</tr>
<tr>
<th scope="row">{populationEstimates[1].year}</th>
<td>{formatNumber(populationEstimates[1].estimate)}</td>
</tr>
<tr>
<th scope="row">{populationEstimates[2].year}</th>
<td>{formatNumber(populationEstimates[2].estimate)}</td>
</tr>
<tr>
<th scope="row">{populationEstimates[3].year}</th>
<td>{formatNumber(populationEstimates[3].estimate)}</td>
</tr>
<tr>
<th scope="row">{populationEstimates[4].year}</th>
<td>{formatNumber(populationEstimates[4].estimate)}</td>
</tr>
</tbody>
</table>
</div>
<div className="mt-2">
Source:{" "}
<a
href="https://www.austintexas.gov/sites/default/files/files/Planning/Demographics/austin_forecast_2019_pub.pdf"
href={populationEstimates[5].sourceURL}
target="_blank"
rel="noopener noreferrer"
>
Ryan Robinson, City Demographer, Department of Planning, City
of Austin. November 2018
{populationEstimates[5].sourceString}
</a>
.
</div>
</div>
</div>
Expand Down
26 changes: 26 additions & 0 deletions atd-vzv/src/constants/populationEstimates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export const populationEstimates = [
tillyw marked this conversation as resolved.
Show resolved Hide resolved
{
year: "2020",
estimate: 989233,
},
{
year: "2019",
estimate: 972499,
},
{
year: "2018",
estimate: 955094,
},
{
year: "2017",
estimate: 937065,
},
{
year: "2016",
estimate: 913917,
},
{
sourceURL: "http://www.austintexas.gov/sites/default/files/files/Planning/Demographics/Austin_Forecast_2020_pub.pdf",
sourceString: "Ryan Robinson, City Demographer, Department of Planning, Cit of Austin. December 2019."
tillyw marked this conversation as resolved.
Show resolved Hide resolved
}
];
9 changes: 5 additions & 4 deletions atd-vzv/src/views/summary/CrashesByPopulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import InfoPopover from "../../Components/Popover/InfoPopover";
import { popoverConfig } from "../../Components/Popover/popoverConfig";
import { crashEndpointUrl } from "./queries/socrataQueries";
import { dataStartDate, fiveYearAvgEndDate } from "../../constants/time";
import { populationEstimates } from "../../constants/populationEstimates";
import { colors } from "../../constants/colors";

const CrashesByPopulation = () => {
Expand All @@ -33,10 +34,10 @@ const CrashesByPopulation = () => {
};

const chartConfig = {
barOne: { color: colors.viridis1Of6Highest, population: 913917 },
barTwo: { color: colors.viridis1Of6Highest, population: 937065 },
barThree: { color: colors.viridis1Of6Highest, population: 955094 },
barFour: { color: colors.viridis1Of6Highest, population: 972499 },
barOne: { color: colors.viridis1Of6Highest, population: populationEstimates[4].estimate },
barTwo: { color: colors.viridis1Of6Highest, population: populationEstimates[3].estimate },
barThree: { color: colors.viridis1Of6Highest, population: populationEstimates[2].estimate },
barFour: { color: colors.viridis1Of6Highest, population: populationEstimates[1].estimate },
};

const calculateRatePer100000 = (data) => {
Expand Down