Skip to content

Commit

Permalink
display UI input for new slot
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrue committed Jul 30, 2024
1 parent d26470d commit 9fa2e37
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
Binary file added vignettes/img/iSEEhex_input.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 34 additions & 3 deletions vignettes/workshop_isee_extension.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ We set the default resolution to 100 hexagonal bins along each axis.
setMethod("initialize", "ReducedDimensionHexPlot", function(.Object, ...) {
args <- list(...)
args <- .emptyDefault(args, .plotBinResolution, 100)
args <- .emptyDefault(args, "BinResolution", 100)
do.call(callNextMethod, c(list(.Object), args))
})
Expand All @@ -580,8 +580,8 @@ At this point, we can already demonstrate that we have a functional new panel cl

```{r, message=FALSE, warning=FALSE, eval=FALSE}
iSEE(sce, initial = list(
ReducedDimensionHexPlot(),
ReducedDimensionPlot()
ReducedDimensionHexPlot(PanelWidth = 6L),
ReducedDimensionPlot(PanelWidth = 6L)
))
```

Expand Down Expand Up @@ -635,6 +635,37 @@ iSEE(sce, initial = list(

<br/>

At this point, there is still no component in the user interface to control the resolution value store in the new slot.

A number of S4 methods control the interface elements displayed in the variousgroups of parameters located under each panel.

Here, we are discussing a parameter that will control the *size* of bins.
Moreover, we are about to replace data points by hexagonal bins, meaning that the visual parameters controlling the size of data points are about to become useless.

Thus, the generic `.defineVisualSizeInterface()` is the natural choice to use for replacing the size parameters of the parent `ReducedDimensionHexPlot()` class by a new HTML element that displays a numeric input allowing users to change the hexagonal bin resolution.

```{r}
setMethod(".defineVisualSizeInterface", "ReducedDimensionHexPlot", function(x) {
plot_name <- .getEncodedName(x)
tagList(
.numericInput.iSEE(x, "BinResolution", label="Bin resolution:",
min=1, value=x[["BinResolution"]], step = 1)
)
})
```

```{r, message=FALSE, warning=FALSE, eval=FALSE}
iSEE(sce, initial = list(
ReducedDimensionHexPlot(PanelWidth = 6L, VisualBoxOpen = TRUE, VisualChoices = "Size"),
ReducedDimensionPlot(PanelWidth = 6L, VisualBoxOpen = TRUE, VisualChoices = "Size")
))
```

![Screenshot of iSEE app including a parent ReducedDimensionPlot and a ReducedDimensionHexPlot extension after replacing the size parameter interface in the child panel.](img/iSEEhex_input.png)

<br/>

## Session info

```{r}
Expand Down

0 comments on commit 9fa2e37

Please sign in to comment.