3

我正在尝试更改 Highcharts 中折线图的 dashStyle。

我参考了RDocumentation,第 7 页,在任何地方都没有它的例子。它所说的只是使用dash_styles()

然后我在这里检查并尝试过,但它没有得到我需要的结果。

library(highcharter)
  highchart() %>% 
    hc_title(text = title) %>% 
    hc_xAxis(categories = batchno) %>% 
    hc_add_series(name = "Mixer A", data = A,
                  color = "hotpink", pointWidth = 20, type = "line",
                 dash_styles(style = "LongDot")) %>% 
    hc_add_series(name = "Mixer B" , data = B,
                  color =  "slateblue", pointWidth = 20,type = "line") %>%

    hc_chart(type = "column") %>% 

    hc_yAxis(
      list(lineWidth = 3, lineColor='seashell', title=list(text= "text"),max= 10)) %>% hc_tooltip(crosshairs = TRUE, shared =  TRUE)
}

我如何使用这个 dash_style ?

4

1 回答 1

5

dash_styles只是一个辅助函数,显示您可以使用哪些类型的破折号。

检查这个例子。你会看到你只需要给出破折号类型的名称:

highchart() %>%
  hc_add_series(data = rnorm(5), dashStyle = "longdash") %>% 
  hc_add_series(data = rnorm(5), dashStyle = "DashDot") 

在此处输入图像描述

于 2017-11-06T14:26:08.453 回答