Archive for November 22nd, 2010

Google charts API – PHP Goodie for calculation of extended code

Montag, November 22nd, 2010

If you want to use googles faboulous Chart API, and dont want to use javascript to calculate the extended code, try this useful php snippet [php light="true"] $EXTENDED_MAP= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.'; $EXTENDED_MAP_LENGTH = strlen($EXTENDED_MAP); $maxVal = 150; //your max value $chartData = "e:"; for($i=0; $i < (sizeof($array));$i++) { $scaledVal = floor($EXTENDED_MAP_LENGTH * $EXTENDED_MAP_LENGTH * $array[$i]/$maxVal); ...