diff --git a/fill_survey/survey_analysis.php b/fill_survey/survey_analysis.php index 929d867abe2..0e724610af5 100644 --- a/fill_survey/survey_analysis.php +++ b/fill_survey/survey_analysis.php @@ -231,7 +231,7 @@ function calculate_pie_chart_data_by_question_category($interpretationdata, $que $pieChartLabels = []; foreach ($interpretationCounts as $interpretation => $count) { - $percentage = (1 / count($interpretationCounts)) * 100; + $percentage = ($count / array_sum($interpretationCounts)) * 100; $pieChartData[] = number_format($percentage, 1); $pieChartLabels[] = $interpretation; }