|
|
|
|
|
|
|
|
## Shiny comes for free! |
|
|
## Shiny comes for free! |
|
|
|
|
|
|
|
|
* `r github_sha_link("739d5945010d5e46ab3f9847fd412beb0766805d")` |
|
|
* `r github_sha_link("739d5945010d5e46ab3f9847fd412beb0766805d")` |
|
|
|
|
|
* Start from: `repl_example("frappe-chart-starter")` |
|
|
|
|
|
* Basics: `repl_example("frappe-chart-basic")` |
|
|
|
|
|
|
|
|
Create a basic Shiny app with |
|
|
Create a basic Shiny app with |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`r github_sha_link("5da4b68b5f60d8e6ee17cc8c4a009121539a2653")` |
|
|
`r github_sha_link("5da4b68b5f60d8e6ee17cc8c4a009121539a2653")` |
|
|
|
|
|
|
|
|
Demo with `app.R` |
|
|
|
|
|
|
|
|
Demo with `app.R` by just running the |
|
|
|
|
|
`repl_example("frappe-chart-basic")` app again |
|
|
|
|
|
and using the dev console to show |
|
|
|
|
|
that the update method is working. |
|
|
|
|
|
|
|
|
```js |
|
|
```js |
|
|
let el = document.getElementById('chart') |
|
|
let el = document.getElementById('chart') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`r github_sha_link("0b4f7ea16f378ec5a53d81260c8f9056fabbcaba")` |
|
|
`r github_sha_link("0b4f7ea16f378ec5a53d81260c8f9056fabbcaba")` |
|
|
|
|
|
|
|
|
Attach the event listener during `renderValue()` and watch for the `data-select` event. |
|
|
|
|
|
|
|
|
Attach the event listener during `renderValue()` |
|
|
|
|
|
and watch for the `data-select` event. |
|
|
Use the `el.id` to create a new id, like `el.id + '_selected'`. |
|
|
Use the `el.id` to create a new id, like `el.id + '_selected'`. |
|
|
Send back `index` and `values` from the event. |
|
|
Send back `index` and `values` from the event. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`r github_sha_link("e7fe0e1d87977823e6a040434b33e6d5cdf8eac1")` |
|
|
`r github_sha_link("e7fe0e1d87977823e6a040434b33e6d5cdf8eac1")` |
|
|
|
|
|
|
|
|
You would probably want to do some work for the user and return more meaningful values. |
|
|
|
|
|
|
|
|
You would probably want to do some work for the user |
|
|
|
|
|
and return more meaningful values. |
|
|
We'll probably just copy and paste this during the workshop, |
|
|
We'll probably just copy and paste this during the workshop, |
|
|
but here's a potential method. |
|
|
but here's a potential method. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Final result: `repl_example("frappe-chart-full")` |