1

大きなデータセットをインポートし、そのデータセットから選択入力を生成し、データセットから x 軸と y 軸を自由に選択できるプロットを作成したいという問題があります。

現在のコードでブラウザーをクラッシュさせ続けます-変数がまだ利用できない状態で、ポリチャートを生成しようとしているrChartsに何か関係があると思います-私のカスタム入力を最初にロードする必要があります。リアクティブパーツの使用と出力の分離、およびその他のことの両方を試しました-正しく実行していないか、正しい方法ではない-どちらにしても機能していません。

私は光沢のあるR、特にrChartsにはかなり慣れていませんが、1つの入力のみでグラフが機能するようになりました-複数を選択可能にしようとすると問題が発生します。

以下に示す renderCharts に入力を与える次の 3 つの UI があります。

    output$TestSelection <- renderUI({
          selectInput("TestSel", "Test Variable", ls(df, pattern = ".*?_meas|.*?_calc"))
    })
    output$customx <- renderUI({
          selectInput("xcustom", "Custom Graph - X", ls(df), selected = input$TestSel) 
    }) 
    output$customy <- renderUI({
         selectInput("ycustom", "Custom Graph - Y", ls(df), selected = input$TestSel) 
    }) 

そして renderChart2 コード:

   output$customplot <- renderChart2({
      if(is.null(input$xcustom)|is.null(input$ycustom))
        return(rCharts$new())

      #Removing all unneccessary data from dataframe,
      dataPlot <- df[,c("DUT", input$ycustom, input$xcustom)]

      custom_chart <- rPlot(x = input$xcustom,y = input$ycustom,
                            data = dataPlot, 
                            type = "point", 
                            tooltip = "#!function(item){return item.DUT}!#", 
                            sample = FALSE)

      #Adjusting width to fit the current screen
      custom_chart$set(width = session$clientData$output_plot2_width , title = paste(input$ycustom, " vs. ", input$ycustom, sep =""))

      #Setting the correct axis
      axisincrease = abs((max(dataPlot[,input$xcustom])-min(dataPlot[,input$xcustom]))*0.05)

      custom_chart$guides(
       x = list(
          min = pretty(dataPlot[,input$xcustom])[1]-axisincrease,
          max = tail(pretty(dataPlot[,input$xcustom]),1)+axisincrease,
          numticks = length(dataPlot[,input$xcustom])
        ),
       y = list(
          min = pretty( dataPlot[, input$ycustom] ) [1],
          max = tail( pretty( dataPlot[, input$ycustom] ), 1 )
       )
       )
       return(custom_chart)})
4

0 に答える 0