Heatmaps with hovertemplate with %{text} is not working
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 18.3k
- Fork
- 2k
- Merge medio
- 2g 12h
- PR unite (30g)
- 28
Descrizione
The following works for scatter plot where you can see %{text} is being populated from the provided text:
<head>
<!-- Load plotly.js into the DOM -->
<script src='https://cdn.plot.ly/plotly-2.24.1.min.js'></script>
</head>
<body>
<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
var data = [
{
type: 'scatter',
mode: 'lines+markers',
x: [1, 2, 3],
y: [2, 4, 6],
z: [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
hovertemplate: '<i>Price</i>: $%{y:.2f}' +
'<br><b>X</b>: %{x}<br>' +
'<b>%{text}</b>',
text: ["Text A", "Text B", "Text C"],
showlegend: false
}
];
var layout = {
title: "Set hover text with hovertemplate",
};
Plotly.newPlot('myDiv', data, layout);
But the same doesn't work you generate a heatmap (the code is the same, except changed the type to heatmap):
var data = [
{
type: 'heatmap',
mode: 'lines+markers',
x: [1, 2, 3],
y: [2, 4, 6],
z: [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
hovertemplate: '<i>Price</i>: $%{y:.2f}' +
'<br><b>X</b>: %{x}<br>' +
'<b>%{text}</b>',
text: ["Text A", "Text B", "Text C"],
showlegend: false
}
];
var layout = {
title: "Set hover text with hovertemplate",
};
Plotly.newPlot('myDiv', data, layout);
Would really appreciate some help on this.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia eseguendo la riproduzione HTML e JavaScript fornita con Plotly 2.24.1, quindi confronta la gestione di hovertemplate per le tracce scatter e heatmap. Traccia il comportamento dell'hover di heatmap e la relativa mappatura dei dati %{text}; il lavoro è completato quando il testo fornito appare nelle etichette hover di heatmap senza regressioni nel comportamento di scatter.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100