Giter Club home page Giter Club logo

progress_indicator's Introduction

Progress Indicator

When apps have some longer calculations it is good practice to give the user an indication that the app is still up and running. This app shows an implementation of a minimalistic progress bar using NProgress and how to use 'skeleton screens' with Shiny. In this example grey boxes (that's the 'skeleton') are displayed till the data table is fully loaded to provide a nicer user experience, as used by Facebook, YouTube etc.

See it in action here

alt text

Focus

This feature focuses on improving the UX of applications by showing progress and activity to the user. We found that this can be especially useful for our Shiny apps where we need to perform calculations and process data on the fly.

How it works

Using NProgress we listen for some built in Shiny lifecycle events.

// Start NProgress when starting calculations
$(document).on('shiny:busy', function(event) {
    NProgress.start({
      showSpinner: false,
    });
});

// End NProgress when shiny goes idle 
$(document).on('shiny:idle', function(event) {
    NProgress.done();
});

Create a skeleton placeholder for your content to show while its loading

createTableSkeleton <- function() {
       div(class="skeleton",
          div(class="sk-layout sk-layout-column",
              div(class="sk-text-row skeleton-item")
          )
       )
}

Add it to your Shiny app

mainPanel(
   tableOutput("table"),
   createTableSkeleton()
)

Use :empty CSS pseudo to only show the skeleton when your content is loading

.skeleton {
  display: none;
}

.shiny-bound-output:empty + .skeleton {
  display: block;
}

Code created by Epi-interactive

As always, our expert team is here to help if you want custom training, would like to take your dashboards to the next level or just need an urgent fix to keep things running. Just get in touch for a chat.

https://www.epi-interactive.com/contact

progress_indicator's People

Contributors

chet-epi avatar epi-crystal avatar epi-interactive avatar nsheresy avatar

Stargazers

 avatar  avatar  avatar  avatar

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.