在 Panel 仪表板中呈现时,绘图线图有问题并且失去交互性

我目前正在使用 Plotly express 和 Panel 创建仪表板。

使用 Plotly 创建的图表工作正常,但一旦呈现到仪表板中,它们就会变得有问题。当鼠标悬停在数据点上时,不会弹出悬停信息,缩放、平移和重置等绘图工具会消失,我的鼠标在图表上移动时会变成一个双面水平箭头,当您将鼠标悬停在滚动条上时就会看到。>

我将放置足够的代码来重新创建仪表板内外的图表之一,以便任何想要测试的人都可以测试并查看他们是否得到相同的结果。

# Getting BTC TWh csv straight from the download link so that whenever the notebook is ran,the data is the latest available
req = requests.get('https://static.dwcdn.net/data/cFnri.csv')
url_content = req.content
csv_file = open('Resources/btc_twh.csv','wb')
csv_file.write(url_content)

# Creating BTC TWh dataframe from csv
btc_twh_df = pd.read_csv(Path("Resources/btc_twh.csv"))

# Changing column names for readability and replacing '/' with '-' for plotting reasons
btc_twh_df.columns = ["date","btc_estimated","btc_minimum"]
btc_twh_df["date"] = btc_twh_df["date"].str.replace("/","-")
btc_twh_df_subset.head()

# Plot ETH/BTC TWh with Plotly
btc_twh_chart = px.line(
    btc_twh_df,y="btc_estimated",title="BTC Energy Usage",color_discrete_map={"btc_estimated":"orange"},labels={"btc_estimated":"BTC"})

btc_twh_chart.update_layout(xaxis_title="",yaxis_title="Energy Usage in TWh",template="plotly_dark",height=600,width=1000)

btc_twh_chart.show()

###################
# Plot chart within the dashboard

# TWh panes and column
twh_pane = pn.pane.Plotly(btc_twh_chart)

# Dashboard
dashboard = pn.Tabs(
    ("Welcome",twh_pane)
)

dashboard.servable()

看看情况如何,让我知道,这可能是我的 2017 Macbook Pro,虽然到目前为止我还没有遇到处理器问题,但我的直觉告诉我这更像是一个错误。

如果它工作正常并且你想进一步调查这里是我的回购 https://github.com/kez4twez/mining_energy_usage

随意克隆它并尝试运行整个dashboard.ipynb文件,看看会发生什么。

谢谢

iCMS 回答:在 Panel 仪表板中呈现时,绘图线图有问题并且失去交互性

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/116158.html

大家都在问