Closed pensivedog closed 2 years ago
You're right, this seems to be linked to a recent Observable runtime update.
I'll look into it, thanks for taking the time to report the issue.
So I think inputs are working now. Part of the problem was that the notebooks used in the introduction vignettes have been rewritten on Observable and were not functional anymore.
This should now be fixed in the development version.
Thanks again and don't hesitate to let us know if there is any other problem.
Thanks for this update. I'm getting a "RuntimeError: invalid module" message now when trying to run this in RStudio:
robservable( "@juba/robservable-bar-chart", include = "chart" )
Urf, I get the same error in RStudio but it works ok in VSCode or in a browser. Could you confirm that if you click on "show in new window" the chart is displayed correctly ?
It seems to be linked to the Plot library, which can't be loaded into RStudio, surely because its underlying chromium engine is now too old. Notebooks which don't use plot seem to be working just fine.
More precisely, the Plot
library uses the ?.
optional chaining operator which is supported since Chromium 80, whereas RStudio is still at Chromium 69...
I fear we're stuck here, not sure there is a workaround. core-js
doesn't seem to provide a polyfill for optional chaining operator, and even RStudio preview is still on Chromium 69.
Thanks for helping troubleshoot. I confirm that Observable charts not using Plot are previewing fine in RStudio.
But... the input argument still seems to not be working. For instance, this does not successfully update the color:
robservable( "@d3/horizontal-bar-chart", include = "chart", input = list(color="red") )
Yes, that's normal, this code doesn't work now because the notebook has been changed and there isn't any cell named color
anymore.
input
only allows to change the value of a named cell in the Observable notebook, so in this example you could change alphabet
for example, but not color
.
Apologies, I'm still figuring out how this works. In this example, input = list(color="red")
doesn't work, but input = list(width=100)
does work, even though there isn't a cell named width
. What am I missing here?
You're right, width
is an exception here, it is always available as it is a variable which is part of Observable standard library. So you can change its value even if it is not defined as a cell. But other inputs must exist in the notebook to be modified.
Ok, very helpful! Thank you for taking the time to answer these questions :)
The input argument is not working. This can be observed in the "Update cell values" section of the package vignette:
https://juba.github.io/robservable/articles/introduction.html#update-cell-values
The example from the project documentation is also not working:
Change data frame cells data df <- data.frame(table(mtcars$cyl)) names(df) <- c("name", "value") robservable( "@d3/horizontal-bar-chart", include = "chart", input = list(data = df) )