|
| 1 | +const first = [ |
| 2 | + { rich: 10, cost: 50, name: "readme" }, |
| 3 | + { rich: 20, cost: 50, name: "static blog" }, |
| 4 | + { rich: 40, cost: 50, name: "static docs" }, |
| 5 | + { rich: 60, cost: 50, name: "interactive blog" }, |
| 6 | + { rich: 75, cost: 50, name: "interactive tutorial" }, |
| 7 | + { rich: 90, cost: 50, name: "landing page" }, |
| 8 | +] |
| 9 | + |
| 10 | +const second = [ |
| 11 | + { rich: 10, cost: 10, name: "readme" }, |
| 12 | + { rich: 20, cost: 18, name: "static blog" }, |
| 13 | + { rich: 40, cost: 43, name: "static docs" }, |
| 14 | + { rich: 60, cost: 56, name: "interactive blog" }, |
| 15 | + { rich: 75, cost: 80, name: "interactive tutorial" }, |
| 16 | + { rich: 90, cost: 95, name: "landing page" }, |
| 17 | +] |
| 18 | + |
| 19 | +const w = 300 |
| 20 | +const h = 200 |
| 21 | + |
| 22 | +export function Chart({ name }: { name: string }) { |
| 23 | + const points = name === "first" ? first : second |
| 24 | + // Scatter plot |
| 25 | + return ( |
| 26 | + <div className=""> |
| 27 | + <div |
| 28 | + style={{ width: w, height: h }} |
| 29 | + className="relative border-l-2 border-b-2" |
| 30 | + > |
| 31 | + {points.map(({ rich, cost }, i) => ( |
| 32 | + <div |
| 33 | + key={i} |
| 34 | + style={{ left: `${rich}%`, bottom: `${cost}%` }} |
| 35 | + className="absolute w-2 h-2 bg-blue-500 rounded-full" |
| 36 | + /> |
| 37 | + ))} |
| 38 | + </div> |
| 39 | + </div> |
| 40 | + ) |
| 41 | +} |
0 commit comments