Skip to content

panelFn with return(NULL) breaks trelliscope when used with rbokeh  #121

@jrounds

Description

@jrounds

Hi,

My hobbies include staying up late finding bugs because my other hobby is writing code that hits corner cases... I was quite excited to see the potential of rbokeh mixed with trelliscope unfortunately nothing happened for me when I went to do it! I eventually figured this out, but sorry no quick fix from me tonight =) Though I think the work around is simply to always plot something.

When the leading panelFn call for a ddo returns NULL and all the rest return rbokeh objects no panels display. However, if the leading panelFn returns an rbokeh object and a subsequent panelFn returns NULL only the NULL panel fails to display as it should be. There is however a squawk from trelliscope while displaying the NULL of:
"Error in system.file(config, package = package) :
'package' must be of length 1"

R code to recreate this issue is this and it shows both the bad behavior and the good behavior:

data(iris)
idata = divide(iris,by="Species")
i = 1
idata = lapply(idata, function(kv){
    new.value = list()
    new.value$data = kv$value
    new.value$i = i
    i <<- i + 1
    kv$value = new.value
    return(kv)
})
idata = ddo(idata)
badPanelFn = function(v) {
    if(v$i == 1)
        return(NULL)
    p = figure() %>% ly_points(Sepal.Length, Sepal.Width, data=v$data, hover=list(Sepal.Length))
    return(p)
}
panelFn(idata[[1]]$value)
bad = vdbConn("/tmp/bad", autoYes=TRUE)
makeDisplay(idata, panelFn=badPanelFn, conn=bad, name="name")
view(conn=bad)

goodPanelFn = function(v){
    if(v$i == 2)
        return(NULL)
    p = figure() %>% ly_points(Sepal.Length, Sepal.Width, data=v$data, hover=list(Sepal.Length))
    return(p)
}

good = vdbConn("/tmp/good", autoYes=TRUE)
makeDisplay(idata, panelFn=goodPanelFn, conn=good, name="name")
view(conn=good)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions