Skip to content

jjallaire/knob

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

knob

This is an experimental R package that provides a jquery Knob html widget for R.

Installation

You can install it from github.

library(devtools)
install_github('rstudio/htmltools')
install_github('ramnathv/htmlwidgets')
install_github('ramnathv/knob')

Usage

Let us first create a simple knob.

library(knob)
knob(value = 20, min = 0, max = 100, 
     angleArc = 250, angleOffset = -125, 
     fgColor = "#66CC66")

knob1

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)

knob2

See Also

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!

About

jquery Knob HTML Widget.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.1%
  • R 1.9%