Reputation: 87
I am a new user to shiny and try to train through the examples provided in the library. I have some troubles with the highchart options, my plot is a line with points, and I would like to control the size of the points.
Here is the simplified code: (using an example from the "highchart" library, folder "demo"):
### START of the code
library("shiny")
library("highcharter")
data(citytemp)
ui <- fluidPage(
h1("Highcharter Demo"),
fluidRow(
column(width = 4, class = "panel",
selectInput("type", label = "Type", width = "100%",
choices = c("line", "column", "bar", "spline")),
selectInput("stacked", label = "Stacked", width = "100%",
choices = c(FALSE, "normal", "percent")),
selectInput("theme", label = "Theme", width = "100%",
choices = c(FALSE, "fivethirtyeight", "economist", "darkunica", "gridlight",
"sandsignika", "null", "handdrwran", "chalk")
)
),
column(width = 8,
highchartOutput("hcontainer",height = "500px")
)
)
)
server = function(input, output) {
output$hcontainer <- renderHighchart({
hc <- highcharts_demo() %>%
hc_rm_series("Berlin") %>%
hc_chart(type = "line") %>%
hc_plotOptions(area = list(
stacking = input$stacked,
lineColor = "#ffffff",
lineWidth = 1,
marker = list(
lineWidth = 1,
radius=10,
lineColor = "#ffffff"
)))%>%
hc_tooltip(pointFormat = '<span style="color:{series.color}">{series.name}</span>:
<b>{point.percentage:.1f}%</b> ({point.y:,.0f} millions)<br/>',
shared = TRUE)
hc
})
}
shinyApp(ui = ui, server = server)
## END of the code
I have done some research and found out that you can control the size using "marker" and its options. But my chart looks completely independent from this feature: I tried several values of Width & radius for the marker and it does not change anything.
Can someone advise me on what I am doing wrong? Many thanks in advance for your help!
Upvotes: 2
Views: 1434
Reputation: 13856
Hi your chart is a line, so in hc_plotOptions
you should set options for a line, not an area, e.g. :
hc_plotOptions(
line = list( # put line here instead of area
stacking = input$stacked,
lineColor = "#ffffff",
lineWidth = 1,
marker = list(
lineWidth = 1,
radius=10,
lineColor = "#ffffff"
)
)
)
Upvotes: 2