From 88c03748f7955dc08ec6a70360fcf45e7f8922b8 Mon Sep 17 00:00:00 2001 From: Charlotte Nyman <85078175+Svempolin@users.noreply.github.com> Date: Mon, 27 Sep 2021 16:24:42 +0200 Subject: [PATCH 1/7] done first part --- code/chart.js | 21 ++++++++++++++++++++- code/index.html | 35 ++++++++++++++++++----------------- code/script.js | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 18 deletions(-) diff --git a/code/chart.js b/code/chart.js index 92e85a30..e8702263 100644 --- a/code/chart.js +++ b/code/chart.js @@ -1,4 +1,23 @@ //DOM-selector for the canvas 👇 -const ctx = document.getElementById('chart').getContext('2d') +const ctx = document.getElementById("chart").getContext("2d"); //"Draw" the chart here 👇 + +const drawChart = (amount) => { + const config = { + type: "doughnut", + data: { + labels: ["projects let", "done"], + datasets: [ + { + label: "My First Dataset", + data: [amount, 19 - amount], + backgroundColor: ["rgb(255, 99, 132)", "rgb(54, 162, 235)"], + hoverOffset: 4, + }, + ], + }, + }; + + const myChart = new Chart(ctx, config); +}; diff --git a/code/index.html b/code/index.html index 2fb5e0ae..2abe238b 100644 --- a/code/index.html +++ b/code/index.html @@ -1,21 +1,22 @@ -
- - - -