As the source code isn't editable by me, I'll use the "submit issue" for
some suggestions. Especially my first suggestion will dramatically improve
rendering speed (for large csv files by a full second on slow server).
1. Line 3018. The count function will be executed for every loop cycle.
This means, for a csv file with 300 lines, each line a label and 3 date
points, the count function will be executed 135450 times. Simply putting
the count outside the for-loop will do the trick.
for($i = 0; $i <= count($Plots) - 4; $i += 2) {
// do some stuff
}
will be
$Count = count($Plots);
for($i = 0; $i <= $count - 4; $i += 2) {
// do some stuff
}
2. Seriously consider changing all the usings of floor into typecasting
with (int)$variable .
For example, line 4399. Also a rewrite of the if else a few lines beneath.
So line 4398-4422 could be changed to:
$Plot = array();
$Xi = (int)$X;
$Yi = (int)$Y;
if ( $Xi == $X && $Yi == $Y)
{
// ..
}
else
{
$xdiff = ($X - $Xi);
$ydiff = ($Y - $Yi);
$Alpha1 = (((1 - $xdiff) * (1 - $ydiff) * 100) / 100) * $Alpha;
if ( $Alpha1 > $this->AntialiasQuality ) { $this->drawAlphaPixel
($Xi,$Yi,$Alpha1,$R,$G,$B); }
$Alpha2 = (($xdiff * (1 - $ydiff) * 100) / 100) * $Alpha;
if ( $Alpha2 > $this->AntialiasQuality ) { $this->drawAlphaPixel
($Xi+1,$Yi,$Alpha2,$R,$G,$B); }
$Alpha3 = (((1 - $xdiff) * $ydiff * 100) / 100) * $Alpha;
if ( $Alpha3 > $this->AntialiasQuality ) { $this->drawAlphaPixel
($Xi,$Yi+1,$Alpha3,$R,$G,$B); }
$Alpha4 = (($xdiff * $ydiff * 100) / 100) * $Alpha;
if ( $Alpha4 > $this->AntialiasQuality ) { $this->drawAlphaPixel
($Xi+1,$Yi+1,$Alpha4,$R,$G,$B); }
}
}
Love MTChart, keep up the good work!
-afraca
Original issue reported on code.google.com by harkemas...@gmail.com on 22 Oct 2009 at 3:24
Original issue reported on code.google.com by
harkemas...@gmail.com
on 22 Oct 2009 at 3:24