소스 검색

treemap limit 42

master
MEUNIER Thibaud 1 년 전
부모
커밋
3c198659e8
1개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. +18
    -0
      methode/treemap/inc/treemap.php

+ 18
- 0
methode/treemap/inc/treemap.php 파일 보기

@ -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);

불러오는 중...
취소
저장