From ab61ef624418e6b489ffad6ee931f27d667f2be8 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Wed, 10 Feb 2021 21:32:00 -0500 Subject: [PATCH] Vaccine gap chart updates * Show the tooltip rows as nicely formatted numbers * Ensure that users do not need to hover over a point to view the tooltip --- js/vacgraph.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/js/vacgraph.js b/js/vacgraph.js index b0db665c9..36caabd96 100644 --- a/js/vacgraph.js +++ b/js/vacgraph.js @@ -174,10 +174,29 @@ function draw(graphConfig) { } }], }, + hover: { + intersect: false, + mode: 'index', + }, legend: { display: true }, tooltips: { + callbacks: { + // Show the tooltip rows as nicely formatted numbers + label: function(tooltipItem, data) { + var label = data.datasets[tooltipItem.datasetIndex].label || ''; + + if (label) { + label += ': '; + } + label += tooltipItem.yLabel.toLocaleString(); + return label; + } + }, + + // Ensure that the user does not have to hover over a point to view the tooltip + intersect: false, mode: 'index' } }