observablehq / observablehq/plot

An implicit group transform for z-less areas?

Open
#1,770 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement question
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

The areaY mark gets an implicit stack transform that works well when there’s a z channel:

untitled (44)

Plot.areaY(industries, {x: "date", y: "unemployed", z: "industry"}).plot()

But when there isn’t a z channel, stacking doesn’t really help, because you’re still drawing a single shape for the entire dataset, resulting in zigzags:

untitled (45)

Plot.areaY(industries, {x: "date", y: "unemployed"}).plot()

This is a little more visible when drawing a line:

untitled (46)

Plot.lineY(industries, {x: "date", y: "unemployed"}).plot()

If you want to draw a single shape, you need the group transform:

untitled (47)

Plot.areaY(industries, Plot.groupX({y: "sum"}, {x: "date", y: "unemployed"})).plot()

Maybe areaX and areaY could apply a group transform by default (using groupY and groupX respectively) when no fill, stroke, or z channel is present?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the areaY and areaX mark behavior with the existing Plot.groupX and Plot.groupY examples in the issue. Determine how the absence of fill, stroke, and z should affect the implicit transform, then verify the area and line examples produce a single shape without changing grouped cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3, javascript
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.