From 8aeeeade755fdc07e46ff963bbf479cb84fdda1a Mon Sep 17 00:00:00 2001 From: Matiboux Date: Thu, 2 May 2024 16:34:33 +0200 Subject: [PATCH] Update 2024 votes legend & disable click --- app/app/src/pages/2024/index.astro | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/app/src/pages/2024/index.astro b/app/app/src/pages/2024/index.astro index 4648280..527960e 100644 --- a/app/app/src/pages/2024/index.astro +++ b/app/app/src/pages/2024/index.astro @@ -50,8 +50,8 @@ declare const Plotly: any function updateGraph() { - const graph = document.getElementById('graph') - const nbVotesElement = document.getElementById('nb_votes') + const graph = document.getElementById('graph') as (HTMLDivElement & { on: CallableFunction }) | null + const nbVotesElement = document.getElementById('nb_votes') as HTMLSpanElement | null if (!graph || !nbVotesElement) { return @@ -104,7 +104,8 @@ function updateGraph() x: bar_x, y: bar_y, type: 'bar', - name: charities[i]!, + legendgroup: 'votes', + name: `Choix ${i + 1}`, }) } @@ -112,6 +113,7 @@ function updateGraph() x: line_x, y: line_y, type: 'line', + legendgroup: 'median', name: 'Votes median', line: { color: 'black' }, }) @@ -126,6 +128,7 @@ function updateGraph() showlegend: true, margin: { t: 0, }, }) + graph.on('plotly_legendclick', function() { return false; }) }) }