Closed Yang-Tang closed 8 years ago
Hi @Yang-Tang ,
Sadly highcharts dont have a facet implementation like taucharts or plotly.
You can implement kind of facet for y axis like http://jkunst.com/highcharter/hchart.html#seasonal-decomposition-of-time-series-by-loess, but there no way to create more x axis.
If you're ok, we can close this issue.
Thanks ;)
Hi @jbkunst,
In fact, I find myself have some difficulties on understanding the underline mechanism when you use hchart()
to draw the seasonal decomposition of time series. I want to build some similar facets of time series data but they are not coming from the stl()
function. Is there a way to get around that?
Thanks!
Hi @haozhu233
Basically, the code from hchart.stl()
was based on the candlestick-volume example from highcharts.
You have to work/play with the yAxis to create many xAxis as you need taking care of the top
and height
arguments:
yAxis: [{
height: '60%'
}, {
top: '65%',
height: '35%',
offset: 0
}]
Then add each (ts) series to each yaxis.
Hope I was clear :D.
Excellent! @jbkunst , thank you for this short but right-to-the-point instruction! I will play around with it. :)
@Yang-Tang , @haozhu233 ,
I'm just implemented a grid function hc_grid
to display highchart like faceting. Take a look please: http://rpubs.com/jbkunst/higcharter-grid-test
Excellent! Thanks!! @jbkunst
That's great! Thanks! @jbkunst
How is this incorporated into a shiny app? My test app below.
library(purrr)
library(highcharter)
library(shiny)
data(diamonds, package = "ggplot2")
diamonds <- diamonds[-6]
ui <- fluidPage(highchartOutput('hchart'))
server <- function(input,output,session){
output$hchart <- renderHighchart({
map(names(diamonds), function(x){
diamonds[[x]] %>%
hchart(showInLegend = FALSE) %>%
hc_add_theme(hc_theme_smpl()) %>%
hc_title(text = x) %>%
hc_yAxis(title = list(text = ""))
}) %>%
hw_grid(rowheight = 225, ncol = 3)
})
}
shinyApp(ui=ui,server=server)
Hi @svarn27 ,
Use htmlOutput
and renderUI
works for me.
ui <- fluidPage(htmlOutput('hchart'))
server <- function(input,output,session){
output$hchart <- renderUI({
map(names(diamonds), function(x){
diamonds[[x]] %>%
hchart(showInLegend = FALSE) %>%
hc_add_theme(hc_theme_smpl()) %>%
hc_title(text = x) %>%
hc_yAxis(title = list(text = ""))
}) %>%
hw_grid(rowheight = 225, ncol = 3)
})
}
shinyApp(ui=ui,server=server)
OK great, I'll see how I can incorporate it in that fashion. Thanks a ton, this package is amazing. By far the most powerful/flexible I've come across. Your hard work is much appreciated! @jbkunst
@jbkunst you are the man!
@jbkunst Can the output be directed to RStudio viewer instead of Shiny? Can the multiplot be embedded in a knittr document? Thanks
@rfarouni ,
Yep! It's possible.
In console/rstudio viewer you need to use browseable
from the htmltools
package, see https://github.com/jbkunst/highcharter/blob/master/devscripts/hc_grid2.R
In knitr/rmarkdown documents you just use hw_grid
alone. https://github.com/jbkunst/highcharter/blob/master/devscripts/hc_grid.R
Let me if this work for you ;)!
Yes it works! Thank you!
Is it possible to use hw_grid function nested? I want to locate my plots in a layout like this
1 3 3 3
2 3 3 3
two graphs at left and one bigger at right-hand side. Also, I want this pattern to repeat several times as rows. I tried to use hw_grid function in nested forms, but did not make it work.
@mcandar
Not sure, but you can try https://github.com/FrancoisGuillem/combineWidgets It supposed to do what you want :sweat_smile:
@jbkunst thanks! combineWidgets function is also included in manipulateWidget package. They work properly but now I have problems with sizing and adding slider when exporting them as html ... 😄
@jbkunst....
Below page is not found.. Please help.. https://github.com/jbkunst/highcharter/blob/master/devscripts/hc_grid2.R https://github.com/jbkunst/highcharter/blob/master/devscripts/hc_grid.R
(This is pasted from message "jbkunst commented on Aug 19, 2016" to @rfarouni ....)
Thank You!!!
I've found the link your're looking for @vinoth4stat In this link you can find the mentioned example!
Plus, if you search for hw_grid
in the highcharter
repo you can find a bunch of examples!
To put side by side highcharter
graphs you can do something like that:
htmltools::browsable(hw_grid(h1, h2, ncol = 2, rowheight = 300))
where h1
and h2
are highcharter
graphs!
Is there any way to show multiple highcharts in facet grid layout?