Export Code
XAxis.js
import { useRef, useEffect } from 'react';
import { select, axisBottom } from 'd3';

export const XAxis = ({ xScale, innerHeight }) => {
const ref = useRef();
useEffect(() => {
const xAxisG = select(ref.current);
const xAxis = axisBottom(xScale)
.tickSize(-innerHeight)
.tickPadding(18);
xAxisG.call(xAxis);
}, []);
return <g transform={`translate(0,${innerHeight})`} ref={ref} />;
};

Coronavirus Linear Y Axis

Curran Kelleher

Last edited Dec 28, 2020
Created on Mar 28, 2020

Line chart of Coronavirus cases to date. Data from Johns Hopkins Coronavirus Dataset.

MIT Licensed