-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiphone.php
More file actions
73 lines (62 loc) · 1.67 KB
/
iphone.php
File metadata and controls
73 lines (62 loc) · 1.67 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php include 'includes/header.php'; ?>
<body class="hold-transition skin-blue layout-top-nav">
<div class="wrapper">
<?php include 'includes/navbar.php'; ?>
<div class="content-wrapper">
<div class="container">
<?php require 'vendor/autoload.php'; // include Composer's autoloader
$client = new MongoDB\Client("mongodb://localhost:27017");
$collection = $client->review_db->iphone_textAnalysis;
$cursor = $collection->find();
// Naviye Baies Classification
$pos=0;
$neg=0;
$neu=0;
$total=0;
foreach($cursor as $document)
{ //echo $document["TextAnalysis"]["score_tag"]."\n";
$total+=1;
if(strcmp( $document["TextAnalysis"]["score_tag"], "N") == 0)
$neg+=1;
if(strcmp( $document["TextAnalysis"]["score_tag"], "P") == 0)
$pos+=1;
if(strcmp( $document["TextAnalysis"]["score_tag"], "NONE") == 0)
$neu+=1;
}
//echo $neu;
//echo $pos;
//echo $neg;
//echo $total;
?>
<!DOCTYPE HTML>
<html>
<head>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script> <script
type="text/javascript"> window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "iphone"
},
data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
type: "column",
dataPoints: [
{ label: "TOTAL", y: <?php echo $total; ?> },
{ label: "NEUTRAL", y: <?php echo $neu; ?> },
{ label: "POSITIVE", y: <?php echo $pos; ?> },
{ label: "NEGATIVE", y: <?php echo $neg; ?> }
]
}
]
});
chart.render();
}
</script> </head>
<body>
<div id="chartContainer" style="height: 400px; width: 70%; margin:100px;"></div>
</body>
</html>
<?php include 'includes/scripts.php'; ?>
</body>
</html>