data=Object.assign(newMap(csv_data),{title:["Percentage of Confirmed Covid Cases from total County Population"]})
md`# Linear Scale (Unclassed)`
//all of the colors used for this assignment came from colorbrewer.org. To select colors you go to the top and there is a pull down menu for the number of classes that you want to use, for this assignment I just left the number of classes at 3 but if you want to use more you use this menu to select the number of classes that you want. After you select the number of classes you choose which hue you would like to use for your map. Below that is an export section. There is a drop down menu for if you want to export HEX, RGB, or CMYK. For this assignment I used HEX. To export you copy the value next to each color that you want to where ever you want to use it.
//the code below creates a Linear Scale or Unclassified map on observable. .domain is how you select the data that will be used for the map and .rage is how you set the rage of colors to go with the data from the domain.
// The code below is used to create a quantile map. scaleQuantile() tell it to create three classes with roughly equal number of elements in them. .domain tells it which data to use and .range tells it which colors to assign to data within certain ranges.
quantile=d3.scaleQuantile()
.domain(CaseConfirmedpct)
.range(["#e5f5f9","#99d8c9","#2ca25f"])
chart(numericSort(CaseConfirmedpct),quantile)
md`# Jenks Natural Breaks Classification`
// this is how you create natural breaks for your data. It looks at CaseConfirmedpct for the data and the 3 after CaseConfirmedpct tells it the number of breaks to assign. Natural breaks means that it looks at the data to find naturally occuring gaps in the data distribution.
//this maps out the natural breaks from above. .domain is naturalbreaks as that is what is being mapped and the .range assigns the colors for each of those classes
jenks=d3
.scaleThreshold()
.domain(naturalbreaks)
.range(["#deebf7","#9ecae1","#3182bd"])
chart(numericSort(CaseConfirmedpct),jenks)
md`# Equal Interval Classification (Quantize)`
//The code below creates a Equal Interval map. domain is set to the min and max of CaseConfirmedpct and the range assigns colors from colorbrewer to each class
// below is the threshold map. the .domian has the thresold for the classes. I changed the thresolds from what they orginally were to use all of the colors from colorbrewer. I left it with three classes as that is what it orginally was, I just raised the thresold values to show all of the colors
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.