analytics-chart.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { Area, AreaChart, ResponsiveContainer, XAxis, YAxis } from 'recharts'
  2. const data = [
  3. {
  4. name: 'Mon',
  5. clicks: Math.floor(Math.random() * 900) + 100,
  6. uniques: Math.floor(Math.random() * 700) + 80,
  7. },
  8. {
  9. name: 'Tue',
  10. clicks: Math.floor(Math.random() * 900) + 100,
  11. uniques: Math.floor(Math.random() * 700) + 80,
  12. },
  13. {
  14. name: 'Wed',
  15. clicks: Math.floor(Math.random() * 900) + 100,
  16. uniques: Math.floor(Math.random() * 700) + 80,
  17. },
  18. {
  19. name: 'Thu',
  20. clicks: Math.floor(Math.random() * 900) + 100,
  21. uniques: Math.floor(Math.random() * 700) + 80,
  22. },
  23. {
  24. name: 'Fri',
  25. clicks: Math.floor(Math.random() * 900) + 100,
  26. uniques: Math.floor(Math.random() * 700) + 80,
  27. },
  28. {
  29. name: 'Sat',
  30. clicks: Math.floor(Math.random() * 900) + 100,
  31. uniques: Math.floor(Math.random() * 700) + 80,
  32. },
  33. {
  34. name: 'Sun',
  35. clicks: Math.floor(Math.random() * 900) + 100,
  36. uniques: Math.floor(Math.random() * 700) + 80,
  37. },
  38. ]
  39. export function AnalyticsChart() {
  40. return (
  41. <ResponsiveContainer width='100%' height={300}>
  42. <AreaChart data={data}>
  43. <XAxis
  44. dataKey='name'
  45. stroke='#888888'
  46. fontSize={12}
  47. tickLine={false}
  48. axisLine={false}
  49. />
  50. <YAxis
  51. stroke='#888888'
  52. fontSize={12}
  53. tickLine={false}
  54. axisLine={false}
  55. />
  56. <Area
  57. type='monotone'
  58. dataKey='clicks'
  59. stroke='currentColor'
  60. className='text-primary'
  61. fill='currentColor'
  62. fillOpacity={0.15}
  63. />
  64. <Area
  65. type='monotone'
  66. dataKey='uniques'
  67. stroke='currentColor'
  68. className='text-muted-foreground'
  69. fill='currentColor'
  70. fillOpacity={0.1}
  71. />
  72. </AreaChart>
  73. </ResponsiveContainer>
  74. )
  75. }