forked from pluginsGLPI/mreporting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
67 lines (57 loc) · 1.67 KB
/
test.php
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
<?php
define('GLPI_ROOT', '../..');
include (GLPI_ROOT."/inc/includes.php");
commonHeader(__("More Reporting", 'mreporting'), '' ,"plugins", "hreporting");
?>
<link href="lib/protovis/examples/ex.css" rel="stylesheet" type="text/css">
<script src="lib/protovis/protovis.min.js" type="text/javascript"></script>
<script src="lib/protovis/examples/crimea/crimea.js" type="text/javascript"></script>
<style type="text/css">
#fig {
width: 600px;
height: 300px;
}
</style>
<div class="center"><div id="fig">
<script type="text/javascript+protovis">
var w = 545,
h = 280,
x = pv.Scale.ordinal(crimea, function(d) d.date).splitBanded(0, w, 4 / 5),
y = pv.Scale.linear(0, 1500).range(0, h),
k = x.range().band / causes.length,
format = pv.Format.date("%b");
var vis = new pv.Panel()
.width(w)
.height(h)
.margin(19.5)
.right(40);
var panel = vis.add(pv.Panel)
.data(crimea)
.left(function(d) x(d.date))
.width(x.range().band);
panel.add(pv.Bar)
.data(causes)
.bottom(0)
.width(k)
.left(function() this.index * k)
.height(function(t, d) y(d[t]))
.fillStyle(pv.colors("lightpink", "darkgray", "lightblue"))
.strokeStyle(function() this.fillStyle().darker())
.lineWidth(1);
panel.anchor("bottom").add(pv.Label)
.visible(function() !(this.parent.index % 3))
.textBaseline("top")
.textMargin(5)
.text(function(d) format(d.date));
vis.add(pv.Rule)
.data(y.ticks())
.bottom(y)
.strokeStyle(function(i) i ? "rgba(255, 255, 255, .5)" : "black")
.anchor("right").add(pv.Label)
.visible(function() !(this.index & 1))
.textMargin(6);
vis.render();
</script>
</div></div>
<?php
commonFooter();