Published
Edited
Jun 30, 2020
1 fork
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tickFormatter = d3.timeFormat('%b');
Insert cell
timeParser = d3.timeParse('%Y-%m-%d');
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
filtered_counties = counties_data.filter(d => d.county == county)
Insert cell
Insert cell
// trying with missing values as null
counties_data_nulls = FileAttachment("data_mob_google_counties_longer_NAs.json").json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// county_chart_nulls = {
// const div = d3.create("div").style("display", "block");
// const charts = div
// .html(`<h4>Google mobility data for <span class="underline">${county}</span>, relative change since Jan 2020</h4>
// <p><span class="ul-purple">purple line</span> indicates when shelter in place began on March 19</p>
// <p><span class="ul-blue">blue bar</span> indicates Presidents' Day Weekend</p>
// <p><span class="ul-red">red bar</span> indicates Memorial Day Weekend</p>`)
// .selectAll("div")
// .data(by_type_counties_data_nulls)
// .join("div")
// .style("height", chart_height + "px")
// .style("width", chart_width + "px")
// .attr("class", "chart-container")
// .call(drawNewChartNulls);

// return div.node();
// }
Insert cell
// doesn't take into account null values
// county_chart = {
// const div = d3.create("div").style("display", "block");
// const charts = div
// .html(`<h4>Google mobility data for <span class="underline">${county}</span>, relative change since Jan 2020</h4>\n<p>line indicates when shelter in place began on March 19</p>`)
// .selectAll("div")
// .data(by_type_counties_data )
// .join("div")
// .style("height", chart_height + "px")
// .style("width", chart_width + "px")
// .attr("class", "chart-container")
// .call(drawNewChart);

// return div.node();
// }

// not sure where i need this, doesn't take into account nulls
// // Line
// svg.append("path")
// .datum(d => d.values)
// .attr("fill", "pink")
// .attr("d", d3.line()
// .curve(d3.curveLinear)
// .x(d => x(timeParser(d.date)))
// .y(d => y(d.perc_change)))
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more