RechartsCustom: Echarts with shiny

Description Usage Examples

Description

Echarts with shiny

Usage

1
none

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
library(RechartsCustom)
library(shiny)
library(shinydashboard)
data_line_bar <- data.frame('<e6><97><a5><e6><9c><9f>'=c('3-1','3-2','3-3','3-4','3-5'),
                            '<e6><9c><80><e9><ab><98>'=c(35,45,40,35,55),
                            '<e4><b8><ad><e9><97><b4>'=c(25,35,30,25,45),
                            '<e6><9c><80><e4><bd><8e>'=c(15,25,20,15,35))
data_pie <- data.frame('<e7><9b><b4><e6><8e><a5><e8><ae><bf><e9><97><ae>'=1,
                       'SEO'=2,
                       'SEM'=3,
                       'REF'=1
)
data_funnel <- data.frame('<e7><82><b9><e5><87><bb>_22222'=100,
                          '<e4><b8><8b><e5><8d><95>_111112'=30,
                          '<e6><94><af><e4><bb><98>1111'=20,
                          '<e6><94><b6><e8><b4><a7>565'=15)
option_value <- paste(
  tooltip_fun(),
  legend_fun(data=colnames(data)[2:4]),
  toolbox_fun(show="TRUE"),
  xAxis_fun(data=data_line_bar[,1]),
  yAxis_fun(),
  series_rectangular(data_line_bar[,c(2,3,4)],type=c('line','line','bar')),
  seq=""
)

option_value_pie <- paste(
  tooltip_fun(trigger = 'item',formatter="{b}:{c}({d}
  series_pie(data_pie),
  seq=""
)

option_value_funnel <- paste(
  tooltip_fun(trigger = 'item',formatter="{b}:{c}
  series_funnel(data_funnel,gap=3),
  seq=""
)


body <- dashboardBody(
  tags$script(src="http://echarts.baidu.com/build/dist/echarts-all.js"),
  data_to_plot_fun(id="main",data=option_value),
  data_to_plot_fun(id="main_1",data=option_value_pie ),
  data_to_plot_fun(id="main_2",data=option_value_funnel)
)

ui <- dashboardPage(
  dashboardHeader(title="<e7><99><be><e5><ba><a6>Echart<e6><b5><8b><e8><af><95>"),
  dashboardSidebar(disable = TRUE),
  body
)

server <- function(input, output) { }

shinyApp(ui, server)

xizhiming/RechartsCustom documentation built on May 4, 2019, 1:24 p.m.