Closed (duplicate)
Project:
Charts
Version:
6.x-1.0-alpha6
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
24 Feb 2010 at 10:02 UTC
Updated:
14 Oct 2010 at 13:03 UTC
If all values from an array are 0 ,will have error divide by 0...example here
array(
array('#value' => $eu1,'#label' => t('A')), //value $eu1 is 0
array('#value' => $eu3,'#label' => t('B')), //value $eu3 is 0
array('#value' => $eu5,'#label' => t('C')), //value $eu5 is 0
array('#value' => $eu7,'#label' => t('D')), //value $eu7 is 0
),
So , I use this before this code :
if(($eu1+$eu3+$eu5+$eu7)== 0)
{
$eunull = 1;
}
else
{
$eunull = 0;
}
An I add this line to first group of code :
array(
array('#value' => $eu1,'#label' => t('A')), //value $eu1 is 0
array('#value' => $eu3,'#label' => t('B')), //value $eu3 is 0
array('#value' => $eu5,'#label' => t('C')), //value $eu5 is 0
array('#value' => $eu7,'#label' => t('D')), //value $eu7 is 0
array('#value' => $eunull), // in this line value for $eunull will be set to 1 if all values $eu1+$eu3+$eu5+$eu7 == 0
),
Scuse me for my english
Comments
Comment #1
apaatsio commentedDoes this have anything to do with #912084: Division by zero ?
Comment #2
kenorb commented#941460: Graphs with all 0 (zero) results cause php warnings around division by zero