FaZeranajit's picture
create an interactive data for this data
8954cb6 verified
Raw History Blame Contribute Delete
11.9 kB
document.addEventListener('DOMContentLoaded', function() {
// Initialize members
const members = [
{ name: "Surajit", role: "Project Lead" },
{ name: "Sahil", role: "Data Analyst" },
{ name: "Emmanual", role: "Researcher" },
{ name: "Ranajit", role: "Developer" }
];
// Render members
const membersContainer = document.getElementById('members-container');
renderMembers();
function renderMembers() {
membersContainer.innerHTML = '';
members.forEach(member => {
const memberHTML = `
<div class="member-card">
<img src="http://static.photos/people/200x200/${members.indexOf(member)+1}" alt="${member.name}">
<h3>${member.name}</h3>
<p>${member.role}</p>
</div>
`;
membersContainer.insertAdjacentHTML('beforeend', memberHTML);
});
}
// Shuffle members
document.getElementById('shuffle-members').addEventListener('click', function() {
members.sort(() => Math.random() - 0.5);
renderMembers();
});
// Initialize data visualizations
initVisualizations();
function initVisualizations() {
// Employment Growth Chart
const employmentCtx = document.createElement('canvas');
employmentCtx.id = 'employmentChart';
document.querySelector('main').insertBefore(employmentCtx, document.getElementById('members-container').parentNode.nextSibling);
new Chart(employmentCtx, {
type: 'line',
data: {
labels: ['1950', '1960', '1970', '1980', '1990', '2000', '2010', '2020'],
datasets: [{
label: 'Tertiary Sector Employment (%)',
data: [20, 25, 32, 38, 42, 48, 55, 63],
borderColor: 'rgba(79, 70, 229, 1)',
backgroundColor: 'rgba(79, 70, 229, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: {
responsive: true,
plugins: {
title: {
display: true,
text: 'Growth of Tertiary Sector Employment (1950-2020)'
}
}
}
});
// Digital Divide Chart
const digitalDivideCtx = document.getElementById('digitalDivideChart').getContext('2d');
new Chart(digitalDivideCtx, {
type: 'radar',
data: {
labels: ['Infrastructure', 'Affordability', 'Skills', 'Usage', 'Quality'],
datasets: [
{
label: 'Developed Countries',
data: [90, 85, 88, 92, 87],
backgroundColor: 'rgba(79, 70, 229, 0.2)',
borderColor: 'rgba(79, 70, 229, 1)',
borderWidth: 2,
pointBackgroundColor: 'rgba(79, 70, 229, 1)'
},
{
label: 'Developing Countries',
data: [45, 50, 40, 55, 35],
backgroundColor: 'rgba(236, 72, 153, 0.2)',
borderColor: 'rgba(236, 72, 153, 1)',
borderWidth: 2,
pointBackgroundColor: 'rgba(236, 72, 153, 1)'
}
]
},
options: {
responsive: true,
scales: {
r: {
angleLines: {
display: true
},
suggestedMin: 0,
suggestedMax: 100
}
}
}
});
// Tourism Chart
const tourismCtx = document.getElementById('tourismChart').getContext('2d');
new Chart(tourismCtx, {
type: 'bar',
data: {
labels: ['Jaipur', 'Mediterranean', 'Mountain Resorts', 'Historic Towns'],
datasets: [{
label: 'Annual Visitors (millions)',
data: [1.2, 45, 12, 8.5],
backgroundColor: [
'rgba(79, 70, 229, 0.7)',
'rgba(99, 102, 241, 0.7)',
'rgba(129, 140, 248, 0.7)',
'rgba(165, 180, 252, 0.7)'
],
borderColor: [
'rgba(79, 70, 229, 1)',
'rgba(99, 102, 241, 1)',
'rgba(129, 140, 248, 1)',
'rgba(165, 180, 252, 1)'
],
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true
}
}
}
});
// Sector Employment Chart
const sectorCtx = document.getElementById('sectorChart').getContext('2d');
new Chart(sectorCtx, {
type: 'doughnut',
data: {
labels: ['Tertiary', 'Primary', 'Secondary', 'Quaternary', 'Quinary'],
datasets: [{
data: [45, 20, 25, 7, 3],
backgroundColor: [
'rgba(79, 70, 229, 0.7)',
'rgba(16, 185, 129, 0.7)',
'rgba(245, 158, 11, 0.7)',
'rgba(236, 72, 153, 0.7)',
'rgba(20, 184, 166, 0.7)'
],
hoverOffset: 4
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'right',
}
}
}
});
}
// Activity card click handlers
document.querySelectorAll('.activity-card').forEach(card => {
card.addEventListener('click', function() {
const category = this.getAttribute('data-category');
showDetailPanel(category);
});
});
// Close detail panel
document.getElementById('close-detail').addEventListener('click', function() {
document.getElementById('detail-panel').classList.remove('show');
});
function showDetailPanel(category) {
const detailPanel = document.getElementById('detail-panel');
const detailContent = document.getElementById('detail-content');
let content = '';
switch(category) {
case 'tourism':
content = `
<h2 class="text-2xl font-bold text-indigo-700 mb-4">Tourism</h2>
<p class="mb-4">Tourism is travel undertaken for purposes of recreation rather than business. It has become the world's single largest tertiary activity in total registered jobs (250 million) and total revenue (40% of the total GDP).</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-4">
<div>
<h3 class="font-semibold text-lg mb-2">Popular Destinations</h3>
<ul class="list-disc pl-5 space-y-1">
<li>Jaipur, India (November–February)</li>
<li>Mediterranean Coast</li>
<li>Mountain resorts for winter sports</li>
</ul>
</div>
<div>
<h3 class="font-semibold text-lg mb-2">Tourist Attractions</h3>
<ul class="list-disc pl-5 space-y-1">
<li>Climate</li>
<li>Landscape</li>
<li>History and Art</li>
<li>Culture and Economy</li>
</ul>
</div>
</div>
`;
break;
case 'medical':
content = `
<h2 class="text-2xl font-bold text-indigo-700 mb-4">Medical Tourism in India</h2>
<p class="mb-4">India has emerged as the leading country of medical tourism in the world. World class hospitals located in metropolitan cities cater to patients all over the world.</p>
<div class="mb-4">
<h3 class="font-semibold text-lg mb-2">Key Statistics</h3>
<p>About 55,000 patients from U.S.A. visited India in 2005 for treatment.</p>
</div>
<div>
<h3 class="font-semibold text-lg mb-2">Benefits</h3>
<ul class="list-disc pl-5 space-y-1">
<li>Cost-effective treatments</li>
<li>High-quality medical care</li>
<li>Reduced waiting times</li>
<li>Opportunity to combine treatment with tourism</li>
</ul>
</div>
`;
break;
case 'quaternary':
content = `
<h2 class="text-2xl font-bold text-indigo-700 mb-4">Quaternary Activities</h2>
<p class="mb-4">Quaternary activities involve the collection, production and dissemination of information or even the production of information. These activities center around research, development and may be seen as an advanced form of services involving specialised knowledge and technical skills.</p>
<div>
<h3 class="font-semibold text-lg mb-2">Examples</h3>
<ul class="list-disc pl-5 space-y-1">
<li>Information technology services</li>
<li>Research and development</li>
<li>Financial planning services</li>
<li>Consulting services</li>
</ul>
</div>
`;
break;
case 'quinary':
content = `
<h2 class="text-2xl font-bold text-indigo-700 mb-4">Quinary Activities</h2>
<p class="mb-4">These are the activities that are highly specific and specialized. They include high level decision-makers, administrators, government officials, research scientists, etc. They are also known as gold collar professions.</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 class="font-semibold text-lg mb-2">Outsourcing</h3>
<p>It means contracting out or giving work to an outside agency to improve efficiency and to reduce cost. It is termed as offshoring when work is transferred to overseas location.</p>
</div>
<div>
<h3 class="font-semibold text-lg mb-2">BPO & KPO</h3>
<p>BPO stands for Business Process Outsourcing while KPO stands for Knowledge Process Outsourcing which involves skilled workers and enables companies to create additional business opportunities.</p>
</div>
</div>
`;
break;
}
detailContent.innerHTML = content;
detailPanel.classList.add('show');
feather.replace();
}
});