File: graph.html

package info (click to toggle)
0ad 0.0.21-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 54,068 kB
  • sloc: cpp: 230,527; ansic: 23,115; python: 13,559; perl: 2,499; sh: 948; xml: 776; makefile: 696; java: 533; ruby: 229; erlang: 53; sql: 21
file content (61 lines) | stat: -rw-r--r-- 1,770 bytes parent folder | download | duplicates (5)
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
<!DOCTYPE html>
<script src="jquery.js"></script>
<script src="jquery.flot.js"></script>
<script src="jquery.flot.navigate.js"></script>
<script src="data.js"></script>
<script>
var newGraphData = [];
for (var i = 0; i < graphData.length; ++i) {
    var d = graphData[i];

    if (d.label == "allocated bytes" || d.label == "max nominal heap bytes" || d.label == "max JS_malloc bytes")
        d.yaxis = 2;

    // Uninteresting:
    if (d.label == "max nominal heap bytes" || d.label == "max JS_malloc bytes" || d.label == "number of GCs" || d.label == "allocated bytes")
        continue;

    // Bogus data:
    if (d.label == "unlogged")
        continue;

    newGraphData.push(d);
}

function showTooltip(x, y, contents) {
    $('<div id="tooltip">' + contents + '</div>').css( {
        position: 'absolute',
        top: y + 5,
        left: x + 5,
        border: '1px solid #fdd',
        padding: '2px',
        'background-color': '#fee',
        opacity: 0.80
    }).appendTo("body");
}

$(function () {
    $.plot($("#placeholder"), newGraphData, {
        grid: { hoverable: true },
        zoom: { interactive: true },
        pan: { interactive: true },
        legend: { position: "nw" }
    });

    $("#placeholder").bind("plothover", function (event, pos, item) {
        $("#tooltip").remove();
        if (item) {
            var x = item.datapoint[0].toFixed(2);
            var y = item.datapoint[1].toFixed(2);
            showTooltip(item.pageX, item.pageY, item.series.label + " at " + Math.round(x) + ": " + y);
        }
    });

});
</script>

<div id="placeholder" style="width:1100px; height:600px;"></div>
<p>x axis: turn number / 20
<p>y axis (left): time per frame / msecs
<p>y axis (right): bytes
<p>Drag to pan, mouse-wheel to zoom