Merge pull request #815 from rrobgill/pietooltips

Pie-chart custom tooltips
This commit is contained in:
Mark Drobnak
2018-08-10 17:34:30 -04:00
committed by GitHub
2 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -149,10 +149,10 @@
</div>
<div class="box-body">
<div class="float-left" style="width:50%">
<canvas id="forwardDestinationPieChart" width="120" height="120"></canvas>
<canvas id="forwardDestinationPieChart" width="120" height="120" class="extratooltipcanvas"></canvas>
</div>
<div class="float-left" style="width:50%">
<div id="forward-destinations-legend" class="chart-legend"></div>
<div id="forward-destinations-legend" class="chart-legend" class="extratooltipcanvas"></div>
</div>
</div>
<div class="overlay">
+7 -3
View File
@@ -81,7 +81,9 @@ var customTooltips = function(tooltip) {
style += "; border-width: 2px";
var span = "<span class=\"chartjs-tooltip-key\" style=\"" + style + "\"></span>";
var num = body[0].split(": ");
if(num[1] > 0)
// remove percent symbol from amount to allow numeric comparison
var number = num[1].replace(/%/i,"");
if(number > 0)
{
innerHtml += "<tr><td>" + span + body + "</td></tr>";
printed++;
@@ -1146,7 +1148,8 @@ $(document).ready(function() {
display: false
},
tooltips: {
enabled: true,
enabled: false,
custom: customTooltips,
callbacks: {
title: function(tooltipItem, data) {
return "Query types";
@@ -1183,7 +1186,8 @@ $(document).ready(function() {
display: false
},
tooltips: {
enabled: true,
enabled: false,
custom: customTooltips,
callbacks: {
title: function(tooltipItem, data) {
return "Forward destinations";