Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
i2dash
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
loosolab
software
i2dash
Commits
50efbb2a
Commit
50efbb2a
authored
4 years ago
by
jens.preussner
Browse files
Options
Downloads
Plain Diff
Added ANY signature to add_component for a generic way to add htmlwidgets
See merge request
!18
parents
88672b1b
118b0da2
No related branches found
No related tags found
1 merge request
!18
Generic htm lwidget
Pipeline
#129979
failed
4 years ago
Stage: build
Stage: check
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
DESCRIPTION
+1
-0
1 addition, 0 deletions
DESCRIPTION
R/components.R
+1
-1
1 addition, 1 deletion
R/components.R
R/vis_objects.R
+23
-42
23 additions, 42 deletions
R/vis_objects.R
inst/templates/vis_object.Rmd
+1
-1
1 addition, 1 deletion
inst/templates/vis_object.Rmd
with
26 additions
and
44 deletions
DESCRIPTION
+
1
−
0
View file @
50efbb2a
...
@@ -23,6 +23,7 @@ Imports:
...
@@ -23,6 +23,7 @@ Imports:
glue,
glue,
ymlthis
ymlthis
Suggests:
Suggests:
switchr,
highcharter,
highcharter,
plotly,
plotly,
crosstalk,
crosstalk,
...
...
This diff is collapsed.
Click to expand it.
R/components.R
+
1
−
1
View file @
50efbb2a
...
@@ -59,7 +59,7 @@ setMethod("add_component",
...
@@ -59,7 +59,7 @@ setMethod("add_component",
})
})
setMethod
(
"add_component"
,
signature
(
dashboard
=
"i2dashboard"
,
component
=
"function"
),
setMethod
(
"add_component"
,
signature
(
dashboard
=
"i2dashboard"
,
component
=
"function"
),
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
function
(
dashboard
,
component
,
page
=
"default"
,
...
)
{
# validate "page" input
# validate "page" input
name
<-
.create_page_name
(
page
)
name
<-
.create_page_name
(
page
)
if
(
!
(
name
%in%
names
(
dashboard
@
pages
)))
{
if
(
!
(
name
%in%
names
(
dashboard
@
pages
)))
{
...
...
This diff is collapsed.
Click to expand it.
R/vis_objects.R
+
23
−
42
View file @
50efbb2a
...
@@ -29,7 +29,7 @@ add_vis_object <- function(dashboard, object, package, page = "default", title =
...
@@ -29,7 +29,7 @@ add_vis_object <- function(dashboard, object, package, page = "default", title =
delim
=
c
(
"<%"
,
"%>"
),
delim
=
c
(
"<%"
,
"%>"
),
title
=
title
,
title
=
title
,
package
=
package
,
package
=
package
,
class
=
clas
s
(
object
),
class
=
i
s
(
object
),
component_id
=
component_id
,
component_id
=
component_id
,
timestamp
=
timestamp
)
timestamp
=
timestamp
)
...
@@ -42,61 +42,42 @@ add_vis_object <- function(dashboard, object, package, page = "default", title =
...
@@ -42,61 +42,42 @@ add_vis_object <- function(dashboard, object, package, page = "default", title =
# Methods to add common visualization objects
# Methods to add common visualization objects
#
#
setMethod
(
"add_component"
,
setMethod
(
"add_component"
,
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
highchart
"
),
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
gg
"
),
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"
highcharter
"
,
page
,
title
,
...
)
})
add_vis_object
(
dashboard
,
component
,
"
ggplot2
"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
setMethod
(
"add_component"
,
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
plotly
"
),
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
gt_tbl
"
),
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"plotly
"
,
page
,
title
,
...
)
})
add_vis_object
(
dashboard
,
component
,
"gt
"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
setMethod
(
"add_component"
,
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
leaf
le
t
"
),
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
knitr_kab
le"
),
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"
leaflet
"
,
page
,
title
,
...
)
})
add_vis_object
(
dashboard
,
component
,
"
kableExtra
"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
setMethod
(
"add_component"
,
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
dygraphs
"
),
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
Heatmap
"
),
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"
dygraphs
"
,
page
,
title
,
...
)
})
add_vis_object
(
dashboard
,
component
,
"
ComplexHeatmap
"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
setMethod
(
"add_component"
,
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
rbokeh
"
),
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"
ANY
"
),
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"rbokeh"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
# HTMLWIDGETS
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"visNetwork"
),
if
(
inherits
(
component
,
"htmlwidget"
))
{
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
package
<-
packageSlot
(
component
)
add_vis_object
(
dashboard
,
component
,
"visNetwork"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
if
(
is.null
(
package
))
{
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"d3heatmap
"
)
,
warning
(
"No component added, since the package name of the HTML widget could not be determined.
"
)
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
return
(
dashboard
)
add_vis_object
(
dashboard
,
component
,
"d3heatmap"
,
page
,
title
,
...
)
}
)
}
setMethod
(
"add_component"
,
return
(
add_vis_object
(
dashboard
,
component
,
package
,
page
,
title
,
...
))
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"metricsgraphics"
),
}
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"metricsgraphics"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
# OTHER
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"gg"
),
warning
(
"The component did not inherit from any of the currently supported classes ('htmlwidget')."
)
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
return
(
dashboard
)
add_vis_object
(
dashboard
,
component
,
"ggplot2"
,
page
,
title
,
...
)
})
})
setMethod
(
"add_component"
,
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"datatables"
),
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"DT"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"grViz"
),
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"DiagrammeR"
,
page
,
title
,
...
)
})
setMethod
(
"add_component"
,
signature
=
signature
(
dashboard
=
"i2dashboard"
,
component
=
"gt_tbl"
),
definition
=
function
(
dashboard
,
component
,
page
=
"default"
,
title
=
NULL
,
...
)
{
add_vis_object
(
dashboard
,
component
,
"gt"
,
page
,
title
,
...
)
})
This diff is collapsed.
Click to expand it.
inst/templates/vis_object.Rmd
+
1
−
1
View file @
50efbb2a
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
```{r}
```{r}
if (!requireNamespace("<% package %>", quietly = TRUE)) {
if (!requireNamespace("<% package %>", quietly = TRUE)) {
stop('The package <% package %> is needed to embed objects of class <% class %>.', call. = FALSE)
stop('The package
"
<% package %>
"
is needed to embed objects of class
"
<% class %>
"
.', call. = FALSE)
}
}
vis_<% component_id %> <- readRDS(file.path(datadir, '<% component_id %>.rds'))
vis_<% component_id %> <- readRDS(file.path(datadir, '<% component_id %>.rds'))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment