From: Yao Zongyou Date: Mon, 6 Nov 2017 15:40:00 +0000 (+0800) Subject: mgr/dashboard: format chart's tooltip's label as friendly string X-Git-Tag: v13.0.1~275^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e74c7f84c0156bbf136100e29a547e916d611533;p=ceph.git mgr/dashboard: format chart's tooltip's label as friendly string The default tooltip's label is a long number string, so format the label as a user friendly string. Signed-off-by: Yao Zongyou --- diff --git a/src/pybind/mgr/dashboard/health.html b/src/pybind/mgr/dashboard/health.html index e61c8ef92db6..4859f686da7b 100644 --- a/src/pybind/mgr/dashboard/health.html +++ b/src/pybind/mgr/dashboard/health.html @@ -168,7 +168,15 @@ center_text: raw_usage_text, responsive: true, legend: {display: false}, - animation: {duration: 0} + animation: {duration: 0}, + tooltips: { + callbacks: { + label: function(tooltipItem, chart) { + return chart.labels[tooltipItem.index] + ": " + + rivets.formatters.dimless_binary(chart.datasets[0].data[tooltipItem.index]); + } + } + } } }); @@ -202,7 +210,15 @@ options: { responsive: true, legend: {display: false}, - animation: {duration: 0} + animation: {duration: 0}, + tooltips: { + callbacks: { + label: function(tooltipItem, chart) { + return chart.labels[tooltipItem.index] + ": " + + rivets.formatters.dimless_binary(chart.datasets[0].data[tooltipItem.index]); + } + } + } } }); }