#42 Pie Chart

v0.9
pending
nobody
5
2012-09-16
2011-12-13
Stephen
No

The the pie chart for online user is showing Total and online as totals not percentages of total to online.
My pie charts look like only 50% of people are online, but 95% are online.

Discussion

  • Liran Tal
    Liran Tal
    2012-06-24

    Thanks for the bug report.
    Please apply the following patch to library/graphs-reports-online-users.php:

    Index: library/graphs-reports-online-users.php

    --- library/graphs-reports-online-users.php (revision 2111)
    +++ library/graphs-reports-online-users.php (working copy)
    @@ -35,16 +35,21 @@
    $res = $dbSocket->query($sql);
    $totalUsers = $res->numRows();

    - $chart->addPoint(new Point("$totalUsers ($totalUsers users total)", "$totalUsers"));

    // get total users online
    $sql = "SELECT DISTINCT(UserName) FROM ".$configValues['CONFIG_DB_TBL_RADACCT']." WHERE (AcctStopTime is NULL OR AcctStopTime = '0000-00-00 00:00:00')";
    $res = $dbSocket->query($sql);
    $totalUsersOnline = $res->numRows();
    
    • if ($totalUsers != 0) {
    • $totalUsersOffline = $totalUsers - $totalUsersOnline;
    • if ($totalUsersOnline == 0) {
    • $chart->addPoint(new Point("$totalUsersOffline ($totalUsersOffline users offline)", "$totalUsersOffline"));
    • } else {
    • $chart->addPoint(new Point("$totalUsersOffline ($totalUsersOffline users offline)", "$totalUsersOffline"));
    • $chart->addPoint(new Point("$totalUsersOnline ($totalUsersOnline users online)", "$totalUsersOnline"));
    • }
    • }

    - $chart->addPoint(new Point("$totalUsersOnline ($totalUsersOnline users online)", "$totalUsersOnline"));

    $chart->setTitle("Online users");
    $chart->render();
    

    Let me know if it works well or requires more attention.

     


Anonymous


Cancel   Add attachments