summaryrefslogtreecommitdiffstats
path: root/web/gui/src/dashboard.js/charting/_raphael.js
blob: 2d89a22a85cb8435827580ea4d7e11254648465c (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
43
44
45
46
47
48
// DEPRECATED: will be removed!

// raphael

NETDATA.raphaelInitialize = function(callback) {
    if (typeof netdataStopRaphael === 'undefined' || !netdataStopRaphael) {
        $.ajax({
            url: NETDATA.raphael_js,
            cache: true,
            dataType: "script",
            xhrFields: { withCredentials: true } // required for the cookie
        })
        .done(function() {
            NETDATA.registerChartLibrary('raphael', NETDATA.raphael_js);
        })
        .fail(function() {
            NETDATA.chartLibraries.raphael.enabled = false;
            NETDATA.error(100, NETDATA.raphael_js);
        })
        .always(function() {
            if (typeof callback === "function")
                return callback();
        });
    } else {
        NETDATA.chartLibraries.raphael.enabled = false;
        if (typeof callback === "function")
            return callback();
    }
};

NETDATA.raphaelChartUpdate = function(state, data) {
    $(state.element_chart).raphael(data.result, {
        width: state.chartWidth(),
        height: state.chartHeight()
    });

    return false;
};

NETDATA.raphaelChartCreate = function(state, data) {
    $(state.element_chart).raphael(data.result, {
        width: state.chartWidth(),
        height: state.chartHeight()
    });

    return false;
};