Generate aggregated survey results
In addition to the Survey JS builder you can use our Survey API to display the results in a neat design. You can either use charts or tables to show the survey outcome to the participants. The code below is sufficient to get a proper graph illustrating the results.
Simply get the survey result API, define the possible answers and create the graph by stating the name of the variable, the stepgroup, the stepgrouploop and the possible answers. Keep in mind that there are different functions for different variable contexts.
$surveyResult = $api->get('sophielabs_surveyresult'); $answerOptions = array('classroom', 'research', 'both'); echo $surveyResult->pieChartForChoicePSL('rating', 'main', '*', $answerOptions);
The outcome for the code above is shown in the screenshot below.
The procedure to get a tabular visualization is fairly similar as shown below.
$surveyResult = $api->get('sophielabs_surveyresult'); echo $surveyResult->tableForOpenendedPSL('input', 'main', '*');