Remove white labels whit values on echarts (sankey)

Summary

I would like to remove the labels on the echart, they are marked in red in the picture

Steps to reproduce

Code snippet:

with open("./data/product.json", "r") as f:
    data = json.loads(f.read())

option = {
    "title": {"text": "Sankey Diagram"},
    "tooltip": {"trigger": "item", "triggerOn": "mousemove"},
    "series": [
        {
            "type": "sankey",
            "data": data["nodes"],
            "links": data["links"],
            "emphasis": {"focus": "adjacency"},
            "levels": [
                {
                    "depth": 0,
                    "itemStyle": {"color": "#fbb4ae"},
                    "lineStyle": {"color": "source", "opacity": 0.6},
                },
                {
                    "depth": 1,
                    "itemStyle": {"color": "#b3cde3"},
                    "lineStyle": {"color": "source", "opacity": 0.6},
                },
                {
                    "depth": 2,
                    "itemStyle": {"color": "#ccebc5"},
                    "lineStyle": {"color": "source", "opacity": 0.6},
                },
                {
                    "depth": 3,
                    "itemStyle": {"color": "#decbe4"},
                    "lineStyle": {"color": "source", "opacity": 0.6},
                },
            ],
            "lineStyle": {"curveness": 0.5},
        }
    ],
}
st_echarts(option, height="500px")

If applicable, please provide the steps we should take to reproduce the error or specified behavior.
You just need a sankey chart and move the mouse pointer above the graph
there’s one example here:
https://echarts.streamlit.app/~/+/#streamlit-echarts-demo
select on the left Sankey with Level Settings

Expected behavior:
To remove the white label with values, so i could see the graph in detail

Actual behavior:
There’s a white big label with values, and I’d prefer to hide them

1 Like

Hi @mabusdogma! :wave:

Based on your code and if I’m understanding your question properly, you want to remove the tooltips that appear when you mouse over the nodes in your Sankey diagram.

The tooltips are controlled by the “tooltip” object in your options config. Setting this to an empty object, {}, should remove the tooltips.

Change this line:

"tooltip": {"trigger": "item", "triggerOn": "mousemove"},

to:

"tooltip": {},

Let me know if that’s what you are after.

Thanks
Charly

1 Like

Yes! tooltips, Sorry I didn’t know how to call them. It actually works.
What I did is to remove the whole line, so I have now:

option = {
    "title": {"text": "Sankey Diagram"},
    "series": [...

Thank you!

1 Like

Glad this fixes your issue! :smiley:

Happy Streamlit’ing! :balloon:

Charly

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.