lotta data master
[contractdashboard.git] / heuristics / viewHeuristicsDistribution.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php    
 
/*// most interesting
SELECT sum(heuristic_value) as sum, CNID
FROM heuristic_results group by CNID order by sum DESC limit 30
 
// spread of values
select floor(sum) as val,count(*) from (SELECT sum(heuristic_value) 
as sum FROM heuristic_results group by "CNID") as a group by val*/
 
$series = Array();
 
  include_once("../lib/common.inc.php");
$query = "select heuristic_name, floor(heuristic_value) as val,count(*) from heuristic_results group by heuristic_name, val";
    $result = $conn->query($query);
foreach ($result->fetchAll() as $r) {
    $series[$r["heuristic_name"]][$r["val"]] = $r[2];
}
 
 $labels = Array();
 foreach ($series as $value) {
    $labels = $labels+array_keys($value);
 }
 $labels =  Array(0,1,2,3,4,5);
foreach ($series as $seriesName => $seriesEntry) {
    $data;
 foreach ($labels as $label) {
    $data[$label] = ($seriesEntry[$label] ? $seriesEntry[$label] : 0);
 }
}
print_r($labels);
print_r($data);
?>