You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
887B

  1. ---
  2. output: js4shiny::html_document_plain
  3. ---
  4. ```{r htmldeps, echo=FALSE}
  5. library(htmltools)
  6. tagList(
  7. div(id = "chart"),
  8. htmltools::htmlDependency(
  9. name = "frappe-charts",
  10. version = "1.3.0",
  11. package = "frappeCharts",
  12. src = "htmlwidgets/lib/frappe-charts",
  13. script = "frappe-charts.min.iife.js",
  14. all_files = TRUE
  15. )
  16. )
  17. ```
  18. ```{js}
  19. const data = {
  20. labels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
  21. datasets: [
  22. { name: "R", values: [18, 40, 30, 35, 8, 52, 17, -4] },
  23. { name: "Python", values: [30, 50, -10, 15, 18, 32, 27, 14] }
  24. ]
  25. }
  26. const chart = new frappe.Chart("#chart", { // or a DOM element,
  27. // new Chart() in case of ES6 module with above usage
  28. title: "My Awesome Chart",
  29. data: data,
  30. type: 'line',
  31. height: 250,
  32. colors: ['#7cd6fd', '#743ee2']
  33. })
  34. ```