Results of Chart.js integration in Reveal slides #8244
fuhrmanator
started this conversation in
Show and Tell
Replies: 1 comment 3 replies
-
I think you're tempting fate a little bit by writing exposed HTML elements like that: Pandoc will likely attempt to parse it and I think that might be the source of your troubles. What happens when you put those in a raw block?
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
I followed the advice in https://quarto.org/docs/presentations/revealjs/advanced.html#reveal-plugins to add the https://github.com/rajgoel/reveal.js-plugins/tree/master/chart plugin for reveal. It works, but I was unable to get the simple examples (with CSV data inside the HTML) to work.
Examples that use CSV data in the HTML portion (see below) don't work well, mainly because (as far as I gather) the separate markdown lines get joined into one HTML line. If you try to force line breaks in the markdown, they are converted to
<br>
in the HTML, which then corrupts the CSV data.I use Copilot (enterprise through my university) in VSCode, and it easily converts these examples to ones that have embedded
dataset
in a JSON setting. I gets ugly...Here's an example of the HTML-embedded data that I couldn't get to work. By forcing line endings (e.g., with two blanks at the end of a line, a backslash before the end of line, etc.) I end up with missing data (on the second line, which can be fixed by adding a column) and a
July<br>
label (which I couldn't manage to fix).Here's the Quarto snippet that works. It's obviously more complicated when everything is embedded in the JSON string. Again, using an AI for the gory details helps a lot.
The
plugin.yml
file is inrevealjs-plugins/chart
of my project:The configuration in
_quarto.yml
:Since https://github.com/rajgoel/reveal.js-plugins/tree/master/chart is just the reveal plugin (which I renamed to revealjs-plugins/chart/chart.js), I also had to download the Chart.js library from https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.2.0/chart.min.js which I also saved in revealjs-plugins/chart
Hope this is helpful!
Beta Was this translation helpful? Give feedback.
All reactions