DayZ-Stat-Server/GraphPlayer.php

48 lines
1.2 KiB
PHP
Raw Normal View History

2021-01-31 13:16:02 +01:00
<?php
2021-02-04 18:00:02 +01:00
ini_set('display_errors', 'on');
2021-01-31 18:56:08 +01:00
2021-01-31 13:16:02 +01:00
include('./consql.php');
include_once('config.php');
2021-01-31 18:56:08 +01:00
// MYSQL table
2021-02-04 18:00:02 +01:00
// $StatServer = "StatServer_20"; // set in consql.php
2021-01-31 18:56:08 +01:00
2021-02-04 18:00:02 +01:00
$queryP = "SELECT date, players FROM ".$StatServer." ORDER BY id DESC LIMIT 80";
$arrPlay = $con->query($queryP);
2021-01-31 13:16:02 +01:00
?>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
2021-01-31 18:56:08 +01:00
2021-01-31 13:16:02 +01:00
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.css">
2021-01-31 18:56:08 +01:00
<script src="morris/morris.js"></script>
2021-01-31 13:16:02 +01:00
<link rel="stylesheet" href="morris/morris.css">
</head>
2021-01-31 18:56:08 +01:00
<body>
2021-01-31 21:12:51 +01:00
<h3> Players on <?php echo $namemap ;?></h3>
2021-02-04 18:00:02 +01:00
2021-01-31 13:16:02 +01:00
<div id="graph32"></div>
<script>
2021-02-04 18:00:02 +01:00
var day_data = [<?php while($row = mysqli_fetch_assoc($arrPlay)){ echo "{'Date': '".$row["date"]."', 'Players': ".$row["players"]."}, "; } ?> ];
2021-01-31 13:16:02 +01:00
Morris.Line({
element: 'graph32',
data: day_data,
xkey: 'Date',
ykeys: ['Players'],
labels: ['Players on <?php echo $namemap ;?>'],
yLabelFormat: function(y){return y != Math.round(y)?'':y;},
grid: false,
//ymin: 0,
//parseTime: false,
hideHover:'auto'
});
</script>
</body>
2021-01-31 18:56:08 +01:00