Skip to content

Bug: areaY tip/pointer position wrong for stacked data #1952

Answered by mbostock
Hvass-Labs asked this question in Q&A
Discussion options

You must be logged in to vote

As @Fil said, you need to make the stack transform explicit if you are using it with the tip mark; the area mark applies it implicitly, but the tip mark does not. But there’s no reason to use the tip mark explicitly here when you can use the tip option instead, and then you can continue to benefit from the implicit stack transform provided by the area mark. That looks like this:

Plot.plot({
  marginLeft: 50,
  y: {
    grid: true,
    label: "Unemployed (thousands)"
  },
  marks: [
    Plot.areaY(unemployment, {x: "date", y: "unemployed", fill: "industry", tip: true}),
    Plot.ruleY([0])
  ]
})

I also removed the “↑” from the label since the arrow is applied implicitly by the axis (thou…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
5 replies
@Hvass-Labs
Comment options

@Fil
Comment options

@Hvass-Labs
Comment options

@Hvass-Labs
Comment options

@Fil
Comment options

Comment options

You must be logged in to vote
4 replies
@Hvass-Labs
Comment options

@Hvass-Labs
Comment options

@mbostock
Comment options

@Hvass-Labs
Comment options

Answer selected by Hvass-Labs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1950 on December 18, 2023 12:08.