R Shiny HTMLWidget for interactive 3D-histograms

后端 未结 3 1731
逝去的感伤
逝去的感伤 2021-01-27 07:11

I would like to include a 3D dynamic (i.e. one can change its perspective just by moving the plot) histogram widget in a R Shiny application.

Unfortunately I di

3条回答
  •  遇见更好的自我
    2021-01-27 07:40

    My package graph3d is on CRAN now.

    library(graph3d)
    
    dat <- data.frame(x = c(1,1,2,2), y = c(1,2,1,2), z = c(1,2,3,4))
    graph3d(dat, type = "bar", zMin = 0, tooltip = TRUE)
    

    You can customize the tooltips:

    graph3d(dat, type = "bar", zMin = 0,
            tooltip = JS(c("function(xyz){",
                           "  var x = 'X: ' + xyz.x.toFixed(2);",
                           "  var y = 'Y: ' + xyz.y.toFixed(2);",
                           "  var z = 'Z: ' + xyz.z.toFixed(2);",
                           "  return  x + '
    ' + y + '
    ' + z;", "}")) )

    I realize I have to add an option to control the size of the axes labels...

提交回复
热议问题