mondrian limit at 42
This commit is contained in:
@@ -4,6 +4,11 @@ use codeagent\treemap\Treemap;
|
||||
use codeagent\treemap\presenter\ImagePresenter;
|
||||
use codeagent\treemap\presenter\NodeInfo;
|
||||
|
||||
function tri($a, $b) {
|
||||
if ($a['value'] == $b['value']) return 0;
|
||||
return ($a['value'] < $b['value']) ? 1 : -1;
|
||||
}
|
||||
|
||||
function DrawBlock($the_block, $vImage, $parametres)
|
||||
{
|
||||
$type = 1;
|
||||
@@ -30,6 +35,18 @@ function DrawBlock($the_block, $vImage, $parametres)
|
||||
|
||||
$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, 41);
|
||||
$data[] = ["hash" => "0000000000000000000000000000000000000000000000000000000000000000", "value" => $n];
|
||||
|
||||
usort($data, 'tri');
|
||||
|
||||
$treemap = new Treemap($data, $width, $height);
|
||||
$map = $treemap->getMap();
|
||||
$m = count($map);
|
||||
|
||||
Reference in New Issue
Block a user