BSJ2004's picture
Upload 31 files
82f07ee verified
raw
history blame contribute delete
No virus
6.72 kB
<!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>