[英]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: 我用高度参数调用了highchart,在RStudio中成功制作了一个更高的图表:
chart <- highchart(type = "stock", height=800, ...)
When in Shiny, the chart shown up but ignore the height parameter. 在Shiny中,图表显示但忽略height参数。 Is there any way to fix it ? 有什么办法可以解决吗?
If you are using shiny you can set the dimension in the highchartOutput()
function: 如果使用闪亮,可以在highchartOutput()
函数中设置尺寸:
# ui.R
...
highchartOutput("my_hc_id", width = 450, height = 300)
...
Other way using the hc_size
function compared with the @pork-chop answer: 使用hc_size
函数的其他方式与@ pork-chop答案相比:
library(quantmod)
library(highcharter)
x <- getSymbols("GOOG", auto.assign = FALSE)
b <- hchart(x)
b <- hc_size(b, width = 450, height = 300)
b
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.