function getEvent()

in src/html_files/perf_stat.ts [106:162]


function getEvent(elem, key, run_data, run) {
    var data = JSON.parse(run_data);
    var perfstat_datas = [];
    data.data[0].cpus.forEach(function (value, index, arr) {
        var cpu_stat = new StatValue();
        cpu_stat.cpu = value.cpu;
        cpu_stat.x_time = [];
        cpu_stat.y_data = [];
        perfstat_datas.push(cpu_stat);
    });
    data.data.forEach(function (value, index, arr) {
        value.cpus.forEach(function (stat, i_index, i_arr) {
            addData(perfstat_datas, stat, value.time.TimeDiff);
        })
    });
    var TESTER = elem;
    var end_datas = [];
    perfstat_datas.forEach(function (value, index, arr) {
        var cpu_string = "";
        let cpu = value.cpu.toString();
        if (value.cpu > -1) {
            cpu_string = `CPU ${value.cpu}`;
        }
        else {
            cpu_string = `Aggregate`;
        }
        var perfstat_line: Partial<Plotly.PlotData> = {
            name: cpu_string,
            x: value.x_time,
            y: value.y_data,
            type: 'scatter',
        };
        if (cpu_string == 'Aggregate') {
            if (!perf_cpu_list.get(run).all_selected) {
                perfstat_line.visible = 'legendonly';
            }
            end_datas.unshift(perfstat_line);
        } else {
            if (perf_cpu_list.get(run).cpulist.indexOf(cpu) == -1) {
                perfstat_line.visible = 'legendonly';
            }
            end_datas.push(perfstat_line);
        }
    })
    let limits = key_limits.get(key);
    var layout = {
        title: `${key}`,
        xaxis: {
            title: 'Time (s)',
        },
        yaxis: {
            title: 'Count',
            range: [limits.low, limits.high],
        },
    }
    Plotly.newPlot(TESTER, end_datas, layout, { frameMargins: 0 });
}