diff --git a/locale/fr/LC_MESSAGES/djangojs.po b/locale/fr/LC_MESSAGES/djangojs.po index 62c7e9b..daacf05 100644 --- a/locale/fr/LC_MESSAGES/djangojs.po +++ b/locale/fr/LC_MESSAGES/djangojs.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-15 20:23+0000\n" +"POT-Creation-Date: 2024-06-03 15:43+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -56,3 +56,7 @@ msgstr "Pas de données disponibles" #: static/custom.js:17 msgid "Loading..." msgstr "Chargement..." + +#: static/custom.js:54 +msgid "Filter series by name (case sensitive):" +msgstr "Filtrer les séries par nom (sensible à la casse):" diff --git a/static/custom.js b/static/custom.js index 228b13e..3aff744 100644 --- a/static/custom.js +++ b/static/custom.js @@ -46,6 +46,29 @@ function loadGraph(container, url){ content['config'] = {}; } + content['config']['modeBarButtonsToAdd'] = [ + { + name: 'Filter series', + icon: Plotly.Icons.eraseshape, + click: function(gd) { + bootbox.prompt(gettext('Filter series by name (case sensitive):'), + function(filter_value) { + if (filter_value != null) { + var new_data = []; + for (var i = 0; i < content['data'].length; i++) { + var trace = content['data'][i]; + // check if the trace name contains the filter value + if(trace['name'].includes(filter_value)){ + new_data.push(trace); + } + } + Plotly.newPlot(gd, new_data, content['layout'], content['config']); + } + }); + } + } + ] + Plotly.newPlot(container, content['data'], content['layout'], content['config']); $(container_div).on('plotly_relayout', function(self, relayout_data){ diff --git a/templates/base.html b/templates/base.html index 09883ad..c2bb7af 100644 --- a/templates/base.html +++ b/templates/base.html @@ -36,6 +36,7 @@ +