Skip to content

Commit

Permalink
Refs #197: Try to fix the duplicate ID error
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Pichler committed May 21, 2015
1 parent bc2dc89 commit 2221f74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/php/PDepend/Report/Jdepend/Chart.php
Expand Up @@ -150,10 +150,16 @@ public function close()
$svg = new \DOMDocument('1.0', 'UTF-8');
$svg->load(dirname(__FILE__) . '/chart.svg');

$bad = $svg->getElementById('jdepend.bad');
$good = $svg->getElementById('jdepend.good');
$layer = $svg->getElementById('jdepend.layer');

$bad = $svg->getElementById('jdepend.bad');
$bad->removeAttribute('xml:id');

$good = $svg->getElementById('jdepend.good');
$good->removeAttribute('xml:id');

$legendTemplate = $svg->getElementById('jdepend.legend');
$legendTemplate->removeAttribute('xml:id');

$max = 0;
$min = 0;
Expand Down Expand Up @@ -211,7 +217,6 @@ public function close()

$transform = "matrix({$a}, 0, 0, {$a}, {$e}, {$f})";

$ellipse->removeAttribute('xml:id');
$ellipse->setAttribute('id', uniqid('pdepend_'));
$ellipse->setAttribute('title', $item['name']);
$ellipse->setAttribute('transform', $transform);
Expand All @@ -222,7 +227,6 @@ public function close()
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];
Expand Down

0 comments on commit 2221f74

Please sign in to comment.