aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/www/messagebus.js
blob: e30508b8796196f522fbf8400175e8dea7860b29 (plain) (blame)
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
function logTransform(v) {
    return Math.log(v + 1);
}

function plotHist(where, hist) {
    var max = hist.map(function(x) {return x[1]}).reduce(function(x, y) {return Math.max(x, y)});

    var ticks = [];
    for (var t = 1; ; t *= 10) {
        if (t > max) {
            break;
        }
        ticks.push(t);
    }

    $.plot(where, [hist],
        {
            data: hist,
            series: {
                bars: {
                    show: true,
                    barWidth: 0.9
                }
            },
            xaxis: {
                mode: 'categories',
                tickLength: 0
            },
            yaxis: {
                ticks: ticks,
                transform: logTransform
            }
        }
    );
}

function plotQueueSize(where, data, ticks) {
    $.plot(where, [data],
        {
            xaxis: {
                ticks: ticks,
            },
            yaxis: {
                //transform: logTransform
            }
        }
    );
}