Skip to content

Commit

Permalink
Added active label per country
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmaylaud committed Aug 7, 2020
1 parent 3e69714 commit 06521cc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/PolygonLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { format } from "d3";
import { FLAG_ENDPOINT } from "./Constants";
import { numberWithCommas } from "./utils";

export function getPolygonLabel(flagName: string, d: any, c: any): string {
return `
<div class="card">
<img class="card-img" src="${FLAG_ENDPOINT}/${flagName}.png" alt="flag" />
<div class="container">
<span class="card-title"><b>${d.NAME}</b></span> <br />
<div class="card-spacer"></div>
<hr />
<div class="card-spacer"></div>
<span>Cases: ${numberWithCommas(c.confirmed)}</span> <br />
<span>Deaths: ${numberWithCommas(c.deaths)}</span> <br />
<span>Recovered: ${numberWithCommas(c.recoveries)}</span> <br />
<span>Active: ${numberWithCommas(c.active)}</span> <br />
<span>Population: ${format(".3s")(d.POP_EST)}</span>
</div>
</div>
`;
}

0 comments on commit 06521cc

Please sign in to comment.