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

    //取得数据系列的名称
    var seriesNames = [];
    $.ajax({
        async: false,
        dataType: "json",
        "type": "GET",
        url: "/web/rest/web/dm/dashboard/selfcpu/queryValues",
        "data": JSON.stringify(data),
        contentType: "application/json; charset=utf-8",
        "success": function (data) {
            seriesNames.push(data.deviceLabels[0]);
        }
    });

    var colors = ["#fc4400", '#5ab1ef', '#b6a2de'];
    var c3Line = ICT_Line_C3(placeholderC3, seriesNames, colors);

    var data = {};

    window.setInterval(function () {

        var newSeriesData = [];

        $.ajax({
            dataType: "json",
            "type": "GET",
            url: "/web/rest/web/dm/dashboard/selfcpu/queryValues",
            "data": JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            "success": function (data) {
                newSeriesData.push({name: data.deviceLabels[0], value: data.cpuUseRatios[0]});
                c3Line.setC3Data(newSeriesData);
            }
        });

    }, 3 * 1000);

}