mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Merge pull request #815 from rrobgill/pietooltips
Pie-chart custom tooltips
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user