Fixed call forward chart not showing up (#6547)

Fixed a bug where the chart doesn't show up when all the values are equal to 0.
This commit is contained in:
Alex 2023-02-09 13:38:48 -07:00 committed by GitHub
parent a727c4c38a
commit d35c7577bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 68 additions and 63 deletions

View File

@ -92,10 +92,15 @@
//begin widget
echo "<div class='hud_box'>\n";
//set defaults
if ($stats['dnd'] == null) { $stats['dnd'] = 0; }
if ($stats['follow_me'] == null) { $stats['follow_me'] = 0; }
if ($stats['call_forward'] == null) { $stats['call_forward'] = 0; }
if ($stats['active'] == null) { $stats['active'] = 0; }
//doughnut chart
if ($show_stat) {
echo "<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick=\"$('#hud_call_forward_details').slideToggle('fast');\">\n";
echo " <div style='width: 250px; height: 175px;'><canvas id='call_forward_chart'></canvas></div>\n";
echo " <div style='width: 275px; height: 175px;'><canvas id='call_forward_chart'></canvas></div>\n";
echo "</div>\n";
echo "<script>\n";
@ -116,17 +121,18 @@
echo " '".$stats['follow_me']."',\n";
echo " '".$stats['call_forward']."',\n";
echo " '".$stats['active']."',\n";
echo " 0.00001,\n";
echo " ],\n";
echo " backgroundColor: [\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_do_not_disturb']['text']."',\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_follow_me']['text']."',\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_call_forward']['text']."',\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_active']['text']."',\n";
echo " '#000',\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_active']['text']."',\n";
echo " ],\n";
echo " borderColor: '".$_SESSION['dashboard']['call_forward_chart_border_color']['text']."',\n";
echo " borderWidth: '".$_SESSION['dashboard']['call_forward_chart_border_width']['text']."',\n";
echo " cutout: chart_cutout\n";
echo " cutout: chart_cutout,\n";
echo " }]\n";
echo " },\n";
echo " options: {\n";
@ -154,7 +160,6 @@
echo " }\n";
echo " );\n";
echo "</script>\n";
}
//details
echo "<div class='hud_details hud_box' id='hud_call_forward_details'>";