Server IP : 80.241.246.6 / Your IP : 216.73.216.188 Web Server : Apache/2.4.25 (Debian) System : Linux kharagauli 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64 User : www-data ( 33) PHP Version : 7.0.33-0+deb9u12 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/kharagauli_new/admin/view/templates_1/ |
Upload File : |
<?php /** * file chart * * @author suxoza */ header("Content-type: text/html; Charset=utf-8"); session_start(); mb_internal_encoding("UTF-8"); error_reporting(E_ALL); date_default_timezone_set("Asia/Tbilisi"); try{ if(!isset($_GET['id'])) throw new Exception("Error Processing Request", 1); set_include_path( get_include_path() .PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT'].'/clases' .PATH_SEPARATOR.str_replace('/admin','',$_SERVER['DOCUMENT_ROOT']).'/Smarty' .PATH_SEPARATOR.str_replace('/admin','',$_SERVER['DOCUMENT_ROOT']).'/cls' ); function class_loader($class){ require_once $class.'.php'; } spl_autoload_register('class_loader'); $_ = new Central; $id = (int)$_GET['id']; $select = $_->select_(["*","question_answers","new_big",["question_id",$id]]); if(!$select) throw new Exception("Error Processing Request", 1); $final = []; $sum = 0; for($i = 0; $i < count($select); $i++){ $final[$i]['name'] = $select[$i]['answer_'.$_->_lang]; $final[$i]['y'] = $select[$i]['choosed']; $sum += $select[$i]['choosed']; } }catch(Exception $e){ die($e->getMessage()); } ?> <!DOCTYPE html> <html> <head> <title></title> <script src="/bower_components/jquery/dist/jquery.min.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/modules/exporting.js"></script> <script> $(function () { Highcharts.getOptions().plotOptions.pie.colors = (function () { var colors = [], base = Highcharts.getOptions().colors[0], i; for (i = 0; i < 10; i += 1) { colors.push(Highcharts.Color(base).brighten((i - 3) / 7).get()); } return colors; }()); $('#container').highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, type: 'pie' }, title: { text: 'გამოკითხვის შედეგები, სულ: <?php echo $sum;?> ხმა' }, tooltip: { pointFormat: '{point.percentage:.1f}%</b>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '<b>{point.name}</b>: {point.percentage:.1f} %', style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' } } } }, series: [{ name: "Brands", data: [ <?php for($i = 0; $i < count($final); $i++):?> {name: '<?php echo $final[$i]["name"];?>', y: <?php echo $final[$i]["y"];?>}<?php echo ($i < (count($final)-1))?',':'';?> <?php endfor;?> ] }] }); }); </script> </head> <body style="background:#fff"> <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div> </body> </html>