forked from plotly/dash-pivottable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdash-info.yaml
121 lines (112 loc) · 5.27 KB
/
dash-info.yaml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
pkg_help_description: >-
Pivot tables are useful for interactive presentation of
summary statistics computed for data contained in another table.
The 'dashPivottable' package wraps 'react-pivottable',
making it easy to add drag-and-drop tables into your
Dash for R applications.
pkg_help_title: >-
Interactive React-based Pivot Tables for Dash
pkg_authors: >-
c(person("Chris", "Parmer", email = "[email protected]", role = c("aut")), person("Nicolas", "Kruchten", email = "[email protected]", role = c("aut")), person("Xing Han", "Lu", email = "[email protected]", role = c("trl")), person("Ryan Patrick", "Kyle", email = "[email protected]", role = c("cre"), comment = c(ORCID = "0000-0002-4958-2844")), person(family = "Plotly Technologies, Inc.", role = "cph"))
pkg_copyright: >-
Plotly Technologies, Inc.
r_examples:
- name: dashPivotTable
dontrun: FALSE
code: |
# Input data for dashPivottable may be passed in the "list-of-lists"
# format -- scroll down to see an example which demonstrates how
# to pass a data.frame into dashPivottable directly.
library(dash)
library(dashPivottable)
library(dashHtmlComponents)
app <- Dash$new()
app$title("Summary statistics for tips data")
app$layout(
htmlDiv(
list(
dashPivotTable(
id = "table",
data = tips,
cols = list("Day of Week"),
colOrder = "key_a_to_z",
rows = list("Party Size"),
rowOrder = "key_a_to_z",
rendererName = "Grouped Column Chart",
aggregatorName = "Average",
vals = list("Total Bill"),
valueFilter = list("Day of Week"=list("Thursday"=FALSE))
),
htmlDiv(
id = "output"
)
)
)
)
app$callback(output = output(id="output", property="children"),
params = list(input(id="table", property="cols"),
input(id="table", property="rows"),
input(id="table", property="rowOrder"),
input(id="table", property="colOrder"),
input(id="table", property="aggregatorName"),
input(id="table", property="rendererName")),
function(cols, rows, row_order, col_order, aggregator, renderer) {
return(
list(
htmlP(cols, id="columns"),
htmlP(rows, id="rows"),
htmlP(row_order, id="row_order"),
htmlP(col_order, id="col_order"),
htmlP(aggregator, id="aggregator"),
htmlP(renderer, id="renderer")
)
)
}
)
app$run_server(debug=TRUE)
# This example illustrates the use of `df_to_list` to format a data.frame
# for use with dashPivottable
library(dashTable)
app <- Dash$new()
app$title("Summary statistics for iris data")
app$layout(
htmlDiv(
list(
dashPivotTable(
id = "table",
data = df_to_list(Loblolly),
cols = list("Seed"),
colOrder = "key_a_to_z",
rows = list("age"),
rowOrder = "key_a_to_z",
rendererName = "Grouped Column Chart",
aggregatorName = "Average",
vals = list("height")
),
htmlDiv(
id = "output"
)
)
)
)
app$callback(output = output(id="output", property="children"),
params = list(input(id="table", property="cols"),
input(id="table", property="rows"),
input(id="table", property="rowOrder"),
input(id="table", property="colOrder"),
input(id="table", property="aggregatorName"),
input(id="table", property="rendererName")),
function(cols, rows, row_order, col_order, aggregator, renderer) {
return(
list(
htmlP(cols, id="columns"),
htmlP(rows, id="rows"),
htmlP(row_order, id="row_order"),
htmlP(col_order, id="col_order"),
htmlP(aggregator, id="aggregator"),
htmlP(renderer, id="renderer")
)
)
}
)
app$run_server(debug=TRUE)