python - Plotly(Dash)将鼠标悬停在两点之间的线上并获取值 - python
问题描述
使用 pandas 数据框和 plotly 绘制以下内容:
使用情节快递:
fig= px.line(
df.sort_values(by='allocation'),
x='allocation',
y='cost')
fig.data[0].update(mode='markers+lines',
line = dict(shape = 'linear', color = 'rgb(10, 12, 240)', dash = 'dash'),
connectgaps = True,)
当我将鼠标悬停在标记上时,我会得到预期的弹出窗口,其中 x 和 y 值正确命名。将鼠标悬停在由 绘制的线条connectgaps=True
上时,有什么方法可以得到相同的结果吗?所以悬停在两点之间的线上会给我创建线的那个点的 x 和 y 值吗?
我希望避免必须创建一个公式并为每个单独的段添加一行(并找出最好的方法!)。
解决方案
推荐阅读
- reactjs - 屏幕没有在 touchablenativefeedback 中导航,重要的是组件是功能性的还是反应原生的类
- elasticsearch - solr/elasticsearch search request is handled by shards or replica?
- autocomplete - 谷歌地图“地点自动完成”没有找到带有公寓和号码范围的地址
- c++ - How to do a variadic macro and or template and or function that captures the expression as well as its evaluation?
- django - 如果用户在帖子中找到它,它将从用户数据库中返回用户名作为帖子中的永久链接,来自 Django 中的模型
- java - 可以从 Java SE for WIndows 中包含的 src.zip 编译 jdk
- excel - 我怎样才能更好地从这个列表中选择我想要的值?
- python - Django 显示:OSError: [WinError 123] 文件名、目录名或卷标语法不正确:'
' - linux - 使用 WebDAV 进行身份验证的问题 - davfs2
- javascript - Django - 如何将 Google Maps Polygon area javascript 代码保存到 View?