Giter Club home page Giter Club logo

justgage's Introduction

justGage

This is an experimental R package that provides a justgage html widget for R. It is more or less a rewrite of the justgage package using the htmlwidgets package, that reduces the amount of code required considerably by providing generic plumbing to build upon.

Installation

You can install it from github.

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

Usage

Let us first create a simple knob.

library(htmlwidgets)
library(justGage)
k1 = justgage('My Gauge', 20, 0, 100, label = 'New')
k1

justgage1

We can also use it in a Shiny application.

library(shiny)
library(htmlwidgets)
library(justGage)
ui = bootstrapPage(
  tags$style('body{margin-left:40px; margin-top:40px;}'),
  sliderInput('value', 'Value', 0, 200, 50),
  justgageOutput('live_gauge', width = 250, height = 200)
)
server = function(input, output, session){
  output$live_gauge <- renderWidget(list(
    title = 'My Gauge',
    min = 0,
    value = input$value,
    max = 200
  ))
}

runApp(list(ui = ui, server = server))

justgage2

See Also

The justGage 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!

Credits

This package is highly inspired by the justgage package under development by JJ of RStudio. I have used several functions from his package, some verbatim, some with minor tweaks, aimed at providing the plumbing required to create HTML widgets with ease. I have also used some code from Winston Chang's shiny-jsdemo package on how to bind justgage with Shiny.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.