Search code examples
rhighchartslinechartr-highcharter

dash_styles in Highcharts


I am trying to change the dashStyle of a Line chart in Highcharts.

I referred to RDocumentation , page 7, There is no example of it anywhere. All it says is use dash_styles()

Then i checked here and tried, but it is not resulting in what i need.

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)
}

How do i use this dash_style ?


Solution

  • dash_styles is only a helper function show what types of dash you can use.

    Check this example. You'll see you need only give the name of the type of dash:

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

    enter image description here