1<?php 2declare(strict_types=1); 3 4use Fisharebest\Webtrees\I18N; 5 6$id = 'google-chart-' . bin2hex(random_bytes(8)); 7?> 8 9<?php if (count($data) === 1): ?> 10 <?= I18N::translate('This information is not available.') ?> 11<?php else: ?> 12 13 <?= view('statistics/other/chart-setup') ?> 14 15 <div id="<?= $id ?>" title="<?= $chart_title ?? '' ?>"></div> 16 17 <script> 18 19 var callbackColumnChart = function () { 20 google.charts.setOnLoadCallback(function () { 21 drawColumnChart( 22 '<?= $id ?>', 23 <?= json_encode($data) ?>, 24 <?= json_encode($chart_options) ?> 25 ); 26 }); 27 28 $(window).resize(function () { 29 drawColumnChart( 30 '<?= $id ?>', 31 <?= json_encode($data) ?>, 32 <?= json_encode($chart_options) ?> 33 ); 34 }); 35 }; 36 37 if ( 38 document.readyState === "complete" || 39 (document.readyState !== "loading" && !document.documentElement.doScroll) 40 ) { 41 callbackColumnChart(); 42 } else { 43 document.addEventListener("DOMContentLoaded", callbackColumnChart); 44 } 45 46 </script> 47<?php endif; ?> 48