mondrian limit at 42

This commit is contained in:
2024-01-29 19:55:12 +01:00
parent 5d8263bcc1
commit 65dc8f2002
29 changed files with 1141 additions and 1506 deletions
+17
View File
@@ -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);