uvote fixes @ graph

This commit is contained in:
Ulf Gebhardt 2014-03-06 17:07:04 +01:00
parent 0c5b31b459
commit edff4a4457
2 changed files with 5 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);
});
}