aboutsummaryrefslogtreecommitdiffstats
path: root/uiframe-iui/src/main/resources/webroot/vendor/ict/ict-chart/demo/demo-barchart-c3.js
blob: d568044592cab46faa8e6746b71e609610e30160 (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
var AlarmCount_BarChart_C3 = function (placeholdeC3) {

    var callbackList = [];
    var callback = function (data) {
        if (data.index !== undefined) {
            var severity = data.index + 1;
            window.open(
                "/web/res/web-framework/default.html?showNav=false&severity="
                + severity + "#uep-ict-fm-currentAlarm", "fm_portlet_page_title"
                + severity, "");
        }
    }
    callbackList.push(callback);

    $.ajax({
        async: false,
        "dataType": "json",
        "type": "GET",
        "url": "/web/rest/web/fm/count/total",
        "data": null,
        "Content-Type": "application/json; charset=utf-8",
        "success": function (json, textStatus, jqXHR) {
            var alarmcount = json;
            var inputData = [];
            for (var i = 0; i < alarmcount.ackedCount.length; i++) {
                inputData.push(alarmcount.unAckedCount[i] + alarmcount.ackedCount[i]);
            }
            ICT_Bar_Chart_C3(placeholdeC3, inputData, callbackList);
        },
        "error": function () {
        }
    });

}