Skip to content

Commit 5458826

Browse files
authored
Merge pull request #233 from chnm/refactor/revisions-rsa
refactor: Update functions to accept billType parameter in COD histogram
2 parents 525eb01 + 7ed7fb3 commit 5458826

File tree

1 file changed

+6
-6
lines changed
  • bom-website/assets/visualizations/causes-histogram

1 file changed

+6
-6
lines changed

bom-website/assets/visualizations/causes-histogram/main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import * as d3 from "d3";
22
import HistogramChart from "./causes-histogram";
33

44
// Function to fetch the list of causes and populate the dropdown
5-
function populateCausesDropdown() {
6-
const url = `https://data.chnm.org/bom/list-deaths`;
5+
function populateCausesDropdown(billType = 'weekly') {
6+
const url = `https://data.chnm.org/bom/list-deaths?bill-type=${billType}`;
77

88
d3.json(url)
99
.then((data) => {
@@ -27,8 +27,8 @@ function populateCausesDropdown() {
2727
}
2828

2929
// Function to fetch available years and populate the year dropdown
30-
function populateYearsDropdown() {
31-
const url = `https://data.chnm.org/bom/causes?start-year=1636&end-year=1754&bill-type=weekly&id=aged`;
30+
function populateYearsDropdown(billType = 'weekly') {
31+
const url = `https://data.chnm.org/bom/causes?bill-type=${billType}&start-year=1636&end-year=1754&id=aged`;
3232

3333
d3.json(url)
3434
.then((data) => {
@@ -55,8 +55,8 @@ function populateYearsDropdown() {
5555
}
5656

5757
// Function to fetch data and render the histogram
58-
function fetchDataAndRender(year, cause) {
59-
const url = `https://data.chnm.org/bom/causes?start-year=${year}&end-year=${year}&bill-type=weekly&limit=9000`;
58+
function fetchDataAndRender(year, cause, billType = 'weekly') {
59+
const url = `https://data.chnm.org/bom/causes?bill-type=${billType}&start-year=${year}&end-year=${year}&limit=9000`;
6060

6161
d3.json(url)
6262
.then((data) => {

0 commit comments

Comments
 (0)