File size: 6,717 Bytes
82f07ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Crime Dashboard</title>
    <style>

        body {

            font-family: Arial, sans-serif;

            background-color: #121212;

            color: white;

            margin: 0;

            padding: 0;

        }



        .container {

            display: flex;

            min-height: 100vh;

        }



        .sidebar {

            width: 300px;

            background-color: #2A2A2A;

            padding: 20px;

            box-sizing: border-box;

        }



        .sidebar h2, .sidebar h1, .sidebar label {

            color: #EFF204;

        }



        .sidebar .btn-back {

            background-color: #FF4747;

            border: none;

            width: 100%;

            margin-bottom: 20px;

        }



        .sidebar nav a {

            display: block;

            color: white;

            padding: 10px 0;

            text-decoration: none;

            font-size: 16px;

            cursor: pointer;

        }



        .sidebar nav a:hover {

            background-color: #444;

        }



        .sidebar nav .sub-menu {

            display: none;

            padding-left: 20px;

        }



        .sidebar nav .sub-menu a {

            padding: 5px 0;

        }



        .main-content {

            flex: 1;

            padding: 0;

            box-sizing: border-box;

            position: relative;

        }



        .iframe-container {

            position: relative;

            width: 100%;

            height: 100vh;

            overflow: hidden;

        }



        .iframe-container iframe {

            position: absolute;

            top: 0;

            left: 0;

            width: 100%;

            height: 100%;

            border: none;

        }



        .chart-container {

            margin-top: 20px;

            background-color: #1E1E1E;

            padding: 20px;

            border-radius: 8px;

        }



        canvas {

            height: 100% !important;

        }

    </style>
</head>
<body>
    <div class="container">
        <div class="sidebar">
            <button class="btn-back" onclick="goBack()">Back</button>
            <h2>Dashboard</h2>
            <nav>
                <a href="http://127.0.0.1:5000/heat-map">Heat Map</a>
                <a onclick="toggleSubMenu(event)">Prediction</a>
                <div class="sub-menu">
                    <a href="http://127.0.0.1:5000/cluster">Crime Suggestion Prediction</a>
                    <a href="http://127.0.0.1:5000/predict">Behavior Prediction</a>
                    <a href="http://127.0.0.1:5000/future-crime-forecast">Future Crime Prediction</a>
                     <a href="http://127.0.0.1:5000/crime-prediction">Crime Prediction</a>
                </div>
            </nav>
           
            <div class="chart-container">
                <canvas id="crimeMapChart"></canvas>
            </div>
            <div class="chart-container">
                <canvas id="karnatakaMapChart"></canvas>
            </div>
        </div>
        <div class="main-content">
            <div class="iframe-container">
                <iframe src="https://crime-marker-map.netlify.app/"></iframe>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script>

        function goBack() {

            window.location.href = 'http://127.0.0.1:5000/index';

        }



        function toggleSubMenu(event) {

            event.preventDefault();

            const subMenu = event.target.nextElementSibling;

            subMenu.style.display = subMenu.style.display === 'block' ? 'none' : 'block';

        }



        document.addEventListener("DOMContentLoaded", function() {

           



            // Crime Map Chart

            const crimeMapCtx = document.getElementById('crimeMapChart').getContext('2d');

            new Chart(crimeMapCtx, {

                type: 'bubble',

                data: {

                    datasets: [{

                        label: 'Crime Map',

                        data: [

                            { x: 10, y: 20, r: 15 },

                            { x: 15, y: 10, r: 10 },

                            { x: 20, y: 30, r: 25 },

                            { x: 25, y: 20, r: 5 },

                            { x: 30, y: 25, r: 20 }

                        ],

                        backgroundColor: 'rgba(54, 162, 235, 0.8)',

                        borderColor: 'rgba(54, 162, 235, 1)',

                        borderWidth: 1

                    }]

                },

                options: {

                    scales: {

                        y: {

                            beginAtZero: true

                        }

                    }

                }

            });



            // Karnataka Map Chart

            const karnatakaMapCtx = document.getElementById('karnatakaMapChart').getContext('2d');

            new Chart(karnatakaMapCtx, {

                type: 'bubble',

                data: {

                    datasets: [{

                        label: 'Crime Rates in Karnataka',

                        data: [

                            { x: 12.9716, y: 77.5946, r: 15 }, // Bengaluru

                            { x: 12.2958, y: 76.6394, r: 10 }, // Mysuru

                            { x: 12.9141, y: 74.8560, r: 12 }, // Mangaluru

                            { x: 15.3647, y: 75.1240, r: 8 }, // Hubli

                            { x: 15.8497, y: 74.4977, r: 5 }  // Belagavi

                        ],

                        backgroundColor: 'rgba(255, 99, 132, 0.8)',

                        borderColor: 'rgba(255, 99, 132, 1)',

                        borderWidth: 1

                    }]

                },

                options: {

                    scales: {

                        x: {

                            type: 'linear',

                            position: 'bottom',

                            title: {

                                display: true,

                                text: 'Latitude'

                            }

                        },

                        y: {

                            title: {

                                display: true,

                                text: 'Longitude'

                            }

                        }

                    }

                }

            });

        });

    </script>
</body>
</html>