diff --git a/app/(main)/dashboard/page.tsx b/app/(main)/dashboard/page.tsx index 79077b3..71689a0 100644 --- a/app/(main)/dashboard/page.tsx +++ b/app/(main)/dashboard/page.tsx @@ -16,63 +16,66 @@ const Dashboard = () => { const textColor = documentStyle.getPropertyValue('--text-color'); const textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary'); - const [chartOptions, setChartOptions] = useState({}); + const [chartOptions, setChartOptions] = useState({}); const [topicSkillStats, setTopicSkillStats] = useState(); + const [top10SkillNames, settop10SkillNames] = useState([]); const { layoutConfig } = useContext(LayoutContext); const appMsg = useRef(null); useEffect(() => { const chartOptions = { + indexAxis: 'y', maintainAspectRatio: false, - aspectRatio: 0.8, + aspectRatio: 1, plugins: { - tooltips: { - mode: 'index', - intersect: false - }, legend: { labels: { - color: textColor + fontColor: textColor } } }, scales: { x: { - stacked: false, ticks: { - color: textColorSecondary + color: textColorSecondary, + font: { + weight: 500 + } }, grid: { - color: surfaceBorder + display: false, + drawBorder: false } }, y: { - stacked: false, ticks: { color: textColorSecondary }, grid: { - color: surfaceBorder + color: surfaceBorder, + drawBorder: false } } } }; setChartOptions(chartOptions); - }, []); + }, [textColor, textColorSecondary, surfaceBorder]); useEffect(() => { StatisticService.getTopicSkillStatistics(0, 10).then((statsResponse) => { let topicSkillStat = statsResponse.data; let chartLabels: string[] = []; + let top10FullNames: string[] = []; let totalAttempts: number[] = []; let correctAnswers: number[] = []; //labels //array of data set topicSkillStat.map((item) => { - chartLabels.push(item.topicName + ' - ' + item.skillName); + top10FullNames.push(item.topicName + ' - ' + item.skillName); + chartLabels.push(item.skillName.substring(0, 20)); totalAttempts.push(item.cntAttempt); correctAnswers.push(item.cntCorrectAnswer); }); @@ -97,6 +100,7 @@ const Dashboard = () => { } ] }; + settop10SkillNames(top10FullNames); setTopicSkillStats(chartData); }); }, []); @@ -124,8 +128,11 @@ const Dashboard = () => {
-
Worst performed topics-skills
+
Top 10 Topics/Skill for Improvement
+ { + top10SkillNames.map((skill, i) =>

{i+1}. {skill}

) + }