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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// peity
NETDATA.peityInitialize = function (callback) {
if (typeof netdataNoPeitys === 'undefined' || !netdataNoPeitys) {
$.ajax({
url: NETDATA.peity_js,
cache: true,
dataType: "script",
xhrFields: {withCredentials: true} // required for the cookie
})
.done(function () {
NETDATA.registerChartLibrary('peity', NETDATA.peity_js);
})
.fail(function () {
NETDATA.chartLibraries.peity.enabled = false;
NETDATA.error(100, NETDATA.peity_js);
})
.always(function () {
if (typeof callback === "function") {
return callback();
}
});
} else {
NETDATA.chartLibraries.peity.enabled = false;
if (typeof callback === "function") {
return callback();
}
}
};
NETDATA.peityChartUpdate = function (state, data) {
state.peity_instance.innerHTML = data.result;
if (state.peity_options.stroke !== state.chartCustomColors()[0]) {
state.peity_options.stroke = state.chartCustomColors()[0];
if (state.chart.chart_type === 'line') {
state.peity_options.fill = NETDATA.themes.current.background;
} else {
state.peity_options.fill = NETDATA.colorLuminance(state.chartCustomColors()[0], NETDATA.chartDefaults.fill_luminance);
}
}
$(state.peity_instance).peity('line', state.peity_options);
return true;
};
NETDATA.peityChartCreate = function (state, data) {
state.peity_instance = document.createElement('div');
state.element_chart.appendChild(state.peity_instance);
state.peity_options = {
stroke: NETDATA.themes.current.foreground,
strokeWidth: NETDATA.dataAttribute(state.element, 'peity-strokewidth', 1),
width: state.chartWidth(),
height: state.chartHeight(),
fill: NETDATA.themes.current.foreground
};
NETDATA.peityChartUpdate(state, data);
return true;
};
|