簡體   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