Skip to content
Mapping China using amCharts + R
JavaScript CSS R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Meta
R
doc
inst
man
tests
vignettes
.DS_Store
.Rbuildignore
.gitattributes
.gitignore
DESCRIPTION
LICENSE
NAMESPACE
README.md
mapbrew.Rproj

README.md

mapbrew

Mapping China using amCharts + R.

Installation

devtools::install_github('czxa/mapbrew')

Example

This is a basic example which shows you how to solve a common problem:

library(hchinamap)
library(mapbrew)
library(magrittr)
df <- hchinamap::chinadf %>% 
  dplyr::filter(region == "中国")
cnmap(id = df$name, 
      value = df$value, 
      description = paste0(df$name, ": ", df$value, ""),
      smallMap = 0, 
      theme = "dark",
      width = "100%")

Use it in RMarkdown documents and Shiny Apps

library(shiny)
library(hchinamap)
library(mapbrew)
library(dplyr)
library(magrittr)
ui <- fluidPage(
    titlePanel("Map of China example"),
    mainPanel(
      cnmapOutput("shinytest", height = "500px")
    )
)
server <- function(input, output) {
    output$shinytest <- renderCnmap({
		df <- chinadf %>% dplyr::filter(region == "中国")
		cnmap(id = df$name, value = df$value,
      		description = paste0(df$name, ": ", df$value, ""),
      		smallMap = 0, theme = "dark")
    })
}
shinyApp(ui = ui, server = server)
You can’t perform that action at this time.