SuperFly - 2007-01-07

Logged In: YES
user_id=1679730
Originator: YES

Using big numbers, and having great interval between minX and maxX I have great delay generating graphic, about 20-30 seconds. The problem is in _averageY(). It tries to go through all values in interval, Maybe it's correct for function, but stepX makes it hard. But for Trivial function you can define function which counts average easier, something like this:
function _averageY() {
$first = NULL;
$second = 0;

$count = 0;
$total = 0;
foreach ($this->_data as $key => $value) {
if ($second === NULL) {
$second = $key;
} else {
$first = $second;
$second = $key;
$total += ($second - $first)*($this->_getPointY($second) + $this->_getPointY($fisrst))/2;
$count += ($second - $first);
}
}

if ($count != 0) {
return $total / $count;
} else {
return false;
}
}