inst/shiny/src/pie/ampie_server.R

output$ampie0 <- rAmCharts::renderAmCharts({
  ##Data
  data('data_gdp')
  setnames(data_gdp, c("country", "gdp"), c("label", "value"))
  ##Plot
  amPie(data_gdp)
})

output$code_ampie0 <- renderText({
  "
  ##Data
  data('data_gdp')
  setnames(data_gdp, c('country', 'gdp'), c('label', 'value'))
  ##Plot
  amPie(data_gdp)
  "
})






output$ampie1 <- rAmCharts::renderAmCharts({
  ##Data
  data('data_gdp')
  setnames(data_gdp, c('country','gdp'), c('label', 'value'))
  color <- rgb(sample(255)[1:10], sample(255)[1:10], sample(255)[1:10], maxColorValue = 255)
  data_gdp$color <- color
  ##Plot
  amPie(data_gdp)
})

output$code_ampie1 <- renderText({
  "
  ##Data
  data('data_gdp')
  setnames(data_gdp,c('country', 'gdp'), c('label','value'))
  color <- rgb(sample(255)[1:10], sample(255)[1:10], sample(255)[1:10], maxColorValue = 255)
  data_gdp$color <- color
  ##Plot
  amPie(data_gdp)
  "
})



output$ampie2 <- rAmCharts::renderAmCharts({
  ##Data
  data('data_gdp')
  setnames(data_gdp,c('country', 'gdp'), c('label', 'value'))
  ##Plot
  amPie(data_gdp, legend = TRUE)
})

output$code_ampie2 <- renderText({
  "
  ##Data
  data('data_gdp')
  setnames(data_gdp,c('country', 'gdp'), c('label', 'value'))
  ##Plot
  amPie(data_gdp, legend = TRUE)
  "
})





output$ampie3 <- rAmCharts::renderAmCharts({
  ##Data
  data('data_gdp')
  setnames(data_gdp,c('country', 'gdp'), c('label', 'value'))
  ##Plot
  amPie(data_gdp, legend = TRUE,inner_radius = 45, depth = 45,show_values = FALSE)
})

output$code_ampie3 <- renderText({
  "
  ##Data
  data('data_gdp')
  setnames(data_gdp,c('country', 'gdp'), c('label', 'value'))
  ##Plot
  amPie(data_gdp, legend = TRUE,inner_radius = 45, depth = 45,show_values = FALSE)
  "
})

Try the rAmCharts package in your browser

Any scripts or data that you put into this service are public.

rAmCharts documentation built on Dec. 6, 2019, 5:11 p.m.