繁体   English   中英

Plotly 悬停下拉按钮时更改字体和背景颜色

[英]Plotly change font and background color when hovering dropdown button

有没有办法将自定义 CSS 添加到 Plotly 下拉按钮? 我有以下几个:

...
updatemenus=[
  dict(buttons=[
    dict(
      args=["type", "bar"],
      label="Bar Chart",
      method="restyle",
    ),
    dict(
      args=["type", "scatter"],
      label="Line Chart",
      method="restyle",
    )
  ]
  , direction="down"),
...

但是当使用主题为plotly_dark的图形时,它们在悬停时是这样的: 在此处输入图像描述

我看到了属性 bgcolor、bordercolor、borderwidth... 但没有关于 hover 样式的信息。 任何人都能够使它工作?

谢谢

你应该使用

font = dict(color='#000000')

例如,

...
updatemenus=[
  dict(buttons=[
    dict(
      args=["type", "bar"],
      label="Bar Chart",
      method="restyle",
    ),
    dict(
      args=["type", "scatter"],
      label="Line Chart",
      method="restyle",
      )
    ],
  direction="down",
  font = dict(color='#000000'),
  ),
...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM