File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
bom-website/assets/visualizations/causes-histogram Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ import * as d3 from "d3";
22import 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 ) => {
You can’t perform that action at this time.
0 commit comments