use of org.olat.core.gui.components.chart.BarSeries.Stringuified in project openolat by klemens.
the class QTI21AssessmentTestStatisticsController method initScoreStatisticPerItem.
/**
* The 2 graphs with the score per questions and right answers per questions.
*
* @param numOfParticipants The number of participants
*/
private void initScoreStatisticPerItem(double numOfParticipants) {
BarSeries d1 = new BarSeries();
BarSeries d2 = new BarSeries();
List<AssessmentItemStatistic> statisticItems = qtiStatisticsManager.getStatisticPerItem(resourceResult.getResolvedAssessmentTest(), resourceResult.getSearchParams(), numOfParticipants);
int i = 0;
List<ItemInfos> itemInfos = new ArrayList<>(statisticItems.size());
for (AssessmentItemStatistic statisticItem : statisticItems) {
AssessmentItem item = statisticItem.getAssessmentItem();
String label = Integer.toString(++i);
String text = item.getTitle();
d1.add(statisticItem.getAverageScore(), label);
d2.add(statisticItem.getNumOfCorrectAnswers(), label);
itemInfos.add(new ItemInfos(label, text));
}
mainVC.contextPut("itemInfoList", itemInfos);
VelocityContainer averageScorePeritemVC = createVelocityContainer("hbar_average_score_per_item");
Stringuified data1 = BarSeries.getDatasAndColors(Collections.singletonList(d1), "bar_default");
averageScorePeritemVC.contextPut("datas", data1);
mainVC.put("averageScorePerItemChart", averageScorePeritemVC);
VelocityContainer percentRightAnswersPerItemVC = createVelocityContainer("hbar_right_answer_per_item");
Stringuified data2 = BarSeries.getDatasAndColors(Collections.singletonList(d2), "bar_green");
percentRightAnswersPerItemVC.contextPut("datas", data2);
percentRightAnswersPerItemVC.contextPut("numOfParticipants", Long.toString(Math.round(numOfParticipants)));
mainVC.put("percentRightAnswersPerItemChart", percentRightAnswersPerItemVC);
}
Aggregations