2

我正在尝试根据某些条件在函数中编码的散点图中更改 y 轴参数。但是 Plotly 将其作为字符串而不是列名。

transactions_plot <- function(Gross,FS_Rlse_Split,Failed,name1,name2,name3){

       plot_ly(grand_aggregate_FSID_transactionData, x = ~as.factor(Year), 
            y = ~Gross, 
            name = name1, type = 'scatter', mode = 'lines+markers') %>%
      add_trace(y = ~FS_Rlse_Split, 
                name = name2, 
                mode = 'lines+markers') %>%
      add_trace(y = ~Failed, 
                name = name3, 
                mode = 'lines+markers') %>%
      layout(xaxis = list(tickangle =45,
                          title = ""),
             yaxis = list(title = "")
      )
}


if(input$transaction_View_Type_choose == "TXAmt"){

   transactions_plot('Gross_Value',
                     'FS_Rlse_Split_Usd',
                     'Failed_TX_Sum',
                     'Gross Value',
                     'FS Release USD',
                     'Failed Transactions Value')      
}else{

   transactions_plot('Gross_TXN',
                     'FS_Rlse_Split_TXN',
                     'Failed_TXN',
                     'Gross Transactions',
                     'FS Release Transactions',
                     'Failed Transactions')
}
4

0 回答 0