forked from Technigo/project-github-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtechnigoChart.js
More file actions
40 lines (37 loc) · 944 Bytes
/
technigoChart.js
File metadata and controls
40 lines (37 loc) · 944 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
//DOM-selector for the canvas 👇
import { Chart, registerables } from "chart.js";
Chart.register(...registerables);
export default function makeChart(completedProjects, chartId) {
const ctx = document.getElementById(chartId).getContext("2d");
const myChart = new Chart(ctx, {
type: "bar",
data: {
labels: ["completed", "total"],
datasets: [
{
label: "Technigo spring 2022",
data: [completedProjects, 19],
backgroundColor: ["#358E89", "#D66882"],
// borderColor: ["#404756"],
borderWidth: 1,
},
],
},
options: {
indexAxis: "y",
responsive: true,
plugins: {
title: {
display: true,
position: "bottom",
text: "Technigo spring 2022",
},
legend: {
display: false,
position: "bottom",
},
},
},
});
}
//"Draw" the chart here 👇