-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
chart.phtml
63 lines (49 loc) · 1.76 KB
/
chart.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* This file is part of the package magicsunday/webtrees-pedigree-chart.
*
* For the full copyright and license information, please read the
* LICENSE file distributed with this source code.
*/
declare(strict_types=1);
use Fisharebest\Webtrees\View;
use MagicSunday\Webtrees\PedigreeChart\Configuration;
/**
* @var string $javascript
* @var Configuration $configuration
* @var array $id The unique chart ID
* @var array $chartParams
* @var string[] $exportStylesheets A list of stylesheets used by SVG export
* @var array $data The chart data
*/
?>
<div class="webtrees-pedigree-chart-container" id="webtrees-pedigree-chart-container-<?= $id ?>"></div>
<?php View::push('javascript'); ?>
<script src="<?= e($javascript) ?>"></script>
<?php View::endpush(); ?>
<?php View::push('javascript'); ?>
<script>
// Create chart instance
new WebtreesPedigreeChart.PedigreeChart(
"#webtrees-pedigree-chart-container-<?= $id ?>",
{
labels: <?= json_encode($chartParams['labels']) ?>,
rtl: <?= json_encode($chartParams['rtl']) ?>,
cssFiles: <?= json_encode($exportStylesheets) ?>,
get generations() {
return generations ?? <?= $configuration->getGenerations() ?>
},
get showEmptyBoxes() {
return showEmptyBoxes ?? <?= json_encode($configuration->getShowEmptyBoxes()) ?>;
},
get treeLayout() {
return treeLayout ?? <?= json_encode($configuration->getLayout()) ?>;
},
get openNewTabOnClick() {
return openNewTabOnClick ?? <?= json_encode($configuration->getOpenNewTabOnClick()) ?>;
},
data: <?= json_encode($data) ?>
}
);
</script>
<?php View::endpush(); ?>