Hello! I was wondering how I’d modify the "X: %{x:.0}<br>"
below so that my custom hover can read X: label
and not the numeric x value? For example, X: a
not X: 1
I’ve tried using xaxis.ticklabel but that displays ALL the tick labels and not the one of the current point. Anyone have any pointers??
<head>
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
</head>
<body>
<div id='myDiv'></div>
</body>
let trace1 = {
x: [1,2,3],
y: [1,2,3],
hovertemplate:
"Y: %{y:.0}<br>" +
"X: %{x:.0}<br>" +
"<extra></extra>",
type: 'scattergl',
mode: 'lines',
};
var layout = {
xaxis: {
tickvals: [1,2,3],
ticktext: ["a", "b", "c"],
}
}
Plotly.plot('myDiv', [trace1], layout)