Skip to content

Commit

Permalink
https css adding new example to maps thnks to @pachamaltese
Browse files Browse the repository at this point in the history
  • Loading branch information
jbkunst committed Jul 26, 2020
1 parent 9e9fe08 commit ca492fd
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 92 deletions.
2 changes: 0 additions & 2 deletions CRAN-RELEASE

This file was deleted.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 97 additions & 29 deletions docs/articles/maps.html

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/extra.css
Expand Up @@ -2,14 +2,14 @@

@font-face {
font-family: 'Datalegreya-Gradient';
src: url('http://cdn.rawgit.com/figs-lab/datalegreya/master/font-files/Datalegreya-Gradient.otf');
src: url('https://cdn.rawgit.com/figs-lab/datalegreya/master/font-files/Datalegreya-Gradient.otf');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'Datalegreya-Thin';
src: url('http://cdn.rawgit.com/figs-lab/datalegreya/master/font-files/Datalegreya-Thin.otf');
src: url('https://cdn.rawgit.com/figs-lab/datalegreya/master/font-files/Datalegreya-Thin.otf');
font-weight: normal;
font-style: normal;
}
Expand Down
52 changes: 26 additions & 26 deletions docs/index.html

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkgdown/_pkgdown.yml
Expand Up @@ -3,6 +3,8 @@ template:
params:
bootswatch: cosmo
ganalytics: UA-17670833-9
development:
mode: auto
authors:
Joshua Kunst:
href: http://jkunst.com
Expand Down
4 changes: 2 additions & 2 deletions pkgdown/extra.css
Expand Up @@ -2,14 +2,14 @@

@font-face {
font-family: 'Datalegreya-Gradient';
src: url('http://cdn.rawgit.com/figs-lab/datalegreya/master/font-files/Datalegreya-Gradient.otf');
src: url('https://cdn.rawgit.com/figs-lab/datalegreya/master/font-files/Datalegreya-Gradient.otf');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'Datalegreya-Thin';
src: url('http://cdn.rawgit.com/figs-lab/datalegreya/master/font-files/Datalegreya-Thin.otf');
src: url('https://cdn.rawgit.com/figs-lab/datalegreya/master/font-files/Datalegreya-Thin.otf');
font-weight: normal;
font-style: normal;
}
Expand Down
52 changes: 26 additions & 26 deletions pkgdown/index.html

Large diffs are not rendered by default.

67 changes: 66 additions & 1 deletion vignettes/maps.Rmd
Expand Up @@ -103,6 +103,55 @@ hcmap(
)
```

## Categorized areas

```{r}
data <- tibble(
country =
c("PT", "IE", "GB", "IS",
"NO", "SE", "DK", "DE", "NL", "BE", "LU", "ES", "FR", "PL", "CZ", "AT",
"CH", "LI", "SK", "HU", "SI", "IT", "SM", "HR", "BA", "YF", "ME", "AL", "MK",
"FI", "EE", "LV", "LT", "BY", "UA", "MD", "RO", "BG", "GR", "TR", "CY",
"RU"),
tz = c(rep("UTC", 4), rep("UTC + 1",25), rep("UCT + 2",12), "UTC + 3")
)
# auxiliar variable
data <- data %>%
mutate(value = cumsum(!duplicated(tz)))
# now we'll create the dataClasses
dta_clss <- data %>%
mutate(value = cumsum(!duplicated(tz))) %>%
group_by(tz) %>%
summarise(value = unique(value)) %>%
arrange(value) %>%
rename(name = tz, from = value) %>%
mutate(to = from + 1) %>%
list_parse()
hcmap(
map = "custom/europe",
data = data,
joinBy = c("iso-a2","country"),
name = "Time zone",
value = "value",
tooltip = list(pointFormat = "{point.name} {point.tz}"),
dataLabels = list(enabled = TRUE, format = "{point.country}")
) %>%
hc_colorAxis(
dataClassColor = "category",
dataClasses = dta_clss
) %>%
hc_title(text = "Europe Time Zones")
```

Example from https://www.highcharts.com/demo/maps/category-map.

## Adding Points

With highcharter is possible add data as points or bubbles. For this it is
Expand All @@ -118,7 +167,23 @@ cities <- data.frame(
)
hcmap("countries/gb/gb-all", showInLegend = FALSE) %>%
hc_add_series(data = cities, type = "mapbubble", name = "Cities", maxSize = "10%") %>%
hc_add_series(
data = cities,
type = "mappoint",
name = "Cities",
minSize = "1%",
maxSize = "5%"
) %>%
hc_mapNavigation(enabled = TRUE)
hcmap("countries/gb/gb-all", showInLegend = FALSE) %>%
hc_add_series(
data = cities,
type = "mapbubble",
name = "Cities",
minSize = "1%",
maxSize = "5%"
) %>%
hc_mapNavigation(enabled = TRUE)
```

Expand Down

0 comments on commit ca492fd

Please sign in to comment.