89 $optionAnswers = array();
92 $answerValues = regroupList(
$answers,
"value");
97 $count = count($answerValues[$idx]);
108 $count = count($answerValues[$idx]);
109 $optionAnswers[] =
$count;
113 $percent = number_format(100 * (
$count / $total), 1);
114 $legends[] = trim($option) .
" ( $percent% )";
118 $legends[] = trim($option);
126 $pie =
new PieChart(
"results_$question_id", 650, 400, $optionAnswers, $legends,
"standard");
127 $pie->setRadius(150);
128 $pie->setCenter(180,180);
129 $pie->setLabelSize(12);
130 $pie->setStrokeWidth(2);
131 $pie->showLegend(
true, 375, 20);
132 $pie->shadow =
false;
156 $optionAnswers = array();
158 $optionText = QuestionnaireResultsGraph::getOptionText(
$question->options);
159 $steps = count($optionText);
161 for($idx = 1; $idx <= $steps; ++$idx)
165 $totalValue += $idx * $counts[$idx];
166 $totalCount += $counts[$idx];
167 $datay[] = $counts[$idx] ? $counts[$idx] : 0;
168 $datax[] = $optionText[$idx];
173 $graph =
new Histogram(
"histogram_$question_id", count($datax) * 80 + 100, 400, 50, 10, count($datax) * 80, 300,
"standard");
174 $graph->setLabels($datax);
176 $graph->columnMargin = 0.4;
198 $answerValues = regroupList(
$answers,
"value");
202 $optionAnswers = array();
204 $optionText = QuestionnaireResultsGraph::getRatingsOptionText(
$question->options);
205 $steps = count($optionText);
207 for($idx = 1; $idx <= $steps; ++$idx)
211 $counts[$idx] = count($answerValues[$idx]);
212 $totalValue += $idx * $counts[$idx];
213 $totalCount += $counts[$idx];
214 $datay[] = $counts[$idx];
215 $datax[] = $optionText[$idx];
218 $mean =
"Average: ".number_format($totalValue / $totalCount, 1);
221 $graph =
new Histogram(
"histogram_$question_id", count($datax) * 80 + 100, 400, 50, 10, count($datax) * 80, 300,
"standard");
222 $graph->setLabels($datax);
224 $graph->columnMargin = 0.4;
245 echo
"<p><em>Survey Graphs are not available</em></p>";
271 echo
"<p><em>Survey Graphs are not available</em></p>";
298 echo
"<p><em>Survey Graphs are not available</em></p>";
313 private static function getRatingsOptionText(
$options)
315 $optionText = array();
319 if (!
$to)
$to =
"Highest";
320 if (!$steps) $steps = 5;
322 for($idx = 1; $idx <= $steps; ++$idx)
324 if($idx > 1 AND $idx < $steps)
325 $optionText[$idx] = $idx;
327 $optionText[$idx] = ($idx == 1) ? jsSafe(trim(
$from)) : jsSafe(trim(
$to));
333 private static function getOptionText(
$options)
335 $optionText = array();
342 $optionText[$idx++] = jsSafe(wordwrap(trim(stripHTML($option)), 12));
static using()
Import the datamodels, views and manifest for the specified component(s).
static getCheckListAnswerCounts($answers)
Draws a graph of the aggregated answers for a given question.
static drawSelectResults($surveyField, $qField, $survey_id, $question_id)
Deprecated - call drawGraph from question renderer.
static drawChecklistGraph($question, $resultsManager, $answers)
Draws an interactive graphical view of answers to one question.
static drawRatingResults($surveyField, $qField, $survey_id, $question_id)
Deprecated - call drawGraph from question renderer.
static drawSelectGraph($question, $resultsManager, $answers)
Draws an interactive graphical view of answers to one question.
static drawChecklistResults($surveyField, $qField, $survey_id, $question_id)
Deprecated - call drawGraph from question renderer.
static drawRatingsGraph($question, $resultsManager, $answers)
Draws an interactive graphical view of answers to one question.