Black Lives Matter. Please consider donating to Black Girls Code today.

3D Surface Plot: Customize Axis names of Hover text

Hello,
I tried to customize the tooltip of a surface plot to show the correct axis descriptions (Axis1, Axis2, Axis3 instead of x,y,z). Unfortunately, setting hoverinfo to “text” and adding a text to the “text” attribute does not work. I was able to add a hover event to the plot but was not able to include the text that was set in the hover event to the tooltip. Is it somehow possible to add a text from a Hover event to a tooltip of a 3D surface graph?

My settings
data: {
type: surface,
}
layout:{
height: 600,
autosize: true,
margin: {
l: 150
},
title: 'Chart Title’
scene: {
xaxis: {title: ‘Axis1’},
yaxis: {title: ‘Axis2’, tickmode: ‘array’, tickvals: [0, 1, 2, 3, 4, 5, 6, 7], ticktext: [1, 2, 3, 4, 5, 6, 7, 8]},
zaxis: {title: ‘Axis3’},
camera: {
eye: {
x: -1,
y: -2,
z: 0.5
},
up: {
x: 0,
y: 0,
z: 1
},
center: {
x: 0,
y: 0,
z: 0
}
}
}
}

That should work. See example http://codepen.io/etpinard/pen/RGJpoO

Thank you for the help. It works great now. :slight_smile: