Pie diagrams

More
1 year 3 months ago #138093 by jano
jano created the topic: Pie diagrams
Hello!

I have a question on pie diagrams and this may not be the best forum but i think it's a deveopment issue. When in a report(PDF) using a pie diagram and there are 5 choices. The colors doesn't have the same value, an example follows.

Diagram 1)
1 10-answers
2 10-anwsers
3 20-anwsers
4 25-anwsers
5 30-anwsers
The colors choosed are 1-Blue, 2-Red, 3-lightGreen, 4-Yellow, 5-Green-Blue

The next question is:
1 0-answers
2 0-anwsers
3 0-anwsers
4 30-anwsers
5 45-anwsers
The colors choosed are 4-Blue, 5-Red

From Diagram 1 you learn that blue and green are low values i.e. a bad result. When you look at diagram 2 you think such a terrible result. I know there is a legend telling the scale of colors but... The great thing of pies are that you can show them to inexperienced people and they understand fast.

It would be really nice if it's was possible to tell limesurvey to allways show colours in legend so a value is allways represented by a color. And maybe there is way to patch or an addon or a value in a config file. If not it would be nice to know where in the code where it's possible to patch it.

Please Log in to join the conversation.

More
1 year 3 months ago #138111 by jano
jano replied the topic: Pie diagrams
Ok, a bit closer, think i have found the code, it's in limesurvey/application/helpers/admin/statistics_helper.php from line 228 and forward

//Pie Chart
else
{
// this block is to remove the items with value == 0
// and an inelegant way to remove comments from List with Comments questions
$i = 0;
$j = 0;
$labelTmp = array();
while (isset ($gdata[$i]))
{
$aHelperArray=array_keys($lbl);
if ($gdata[$i] == 0 || ($sQuestionType == "O" && substr($aHelperArray[$i],0,strlen(gT("Comments")))==gT("Comments")))
{
array_splice ($gdata, $i, 1);
}
else
{
$i++;
$labelTmp = $labelTmp + array_slice($lbl, $j, 1, true); // Preserve numeric keys for the labels!
}
$j++;
}

If anyone has some knowledege to solve it.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now