plotly / plotly/plotly.py

Customdata in texttemplate could not be found in heatmap

Offen
#3,929 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

For a heatmap chart I want to create a hyperlink, which is provided in the customdata. For some reason it looks like the customdata fields is not accessible from the texttemplate field. Executing the sample code below with browser debug mode shows that customdata is not found:

import plotly.graph_objects as go
labels = ["a", "b", "c"]
z = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
customdata = [["http://google.com", "http://google.com", "http://google.com"], ["http://google.com", "http://google.com", "http://google.com"], ["http://google.com", "http://google.com", "http://google.com"]]
fig = go.Figure(data=go.Heatmap(x=labels, y=labels,
                                z=z,
                                customdata=customdata,
                                texttemplate="""<a href="%{customdata}">%{z}</a>""",
                                hovertemplate='%{customdata}<extra></extra>',
                                textfont={"size": 20}))
fig.show()

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem bereitgestellten Python-Heatmap-Beispiel und verfolge, wie Heatmap customdata an texttemplate übergeben wird, indem du dies mit dem funktionierenden hovertemplate-Verhalten vergleichst. Bestätige den Fix, indem du den Hyperlink mit der customdata-URL renderst und überprüfst, dass der vorhandene Hover-Text weiterhin korrekt angezeigt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
plotly, python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.