Can't get pointerX to work with ruleY

Plot.plot({
  marks: [
    Plot.lineY(aapl, { x: "Date", y: "Close" }),
    Plot.ruleY(aapl, Plot.pointerX({ y: "Close" })),
    Plot.crosshairX(aapl, { x: "Date", y: "Close" })
  ]
})

Given the above, I would expect ruleY to behave like the crosshairX mark ruleY, but it doesn’t. Instead it behaves the same as pointerY/crosshairY. What am I doing wrong? Ultimately I am trying to replicate the crosshair mark because I need custom label formatting and that isn’t currently supported. If there is an example of that somewhere please let me know.

you could try this:

Plot.ruleY(aapl, Plot.pointerX({ px: "Date", y: "Close" })),

see the documentation for px, py at Pointer transform | Observable Plot

2 Likes

Doh! Thank you. Exactly what I needed.