Public
Edited
Oct 9, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
dates = {
//const data = await FileAttachment("biLISA@2.csv").csv();
const data = await FileAttachment("lisa_weekly@1.csv").csv();
var dd = data.map(function(d) { return d.date; });
return [...new Set(dd)];

}
Insert cell
rrmap= {
const testww = await FileAttachment("lisa_weekly@1.csv").csv();
return new Map(testww.map(({id,lisa_st,date}) => [(id+ " "+date), [+lisa_st]]))
}
Insert cell
data = Object.assign(
rrmap
,{title: ["Bivariate LISA"]},)

Insert cell
labelsRR= ["Group 1", "Group 2","Group 3", "Group 4"]
Insert cell
labels = ["Group 1", "Group 2","Group 3", "Group 4"]

Insert cell
//n = Math.floor(Math.sqrt(colors.length))
n=5
Insert cell
//x = d3.scaleLinear([0.053, 0.128,0.295 ,1000], d3.range(n))
x = d3.scaleQuantile(Array.from(data.values(), d => d[0]), d3.range(n))
Insert cell
//y = d3.scaleLinear([0.053, 0.128,0.295 ,1000], d3.range(n))
y = d3.scaleQuantile(Array.from(data.values(), d => d[1]), d3.range(n))
//y = d3.scaleQuantile([1,14], d3.range(n))
Insert cell
path = d3.geoPath()
Insert cell
color = {
return value => {
if (!value) return "#ccc";
return colors[value];
};
}
Insert cell
Insert cell
format = (value) => {
if (!value) return "N/A";
let [a, b] = value;
return `${data.title[0]} ${a} ${labelsRR[x(a)] && ` (${labelsRR[x(a)]})`}
${data.title[1]} ${b} ${labels[y(b)] && ` (${labels[y(b)]})`}`;
}
Insert cell
//clean.filter(d => d[1] === dates[dates.length-1]).map(d => d[2])
Insert cell
//d => d[1] === dates[dates.length-1]
Insert cell
//color = d3.scaleQuantile(d3.schemeRdPu[bins]).domain(clean.filter(d => d[1] === dates[dates.length-1]).map(d => d[2]));
Insert cell
//path = d3.geoPath().projection(projection);
Insert cell
//projection = d3.geoAlbersUsa().ranslate( [width/2, height/2] );
Insert cell
//states = new Map(us.objects.states.geometries.map(d => [d.id, d.properties]));
states = new Map(us.objects.states.geometries.map(d => [d.id, d.properties]));

Insert cell
us = FileAttachment("counties-albers-10m@9.json").json()
Insert cell
topojson = require("topojson-client@3")
Insert cell
d3 = require("d3@6")
Insert cell
Insert cell
//import {legend} from "@d3/color-legend"
Insert cell
Insert cell
Insert cell
Insert cell
function dateToString(date) {
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var day = ("0" + date.getDate()).slice(-2);
return `${year}-${month}-${day}`;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { viewof colorInterpolatorPicker } from "@zechasault/color-schemes-and-interpolators-picker"
Insert cell
md
`## References

1. Animated Map of COVID-19 Cases:
https://observablehq.com/@onoratod/animated-map-of-covid-19-cases

2. Bivariate Choropleth:
https://observablehq.com/@d3/bivariate-choropleth
`
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