Plot.tip vs tip mark option

I have a plot using Observable Plot.dot with x, y, and symbol channels.

Live example at:

Using the tip mark option, the tooltips display the labels and values for the x, y, and symbol channels. For example, this:

{x: 'a', y: 'b', symbol: 'c', tip: true}

gives me tooltips like this (which is what I want):
My X 1
My Y 1
My Symbol 1

However, if I explicitly create a Plot.tip then the tooltips display the labels and values for x and y, but not the symbol channel. For example, this:

Plot.pointer({x: 'a', y: 'b', symbol: 'c'})

gives me tooltips like this (which is not what I want):
My X 1
My Y 1

If I try to add the symbol channel via channels like this:

Plot.pointer({x: 'a', y: 'b', channels: {symbol: 'c'}})

then I get tooltips like this (with the label for symbol being ignored, which is also not what I want):
c 1
My X 1
My Y 1

As far as I understand it, in order to set the maxRadius for Plot.pointer I need to use Plot.tip instead of the tip mark option. But how do I do that while preserving the information and formatting in the tooltip?

Thanks,
Adam

Plot.tip(
  data,
  Plot.pointer({x: "a", y: "b", channels: {symbol: {value: "c", scale: "symbol"}}}),
),

Only Plot.dot knows that the symbol channel is associated with the symbol scale—for other marks (ie, Plot.tip), you need to specify it.

1 Like

Thank you!

With this information in hand, I was able to find a description of this in the Observable Plot documentation on the Marks page deep down in the Mark options section: Marks | Observable Plot.

Thinking about what would have helped me find it myself:
I feel like it would be a bit easier to find in the Marks have channels section of that page. And I’m tempted to think that it would be helpful to have a Channels page listed under Features. Certainly such a page would overlap with other pages such as Marks and Scales, but it could provide another access point to this sort of information.

1 Like