Spaces:
Running
Running
File size: 4,595 Bytes
260255b | 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 | document.addEventListener('DOMContentLoaded', function() {
// Bar Chart
const barCtx = document.getElementById('barChart').getContext('2d');
new Chart(barCtx, {
type: 'bar',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
datasets: [{
label: 'Sales',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'rgba(59, 130, 246, 0.7)',
borderColor: 'rgba(59, 130, 246, 1)',
borderWidth: 1,
borderRadius: 6
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true
}
},
plugins: {
legend: {
display: false
},
tooltip: {
backgroundColor: 'rgba(0, 0, 0, 0.8)',
titleFont: {
size: 14
},
bodyFont: {
size: 12
}
}
}
}
});
// Line Chart
const lineCtx = document.getElementById('lineChart').getContext('2d');
new Chart(lineCtx, {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
datasets: [{
label: 'Active Users',
data: [100, 150, 230, 280, 350, 420],
fill: true,
backgroundColor: 'rgba(168, 85, 247, 0.1)',
borderColor: 'rgba(168, 85, 247, 1)',
borderWidth: 2,
tension: 0.3,
pointBackgroundColor: 'rgba(168, 85, 247, 1)',
pointRadius: 4,
pointHoverRadius: 6
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true
}
},
plugins: {
legend: {
display: false
}
}
}
});
// Pie Chart
const pieCtx = document.getElementById('pieChart').getContext('2d');
new Chart(pieCtx, {
type: 'doughnut',
data: {
labels: ['Product A', 'Product B', 'Product C', 'Product D'],
datasets: [{
data: [30, 25, 20, 25],
backgroundColor: [
'rgba(16, 185, 129, 0.7)',
'rgba(59, 130, 246, 0.7)',
'rgba(245, 158, 11, 0.7)',
'rgba(236, 72, 153, 0.7)'
],
borderColor: [
'rgba(16, 185, 129, 1)',
'rgba(59, 130, 246, 1)',
'rgba(245, 158, 11, 1)',
'rgba(236, 72, 153, 1)'
],
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'right',
labels: {
boxWidth: 12,
padding: 16
}
}
},
cutout: '70%'
}
});
// Radar Chart
const radarCtx = document.getElementById('radarChart').getContext('2d');
new Chart(radarCtx, {
type: 'radar',
data: {
labels: ['Design', 'Development', 'Marketing', 'Sales', 'Support', 'Innovation'],
datasets: [{
label: 'Team Skills',
data: [85, 90, 70, 80, 75, 95],
backgroundColor: 'rgba(249, 115, 22, 0.2)',
borderColor: 'rgba(249, 115, 22, 1)',
borderWidth: 2,
pointBackgroundColor: 'rgba(249, 115, 22, 1)',
pointRadius: 4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
r: {
angleLines: {
display: true,
color: 'rgba(0, 0, 0, 0.1)'
},
suggestedMin: 0,
suggestedMax: 100
}
},
plugins: {
legend: {
display: false
}
}
}
});
}); |