evrimfeyyaz/covid-19-in-charts

View on GitHub
src/components/pages/SingleLocation/common/charts/SingleLocationLineChart.tsx

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { ValuesOnDate } from "@evrimfeyyaz/covid-19-api";
import { FunctionComponent } from "react";
import { Line, LineChart } from "recharts";
import { SingleLocationChartContainer } from "./SingleLocationChartContainer";
import { SingleLocationChartProps } from "./SingleLocationChartProps";
 
/**
* A line chart that charts a single data point of a single location.
*/
export const SingleLocationLineChart: FunctionComponent<
SingleLocationChartProps<ValuesOnDate, keyof ValuesOnDate>
> = (props) => {
const { dataKey, name, color } = props;
 
return (
<SingleLocationChartContainer ChartComponent={LineChart} {...props}>
<Line
dataKey={dataKey}
opacity={0.9}
stroke={color}
strokeWidth={3}
name={name}
dot={false}
/>
</SingleLocationChartContainer>
);
};