Skip to content

Commit

Permalink
Merge pull request #101 from Trismegiste/package_name_for_chart_svg
Browse files Browse the repository at this point in the history
Package name for chart svg
  • Loading branch information
manuelpichler committed Oct 11, 2012
2 parents 0234a45 + 14209f3 commit 479aaa5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/php/PHP/Depend/Log/Jdepend/Chart.php
Expand Up @@ -163,6 +163,7 @@ public function close()
$bad = $svg->getElementById('jdepend.bad');
$good = $svg->getElementById('jdepend.good');
$layer = $svg->getElementById('jdepend.layer');
$legendTemplate = $svg->getElementById('jdepend.legend');

$max = 0;
$min = 0;
Expand Down Expand Up @@ -227,10 +228,23 @@ public function close()
$ellipse->setAttribute('transform', $transform);

$layer->appendChild($ellipse);

$result = preg_match('#\\\\([^\\\\]+)$#', $item['name'], $found);
if ($result && count($found)) {
$angle = rand(0, 314) / 100 - 1.57;
$legend = $legendTemplate->cloneNode(true);
$legend->removeAttribute('xml:id');
$legend->setAttribute('x', $e + $r * (1 + cos($angle)));
$legend->setAttribute('y', $f + $r * (1 + sin($angle)));
$legend->nodeValue = $found[1];
$legendTemplate->parentNode->appendChild($legend);
}

}

$bad->parentNode->removeChild($bad);
$good->parentNode->removeChild($good);
$legendTemplate->parentNode->removeChild($legendTemplate);

$temp = PHP_Depend_Util_FileUtil::getSysTempDir();
$temp .= '/' . uniqid('pdepend_') . '.svg';
Expand Down
8 changes: 8 additions & 0 deletions src/main/php/PHP/Depend/Log/Jdepend/chart.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 479aaa5

Please sign in to comment.