beginning with getting data
This commit is contained in:
@@ -1,5 +1,30 @@
|
|||||||
//For now create dummy data to show on the website.
|
//For now create dummy data to show on the website.
|
||||||
let dummydata1 = [40, 30, 20];
|
let awa;
|
||||||
|
|
||||||
|
data();
|
||||||
|
|
||||||
|
|
||||||
|
async function data(){
|
||||||
|
fetch("http://145.92.8.114/getQuestionData")
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Network response was not ok');
|
||||||
|
}
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log(data);
|
||||||
|
let Q1Array = data.filter(item => item.Question_QuestionID == 1);
|
||||||
|
console.log(Q1Array);
|
||||||
|
let R1Array = Q1Array.filter(item => item.Result == 0);
|
||||||
|
awa = R1Array.length;
|
||||||
|
graph()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
// for each(Result == 0) in
|
||||||
|
async function graph() {
|
||||||
|
let dummydata1 = [awa, 3, 5];
|
||||||
let questionOptionsDummy1 = ['disgusting','clean', 'fine'];
|
let questionOptionsDummy1 = ['disgusting','clean', 'fine'];
|
||||||
|
|
||||||
let dummydata2 = [25, 35, 40];
|
let dummydata2 = [25, 35, 40];
|
||||||
@@ -52,3 +77,4 @@ const myChart4 = new Chart(ctx4, chartConfigArray[3].chartConfig);
|
|||||||
|
|
||||||
const ctx5 = document.getElementById('chart5').getContext('2d');
|
const ctx5 = document.getElementById('chart5').getContext('2d');
|
||||||
const myChart5 = new Chart(ctx5, chartConfigArray[4].chartConfig);
|
const myChart5 = new Chart(ctx5, chartConfigArray[4].chartConfig);
|
||||||
|
}
|
Reference in New Issue
Block a user