use of org.olat.core.gui.components.chart.BarSeries in project OpenOLAT by OpenOLAT.
the class SeriesFactory method getFIB.
public Series getFIB(Item item) {
List<StatisticFIBOption> processedAnswers = qtiStatisticsManager.getStatisticAnswerOptionsFIB(item, resourceResult.getSearchParams());
boolean survey = QTIType.survey.equals(resourceResult.getType());
boolean singleCorrectScore = item.getQuestion().getSingleCorrectScore() > 0.0f;
int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
int i = 0;
String cssColor = survey ? "bar_default" : "bar_green";
String color = survey ? null : "green";
BarSeries d1 = new BarSeries(cssColor, color, null);
List<ResponseInfos> responseInfos = new ArrayList<>();
for (StatisticFIBOption entry : processedAnswers) {
String label = Integer.toString(++i);
String answerString = entry.getCorrectBlank();
d1.add(entry.getNumOfCorrect(), label, cssColor);
StringBuilder text = new StringBuilder();
text.append(answerString);
if (entry.getAlternatives().size() > 1) {
text.append(" [");
for (int j = 1; j < entry.getAlternatives().size(); j++) {
if (j > 1)
text.append(", ");
text.append(entry.getAlternatives().get(j));
}
text.append("]");
}
Float score = singleCorrectScore ? null : entry.getPoints();
responseInfos.add(new ResponseInfos(label, text.toString(), entry.getWrongAnswers(), score, true, survey, false));
}
List<BarSeries> serieList = Collections.singletonList(d1);
Series series = new Series(serieList, responseInfos, numOfParticipants, false);
series.setChartType(BAR_ANSWERED);
series.setItemCss(getCssClass(item));
return series;
}
use of org.olat.core.gui.components.chart.BarSeries in project OpenOLAT by OpenOLAT.
the class SeriesFactory method getKPrim.
public Series getKPrim(Item item) {
List<StatisticKPrimOption> statisticResponses = qtiStatisticsManager.getNumbersInKPrim(item, resourceResult.getSearchParams());
String mediaBaseURL = resourceResult.getMediaBaseURL();
boolean survey = QTIType.survey.equals(resourceResult.getType());
int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
int i = 0;
BarSeries d1 = new BarSeries("bar_green", "green", translate("answer.correct"));
BarSeries d2 = new BarSeries("bar_red", "red", translate("answer.false"));
BarSeries d3 = new BarSeries("bar_grey", "grey", translate("answer.noanswer"));
List<ResponseInfos> responseInfos = new ArrayList<>();
for (StatisticKPrimOption statisticResponse : statisticResponses) {
Response response = statisticResponse.getResponse();
boolean correct = response.isCorrect();
double right = statisticResponse.getNumOfCorrect();
double wrong = statisticResponse.getNumOfIncorrect();
double notanswered = numOfParticipants - right - wrong;
String label = Integer.toString(++i);
d1.add(right, label);
d2.add(wrong, label);
d3.add(notanswered, label);
String text = response.getContent().renderAsHtml(mediaBaseURL);
responseInfos.add(new ResponseInfos(label, text, null, correct, survey, true));
}
List<BarSeries> serieList = new ArrayList<>(3);
serieList.add(d1);
serieList.add(d2);
serieList.add(d3);
Series series = new Series(serieList, responseInfos, numOfParticipants, !survey);
series.setChartType(survey ? BAR_ANSWERED : BAR_CORRECT_WRONG_NOT);
series.setItemCss(getCssClass(item));
return series;
}
use of org.olat.core.gui.components.chart.BarSeries in project OpenOLAT by OpenOLAT.
the class SeriesFactory method getSingleChoice.
public Series getSingleChoice(Item item) {
List<StatisticChoiceOption> statisticResponses = qtiStatisticsManager.getNumOfAnswersPerSingleChoiceAnswerOption(item, resourceResult.getSearchParams());
String mediaBaseURL = resourceResult.getMediaBaseURL();
boolean survey = QTIType.survey.equals(resourceResult.getType());
int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
int i = 0;
long numOfResults = 0;
BarSeries d1 = new BarSeries();
List<ResponseInfos> responseInfos = new ArrayList<>();
for (StatisticChoiceOption statisticResponse : statisticResponses) {
Response response = statisticResponse.getResponse();
double ans_count = statisticResponse.getCount();
numOfResults += statisticResponse.getCount();
Float points;
String cssColor;
if (survey) {
points = null;
cssColor = "bar_default";
} else {
points = response.getPoints();
cssColor = response.isCorrect() ? "bar_green" : "bar_red";
}
String label = Integer.toString(++i);
d1.add(ans_count, label, cssColor);
String text = response.getContent().renderAsHtml(mediaBaseURL);
responseInfos.add(new ResponseInfos(label, text, points, response.isCorrect(), survey, false));
}
if (numOfResults != numOfParticipants) {
long notAnswered = numOfParticipants - numOfResults;
if (notAnswered > 0) {
String label = Integer.toString(++i);
String text = translate("user.not.answer");
responseInfos.add(new ResponseInfos(label, text, null, false, survey, false));
d1.add(notAnswered, label, "bar_grey");
}
}
List<BarSeries> serieList = Collections.singletonList(d1);
Series series = new Series(serieList, responseInfos, numOfParticipants, false);
series.setChartType(BAR_CORRECT);
series.setItemCss(getCssClass(item));
return series;
}
use of org.olat.core.gui.components.chart.BarSeries in project OpenOLAT by OpenOLAT.
the class QTI12AssessmentStatisticsController method initScoreStatisticPerItem.
private void initScoreStatisticPerItem(List<Item> items, double numOfParticipants) {
BarSeries d1 = new BarSeries();
BarSeries d2 = new BarSeries();
List<StatisticItem> statisticItems = qtiStatisticsManager.getStatisticPerItem(items, resourceResult.getSearchParams(), numOfParticipants);
int i = 0;
List<ItemInfos> itemInfos = new ArrayList<>(items.size());
for (StatisticItem statisticItem : statisticItems) {
Item item = statisticItem.getItem();
String label = Integer.toString(++i);
String text = item.getTitle();
d1.add(statisticItem.getAverageScore(), label);
double numOfRightAnswers = statisticItem.getNumOfCorrectAnswers();
double res = numOfRightAnswers;
d2.add(res, 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);
}
use of org.olat.core.gui.components.chart.BarSeries in project OpenOLAT by OpenOLAT.
the class HotspotInteractionStatisticsController method getSingleChoice.
private Series getSingleChoice(List<HotspotChoiceStatistics> statisticResponses) {
boolean survey = QTIType.survey.equals(resourceResult.getType());
int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
List<Identifier> correctAnswers = getCorrectResponses();
int i = 0;
long numOfResults = 0;
BarSeries d1 = new BarSeries();
List<ResponseInfos> responseInfos = new ArrayList<>();
for (HotspotChoiceStatistics statisticResponse : statisticResponses) {
HotspotChoice choice = statisticResponse.getChoice();
String text = getAnswerText(choice);
double ans_count = statisticResponse.getCount();
numOfResults += statisticResponse.getCount();
boolean correct = correctAnswers.contains(choice.getIdentifier());
Float points;
String cssColor;
if (survey) {
points = null;
cssColor = "bar_default";
} else {
Double mappedValue = CorrectResponsesUtil.getMappedValue(assessmentItem, interaction, choice);
if (mappedValue != null) {
points = mappedValue.floatValue();
} else {
points = correct ? 1.0f : 0.0f;
}
cssColor = correct ? "bar_green" : "bar_red";
}
String label = Integer.toString(++i);
d1.add(ans_count, label, cssColor);
responseInfos.add(new ResponseInfos(label, text, points, correct, survey, false));
}
if (numOfResults != numOfParticipants) {
long notAnswered = numOfParticipants - numOfResults;
if (notAnswered > 0) {
String label = Integer.toString(++i);
String text = translate("user.not.answer");
responseInfos.add(new ResponseInfos(label, text, null, false, survey, false));
d1.add(notAnswered, label, "bar_grey");
}
}
List<BarSeries> serieList = Collections.singletonList(d1);
Series series = new Series(serieList, responseInfos, numOfParticipants, false);
series.setChartType(SeriesFactory.BAR_CORRECT);
series.setItemCss("o_qti_scitem");
return series;
}
Aggregations