score:2
Accepted answer
Hi you can try this solution, it do not use the same function as you but one by @jenesaisquoi (found here), this function create several plots and handle the layout correctly :
# Packages
library("highcharter")
library("shiny")
# data
df <- data.frame(
var1 = rnorm(10),
var2 = rnorm(10),
var3 = rnorm(10),
var4 = rnorm(10),
var5 = rnorm(10),
var6 = rnorm(10),
var7 = rnorm(10)
)
# Fun by @jenesaisquoi (modified with highchartOutput)
makePlotContainers <- function(n, ncol=2, prefix="plot", height=100, width="100%", ...) {
## Validate inputs
validateCssUnit(width)
validateCssUnit(height)
## Construct plotOutputs
lst <- lapply(seq.int(n), function(i)
highchartOutput(sprintf('%s%g', prefix, i), height=height, width=width))
## Make columns
lst <- lapply(split(lst, (seq.int(n)-1)%/%ncol), function(x) column(12/ncol, x))
do.call(tagList, lst)
}
You can use @jenesaisquoi's function directly in the ui, and use lapply
in the server for define as many outputs as the number of cols :
# App
ui <- fluidPage(
# Application title
titlePanel("Hello World!"),
# Show plots
makePlotContainers(n = ncol(df), ncol = 3, prefix = "hcontainer", height = "400px")
)
server <- function(input, output) {
lapply(
X = seq_len(ncol(df)),
FUN = function(i) {
output[[paste0("hcontainer", i)]] <- renderHighchart({
highchart() %>%
hc_add_serie(name = paste("df name", i), data = df[[i]])
})
}
)
}
shinyApp(ui = ui, server = server)
Source: stackoverflow.com
Related Query
- Dynamic number of highcharter plots
- Building dynamic number of arrays to display in Highchart
- R highcharter get data from plots saved as html
- Highcharter format number in tooltip
- how to use high chart when number of lines are dynamic
- Strange character in the Highstock source code
- render a dynamic number of highcharts charts is not working
- Highcharts Interactivity between plots - looking for code improvements
- How do I make highcharter use colorIndex number from tidy dataframe
- Dynamic resizing height not working of bar chart as number of teams increasing in my case
- Highcharts Stacked Colum with variable dynamic number of values
- dynamic data to Jquery code in ASP .Net Visual Studio
- Highcharts - how to have a chart with dynamic height?
- Customize tooltip and format the number to 2 decimal places of highcharts
- Number Formatting at Highcharts Chart Values?
- R Highcharter Sankey nodes column property trouble
- HighChart Shared Tooltip Number Formatting
- r - How to set xlim and ylim range in a highcharter plot?
- Highstock: How to combine lazy loading AND dynamic data?
- highcharts: pie chart - reduce number of slice
- HighCharts - How to create dynamic chart that exports EVERYTHING
- Highcharts - set maximum range for yAxis but keep axis dynamic within that range
- Highcharts dynamic (re-)sizing in AngularJS tabs
- how to set dynamic data in highcharts
- highcharts jquery dynamic change chart type column to bar
- Dynamic update of multiple series in highcharts
- Optimize JavaScript DrillDown code
- display vertical lines and horizontal lines on plots
- Highchart dynamic creation - not rendering properly
- Maximum number of datapoints allowed in a highcharts/stock series data hash
More Query from same tag
- Highcharts - Legend item padding
- Highchart Not Updating With Returned Ajax Data Object
- Use RangeSelector in Highcharts without Date
- HighStock Chart: Extract time based on user selection from the Navigator window
- To create a list with multiple list inside it
- Highcharts - Ignore Series in Pie Percentage
- convert list<int> to object
- How to make Column type series Secondary yAxis values dynamic and not always start with 0?
- Spline graph date on x axis
- How to define colorAxis dataClasses for solid gauge chart?
- Highcharts - column stacked Y axis
- Is there an option to update or draw last candle on a chart based on real-time trading?
- my highchart is currently is not working with pie spline chart in updating after rendering chart
- How to grab correct highchart number in selectors using Selenium Webdriver with Python with several charts on the page?
- highcharter: how can I customize the labels on a column plot
- highcharts breaking when I input seconds
- Exporting Highchart Live Data to Table
- Loading JSON into a Highcharts pie chart
- Dynamic values above column + jQuery Highcharts
- Highcharts bubble graph - Custom Tooltip with Error bar (either horizontal or vertical)
- highcharts- chart
- How to Change Legend Text of a Chart Object in Crystal Reports 10
- Zoom xy proportionally in Highcharts scatter plot
- How do i synchronize multiple(highcharts)charts in angular2
- High Chart not load in Safari browser
- In Highstock v1.3.1 is there a way to detect setExtremes only on mouse up?
- Highcharts hide not active series from legend when taking screenshot
- How to align category labels on xAxes in Highcharts.js
- Highcharts Drilldown is not show if i have more than 4000 data points
- highcharts responsive method in Highcharts.net wrapper