向 Highchart 图添加斜体彩色文本

Add a colored text in italic to Highchart plot

我想使用 HTML 添加蓝色斜体文本。我使用 <em> 标签定义斜体文本,使用 <span> 标签定义颜色,但我只得到斜体文本:

这是我所做的:

library(highcharter)
library(dplyr)
highchart()%>%
  hc_yAxis(
    title = list(text = "value")
  )%>%
  hc_xAxis(
    accessibility = list(
      rangeDescription = 0:5
    )
  )%>%
  hc_plotOptions(
    series = list(
      labels = list(
        connectorAllowed = FALSE
      ),
      pointStart = 0
    )
  )%>%
  hc_series(
    list(
      type = "spline",
      color = "#0000FF",
      name = 'data',
      data = c(100,92,84,77,71)
    )
    
  )%>%
  hc_labels(
    items = list(
      list(
        html = "<span style=\"color:#0000FF\"><em>a text here in blue color</em></span>",
        style = list(
          left = "144%",
          top = "50%"
        )
      )
    )
  )

一些帮助将不胜感激

我们必须将标签放入 list 对象中。这是完整的代码:

library(highcharter)
library(dplyr)
highchart()%>%
  hc_yAxis(
    title = list(text = "value")
  )%>%
  hc_xAxis(
    accessibility = list(
      rangeDescription = 0:5
    )
  )%>%
  hc_plotOptions(
    series = list(
      labels = list(
        connectorAllowed = FALSE
      ),
      pointStart = 0
    )
  )%>%
  hc_series(
    list(
      type = "spline",
      color = "#0000FF",
      name = 'data',
      data = c(100,92,84,77,71)
    )
    
  )%>%
  hc_labels(items = list(
    list(html = "<em>a text here in blue color</em>", style = list( color = "#0000FF", left = "144%", top = "50%" ))
    ))