dreamRs / apexcharter

:bar_chart: R Htmlwidget for ApexCharts.js
https://dreamrs.github.io/apexcharter
Other
140 stars 15 forks source link

apexcharter basic initial example just hangs.... #10

Closed sfd99 closed 2 years ago

sfd99 commented 4 years ago

Hi Victor,

The apexcharter v0.1 basic initial example just hangs/freezes Rstudio , no plot is displayed:

library(apexcharter) data("mpg", package = "ggplot2") n_manufac <- dplyr::count(mpg, manufacturer) n_manufac

A tibble: 15 x 2

manufacturer n

1 audi 18 2 chevrolet 19 3 dodge 37 4 ford 25 5 honda 9 6 hyundai 14 7 jeep 8 8 land rover 4 9 lincoln 3 10 mercury 4 11 nissan 13 12 pontiac 5 13 subaru 14 14 toyota 34 15 volkswagen 27 head(mpg) # A tibble: 6 x 11 manufacturer model displ year cyl 1 audi a4 1.8 1999 4 2 audi a4 1.8 1999 4 3 audi a4 2 2008 4 4 audi a4 2 2008 4 5 audi a4 2.8 1999 6 6 audi a4 2.8 1999 6 # … with 6 more variables: trans , # drv , cty , hwy , # fl , class apex(data = n_manufac, type = "bar", mapping = aes(x = manufacturer, y = n))

At this point, Rstudio will just hang (freezes). Have to restart Rstudio manually...

my loaded packages, simply:

(.packages()) [1] "stats" "graphics" "grDevices" [4] "utils" "datasets" "methods"
[7] "base"

What am I missing?. I have the latest versions of ggplot2, tibble. etc....

Apparently, the latest versions of "tibble" have been breaking a lot of other packages... (for ex: the great janitor pkg, just fixed for that same reason...).

SFd99 Ubuntu Linux 18.04, latest Rstudio and R 3.6.3

pvictor commented 4 years ago

Oups, this seems to work for me with :

> sessioninfo::session_info()
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.3 (2020-02-29)
 os       Pop!_OS 18.04 LTS           
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_US:en                    
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Paris                
 date     2020-04-07                  

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 apexcharter * 0.1.4   2020-03-31 [1] CRAN (R 3.6.3)
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.3)
 cli           2.0.2   2020-02-28 [1] CRAN (R 3.6.3)
 colorspace    1.4-1   2019-03-18 [1] CRAN (R 3.6.3)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.3)
 digest        0.6.25  2020-02-23 [1] CRAN (R 3.6.3)
 dplyr         0.8.5   2020-03-07 [1] CRAN (R 3.6.3)
 ellipsis      0.3.0   2019-09-20 [1] CRAN (R 3.6.3)
 fansi         0.4.1   2020-01-08 [1] CRAN (R 3.6.3)
 fastmap       1.0.1   2019-10-08 [1] CRAN (R 3.6.3)
 ggplot2       3.3.0   2020-03-05 [1] CRAN (R 3.6.3)
 glue          1.4.0   2020-04-03 [1] CRAN (R 3.6.3)
 gtable        0.3.0   2019-03-25 [1] CRAN (R 3.6.3)
 htmltools     0.4.0   2019-10-04 [1] CRAN (R 3.6.3)
 htmlwidgets   1.5.1   2019-10-08 [1] CRAN (R 3.6.3)
 httpuv        1.5.2   2019-09-11 [1] CRAN (R 3.6.3)
 jsonlite      1.6.1   2020-02-02 [1] CRAN (R 3.6.3)
 later         1.0.0   2019-10-04 [1] CRAN (R 3.6.3)
 lifecycle     0.2.0   2020-03-06 [1] CRAN (R 3.6.3)
 magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.3)
 mime          0.9     2020-02-04 [1] CRAN (R 3.6.3)
 munsell       0.5.0   2018-06-12 [1] CRAN (R 3.6.3)
 pillar        1.4.3   2019-12-20 [1] CRAN (R 3.6.3)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 3.6.3)
 promises      1.1.0   2019-10-04 [1] CRAN (R 3.6.3)
 purrr         0.3.3   2019-10-18 [1] CRAN (R 3.6.3)
 R6            2.4.1   2019-11-12 [1] CRAN (R 3.6.3)
 Rcpp          1.0.4   2020-03-17 [1] CRAN (R 3.6.3)
 rlang         0.4.5   2020-03-01 [1] CRAN (R 3.6.3)
 rstudioapi    0.11    2020-02-07 [1] CRAN (R 3.6.3)
 scales        1.1.0   2019-11-18 [1] CRAN (R 3.6.3)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.3)
 shiny         1.4.0.2 2020-03-13 [1] CRAN (R 3.6.3)
 tibble        3.0.0   2020-03-30 [1] CRAN (R 3.6.3)
 tidyselect    1.0.0   2020-01-27 [1] CRAN (R 3.6.3)
 vctrs         0.2.4   2020-03-10 [1] CRAN (R 3.6.3)
 withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.3)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 3.6.3)
 yaml          2.2.1   2020-02-01 [1] CRAN (R 3.6.3)

And RStudio Version 1.2.1280.

What's yours sessioninfo::session_info() and RStudio version ?

Victor

sfd99 commented 4 years ago

Hi Victor!

RStudio version: 1.2.5033 Ubuntu Linux 18.04, latest Rstudio and R 3.6.3

> sessioninfo::session_info() ─ Session info ───────────────────────────────────────────────────────── setting value
version R version 3.6.3 (2020-02-29) os Ubuntu 18.04.4 LTS
system x86_64, linux-gnu
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America
date 2020-04-07

─ Packages ───────────────────────────────────────────────────────────── package version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.3)
cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.3)
colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.3)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.3)
dplyr
0.8.5 2020-03-07 [1] CRAN (R 3.6.3)
ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.3)
fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.3)
generics 0.0.2 2018-11-29 [1] CRAN (R 3.6.3)
ggplot2 3.3.0 2020-03-05 [1] CRAN (R 3.6.3)
glue 1.4.0 2020-04-03 [1] CRAN (R 3.6.3)
gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.3)
janitor
1.2.1.9000 2020-04-06 [1] Github (sfirke/janitor@6c95813) lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.6.3)
lubridate 1.7.8 2020-04-06 [1] CRAN (R 3.6.3)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.3)
munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.3)
pillar 1.4.3 2019-12-20 [1] CRAN (R 3.6.3)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.3)
plyr 1.8.6 2020-03-03 [1] CRAN (R 3.6.3)
purrr 0.3.3 2019-10-18 [1] CRAN (R 3.6.3)
R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.3)
Rcpp 1.0.4 2020-03-17 [1] CRAN (R 3.6.3)
reshape2
1.4.3 2017-12-11 [1] CRAN (R 3.6.3)
rlang 0.4.5 2020-03-01 [1] CRAN (R 3.6.3)
rstudioapi 0.11 2020-02-07 [1] CRAN (R 3.6.3)
scales 1.1.0 2019-11-18 [1] CRAN (R 3.6.3)
sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 3.6.3)
snakecase 0.11.0 2019-05-25 [1] CRAN (R 3.6.3)
stringi 1.4.6 2020-02-17 [1] CRAN (R 3.6.3)
stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.3)
tibble 3.0.0 2020-03-30 [1] CRAN (R 3.6.3)
tidyr * 1.0.2 2020-01-24 [1] CRAN (R 3.6.3)
tidyselect 1.0.0 2020-01-27 [1] CRAN (R 3.6.3)
vctrs 0.2.4 2020-03-10 [1] CRAN (R 3.6.3)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.3)

[1] /home/ray/R/x86_64-pc-linux-gnu-library/3.6 [2] /usr/local/lib/R/site-library [3] /usr/lib/R/site-library [4] /usr/lib/R/library

SFd99 Ubuntu Linux 18.04, latest Rstudio and R 3.6.3

pvictor commented 4 years ago

Thanks ! And what's your version of RStudio ?

image

sfd99 commented 4 years ago

Hi Victor,

here's the info:

RStudio: Version 1.2.5033 (latest version available) Ubuntu Linux 18.04, R 3.6.3 apexcharter 0.1.4

SFd99

pvictor commented 4 years ago

With RStudio 1.2.5033, Ubuntu 18.04, R 3.6.3 and all packages up to date from CRAN I can't reproduce your problem, works fine for me. Sorry..

sfd99 commented 4 years ago

ok, Victor. No problem. If I finally find a reason (or even a hint), will let you know on this thread.

thanks again / merci have a nice, safe weekend!.

sfd99 commented 4 years ago

Victor,

I think I found what the problem is: (and my "workaround" solution...).

1) Just recapping the mystery problem:

All the examples in the pkg webpage would hang Rstudio w/ a totally white Plot Viewer Panel (no plot!).

Ex: library(apexcharter)

data("mpg", package = "ggplot2") n_manufac <- dplyr::count(mpg, manufacturer)

After entering the command (below), Rstudio would "freeze" and NO plot! apex(data = n_manufac, type = "bar", mapping = aes(x = manufacturer, y = n))

2) the SOLUTION: (so far...)

Before issuing the apex() command, I make sure that the PLOT [Viewer Panel] of Rstudio is really wide.

Then the apex() command above works!!. And ALL the examples work.

If the width of the PLOT [Viewer Panel ] of Rstudio is approx. less than 70% of the screen width, NO plot will be shown and Rstudio will "hang" without any warning message.

(I have to force close Rstudio, each time ...).

Victor, is there a way for apexcharter to "auto-detect" the width of the Viewer Panel in Rstudio before it tries to render any wonderful plot?.

Hope my explanation of the problem & the suggested solution is clear.

RStudio: Version 1.2.5033 (latest version available) Ubuntu Linux 18.04, R 3.6.3 apexcharter 0.1.4

pvictor commented 4 years ago

Thanks for investigating, I don't have this issue on Windows, I will check on Linux as soon as I can.

For the exemple in the tweet, you found it here : https://github.com/dreamRs/apexcharter/blob/master/inst/example-sync/app.R

Or if you have last version on GitHub, you can do :

run_sync_demo()