async function main() {
const margin = {
top: 5,
right: 10,
bottom: 50,
left: 70
}
const outerWidth = elemGraph.offsetWidth
const outerHeight = elemGraph.offsetHeight
const innerWidth = outerWidth - margin.right - (margin.left * 2)
const innerHeight = outerHeight - margin.top - (margin.bottom * 2)
const data = await getData()
const x = xScale(innerWidth, data)
const y = yScale(innerHeight, data)
const xAxis = d3.axisBottom(x)
const yAxis = d3.axisLeft(y)
const xGrid = d3.axisBottom(x)
.tickFormat('')
.tickSizeInner(- innerHeight)
const yGrid = d3.axisLeft(y)
.tickFormat('')
.tickSizeInner(- innerWidth)
const graph = d3.select(elemGraph)
const svg = graph.append("svg")
.attr("width", outerWidth)
.attr("height", outerHeight)
.attr("viewBox", [0, 0, outerWidth, outerHeight])
axis(margin.left, innerHeight + margin.top, xAxis, svg)
axis(margin.left, margin.top, yAxis, svg)
labelAxisX((innerWidth / 2) + margin.left, innerHeight + margin.bottom, "girth (in)", svg)
labelAxisY(margin.left / 2, innerHeight / 2, "height (ft)", svg)
grid(margin.left, innerHeight + margin.top, xGrid, svg)
grid(margin.left, margin.top, yGrid, svg)
const cs = colorScale(data)
dots(x, y, margin, cs, data, svg)
tooltips(svg)
table(d3.select(elemTable), cs, data)
}