When displaying and working with statistical data, sometimes outliers can make the rest of your data almost invisible on certain types of line and bar charts.
I created a very quick and simple function in PHP to "clip" values that are above a certain number of times the average value of a data set:
function limitSpikes($d,$ceiling=4){ // Limits extreme values in a 1D array to no more than a ceiling multipler of the average value. $avg = ceil(array_sum($d) / count($d)); foreach($d as $i => $v){ $d[$i] = ($v > ($avg * $ceiling)) ? ($avg * $ceiling) : $v; } return $d; }
Although it is quite basic, it does the job for line charts quite nicely.