Conditions | 4 |
Paths | 8 |
Total Lines | 27 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function render($flags = null) |
||
22 | { |
||
23 | $dom = new DOMDocument(); |
||
24 | |||
25 | // Render canvas HTML element |
||
26 | $canvas = $dom->createElement('canvas'); |
||
27 | $canvas->setAttribute('id', $this->chart->getId()); |
||
28 | |||
29 | // Add title, height and width if applicable |
||
30 | if ($this->chart->getTitle()) { |
||
31 | $canvas->setAttribute('title', $this->chart->getTitle()); |
||
32 | } |
||
33 | if ($this->chart->getHeight()) { |
||
34 | $canvas->setAttribute('height', $this->chart->getHeight()); |
||
35 | } |
||
36 | if ($this->chart->getWidth()) { |
||
37 | $canvas->setAttribute('width', $this->chart->getWidth()); |
||
38 | } |
||
39 | |||
40 | $dom->appendChild($canvas); |
||
41 | |||
42 | // Render JavaScript |
||
43 | $scriptRenderer = new JavaScript($this->chart); |
||
44 | $script = $dom->createElement('script', $scriptRenderer->render($flags)); |
||
45 | $dom->appendChild($script); |
||
46 | |||
47 | return $dom->saveHTML(); |
||
48 | } |
||
50 |