Giter Site home page Giter Site logo

lineupjs / lineup_htmlwidget Goto Github PK

View Code? Open in Web Editor NEW
54.0 7.0 9.0 3.41 MB

HTMLWidget wrapper of LineUp for Visual Analysis of Multi-Attribute Rankings

Home Page: https://lineup.js.org

License: Other

R 63.05% JavaScript 36.95%
lineup htmlwidget r shiny htmlwidgets crosstalk ranking

lineup_htmlwidget's Introduction

LineUp.js as HTMLWidget

License: MIT Github Actions

LineUp is an interactive technique designed to create, visualize and explore rankings of items based on a set of heterogeneous attributes. This is a HTMLWidget wrapper around the JavaScript library LineUp.js. Details about the LineUp visualization technique can be found at https://jku-vds-lab.at/tools/lineup/.

It can be used within standalone R Shiny apps or R Markdown files. Crosstalk is supported for synching selections and filtering among widgets.

Installation

install.packages('lineupjs')
library(lineupjs)

Examples

lineup(mtcars)
lineup(iris)

iris output

Advanced Example

lineup(iris,
  ranking=lineupRanking(columns=c('_*', '*', 'impose'),
                        sortBy=c('Sepal_Length:desc'), groupBy=c('Species'),
                        impose=list(type='impose', column='Sepal_Length', categoricalColumn='Species')))

iris advanced output

Crosstalk Example

devtools::install_github("jcheng5/d3scatter")
library(d3scatter)
library(crosstalk)

shared_iris = SharedData$new(iris)

d3scatter(shared_iris, ~Petal.Length, ~Petal.Width, ~Species, width="100%")
lineup(shared_iris, width="100%")

crosstalk output

Shiny Example

library(shiny)
library(crosstalk)
library(lineupjs)
library(d3scatter)

# Define UI for application that draws a histogram
ui <- fluidPage(
  titlePanel("LineUp Shiny Example"),

  fluidRow(
    column(5, d3scatterOutput("scatter1")),
    column(7, lineupOutput("lineup1"))
  )
)

# Define server logic required to draw a histogram
server <- function(input, output) {
  shared_iris <- SharedData$new(iris)

  output$scatter1 <- renderD3scatter({
    d3scatter(shared_iris, ~Petal.Length, ~Petal.Width, ~Species, width = "100%")
  })

  output$lineup1 <- renderLineup({
    lineup(shared_iris, width = "100%")
  })
}

# Run the application
shinyApp(ui = ui, server = server)

Hint:

In case you see scrollbars in each cell it is because of the font the cells are too narrow, you can specify a larger row height using

lineup(iris, options=list(rowHeight=20))

Authors

  • Samuel Gratzl (@sgratzl)
  • Datavisyn GmbH (@datavisyn)

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.