-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscrapTweet.html
94 lines (83 loc) · 3.41 KB
/
scrapTweet.html
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{% extends "base.html" %} {% block title %}Sample{% endblock %}
{% block content %}
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h3 mb-2 text-gray-800">Cari Keyword</h1>
<form action="scrap-tweet" class="mb-3" method="post">
<input type="text" class="form-control" name="keyword">
<button type="submit" class="btn btn-primary mt-2">Cari</button>
</form>
<div class="row d-flex justify-content-center align-content-center">
<div class="col-xl-6 col-md-6 mb-4">
<canvas id="myChart" width="400" height="200"></canvas>
</div>
</div>
<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Hasil Klasifikasi Keyword {{ keyword.keyword }}</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>No</th>
<th>Teks</th>
<th>Preprocessing</th>
<th>Hasil Klasifikasi</th>
</tr>
</thead>
<tbody>
{% for row in data %}
<tr>
<td>{{ loop.index }}</td>
<td>{{ row.teks }}</td>
<td>{{ row.preprocessing }}</td>
<td>{{ row.hasil_klasifikasi }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
{% endblock %}
{% block js %}
{{ super() }}
<!-- Page level plugins -->
<script src="{{ url_for('static', filename='vendor/datatables/jquery.dataTables.min.js')}}"></script>
<script src="{{ url_for('static', filename='vendor/datatables/dataTables.bootstrap4.min.js')}}"></script>
<!-- Page level custom scripts -->
<script src="{{ url_for('static', filename='js/demo/datatables-demo.js')}}"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
// Data yang akan digunakan untuk grafik
var data = {
labels: ['Kebencian', 'Non Kebencian'],
datasets: [{
label: 'Jumlah Data',
data: [{{ countKebencian }}, {{ countNonKebencian }}],
backgroundColor: ['red', 'green'],
borderWidth: 1,
}]
};
// Konfigurasi grafik
var options = {
responsive: true,
maintainAspectRatio: false,
};
// Menggambar grafik
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar', // Jenis grafik
data: data,
options: options,
});
</script>
{% endblock %}