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

5
有没有办法将自定义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的图形时,鼠标悬停时它们看起来像这样: enter image description here 我看到了bgcolor、bordercolor、borderwidth等属性,但没有关于悬停样式的内容。有人能使其正常工作吗?
谢谢

2
+1 我也在寻找答案。看起来这些按钮只适用于默认/白色背景。 - devcoder
1个回答

1

你应该使用

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'),
  ),
...

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接