rCharts in Shining:宽度,带2个图表

rCharts in Shining:宽度,带2个图表,r,shiny,rcharts,R,Shiny,Rcharts,我有一个带有两个Highcharts plot的应用程序,当我启动应用程序时,两个图的宽度是正确的,但每次我更改平均值输入时,第一个图的宽度设置为第二个图的宽度,如下所示: 启动应用程序时: library(rCharts) library(shiny) runApp(list( ui = fluidPage( title = "App title", titlePanel(strong("App title", style="color: steelblue")),

我有一个带有两个Highcharts plot的应用程序,当我启动应用程序时,两个图的宽度是正确的,但每次我更改
平均值
输入时,第一个图的宽度设置为第二个图的宽度,如下所示:

启动应用程序时:

library(rCharts)
library(shiny)

runApp(list(
  ui = fluidPage(
    title = "App title",
    titlePanel(strong("App title", style="color: steelblue")),
    sidebarLayout(
      sidebarPanel(width = 2,
                   br()),
      mainPanel(width = 10, 
                tabsetPanel(
                  tabPanel("Tab 1",
                           selectInput(inputId = "input_mean", label = "Mean : ", choices = c(20:30)),
                           fluidRow(
                             column(8,
                                    showOutput(outputId = "chart1", lib = "highcharts")
                                    , br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br()),
                             column(4,
                                    showOutput(outputId = "chart2", lib = "highcharts"))
                             )
                           )
                  )
                )
      )
    ),
  server = function(input, output) {

    my_data <- reactive({
      rnorm(n = 30, mean = as.numeric(input$input_mean))
    })

    output$chart1 <- renderChart2({
      my_data = my_data()
      h2 <- Highcharts$new()
      h2$chart(type="line")
      h2$series(data=my_data, name = "One", marker = list(symbol = 'circle'), color = "lightblue")
      h2$set(width = 800, height = 400)
      return(h2)
    })
    output$chart2 <- renderChart2({
      my_data = my_data()
      my_mean = as.numeric(input$input_mean)
      part = data.frame(V1 = c("Sup", "Inf"), V2 = c(sum(my_data>my_mean), sum(my_data<my_mean)))
      p = hPlot(x = "V1", y = "V2", data = part, type = "pie")
      p$tooltip(pointFormat = "{series.name}: <b>{point.percentage:.1f}%</b>")
      p$params$width <- 200
      p$params$height <- 200
      return(p)
    })
  }
))

当我更改输入时:

生成应用程序的我的代码:

library(rCharts)
library(shiny)

runApp(list(
  ui = fluidPage(
    title = "App title",
    titlePanel(strong("App title", style="color: steelblue")),
    sidebarLayout(
      sidebarPanel(width = 2,
                   br()),
      mainPanel(width = 10, 
                tabsetPanel(
                  tabPanel("Tab 1",
                           selectInput(inputId = "input_mean", label = "Mean : ", choices = c(20:30)),
                           fluidRow(
                             column(8,
                                    showOutput(outputId = "chart1", lib = "highcharts")
                                    , br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br()),
                             column(4,
                                    showOutput(outputId = "chart2", lib = "highcharts"))
                             )
                           )
                  )
                )
      )
    ),
  server = function(input, output) {

    my_data <- reactive({
      rnorm(n = 30, mean = as.numeric(input$input_mean))
    })

    output$chart1 <- renderChart2({
      my_data = my_data()
      h2 <- Highcharts$new()
      h2$chart(type="line")
      h2$series(data=my_data, name = "One", marker = list(symbol = 'circle'), color = "lightblue")
      h2$set(width = 800, height = 400)
      return(h2)
    })
    output$chart2 <- renderChart2({
      my_data = my_data()
      my_mean = as.numeric(input$input_mean)
      part = data.frame(V1 = c("Sup", "Inf"), V2 = c(sum(my_data>my_mean), sum(my_data<my_mean)))
      p = hPlot(x = "V1", y = "V2", data = part, type = "pie")
      p$tooltip(pointFormat = "{series.name}: <b>{point.percentage:.1f}%</b>")
      p$params$width <- 200
      p$params$height <- 200
      return(p)
    })
  }
))
库(rCharts)
图书馆(闪亮)
runApp(列表(
ui=fluidPage(
title=“应用程序标题”,
titlePanel(强(“应用程序标题”,style=“color:steelblue”),
侧边栏布局(
侧栏面板(宽度=2,
br()),
主面板(宽度=10,
选项卡面板(
选项卡面板(“选项卡1”,
选择输入(inputId=“input_mean”,label=“mean:”,choices=c(20:30)),
fluidRow(
第(8)栏,
showOutput(outputId=“chart1”,lib=“highcharts”)
,br(),br(),br(),br(),br(),br(),br(),br(),br(),br(),br(),br(),br(),br()),
第(4)栏,
showOutput(outputId=“chart2”,lib=“highcharts”))
)
)
)
)
)
),
服务器=功能(输入、输出){
my_data替换这些行:

h2$chart(type="line")
h2$set(width = 800, height = 400)
详情如下:

h2$chart(type="line", width = 800, height = 400)

这应该会有所帮助。

一开始,您没有反应或观察的机柜。我之前的评论更多的是关于编程。我想查看引导页面方向……我的目标是在列中定义Well面板。