From 713b01f0fb0e5e108889068ef4ebdd7d5d1f9383 Mon Sep 17 00:00:00 2001 From: Xiaohuan Date: Fri, 1 Jul 2022 13:17:33 -0700 Subject: [PATCH] updated line data --- .../HomePage/HomeGraphs/LineGraph.js | 43 +++++++------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/components/HomePage/HomeGraphs/LineGraph.js b/src/components/HomePage/HomeGraphs/LineGraph.js index 550a5ff..44b49be 100644 --- a/src/components/HomePage/HomeGraphs/LineGraph.js +++ b/src/components/HomePage/HomeGraphs/LineGraph.js @@ -132,6 +132,7 @@ export default function Line() { if (graph === 'totalTime' && selection === 'subject') { + setInput([]); const subjectTeam = {}; timeAndLangFiltered.forEach(problem => { const sub = problem.topics; @@ -163,7 +164,10 @@ if (graph === 'totalTime' && selection === 'subject') { //temp['stack']='Total'; temp['data'] = []; for (let value in updateFormate[key]) { - temp['data'].push([value, updateFormate[key][value]]); + var data=[]; + data.push(value); + data.push(updateFormate[key][value]); + temp['data'].push(data); } finalResult.push(temp); } @@ -198,7 +202,7 @@ if (graph === 'totalTime' && selection === 'difficulty') { updateFormate[key]=temp; } - const finalResult = []; + const finalResultD = []; for (let key in updateFormate) { const temp = {}; temp['name'] = key; @@ -206,16 +210,20 @@ if (graph === 'totalTime' && selection === 'difficulty') { //temp['stack']='Total'; temp['data'] = []; for (let value in updateFormate[key]) { - temp['data'].push(value, updateFormate[key][value]); + var data=[]; + data.push(value); + data.push(updateFormate[key][value]); + temp['data'].push(data); } - finalResult.push(temp); + finalResultD.push(temp); } const containerD = []; - for (let i=0; i