plotly / plotly/plotly.py

issue with link in label

Open
#4,947 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

Hi all,

I am doing a sankey plot and I'd like each of my nodes to have a label that can be clickable and redirects to some link.

fig = go.Figure( 
        data=[
            go.Sankey(
                arrangement='fixed',
                node=dict(label=labels, color=label_colors),
                link=dict(
                    source=links["source"],
                    target=links["target"],
                    value=links["value"],
                    color=links["link_c"],
                ),
            )
        ]
    )

However, when exporting the plotly file to html, the link tag appears but the href doesnt, but when further inspecting it appears in "data-unformatted" part of the code below:

<text class="node-label" style="cursor: default; font-family: Helvetica; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; pointer-events: all; text-shadow: white 1px 1px 1px, white -1px -1px 1px, white 1px -1px 1px, white -1px 1px 1px;" data-notex="1" data-unformatted="<a href='google.com'>test</a>" data-math="N" x="0" y="0" text-anchor="start" transform="translate(23.25,4.449999999999999)"><a style="cursor:pointer">test</a></text>

Is there any way I can get this to work (I'd want <a href='google.com'>test</a> instead of the <a style="cursor:pointer">test</a>)

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from Sankey node-label rendering and the exported HTML/SVG markup shown in the issue. Investigate why the href is removed while the label text remains, then verify that exported node labels retain working links without changing ordinary label rendering.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.