Created
January 22, 2024 17:17
-
-
Save eunicekokor/65bed078742e94de491b8c881e542fe6 to your computer and use it in GitHub Desktop.
Chart JS bars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { | |
type: 'scatter', | |
data: data, | |
options: { | |
scales: { | |
y: { | |
beginAtZero: true | |
}, | |
x: { | |
type: 'time', | |
min: new Date('2019-01-01').valueOf(), | |
max: new Date('2019-12-31').valueOf() | |
} | |
} | |
} | |
}; | |
const data = { | |
labels: [ | |
'December', | |
'January', | |
'February', | |
'March', | |
'April' | |
], | |
datasets: [{ | |
type: 'bar', | |
label: 'Bar Dataset', | |
data: [{x: new Date('2024-01-20T04:34:31.742Z'), y: 10}, {x: new Date('2023-01-19T04:34:31.742Z'), y: 40}], | |
borderColor: 'rgb(255, 99, 132)', | |
backgroundColor: 'rgba(255, 99, 132, 0.2)' | |
}, { | |
type: 'line', | |
label: 'Line Dataset', | |
data: [{x: new Date('2024-01-20T04:34:31.742Z'), y: 10}, {x: new Date('2023-01-19T04:34:31.742Z'), y: 40}], | |
fill: false, | |
borderColor: 'rgb(54, 162, 235)' | |
}] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment