1<?php 2declare(strict_types=1); 3 4$id = 'google-chart-' . bin2hex(random_bytes(8)); 5?> 6 7<?= view('statistics/other/chart-setup') ?> 8 9<div id="<?= $id ?>" title="<?= $chart_title ?>"></div> 10 11<script> 12 13var callbackColumnChart = function () { 14 var options = { 15 title: '<?= $chart_title ?? '' ?>', 16 subtitle: '<?= $chart_sub_title ?? '' ?>', 17 vAxis: { 18 title: '<?= $vAxis_title ?? '' ?>' 19 }, 20 hAxis: { 21 title: '<?= $hAxis_title ?? '' ?>' 22 }, 23 colors: <?= json_encode($colors) ?> 24 }; 25 26 google.charts.setOnLoadCallback(function () { 27 drawColumnChart( 28 '<?= $id ?>', 29 <?= json_encode($data) ?>, 30 options 31 ); 32 }); 33 34 $(window).resize(function () { 35 drawColumnChart( 36 '<?= $id ?>', 37 <?= json_encode($data) ?>, 38 options 39 ); 40 }); 41}; 42 43if ( 44 document.readyState === "complete" || 45 (document.readyState !== "loading" && !document.documentElement.doScroll) 46) { 47 callbackColumnChart(); 48} else { 49 document.addEventListener("DOMContentLoaded", callbackColumnChart); 50} 51 52</script> 53