diff --git a/uVote/api/votes/votes.php b/uVote/api/votes/votes.php index 2dfbc65..9cc578a 100644 --- a/uVote/api/votes/votes.php +++ b/uVote/api/votes/votes.php @@ -7,8 +7,8 @@ class votes { $res = \DBD\UVOTE_DATA_GRAPH_BT_TO_UVOTE_OVERALL_BY_TIME::QQ(array($timespan)); while ($row = $res->next()){ $result[] = array( 0 => $row['day'], - 'class_match' => $row['class_match'] / ($row['class_match']+$row['class_mismatch']+1), - 'class_mismatch' => $row['class_mismatch'] / ($row['class_match']+$row['class_mismatch']+1)); + 'class_match' => $row['class_match'] > 0 ? round($row['class_match'] / ($row['class_match']+$row['class_mismatch']),2) : 0, + 'class_mismatch' => $row['class_match'] > 0 ? round($row['class_mismatch'] / ($row['class_match']+$row['class_mismatch']),2) : 0); } return $returnasjson ? SYSTEM\LOG\JsonResult::toString($result) : $result; } diff --git a/uVote/page/default_page/js/loadtexts.js b/uVote/page/default_page/js/loadtexts.js index d5b2fc9..4f9b211 100644 --- a/uVote/page/default_page/js/loadtexts.js +++ b/uVote/page/default_page/js/loadtexts.js @@ -266,7 +266,8 @@ function load_visualisation(id, timespan){ data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));}); console.log(data); - var options = {title: id, aggregationTarget: 'category', selectionMode: 'multiple', curveType: 'function', /*focusTarget: 'category',*/ chartArea:{}, vAxis:{logScale: false}, interpolateNulls: false, width: "300", height: "250"}; - new google.visualization.LineChart(document.getElementById(id)).draw(data, options); + var options = {title: id, aggregationTarget: 'category', selectionMode: 'multiple', /*curveType: 'function',*/ /*focusTarget: 'category',*/ chartArea:{}, vAxis:{format:'#%', logScale: false}, interpolateNulls: false, width: "300", height: "250"}; + //LineChart + new google.visualization.ColumnChart(document.getElementById(id)).draw(data, options); }); } \ No newline at end of file