-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
42 lines (41 loc) · 972 Bytes
/
Copy pathscript.js
File metadata and controls
42 lines (41 loc) · 972 Bytes
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
const ctx = document.getElementById('pieChart').getContext('2d');
new Chart(ctx, {
type: 'pie',
data: {
labels: ['Books', 'Courses', 'Consulting', 'Hosting', 'Themes', 'Plugins'],
datasets: [
{
label: 'Sales Share',
data: [32, 54, 18, 41, 27, 46],
backgroundColor: [
'rgba(255, 99, 132, 0.7)',
'rgba(54, 162, 235, 0.7)',
'rgba(255, 206, 86, 0.7)',
'rgba(75, 192, 192, 0.7)',
'rgba(153, 102, 255, 0.7)',
'rgba(255, 159, 64, 0.7)',
],
borderColor: '#fff',
borderWidth: 1,
},
],
},
options: {
responsive: true,
plugins: {
legend: {
position: 'right',
},
title: {
display: true,
text: 'Sales Distribution',
},
tooltip: {
callbacks: {
label: (context) =>
`${context.label}: ${context.formattedValue} units`,
},
},
},
},
});