TIF_NGANJUK_E41212241/templates/visualization.html

284 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Visualisasi Sentimen</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<style>
/* Basic Styling */
body {
display: flex;
flex-direction: column;
min-height: 100vh; /* Ensure the body takes the full height of the viewport */
padding-bottom: 80px; /* Space to avoid overlap with footer */
}
/* Ensure main content grows to fill available space */
.main-content {
flex-grow: 1; /* This allows the main content to fill remaining space */
padding-bottom: 20px;
}
/* Header Styling */
header {
background-color: #3498db;
color: white;
padding: 40px 20px;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
/* Back Button Styling */
.back-button {
font-size: 35px;
text-decoration: none;
font-weight: bold;
color: white;
padding: 10px 20px;
display: flex;
align-items: center;
position: absolute;
left: 20px;
top: 40%;
transform: translateY(-50%);
}
.back-button i {
margin-right: 8px;
}
/* Header Title */
.header-container h1 {
font-size: 40px;
margin: 0;
color: white;
}
/* Card Styling */
.visualization-card {
background-color: white;
padding: 20px;
border-radius: 10px;
width: 320px;
height: auto; /* Adjust card height based on content */
text-align: center;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
margin: 0;
transition: transform 0.3s ease, box-shadow 0.3s ease;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
overflow: hidden; /* Prevent content overflow */
}
/* Hover Effect */
.visualization-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
/* Card Container */
.card-container {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 20px;
padding: 20px;
flex-wrap: wrap; /* Ensure cards fit within the width */
}
/* WordCloud Image Styling */
.visualization-card img {
max-width: 100%;
max-height: 300px; /* Limit max height for better display */
height: auto;
width: auto;
border-radius: 10px;
margin-bottom: 10px;
display: block;
object-fit: contain; /* Ensure aspect ratio is maintained */
margin-left: auto;
margin-right: auto;
}
/* Visualization Section for WordClouds */
.visualization-section {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 15px;
margin-left: 455px;
}
/* Add space below the last word cloud (Total Sentiment) */
.visualization-section:last-child {
margin-bottom: 200px; /* Adjust the margin as needed */
}
/* Ensure the footer sticks at the bottom */
footer {
position: fixed;
bottom: 0;
width: 100%;
background-color: #3498db;
color: white;
text-align: center;
padding: 20px;
font-size: 14px;
}
footer p {
margin: 0;
}
/* Social Media Icons */
footer .social-icons {
margin-top: 10px;
}
footer .social-icons a {
color: white;
font-size: 20px;
margin: 0 10px;
}
footer .social-icons a:hover {
color: #f39c12;
}
/* Responsive Design for Small Screens */
@media (max-width: 768px) {
.visualization-card {
width: 100%;
}
header {
flex-direction: column;
text-align: center;
}
}
</style>
</head>
<body>
<!-- Header -->
<header>
<div class="header-container">
<!-- Back Button Styling -->
<a href="/" class="back-button">
<i class="fas fa-arrow-left"></i>
</a>
<h1>Visualisasi Sentimen</h1>
</div>
</header>
<!-- Main Content Section -->
<div class="main-content">
<!-- Visualization Selection Section -->
<div class="card-container">
<!-- Cards for IG Unbalanced, IG Balanced, Twitter Unbalanced, Twitter Balanced -->
<div class="visualization-card" onclick="showWordCloud('instagram_unbalanced')">
<h2>Instagram Unbalanced</h2>
<img src="data:image/png;base64,{{ instagram_img_b64_unbalanced }}" alt="Instagram Unbalanced Sentiment Distribution" />
<p>Click to view WordCloud</p>
</div>
<div class="visualization-card" onclick="showWordCloud('instagram_balanced')">
<h2>Instagram Balanced</h2>
<img src="data:image/png;base64,{{ instagram_img_b64_balanced }}" alt="Instagram Balanced Sentiment Distribution" />
<p>Click to view WordCloud</p>
</div>
<div class="visualization-card" onclick="showWordCloud('twitter_unbalanced')">
<h2>Twitter Unbalanced</h2>
<img src="data:image/png;base64,{{ twitter_img_b64_unbalanced }}" alt="Twitter Unbalanced Sentiment Distribution" />
<p>Click to view WordCloud</p>
</div>
<div class="visualization-card" onclick="showWordCloud('twitter_balanced')">
<h2>Twitter Balanced</h2>
<img src="data:image/png;base64,{{ twitter_img_b64_balanced }}" alt="Twitter Balanced Sentiment Distribution" />
<p>Click to view WordCloud</p>
</div>
</div>
<!-- WordClouds for Instagram Unbalanced -->
<div id="instagram_unbalanced" class="visualization-section" style="display: none;">
<h3>Instagram Unbalanced WordClouds</h3>
<h4>WordCloud for Positive Sentiment</h4>
<img src="data:image/png;base64,{{ instagram_wordcloud_b64_pos_unbalanced }}" alt="Instagram WordCloud Positive Sentiment" />
<h4>WordCloud for Negative Sentiment</h4>
<img src="data:image/png;base64,{{ instagram_wordcloud_b64_neg_unbalanced }}" alt="Instagram WordCloud Negative Sentiment" />
<h4>WordCloud for Neutral Sentiment</h4>
<img src="data:image/png;base64,{{ instagram_wordcloud_b64_neu_unbalanced }}" alt="Instagram WordCloud Neutral Sentiment" />
<h4>WordCloud for Total Sentiment</h4>
<img src="data:image/png;base64,{{ instagram_wordcloud_b64_total_unbalanced }}" alt="Instagram WordCloud Total Sentiment" />
</div>
<!-- WordClouds for Instagram Balanced -->
<div id="instagram_balanced" class="visualization-section" style="display: none;">
<h3>Instagram Balanced WordClouds</h3>
<h4>WordCloud for Positive Sentiment</h4>
<img src="data:image/png;base64,{{ instagram_wordcloud_b64_pos_balanced }}" alt="Instagram WordCloud Positive Sentiment" />
<h4>WordCloud for Negative Sentiment</h4>
<img src="data:image/png;base64,{{ instagram_wordcloud_b64_neg_balanced }}" alt="Instagram WordCloud Negative Sentiment" />
<h4>WordCloud for Neutral Sentiment</h4>
<img src="data:image/png;base64,{{ instagram_wordcloud_b64_neu_balanced }}" alt="Instagram WordCloud Neutral Sentiment" />
<h4>WordCloud for Total Sentiment</h4>
<img src="data:image/png;base64,{{ instagram_wordcloud_b64_total_balanced }}" alt="Instagram WordCloud Total Sentiment" />
</div>
<!-- WordClouds for Twitter Unbalanced -->
<div id="twitter_unbalanced" class="visualization-section" style="display: none;">
<h3>Twitter Unbalanced WordClouds</h3>
<h4>WordCloud for Positive Sentiment</h4>
<img src="data:image/png;base64,{{ twitter_wordcloud_b64_pos_unbalanced }}" alt="Twitter WordCloud Positive Sentiment" />
<h4>WordCloud for Negative Sentiment</h4>
<img src="data:image/png;base64,{{ twitter_wordcloud_b64_neg_unbalanced }}" alt="Twitter WordCloud Negative Sentiment" />
<h4>WordCloud for Neutral Sentiment</h4>
<img src="data:image/png;base64,{{ twitter_wordcloud_b64_neu_unbalanced }}" alt="Twitter WordCloud Neutral Sentiment" />
<h4>WordCloud for Total Sentiment</h4>
<img src="data:image/png;base64,{{ twitter_wordcloud_b64_total_unbalanced }}" alt="Twitter WordCloud Total Sentiment" />
</div>
<!-- WordClouds for Twitter Balanced -->
<div id="twitter_balanced" class="visualization-section" style="display: none;">
<h3>Twitter Balanced WordClouds</h3>
<h4>WordCloud for Positive Sentiment</h4>
<img src="data:image/png;base64,{{ twitter_wordcloud_b64_pos_balanced }}" alt="Twitter WordCloud Positive Sentiment" />
<h4>WordCloud for Negative Sentiment</h4>
<img src="data:image/png;base64,{{ twitter_wordcloud_b64_neg_balanced }}" alt="Twitter WordCloud Negative Sentiment" />
<h4>WordCloud for Neutral Sentiment</h4>
<img src="data:image/png;base64,{{ twitter_wordcloud_b64_neu_balanced }}" alt="Twitter WordCloud Neutral Sentiment" />
<h4>WordCloud for Total Sentiment</h4>
<img src="data:image/png;base64,{{ twitter_wordcloud_b64_total_balanced }}" alt="Twitter WordCloud Total Sentiment" />
</div>
</div>
<footer>
<p>&copy; 2025 Sentiment Analysis App. All rights reserved.</p>
<div class="social-icons">
<a href="#" class="fab fa-instagram"></a>
<a href="#" class="fab fa-twitter"></a>
<a href="#" class="fab fa-linkedin"></a>
</div>
</footer>
<script>
function showWordCloud(sectionId) {
// Hide all sections
const sections = document.querySelectorAll('.visualization-section');
sections.forEach((section) => {
section.style.display = 'none';
});
// Show the selected section
const selectedSection = document.getElementById(sectionId);
selectedSection.style.display = 'block';
}
</script>
</body>
</html>