Mouse over events in d3heatmap plots

119 Views Asked by At

I want to create a shiny app that gives the data corresponding to a particular spot in in the heatmap in a separate table.

In shiny.ui

d3heatmapOutput("HeatPlot", click = "plot1_click" ),
tableOutput("Table")

And then in the shiny.server

output$HeatPlot <- renderD3heatmap(d3heatmap(inc1, scale = 'column',Colv = NA,
                                   Rowv = NA,col = rainbow(256)))

Then when the user clicks on any spot on the heatmap a table is shown containing the values at that point in the table.

output$Table <- renderTable({
      if (is.null(input$plot1_click$x)) return()
      else {
        keeprows <- round(input$plot1_click$x) == as.numeric(Data)
        head(Data[keeprows, ], 10)

But when i run the app error like

Error in d3heatmapOutput("HeatPlot", click = "plot1_click") : 
                      unused argument (click = "plot1_click")

Comes. Is the click function not valid for d3heatmap? Or am i to instal something before dong this? Please help.

The dataframe inc1 is somthing like

enter image description here

OR

If i use heatmap.2 or heatmap with same shiny.ui but

inc1 = output$HeatPlot <- renderPlot(heatmap(inc1, scale = 'column',Colv = NA, Rowv = NA,
                                                                        col = rainbow(256)))

I get

Warning: Error in renderTable: (list) object cannot be coerced to type 'double'

What is it that i should do?

0

There are 0 best solutions below