Kelvin Cambridge
Kelvin Cambridge

Reputation: 53

using Highcharters in R with Shiny, control highstock chart height failed

I called highchart with height parameter to make a taller chart successfully in RStudio:

chart <- highchart(type = "stock", height=800, ...)

When in Shiny, the chart shown up but ignore the height parameter. Is there any way to fix it ?

Upvotes: 1

Views: 2488

Answers (2)

jbkunst
jbkunst

Reputation: 3029

If you are using shiny you can set the dimension in the highchartOutput() function:

# ui.R
...
highchartOutput("my_hc_id", width = 450, height = 300)
...

Other way using the hc_size function compared with the @pork-chop answer:

library(quantmod)
library(highcharter)
x <- getSymbols("GOOG", auto.assign = FALSE)

b <- hchart(x)
b <- hc_size(b, width = 450, height = 300)
b

Upvotes: 4

Pork Chop
Pork Chop

Reputation: 29387

Try this:

library(quantmod)
library(highcharter)
x <- getSymbols("GOOG", auto.assign = FALSE)

a <- hchart(x)
a$width <- 450
a$height <- 300
a

enter image description here

Upvotes: 2

Related Questions