summaryrefslogtreecommitdiff
path: root/query/chart_overhead_compare.js
blob: 290b15dd916b8c6d35a4791f15e04d56fd9c4e2a (plain)
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
function GrasChartOverheadCompare(args, panel)
{
    //save enables
    this.ids = args.block_ids;

    //input checking
    if (this.ids.length <= 1) throw gras_error_dialog(
        "GrasChartOverheadCompare",
        "Error making overhead compare chart.\n"+
        "Specify at least 2 blocks for this chart."
    );

    //make new chart
    this.chart = new google.visualization.PieChart(panel);

    this.title = "Overhead Comparison";
    this.default_width = GRAS_CHARTS_STD_WIDTH;
}

GrasChartOverheadCompare.prototype.update = function(point)
{
    var data_set = new Array();
    data_set.push(['Task', 'Percent']);
    $.each(this.ids, function(index, id)
    {
        if (id in point.blocks) //skip this ID if it didnt show up in the data
        {
            var percents = gras_extract_percent_times(point, id);
            data_set.push([id, percents['total']]);
        }
    });

    var data = google.visualization.arrayToDataTable(data_set)

    var options = {
        chartArea:{left:5,top:0,right:5,bottom:0,width:"100%",height:"100%"},
    };
    if (this.gc_resize) options.width = 50;
    if (this.gc_resize) options.height = 50;

    this.chart.draw(data, options);
};