Skip to content

Conversation

@Fil
Copy link
Contributor

@Fil Fil commented Sep 27, 2022

See https://observablehq.com/@observablehq/plot-band-scale-bug-1045

fixes #1045

Note: this is the least disruptive I could do; but it becomes a bit complicated to understand, as we need to compute what the default margins would have been, and add the difference.

(includes #1059, in order to pass CI)

See also #837

@Fil Fil requested review from enjalot and mbostock September 27, 2022 10:27
@Fil Fil changed the base branch from main to fil/prettier-fix September 27, 2022 10:32
@Fil Fil force-pushed the fil/autoheight-margins branch from a073a1e to b5efb4f Compare September 27, 2022 10:34
@Fil Fil changed the base branch from fil/prettier-fix to main September 27, 2022 10:35
@Fil Fil force-pushed the fil/autoheight-margins branch 2 times, most recently from 2e75707 to d9da57e Compare September 27, 2022 15:00
@Fil
Copy link
Contributor Author

Fil commented Sep 27, 2022

🙏 it's easier to read this way!

@Fil Fil requested a review from mbostock September 27, 2022 17:01
Comment on lines 16 to 20
marginTopAuto = Math.max((xAxis === "top" ? 30 : 0) + facetMarginTop, yAxis || fyAxis ? 20 : 0.5 - offset),
marginBottomAuto = Math.max((xAxis === "bottom" ? 30 : 0) + facetMarginBottom, yAxis || fyAxis ? 20 : 0.5 + offset),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn’t implement it this way; it allows a user to change the behavior of Plot by specifying these undocumented marginTopAuto and marginBottomAuto options. Instead we’ll have to restructure the code so that these are local variables to the function.

@mbostock mbostock force-pushed the fil/autoheight-margins branch from b40202f to ff478a3 Compare November 27, 2022 17:16
@mbostock mbostock merged commit 2e5e279 into main Nov 27, 2022
@mbostock mbostock deleted the fil/autoheight-margins branch November 27, 2022 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auto height for band scale consumes margins

4 participants