-
Notifications
You must be signed in to change notification settings - Fork 0
/
graf3.js
42 lines (40 loc) · 1.14 KB
/
graf3.js
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 data = {
labels: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio'],
datasets: [{
label: 'Dados de vendas Breitling',
data: [870, 760, 1023, 920, 940],
backgroundColor: [
' rgba(232, 236, 6, 0.644)',
' rgba(232, 236, 6, 0.644)',
' rgba(232, 236, 6, 0.644)',
' rgba(232, 236, 6, 0.644)',
' rgba(232, 236, 6, 0.644)',
],
borderColor: [
' rgba(232, 236, 6, 0.644)',
' rgba(232, 236, 6, 0.644),',
' rgba(232, 236, 6, 0.644)',
' rgba(232, 236, 6, 0.644),',
' rgba(232, 236, 6, 0.644)',
],
borderWidth: 1
}]
};
// Opções para o gráfico
const options = {
scales: {
y: {
beginAtZero: true
}
}
};
// Criando o gráfico
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'bar',
data: data,
options: options
});
function qs(selector, all = false) {
return all ? document.querySelectorAll(selector) : document.querySelector(selector)
}