Skip to content

Commit

Permalink
Fixed issue #7208: Large list questions cause charts to break in stat…
Browse files Browse the repository at this point in the history
…istics
  • Loading branch information
c-schmitz committed Jan 22, 2013
1 parent a5cb66b commit ee5a821
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion application/helpers/admin/statistics_helper.php
Expand Up @@ -68,7 +68,29 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw
}
}

if (array_sum($gdata) > 0) //Make sure that the percentages add up to more than 0
if (count($lbl)>72)
{
$DataSet = array(1=>array(1=>1));
if ($cache->IsInCache("graph".$language.$iSurveyID,$DataSet))
{
$cachefilename=basename($cache->GetFileFromCache("graph".$language.$iSurveyID,$DataSet));
}
else
{
$graph = new pChart(690,200);
$graph->loadColorPalette($homedir.DIRECTORY_SEPARATOR.'styles'.DIRECTORY_SEPARATOR.$admintheme.DIRECTORY_SEPARATOR.'limesurvey.pal');
$graph->setFontProperties($rootdir.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$chartfontfile,$chartfontsize);
$graph->setFontProperties($rootdir.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$chartfontfile,$chartfontsize);
$graph->drawTitle(0,0,$clang->gT('Sorry, but this question has too many answer options to be shown properly in a graph.','unescaped'),30,30,30,690,200);
$cache->WriteToCache("graph".$language.$iSurveyID,$DataSet,$graph);
$cachefilename=basename($cache->GetFileFromCache("graph".$language.$iSurveyID,$DataSet));
unset($graph);
}

return $cachefilename;
}

if (array_sum($gdata ) > 0) //Make sure that the percentages add up to more than 0
{
$graph = "";
$p1 = "";
Expand Down

0 comments on commit ee5a821

Please sign in to comment.