Created
October 27, 2015 03:52
-
-
Save jalapic/9a071fc5f99b7c1e838a to your computer and use it in GitHub Desktop.
dimple & shiny
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(dplyr) | |
| library(rcdimple) | |
| library(htmltools) | |
| ## INTERACTIVE APP | |
| ex_data <- read.delim( | |
| "http://pmsi-alignalytics.github.io/dimple/data/example_data.tsv" | |
| ) | |
| #eliminate . to avoid confusion in javascript | |
| colnames(ex_data) <- gsub("[.]","", colnames(ex_data)) | |
| server <- shinyServer(function(input, output) { | |
| output$distPlot <- renderDimple({ | |
| dimple( | |
| # input$ChoiceA~UnitSales, #cannot get input working | |
| OperatingProfit~UnitSales, | |
| groups = c("SKU","Channel"), | |
| data = ex_data, | |
| type = "bubble" | |
| ) %>% | |
| xAxis( type = "addMeasureAxis" ) %>% | |
| yAxis( type = "addMeasureAxis" ) %>% | |
| add_legend() | |
| }) | |
| } | |
| ) | |
| ui <- shinyUI(fixedPage( | |
| titlePanel("title-title"), | |
| fixedRow( | |
| column(width = 2, | |
| selectInput("ChoiceA", "ChoiceA:", choices = c("OP"="OperatingProfit", | |
| "GP"="GrossProfit", | |
| "P"="Price"), selected="OperatingProfit") | |
| ), | |
| column(width = 10, | |
| mainPanel( | |
| dimpleOutput("distPlot", height = 700, width = 700) | |
| ) | |
| ) | |
| ) | |
| ) | |
| ) | |
| shinyApp(ui = ui, server = server) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looking into this further, this is very strange, since the
font-sizeis being applied to the title, but has a different effect. I'm guessing my ignorance of the finer points of CSS is to blame. For now, to fix, you can do something like this.Alternately, if you want to use
tags$head, you can style with the CSS selector.dimple-axis.dimple-title.