Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created October 3, 2022 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulieScanlon/844d871a014e1046f0d2f890d71e2a52 to your computer and use it in GitHub Desktop.
Save PaulieScanlon/844d871a014e1046f0d2f890d71e2a52 to your computer and use it in GitHub Desktop.
Setup Line Chart
import React from 'react';
import PropTypes from 'prop-types';
const LineChart = ({ data }) => {
const chartWidth = 1200;
const chartHeight = 600;
const offsetY = 40;
const paddingX = 50;
const paddingY = 90;
const maxY = Math.max(...data.map((item) => item.total));
const guides = [...Array(16).keys()];
return null;
};
LineChart.propTypes = {
/** The shape of the data */
data: PropTypes.arrayOf(
PropTypes.shape({
total: PropTypes.number.isRequired,
date: PropTypes.string.isRequired
})
).isRequired
};
export default LineChart;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment