I am trying to create a custom hover tool using which takes the y-value of the plot and maps the value to different value.
The code I could come up with so far to achiev
Here's how I'd do it:
code = f"return ({json.dumps(mapping)})[Math.floor(special_vars.y)];"
hover = HoverTool(tooltips=[("x", "$x"), ("y", "$y"), ('mapped_y', '$y{0}')],
formatters={'$y': CustomJSHover(code=code)})
If you need a some more complicated code than that of col_mapping
, then you'd have to use a ColumnDataSource
and just add to it the fully transformed column.