Giter Site home page Giter Site logo

Comments (3)

cderv avatar cderv commented on June 9, 2024

This is because bscols() does not return an object of class htmlwidget so it is not seen as an object to add caption too (like #118 fixed).

@yihui How could we handle that ? Should we look maybe into the object when attr(x, "browsable_html") == TRUE ?
Or rather this should be crosstalk that should add a class to the object returned by bscols() so that it is identified as a crosstalk object we can then handle ?

from bookdown.

yihui avatar yihui commented on June 9, 2024

Should we look maybe into the object when attr(x, "browsable_html") == TRUE ?

We could do that.

from bookdown.

ThierryO avatar ThierryO commented on June 9, 2024

Based on your feedback, I've found a workaround. Ugly but effective.

--- 
title: "A Minimal Book Example"
author: "John Doe"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
output:
  bookdown::gitbook: default
---

```{r crosstalk, fig.cap = "Workaround caption"}
library(crosstalk)
library(plotly)
shared_mtcars <- SharedData$new(mtcars)
x <- bscols(widths = 12,
  filter_slider("hp", "Horsepower", shared_mtcars, ~hp, width = "100%"),
  plot_ly(shared_mtcars, x = ~wt, y = ~mpg, color = ~factor(cyl)) |>
    add_markers()
)
class(x) <- c(class(x), "htmlwidget")
x
```

from bookdown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.