This repository was archived by the owner on Feb 27, 2022. It is now read-only.
forked from rposborne/webstatsx
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcharts.php
More file actions
executable file
·79 lines (74 loc) · 1.72 KB
/
Copy pathcharts.php
File metadata and controls
executable file
·79 lines (74 loc) · 1.72 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
include 'stats_web_core/classes.php';
$player = new stats_player(htmlentities($_GET['p'], ENT_QUOTES, 'UTF-8'));
?>
var all_kills_data = [
<?php
$all_kills = $player->get_all_kills();
echo '{ label: "'.$all_kills[0][0].'", data: '.$all_kills[0][1].'}'; unset($all_kills[0]);
foreach($all_kills as $kill){
echo ',{ label: "'.$kill[0].'", data: '.$kill[1].'}';
}
?>
];
var all_deaths_data = [
<?php
$all_deaths = $player->get_all_deaths();
echo '{ label: "'.$all_deaths[0][0].'", data: '.$all_deaths[0][1].'}'; unset($all_deaths[0]);
foreach($all_deaths as $death){
echo ',{ label: "'.$death[0].'", data: '.$death[1].'}';
}
?>
];
if($("#piechart_kills").length)
{
$.plot($("#piechart_kills"), all_kills_data,
{
series: {
pie: {
show: true
}
},
grid: {
hoverable: true,
clickable: true
},
legend: {
show: false
}
});
function pieHover(event, pos, obj)
{
if (!obj)
return;
percent = parseFloat(obj.series.percent).toFixed(2);
$("#hover").html('<span style="font-weight: bold; color: '+obj.series.color+'">'+obj.series.label+' ('+percent+'%)</span>');
}
$("#piechart").bind("plothover", pieHover);
}
if($("#piechart_deaths").length)
{
$.plot($("#piechart_deaths"), all_deaths_data,
{
series: {
pie: {
show: true
}
},
grid: {
hoverable: true,
clickable: true
},
legend: {
show: false
}
});
function pieHover(event, pos, obj)
{
if (!obj)
return;
percent = parseFloat(obj.series.percent).toFixed(2);
$("#hover").html('<span style="font-weight: bold; color: '+obj.series.color+'">'+obj.series.label+' ('+percent+'%)</span>');
}
$("#piechart").bind("plothover", pieHover);
}