Tooltip labeling for plot fills

Hi there,

I’m trying to figure out how to change the label on my tooltip fills:
Screenshot 2024-04-19 at 9.17.10 AM

I can change the labels of the other series using the channels: option in my plot mark, but I can’t get them to stick for the fill. For reference, I’m plotting tips following this general structure,

Plot.plot({
  marks: [
    Plot.barY(
      x: "x",
      y: "y",
      fill: "fuel_type",
      channels: {'Percentage Point Change':"x", Region:"y", 'Fuel Type':"fuel_type"},
      tip: true
    )
  ]
})

If anyone has advice on changing the label of the fill in the Plot call then let me know!

One way I can think of is just by renaming the key to “Fuel Type”, i.e.:
[{x: <x value>, y: <y value>, "Fuel Type": <fuel type value>}]

That worked perfectly. Thank you for your feedback! Hopefully in the future this can be built directly into plot options. Maybe I’ll take a look at the code and see if it would be easy enough to contribute to.

You could add a label option to the color scale option.

1 Like

Thank you! Yes, this is the built-in approach I wasn’t aware of.

1 Like