From 04c02311cbdc427104c57170429e0efb77935716 Mon Sep 17 00:00:00 2001 From: pvictor Date: Wed, 25 Sep 2024 10:27:45 +0200 Subject: [PATCH] vignette charts more examples --- DESCRIPTION | 2 +- man/vchartr-package.Rd | 7 +++++ vignettes/articles/charts.Rmd | 53 +++++++++++++++++++++++++++++++++++ vignettes/vchartr.Rmd | 2 ++ 4 files changed, 63 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e5435af..9fd150b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: vchartr Title: Interactive Charts with the JavaScript 'VChart' Library -Version: 0.0.0.9100 +Version: 0.1.0 Authors@R: c( person("Victor", "Perrier", email = "victor.perrier@dreamrs.fr", role = c("aut", "cre")), person("Fanny", "Meyer", role = "aut")) diff --git a/man/vchartr-package.Rd b/man/vchartr-package.Rd index 02f25fc..fdbf777 100644 --- a/man/vchartr-package.Rd +++ b/man/vchartr-package.Rd @@ -9,6 +9,13 @@ VChart javascript chart library} \description{ This package allow you to use VChart.js (\url{https://www.visactor.io/vchart}), to create interactive charts. +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://dreamrs.github.io/vchartr/} +} + } \author{ Victor Perrier (@dreamRs_fr) diff --git a/vignettes/articles/charts.Rmd b/vignettes/articles/charts.Rmd index dfe647c..94ac302 100644 --- a/vignettes/articles/charts.Rmd +++ b/vignettes/articles/charts.Rmd @@ -215,3 +215,56 @@ vchart(top_cran_downloads) %>% v_wordcloud(aes(word = package, count = count, color = package)) ``` + + +## Venn Diagram + +Create venn diagrams with `v_venn`: + +```{r venn} +data.frame( + sets = c("A", "B", "C", "A,B", "A,C", "B,C", "A,B,C"), + value = c(8, 10, 12, 4, 4, 4, 2) +) %>% + vchart() %>% + v_venn(aes(sets = sets, value = value)) +``` + + + +## Waterfall Chart + +Create waterfall charts with `v_waterfall`: + +```{r waterfall} +data.frame( + desc = c("Starting Cash", + "Sales", "Refunds", "Payouts", "Court Losses", + "Court Wins", "Contracts", "End Cash"), + amount = c(2000, 3400, -1100, -100, -6600, 3800, 1400, 2800) +) %>% + vchart() %>% + v_waterfall(aes(x = desc, y = amount)) +``` + + + +## Sunburst Chart + +Create sunburst charts with `v_sunburst`: + +```{r sunburst} +vchart(countries_gdp) %>% + v_sunburst( + aes(lvl1 = REGION_UN, lvl2 = SUBREGION, lvl3 = ADMIN, value = GDP_MD), + gap = 10, + labelAutoVisible = list( + enable = TRUE + ), + labelLayout = list( + align = "center", + rotate = "radial" + ) + ) +``` + diff --git a/vignettes/vchartr.Rmd b/vignettes/vchartr.Rmd index 748e9c3..241fa0b 100644 --- a/vignettes/vchartr.Rmd +++ b/vignettes/vchartr.Rmd @@ -38,6 +38,8 @@ The following graphs (and more) can be produced: See the [JavaScript library website](https://www.visactor.io/vchart) for more examples and documentation. +Interactive examples are available here: [https://dreamrs.github.io/vchartr/articles/charts.html](https://dreamrs.github.io/vchartr/articles/charts.html). + ## Usage