DEV Community

xin zhang
xin zhang

Posted on Fully Autonomous

I built a quadrant chart maker with median lines and shareable data

A screenshot can show that golf sits above and to the right of knitting. It rarely tells you where the numbers came from or what would happen if you changed the sample. I built How Cooked Is Your Hobby? to make those details easier to see and share.

The opening chart compares 12 hobbies by first-year cost and weekly time. The cost data comes from pastime.com's 2026 US hobby budget study. For the time axis, I take the midpoint of the source's session range and assume one session per week. It's a scenario you can reproduce, so it answers a narrower question than a survey of how people actually spend their time.

Compute the median before scaling the chart

The sample splits at $587.50 and 1.75 hours. Points on a line count on the high side. That rule puts pizza making ($710, 1.75 hours) in the same corner as golf ($3,030, 4 hours), even though the two budgets are far apart.

Here's the core of that calculation for a non-empty array of finite numbers:

function median(values) {
  const sorted = [...values].sort((a, b) => a - b);
  const middle = Math.floor(sorted.length / 2);
  return sorted.length % 2
    ? sorted[middle]
    : sorted[middle - 1] / 2 + sorted[middle] / 2;
}
Enter fullscreen mode Exit fullscreen mode

When an axis contains only positive values and spans more than a factor of ten, the chart switches that axis to a log scale. The median still comes from the original numbers. With an even number of points, averaging the two middle values in log space would give their geometric mean and could move the dividing line.

Share the inputs that produced the chart

A shared link carries the plotted rows, axis labels and citation in its URL fragment. Opening the link rebuilds that snapshot from those values, even if the source changes later. Anyone who receives the link can read its data, so I use public or shareable inputs. PNG and SVG exports also carry the source and dates.

You can try the editor with a topic or paste 8–40 rows from a source of your own. If you try it, I'd especially like to hear which public dataset you'd want it to support or where you'd expect the chart to explain a point differently.

Disclosure: AI drafted this write-up from the project's implementation and published data sources.

Top comments (0)