observablehq / observablehq/plot
smarter autoheight for ordinal scales?
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- HTML
- Stars
- 5.4k
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Description
autoHeight with the default round:true option sometimes leaves too much white space. In the chart below it returns a value of 580, when ideally it should be 556px.
Plot.plot({
x: {
percent: true,
label: "Frequency (%) →"
},
height: 556,
y: {
label: null
},
marks: [
Plot.gridX({interval: 1}),
Plot.axisX({anchor: "top"}),
Plot.axisX({anchor: "bottom", label: null}),
Plot.barX(alphabet, {x: "frequency", y: "letter", fill: "steelblue"}),
Plot.ruleX([0])
]
})
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied Plot example with autoHeight and the default round:true option, comparing the returned 580px height with the intended 556px. Trace the ordinal-scale height calculation and add coverage showing that autoHeight avoids the excess whitespace while preserving rounded heights where appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- d3, javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100