Ver código fonte

treemap limit 42

master
MEUNIER Thibaud 1 ano atrás
pai
commit
3c198659e8
1 arquivos alterados com 18 adições e 0 exclusões
  1. +18
    -0
      methode/treemap/inc/treemap.php

+ 18
- 0
methode/treemap/inc/treemap.php Ver arquivo

@ -27,6 +27,11 @@ function hex2rgb($color){
return $rgb;
}
function tri($a, $b) {
if ($a['value'] == $b['value']) return 0;
return ($a['value'] < $b['value']) ? 1 : -1;
}
class topisto_treemap
{
private static function getRGB($methode, $gradient, $factor)
@ -75,6 +80,19 @@ class topisto_treemap
$data = blockchain::getTransactionData($the_block, $type);
usort($data, 'tri');
$n=0;
$i=count($data)-1;
while($i>41) $n+=$data[$i--]['value'];
$n=intval(round(($n * 1.0) / count($data)));
$data = array_slice($data, 0, 42);
$data[] = ["hash" => "0000000000000000000000000000000000000000000000000000000000000000", "value" => $n];
usort($data, 'tri');
$vBgColor = imagecolorallocate($vImage, 10, 10, 10);
imagefilledrectangle($vImage, $x, $y, $x+$width, $y+$height, $vBgColor);

Carregando…
Cancelar
Salvar