-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviz_generator.php
More file actions
50 lines (47 loc) · 1.59 KB
/
viz_generator.php
File metadata and controls
50 lines (47 loc) · 1.59 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
$count = sizeof($result);
$data = "";
$aggregator_field = null;
if ($groupByMode) {
$aggregator_field = $groupByField;
} else {
$aggregator_field = $chooseField;
}
if ($isCategorical && $count <= 15) {
$chooseType = "Pie Chart";
} else {
$chooseType = "Bar Chart";
}
if ($chooseType=="Bar Chart") {
foreach ($result as $index => $row) {
$data .= '{\'data\':\'' . $row[$aggregator_field] . '\',\'value\':' . $row["value"] . '}';
if ($index != count($result) - 1)
$data .= ',';
}
$data = '[' . $data . ']';
echo "<div id='matchCount'><div><b>Number of Results</b> N = $count </div></div>";
echo "<div><p>Inference Engine selected <b>Bar Chart</b> Visualization for this Query!</p></div>";
include_once 'bar.php';
}
if ($chooseType=="Pie Chart") {
foreach ($result as $index => $row) {
$data .= '{"label":"' . $row[$aggregator_field] . '","value":"' . $row["value"] . '"}';
if ($index != count($result) - 1)
$data .= ',';
}
$data = '[' . $data . ']';
echo "<div id='matchCount'><div><b>Number of Results</b> N = $count </div></div>";
echo "<div><p>Inference Engine selected <b>Pie Chart</b> Visualization for this Query!</p></div>";
include_once 'pie.php';
}
if ($chooseType=="Map") {
foreach ($result as $index => $row) {
$data .= '{"label":"' . $row[$aggregator_field] . '","value":"' . $row["value"] . '"}';
if ($index != count($result) - 1)
$data .= ',';
}
echo "<div id='matchCount'><div><b>Number of Results</b> N = $count </div></div>";
echo "<div><p>Inference Engine selected <b>Map</b> Visualization for this Query!</p></div>";
echo "<p>Map Viz Goes Here!</p>";
}
?>