From f68e88c5ef64c0e3b31626da71c333a7fddf1468 Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Wed, 26 Mar 2025 17:16:03 -0300 Subject: [PATCH] Added support for plotly js (#3097) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only now I realized that the [previous support](https://alshedivat.github.io/al-folio/blog/2021/distill/#interactive-plots) for [plotly](https://plotly.com/) was enabled by exporting an HTML from python code. This adds support for [plotly.js](https://plotly.com/javascript/). --------- Signed-off-by: George Araújo --- _config.yml | 6 ++ _includes/distill_scripts.liquid | 11 ++++ _includes/scripts.liquid | 11 ++++ _posts/2025-03-26-plotly.md | 110 +++++++++++++++++++++++++++++++ assets/js/copy_code.js | 1 + assets/js/plotly-setup.js | 52 +++++++++++++++ assets/js/theme.js | 46 +++++++++++++ 7 files changed, 237 insertions(+) create mode 100644 _posts/2025-03-26-plotly.md create mode 100644 assets/js/plotly-setup.js diff --git a/_config.yml b/_config.yml index 885a892..ec4b7f9 100644 --- a/_config.yml +++ b/_config.yml @@ -548,6 +548,12 @@ third_party_libraries: url: js: "https://cdn.jsdelivr.net/npm/photoswipe@{{version}}/dist/photoswipe-lightbox.esm.min.js" version: "5.4.4" + plotly: + integrity: + js: "sha256-oy6Be7Eh6eiQFs5M7oXuPxxm9qbJXEtTpfSI93dW16Q=" + url: + js: "https://cdn.jsdelivr.net/npm/plotly.js@{{version}}/dist/plotly.min.js" + version: "3.0.1" polyfill: url: js: "https://cdnjs.cloudflare.com/polyfill/v{{version}}/polyfill.min.js?features=es6" diff --git a/_includes/distill_scripts.liquid b/_includes/distill_scripts.liquid index df4104c..8d6a63c 100644 --- a/_includes/distill_scripts.liquid +++ b/_includes/distill_scripts.liquid @@ -81,6 +81,17 @@ {% endif %} +{% if page.chart and page.chart.plotly %} + + + +{% endif %} + {% if page.chart and page.chart.vega_lite %} {% endif %} +{% if page.chart and page.chart.plotly %} + + + +{% endif %} + {% if page.chart and page.chart.vega_lite %}