jquery Knob HTML Widget.
This is an experimental R package that provides a jquery Knob html widget for R.
InstallationYou can install it from github
.
library(devtools) install_github('rstudio/htmltools') install_github('ramnathv/htmlwidgets') install_github('htmlwidgets/knob') Usage
Let us first create a simple knob.
library(knob) knob(value = 20, min = 0, max = 100, angleArc = 250, angleOffset = -125, fgColor = "#66CC66")
We can also use it in a Shiny application.
library(shiny) library(knob) ui = shinyUI(fluidPage( sliderInput('value', 'Value', 0, 200, 50), sliderInput('angleArc', 'Arc Angle', 0, 360, 250), knobOutput('gauge') )) server = function(input, output){ output$gauge <- renderKnob(knob( value = input$value, min = 0, max = 200, angleArc = input$angleArc, fgColor="#66CC66" )) } shinyApp(ui = ui, server = server)
The knob
package makes use of the htmlwidgets
package that makes it super-simple to package any HTML widget for R. Please read this to get a better sense on how the htmlwidgets
package can make your life easier!
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。