html - plotly dash-svg 的标签?

标签 html svg plotly-dash

我正在使用 dash-svg(下图)开发一个 plotly dash 应用程序, https://github.com/stevej2608/dash-svg

我在使用 dash-svg 为 svg 图形制作 htmltag 时遇到问题。 我找不到在 svg 图表中建立链接,例如“https://www.google.com”。

如果有人知道“Clickable svg circle”的答案,请帮助我...

import dash
from dash import html
from dash_svg import Svg, G, Path, Circle


app = dash.Dash(__name__)

app.layout = html.Div([
    html.Header([
        Svg([
            G([
                Path(d='...'),
                Circle(cx="420.9", cy="296.5", r='45.7'),
                Path(d='M520.5 78.1z')
            ], fill='#61DAFB')
        ], viewBox='0 0 841.9 595.3', className="App-logo", alt="logo"),
        html.P(["Edit ", html.Code("usage.py"), " and save to reload."]),
        html.A("Learn Dash", className="App-link", href="https://dash.plotly.com/",  target="_blank", rel="noopener noreferrer")
    ], className="App-header")
], className="App")


if __name__ == '__main__':
    app.run_server(debug=True)

enter image description here

最佳答案

您可以尝试将 Svg 组件设置为 html.A 组件的子组件,如下所示:

html.A(
            [
                Svg([
                    G([
                        Path(d='...'),
                        Circle(cx="420.9", cy="296.5", r='45.7'),
                        Path(d='M520.5 78.1z')
                    ], fill='#61DAFB')
                ], viewBox='0 0 841.9 595.3', className="App-logo", alt="logo"),

            ],
            target="_blank",href="https://google.com"
), 

关于html - plotly dash-svg 的标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74037213/

相关文章:

jquery - 在不使用 $.GET 的情况下在 HTML 中内联 SVG

python - 在 python 中连接失败后重试 SQL 连接的正确语法?

python - 阴谋冲刺 : How to integrate SHAP values

python - python 中的 Plotly-Dash 股票应用程序,带有客户端回调(xaxis 缩放上的 yaxis 自动缩放)

html - 只更改一张表的 td padding,不影响其他表的样式?

html - CSS 类选择器不起作用

javascript - 如何在 SVG 排队时而不是运行时检测并停止动画?

php - 将 AJAX 实现到具有多个选择的 PHP 页面中

html - 仅通过 CSS 在视觉上重新格式化表格行

java - 如何通过命令控制台/终端执行脚本后显示 SVG 图像?