Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

index.tsx 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {
  2. CartesianGrid,
  3. Legend,
  4. Line,
  5. LineChart,
  6. ResponsiveContainer,
  7. Tooltip,
  8. XAxis,
  9. YAxis,
  10. } from 'recharts';
  11. import { CategoricalChartProps } from 'recharts/types/chart/generateCategoricalChart';
  12. interface IProps extends CategoricalChartProps {
  13. data?: Array<{ xAxis: string; yAxis: number }>;
  14. showLegend?: boolean;
  15. }
  16. const RagLineChart = ({ data, showLegend = false }: IProps) => {
  17. return (
  18. <ResponsiveContainer width="100%" height="100%">
  19. <LineChart
  20. // width={500}
  21. // height={300}
  22. data={data}
  23. margin={
  24. {
  25. // top: 5,
  26. // right: 30,
  27. // left: 20,
  28. // bottom: 10,
  29. }
  30. }
  31. >
  32. <CartesianGrid strokeDasharray="3 3" />
  33. <XAxis dataKey="xAxis" />
  34. <YAxis />
  35. <Tooltip />
  36. {showLegend && <Legend />}
  37. <Line
  38. type="monotone"
  39. dataKey="yAxis"
  40. stroke="#8884d8"
  41. activeDot={{ r: 8 }}
  42. />
  43. {/* <Line type="monotone" dataKey="uv" stroke="#82ca9d" /> */}
  44. </LineChart>
  45. </ResponsiveContainer>
  46. );
  47. };
  48. export default RagLineChart;