Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Tried to unbox a vector of length 3" when I use gvisTreeMap in Shiny #82

Closed
APonce73 opened this issue Feb 7, 2019 · 3 comments

Comments

@APonce73
Copy link

APonce73 commented Feb 7, 2019

I tried to run gvisTreeMap in Shiny. When I used outside of shiny is not problem... work well! But when I tried to use it with shiny with "renderGvis" I have the next message:

screen shot 2019-02-07 at 11 50 15

Here the server.R
#######
library(tidyverse)
library(shiny)
library(googleVis)
library(RColorBrewer)

#mx.states1 <- read.table("~/Dropbox/Shiny1/Tabla.txt", header = T)

Define server logic for slider examples

shinyServer(function(input, output, session) {

output$Treeplot1 <- renderGvis({

#Feynmann1 <- mx.states1
Feynmann1 <- mx.states1 %>%
  select(Estado, parent, Valor) %>%
  mutate(Valor1 = Valor)

Treeplot11 <- gvisTreeMap(Feynmann1,  
                     options = list(width = 1000, height = 800,
                                    fontSize = 18,
                                    minColor = '#F7FBFF',
                                    midColor = '#FD8D3C',
                                    maxColor = '#800026',
                                    headerHeight = 20,
                                    fontColor = c('black','black','white'),
                                    showScale = TRUE))
return(Treeplot11)   

})

#######
#Here de ui.R

library(tidyverse)
library(shiny)
library(knitr)
library(plotly)
library(googleVis)

shinyUI(navbarPage(
title = "",

tabPanel('Local leanguage', 
       shinyUI(fluidPage(
         #Application title
         titlePanel("Maize in different Leanguage"),
             width = 1)),       
           fluidRow(
             column(9,
                    htmlOutput("Treeplot1", width = "1000", height = "600"))
           ))

))

The file that I used is this one:

Tabla.txt

I hope that you can give me a tip!!!

Here my sessioninfo()
screen shot 2019-02-07 at 11 58 38

Alex

@mages
Copy link
Owner

mages commented Feb 7, 2019

The way you specify the textStyle option is not correct. The following works for me:

Treeplot11 <- gvisTreeMap(
  Feynmann1, idvar = "Estado", parentvar ="parent",
  sizevar = "Valor", colorvar = "Valor1",
  options = list(width = 1000, height = 800,
                 textStyle = "{fontSize:18, fontColor:['black', 'black', 'white']}",
                 minColor = '#F7FBFF',
                 midColor = '#FD8D3C',
                 maxColor = '#800026',
                 headerHeight = 20,
                 showScale = TRUE))

@APonce73
Copy link
Author

APonce73 commented Feb 7, 2019

Many many many thanks!!!
Now works perfectly!!!
Gracias (Thanks a lot!!!!!)

@mages
Copy link
Owner

mages commented Feb 7, 2019

You are welcome.

@mages mages closed this as completed Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants