Skip to content

frameAnchor: bottom is not properly aligned #1043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Fil opened this issue Sep 7, 2022 · 3 comments · Fixed by #1061 or #1111
Closed

frameAnchor: bottom is not properly aligned #1043

Fil opened this issue Sep 7, 2022 · 3 comments · Fixed by #1061 or #1111
Assignees
Labels
bug Something isn’t working

Comments

@Fil
Copy link
Contributor

Fil commented Sep 7, 2022

untitled (14)

Plot.plot({
  marginLeft: 75,
  x: { insetRight: 10 },
  marks: [
    Plot.frame(),
    Plot.barX(
      penguins,
      Plot.groupY(
        { x: "count" },
        {
          y: "species",
          fill: "sex"
        }
      )
    ),
    Plot.text(["Annotation\nat the bottom-right"], {
      frameAnchor: "bottom-right"
    })
  ]
})

demo https://observablehq.com/@observablehq/bottom-right-misaligned-1043

@Fil Fil added the bug Something isn’t working label Sep 7, 2022
Fil added a commit that referenced this issue Sep 27, 2022
Fil added a commit that referenced this issue Sep 27, 2022
Fil added a commit that referenced this issue Sep 29, 2022
@Fil Fil closed this as completed in #1061 Sep 30, 2022
Fil added a commit that referenced this issue Sep 30, 2022
* text with frameAnchor: bottom should be correctly aligned with the frame, not one line below
closes #1043

* test fixed by #1062

* since the sum (strict window) ignores the first 6 days, feels nicer to ignore them from the domain as well.
@mbostock mbostock reopened this Nov 23, 2022
@mbostock
Copy link
Member

We need a different fix than #1061.

@mbostock
Copy link
Member

mbostock commented Nov 23, 2022

The problem in this case wasn’t that the text was positioned wrong relative to its anchor, its that the anchor is in the wrong place when there are ordinal scales. The anchor is drawn here as a red dot:

Screen Shot 2022-11-23 at 1 56 35 PM

@mbostock
Copy link
Member

More specifically, the problem is that we’re calling applyTransform when the mark doesn’t have an x/y position.

mbostock added a commit that referenced this issue Nov 23, 2022
@mbostock mbostock self-assigned this Nov 23, 2022
mbostock added a commit that referenced this issue Nov 26, 2022
* geometry mark

* pRetTIEr

* project x & y; re-fix #1043

* more projections, and options

* add missing test

* PretTier

* projection + hexbin

* projection.stream for x and y

* test null projection

* another comment

* remove TODO’s

* simplify walmarts

* Update README

* sphere, graticule

* update graticule snapshot

* Walmart data provenance

* r channel for geometries; sort by R.

* Use the facets dimensions, and respect margins. Note that this changes the test plots by 1px (due to margins being 0.5-offset).

* clip: "sphere"

* allow projection configuration function

* revert dimensions changes

* withDefaultSort

* tweak faceted walmarts test

* fix auto height for pre-projected geometry

* more projections

* projection + density

* all marks can clip to sphere

* test voronoi clip to sphere

* error if sphere clip lacks projection

* error if projection and band-requiring channels

* Update README.md

Co-authored-by: Philippe Rivière <[email protected]>

* Update README.md

Co-authored-by: Philippe Rivière <[email protected]>

* pReTTIER

* projection requires x and y channels

* Update README

* Update README

* Update README

* Update README

* a more interesting voronoi map

* geo

* use fitExtent for armadillo

* more data provenance

Co-authored-by: Philippe Rivière <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants