react-plotly.js icon indicating copy to clipboard operation
react-plotly.js copied to clipboard

Change display values

Open SirCameron opened this issue 6 years ago • 3 comments

I have 2 plots displayed on one graph and I changed the values of one of the plots to ensure it was within the same y axis range as the other plot.. Is it possible to show different values on the value tooltips? I would just need to receive the value at the current position and run a calculation on it to get the original value..

SirCameron avatar May 20 '19 14:05 SirCameron

Yep, check out the ā€œhovertemplateā€ attribute

nicolaskruchten avatar May 20 '19 15:05 nicolaskruchten

Thanks. But, it looks like this is just a simple string template. No functionality to specify a function that returns augmented data.

SirCameron avatar May 20 '19 20:05 SirCameron

That’s right: Plotly.js figures are totally declarative and therefore accept no functions. That said, you can store derived data in ā€œcustomdataā€ and refer to it in ā€œhovertemplateā€

nicolaskruchten avatar May 20 '19 20:05 nicolaskruchten