I have a date x axis, and I need to show DAY or NIGHT on hover, instead of actual date. I can’t achieve it with d3 time formatting string.
Would be great to be able to pass a function, that would calculate the hover text based on the x value, ie:
layout.xaxis.hoverformat: function(date) { // determinte DAY, NIGHT, whatever from the date; }
plotly.js attempts to make every chart attribute JSON serializable, that is custom functions won’t be part of our API for the foreseeable future.
Here are two possible workarounds:
- use
tickvals
andticktext
to customize the axis labels: http://codepen.io/etpinard/pen/mEOVad - use trace
text
andhoverinfo
to customize the hover labels: http://codepen.io/etpinard/pen/BzQjMz
1 Like
Thank you.
Customizing hover values seems like a solution for me. But I have grouped bar chart, and getting same hover for every trace.
Is there a way to have single hover for a whole group?
Not at the moment. Hover labels are generated per trace.