Removed container
This commit is contained in:
1 parent
1dccbba044
commit
f5fab38ca8
2 files changed
+30
-4023
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -1,34 +1,7 @@
|
|||||||
import { LineChart } from "@mui/x-charts/LineChart";
|
import { LineChart } from "@mui/x-charts/LineChart";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
import data from "./dummy_data";
|
|
||||||
|
|
||||||
const PageSpeedLineChart = ({ pageSpeedChecks = [] }) => {
|
const PageSpeedLineChart = ({ pageSpeedChecks = [] }) => {
|
||||||
// // SQUASH ERROR, NOT PERMANENT SOLUTION
|
|
||||||
// const error = console.error;
|
|
||||||
// console.error = (...args) => {
|
|
||||||
// if (/defaultProps/.test(args[0])) return;
|
|
||||||
// error(...args);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// // END SQUASH ERROR, NOT PERMANENT SOLUTION
|
|
||||||
// return (
|
|
||||||
// <div style={{ width: "100vw", height: "80vw" }}>
|
|
||||||
// <ResponsiveContainer width="100%" height="100%">
|
|
||||||
// <LineChart width={500} height={300} data={data} margin={{}}>
|
|
||||||
// <CartesianGrid strokeDasharray="3 3" />
|
|
||||||
// <XAxis dataKey="name" />
|
|
||||||
// <YAxis />
|
|
||||||
// <Tooltip />
|
|
||||||
// <Legend />
|
|
||||||
// <Line type="monotone" dataKey="performance" stroke="#2aa02b" />
|
|
||||||
// <Line type="monotone" dataKey="seo" stroke="#9467bd" />
|
|
||||||
// <Line type="monotone" dataKey="bestPractices" stroke="#ff7f0e" />
|
|
||||||
// <Line type="monotone" dataKey="accessibility" stroke="#1f76b3" />
|
|
||||||
// </LineChart>
|
|
||||||
// </ResponsiveContainer>
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
|
|
||||||
const keyToLabel = {
|
const keyToLabel = {
|
||||||
performance: "Performance",
|
performance: "Performance",
|
||||||
seo: "SEO",
|
seo: "SEO",
|
||||||
@@ -44,26 +17,39 @@ const PageSpeedLineChart = ({ pageSpeedChecks = [] }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const customize = {
|
const customize = {
|
||||||
// legend: { hidden: true },
|
legend: { position: { vertical: "bottom", horizontal: "middle" } },
|
||||||
// margin: { top: 5 },
|
margin: { bottom: 75 },
|
||||||
// // stackingOrder: "descending",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const xLabels = pageSpeedChecks.map((check) => {
|
||||||
|
return check.createdAt;
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ height: "100vh", width: "100vw" }}>
|
<LineChart
|
||||||
<LineChart
|
series={Object.keys(keyToLabel).map((key) => ({
|
||||||
series={Object.keys(keyToLabel).map((key) => ({
|
dataKey: key,
|
||||||
dataKey: key,
|
label: keyToLabel[key],
|
||||||
label: keyToLabel[key],
|
color: colors[key],
|
||||||
color: colors[key],
|
showMark: false,
|
||||||
showMark: false,
|
}))}
|
||||||
}))}
|
yAxis={[{ min: 0, max: 100 }]}
|
||||||
dataset={data}
|
xAxis={[
|
||||||
{...customize}
|
{
|
||||||
grid={{ vertical: true, horizontal: true }}
|
scaleType: "point",
|
||||||
/>
|
data: xLabels,
|
||||||
</div>
|
valueFormatter: (val) => new Date(val).toLocaleDateString(),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataset={pageSpeedChecks}
|
||||||
|
{...customize}
|
||||||
|
grid={{ vertical: true, horizontal: true }}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PageSpeedLineChart.propTypes = {
|
||||||
|
pageSpeedChecks: PropTypes.array.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default PageSpeedLineChart;
|
export default PageSpeedLineChart;
|
||||||
Reference in new issue
Block a user