The function d3.scaleLinear Creates a linear scale using the d3 library imported previously in d3=reqired3@5. The .domain(d3.extent(Ageadjvalue)) segment gives the linear function a domain of values for it to process. It reads the previously created Ageadjusted value object that was created using the csv data parse. The min and max of ageadjusted values are read and used in the linear function for the domain. The range is created using the colors white and purple. This segment is defining the output range. The minimum value will be white and the maximum will be #7a0177. D3 turns the domain values into percentage of color to make a continuous unclassed color scheme.
For quantile classification the phrase d2.scaleQuantile creates a quantile scale with the domain of the ageadjvalues. Because I have 5 colors it splits the values of the age adjusted object into approximately even groups. I used 5 classes for quantile because It gives the data a ranking feel. You can see the lowest, low, medium, above average and high cancer rate counties and compare between them and other maps. I chose the colors using https://colorbrewer2.org/#type=sequential&scheme=BuPu&n=5 and selecting 5 colors in a sequential color scheme
Jenks natural breaks is created with the simple ckmeans of the Ageadjvalue object with 5 classes. Again I chose 5 for easy to understand distribution. Basically this function is splitting the data into 5 statistically optimized clusters.
The range must have the same amount of colors as the classes you created in the naturalbreaks array. If you have to few colors your classes wont show up
Equal interval classification in created by taking the min value of your data and the max value and dividing the difference by number of desired classes. For this the number of colors you put into the range will determine the number of classes created.
Manual classification is created using scaleTHreshold with manual numbers put into the domain. These groups are completely determined by the user. In this instence I wanted to highlight differences in groups of data and exclude outgroups. Coincidently this created groupings very similar to Jenks natural breaks with is supposed to create groups based on how people perceive data.
This is the function that allows for the charting of all the data I have added to this notebook. It first reads the data from the ageadjvalues and the scale of the classification method used. It then decides how large the squares will be and how wide the rows can be with the width and height in the svg? It connects each data point with a rectangle and the style("fill".... command returns and fills a color for that square.