iobroker.ebus 3.3.4 → 3.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/admin/i18n/de/translations.json +21 -0
- package/admin/i18n/en/translations.json +21 -0
- package/admin/i18n/es/translations.json +21 -0
- package/admin/i18n/fr/translations.json +21 -0
- package/admin/i18n/it/translations.json +21 -0
- package/admin/i18n/nl/translations.json +21 -0
- package/admin/i18n/pl/translations.json +21 -0
- package/admin/i18n/pt/translations.json +21 -0
- package/admin/i18n/ru/translations.json +21 -0
- package/admin/i18n/uk/translations.json +21 -0
- package/admin/i18n/zh-cn/translations.json +21 -0
- package/io-package.json +28 -29
- package/package.json +27 -23
- package/.eslintrc.json +0 -35
- package/.releaseconfig.json +0 -3
- package/widgets/ebus/img/Prev_tplebus.png +0 -0
- package/widgets/ebus/lib/js/flot/jquery.canvaswrapper.js +0 -549
- package/widgets/ebus/lib/js/flot/jquery.colorhelpers.js +0 -199
- package/widgets/ebus/lib/js/flot/jquery.flot.axislabels.js +0 -212
- package/widgets/ebus/lib/js/flot/jquery.flot.browser.js +0 -98
- package/widgets/ebus/lib/js/flot/jquery.flot.categories.js +0 -202
- package/widgets/ebus/lib/js/flot/jquery.flot.composeImages.js +0 -330
- package/widgets/ebus/lib/js/flot/jquery.flot.crosshair.js +0 -202
- package/widgets/ebus/lib/js/flot/jquery.flot.drawSeries.js +0 -662
- package/widgets/ebus/lib/js/flot/jquery.flot.errorbars.js +0 -375
- package/widgets/ebus/lib/js/flot/jquery.flot.fillbetween.js +0 -254
- package/widgets/ebus/lib/js/flot/jquery.flot.flatdata.js +0 -47
- package/widgets/ebus/lib/js/flot/jquery.flot.hover.js +0 -361
- package/widgets/ebus/lib/js/flot/jquery.flot.image.js +0 -249
- package/widgets/ebus/lib/js/flot/jquery.flot.js +0 -2953
- package/widgets/ebus/lib/js/flot/jquery.flot.legend.js +0 -437
- package/widgets/ebus/lib/js/flot/jquery.flot.logaxis.js +0 -298
- package/widgets/ebus/lib/js/flot/jquery.flot.navigate.js +0 -834
- package/widgets/ebus/lib/js/flot/jquery.flot.pie.js +0 -794
- package/widgets/ebus/lib/js/flot/jquery.flot.resize.js +0 -60
- package/widgets/ebus/lib/js/flot/jquery.flot.saturated.js +0 -43
- package/widgets/ebus/lib/js/flot/jquery.flot.selection.js +0 -527
- package/widgets/ebus/lib/js/flot/jquery.flot.stack.js +0 -220
- package/widgets/ebus/lib/js/flot/jquery.flot.symbol.js +0 -98
- package/widgets/ebus/lib/js/flot/jquery.flot.threshold.js +0 -143
- package/widgets/ebus/lib/js/flot/jquery.flot.time.js +0 -586
- package/widgets/ebus/lib/js/flot/jquery.flot.touch.js +0 -320
- package/widgets/ebus/lib/js/flot/jquery.flot.touchNavigate.js +0 -360
- package/widgets/ebus/lib/js/flot/jquery.flot.uiConstants.js +0 -10
- package/widgets/ebus/lib/js/flot/jquery.js +0 -9473
- package/widgets/ebus/lib/js/lib/globalize.culture.en-US.js +0 -33
- package/widgets/ebus/lib/js/lib/globalize.js +0 -1601
- package/widgets/ebus/lib/js/lib/jquery.event.drag.js +0 -145
- package/widgets/ebus/lib/js/lib/jquery.mousewheel.js +0 -86
- package/widgets/ebus.html +0 -2395
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
/* Plugin for jQuery for working with colors.
|
|
2
|
-
*
|
|
3
|
-
* Version 1.1.
|
|
4
|
-
*
|
|
5
|
-
* Inspiration from jQuery color animation plugin by John Resig.
|
|
6
|
-
*
|
|
7
|
-
* Released under the MIT license by Ole Laursen, October 2009.
|
|
8
|
-
*
|
|
9
|
-
* Examples:
|
|
10
|
-
*
|
|
11
|
-
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()
|
|
12
|
-
* var c = $.color.extract($("#mydiv"), 'background-color');
|
|
13
|
-
* console.log(c.r, c.g, c.b, c.a);
|
|
14
|
-
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"
|
|
15
|
-
*
|
|
16
|
-
* Note that .scale() and .add() return the same modified object
|
|
17
|
-
* instead of making a new one.
|
|
18
|
-
*
|
|
19
|
-
* V. 1.1: Fix error handling so e.g. parsing an empty string does
|
|
20
|
-
* produce a color rather than just crashing.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
(function($) {
|
|
24
|
-
$.color = {};
|
|
25
|
-
|
|
26
|
-
// construct color object with some convenient chainable helpers
|
|
27
|
-
$.color.make = function (r, g, b, a) {
|
|
28
|
-
var o = {};
|
|
29
|
-
o.r = r || 0;
|
|
30
|
-
o.g = g || 0;
|
|
31
|
-
o.b = b || 0;
|
|
32
|
-
o.a = a != null ? a : 1;
|
|
33
|
-
|
|
34
|
-
o.add = function (c, d) {
|
|
35
|
-
for (var i = 0; i < c.length; ++i) {
|
|
36
|
-
o[c.charAt(i)] += d;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return o.normalize();
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
o.scale = function (c, f) {
|
|
43
|
-
for (var i = 0; i < c.length; ++i) {
|
|
44
|
-
o[c.charAt(i)] *= f;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return o.normalize();
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
o.toString = function () {
|
|
51
|
-
if (o.a >= 1.0) {
|
|
52
|
-
return "rgb(" + [o.r, o.g, o.b].join(",") + ")";
|
|
53
|
-
} else {
|
|
54
|
-
return "rgba(" + [o.r, o.g, o.b, o.a].join(",") + ")";
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
o.normalize = function () {
|
|
59
|
-
function clamp(min, value, max) {
|
|
60
|
-
return value < min ? min : (value > max ? max : value);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
o.r = clamp(0, parseInt(o.r), 255);
|
|
64
|
-
o.g = clamp(0, parseInt(o.g), 255);
|
|
65
|
-
o.b = clamp(0, parseInt(o.b), 255);
|
|
66
|
-
o.a = clamp(0, o.a, 1);
|
|
67
|
-
return o;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
o.clone = function () {
|
|
71
|
-
return $.color.make(o.r, o.b, o.g, o.a);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return o.normalize();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// extract CSS color property from element, going up in the DOM
|
|
78
|
-
// if it's "transparent"
|
|
79
|
-
$.color.extract = function (elem, css) {
|
|
80
|
-
var c;
|
|
81
|
-
|
|
82
|
-
do {
|
|
83
|
-
c = elem.css(css).toLowerCase();
|
|
84
|
-
// keep going until we find an element that has color, or
|
|
85
|
-
// we hit the body or root (have no parent)
|
|
86
|
-
if (c !== '' && c !== 'transparent') {
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
elem = elem.parent();
|
|
91
|
-
} while (elem.length && !$.nodeName(elem.get(0), "body"));
|
|
92
|
-
|
|
93
|
-
// catch Safari's way of signalling transparent
|
|
94
|
-
if (c === "rgba(0, 0, 0, 0)") {
|
|
95
|
-
c = "transparent";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return $.color.parse(c);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// parse CSS color string (like "rgb(10, 32, 43)" or "#fff"),
|
|
102
|
-
// returns color object, if parsing failed, you get black (0, 0,
|
|
103
|
-
// 0) out
|
|
104
|
-
$.color.parse = function (str) {
|
|
105
|
-
var res, m = $.color.make;
|
|
106
|
-
|
|
107
|
-
// Look for rgb(num,num,num)
|
|
108
|
-
res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str);
|
|
109
|
-
if (res) {
|
|
110
|
-
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Look for rgba(num,num,num,num)
|
|
114
|
-
res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str)
|
|
115
|
-
if (res) {
|
|
116
|
-
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4]));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Look for rgb(num%,num%,num%)
|
|
120
|
-
res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*\)/.exec(str);
|
|
121
|
-
if (res) {
|
|
122
|
-
return m(parseFloat(res[1]) * 2.55, parseFloat(res[2]) * 2.55, parseFloat(res[3]) * 2.55);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Look for rgba(num%,num%,num%,num)
|
|
126
|
-
res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str);
|
|
127
|
-
if (res) {
|
|
128
|
-
return m(parseFloat(res[1]) * 2.55, parseFloat(res[2]) * 2.55, parseFloat(res[3]) * 2.55, parseFloat(res[4]));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Look for #a0b1c2
|
|
132
|
-
res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str);
|
|
133
|
-
if (res) {
|
|
134
|
-
return m(parseInt(res[1], 16), parseInt(res[2], 16), parseInt(res[3], 16));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Look for #fff
|
|
138
|
-
res = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str);
|
|
139
|
-
if (res) {
|
|
140
|
-
return m(parseInt(res[1] + res[1], 16), parseInt(res[2] + res[2], 16), parseInt(res[3] + res[3], 16));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Otherwise, we're most likely dealing with a named color
|
|
144
|
-
var name = $.trim(str).toLowerCase();
|
|
145
|
-
if (name === "transparent") {
|
|
146
|
-
return m(255, 255, 255, 0);
|
|
147
|
-
} else {
|
|
148
|
-
// default to black
|
|
149
|
-
res = lookupColors[name] || [0, 0, 0];
|
|
150
|
-
return m(res[0], res[1], res[2]);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
var lookupColors = {
|
|
155
|
-
aqua: [0, 255, 255],
|
|
156
|
-
azure: [240, 255, 255],
|
|
157
|
-
beige: [245, 245, 220],
|
|
158
|
-
black: [0, 0, 0],
|
|
159
|
-
blue: [0, 0, 255],
|
|
160
|
-
brown: [165, 42, 42],
|
|
161
|
-
cyan: [0, 255, 255],
|
|
162
|
-
darkblue: [0, 0, 139],
|
|
163
|
-
darkcyan: [0, 139, 139],
|
|
164
|
-
darkgrey: [169, 169, 169],
|
|
165
|
-
darkgreen: [0, 100, 0],
|
|
166
|
-
darkkhaki: [189, 183, 107],
|
|
167
|
-
darkmagenta: [139, 0, 139],
|
|
168
|
-
darkolivegreen: [85, 107, 47],
|
|
169
|
-
darkorange: [255, 140, 0],
|
|
170
|
-
darkorchid: [153, 50, 204],
|
|
171
|
-
darkred: [139, 0, 0],
|
|
172
|
-
darksalmon: [233, 150, 122],
|
|
173
|
-
darkviolet: [148, 0, 211],
|
|
174
|
-
fuchsia: [255, 0, 255],
|
|
175
|
-
gold: [255, 215, 0],
|
|
176
|
-
green: [0, 128, 0],
|
|
177
|
-
indigo: [75, 0, 130],
|
|
178
|
-
khaki: [240, 230, 140],
|
|
179
|
-
lightblue: [173, 216, 230],
|
|
180
|
-
lightcyan: [224, 255, 255],
|
|
181
|
-
lightgreen: [144, 238, 144],
|
|
182
|
-
lightgrey: [211, 211, 211],
|
|
183
|
-
lightpink: [255, 182, 193],
|
|
184
|
-
lightyellow: [255, 255, 224],
|
|
185
|
-
lime: [0, 255, 0],
|
|
186
|
-
magenta: [255, 0, 255],
|
|
187
|
-
maroon: [128, 0, 0],
|
|
188
|
-
navy: [0, 0, 128],
|
|
189
|
-
olive: [128, 128, 0],
|
|
190
|
-
orange: [255, 165, 0],
|
|
191
|
-
pink: [255, 192, 203],
|
|
192
|
-
purple: [128, 0, 128],
|
|
193
|
-
violet: [128, 0, 128],
|
|
194
|
-
red: [255, 0, 0],
|
|
195
|
-
silver: [192, 192, 192],
|
|
196
|
-
white: [255, 255, 255],
|
|
197
|
-
yellow: [255, 255, 0]
|
|
198
|
-
};
|
|
199
|
-
})(jQuery);
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Axis label plugin for flot
|
|
3
|
-
|
|
4
|
-
Derived from:
|
|
5
|
-
Axis Labels Plugin for flot.
|
|
6
|
-
http://github.com/markrcote/flot-axislabels
|
|
7
|
-
|
|
8
|
-
Original code is Copyright (c) 2010 Xuan Luo.
|
|
9
|
-
Original code was released under the GPLv3 license by Xuan Luo, September 2010.
|
|
10
|
-
Original code was rereleased under the MIT license by Xuan Luo, April 2012.
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
13
|
-
a copy of this software and associated documentation files (the
|
|
14
|
-
"Software"), to deal in the Software without restriction, including
|
|
15
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
16
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
17
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
18
|
-
the following conditions:
|
|
19
|
-
|
|
20
|
-
The above copyright notice and this permission notice shall be
|
|
21
|
-
included in all copies or substantial portions of the Software.
|
|
22
|
-
|
|
23
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
24
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
25
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
26
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
27
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
28
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
29
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
(function($) {
|
|
33
|
-
"use strict";
|
|
34
|
-
|
|
35
|
-
var options = {
|
|
36
|
-
axisLabels: {
|
|
37
|
-
show: true
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
function AxisLabel(axisName, position, padding, placeholder, axisLabel, surface) {
|
|
42
|
-
this.axisName = axisName;
|
|
43
|
-
this.position = position;
|
|
44
|
-
this.padding = padding;
|
|
45
|
-
this.placeholder = placeholder;
|
|
46
|
-
this.axisLabel = axisLabel;
|
|
47
|
-
this.surface = surface;
|
|
48
|
-
this.width = 0;
|
|
49
|
-
this.height = 0;
|
|
50
|
-
this.elem = null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
AxisLabel.prototype.calculateSize = function() {
|
|
54
|
-
var axisId = this.axisName + 'Label',
|
|
55
|
-
layerId = axisId + 'Layer',
|
|
56
|
-
className = axisId + ' axisLabels';
|
|
57
|
-
|
|
58
|
-
var info = this.surface.getTextInfo(layerId, this.axisLabel, className);
|
|
59
|
-
this.labelWidth = info.width;
|
|
60
|
-
this.labelHeight = info.height;
|
|
61
|
-
|
|
62
|
-
if (this.position === 'left' || this.position === 'right') {
|
|
63
|
-
this.width = this.labelHeight + this.padding;
|
|
64
|
-
this.height = 0;
|
|
65
|
-
} else {
|
|
66
|
-
this.width = 0;
|
|
67
|
-
this.height = this.labelHeight + this.padding;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
AxisLabel.prototype.transforms = function(degrees, x, y, svgLayer) {
|
|
72
|
-
var transforms = [], translate, rotate;
|
|
73
|
-
if (x !== 0 || y !== 0) {
|
|
74
|
-
translate = svgLayer.createSVGTransform();
|
|
75
|
-
translate.setTranslate(x, y);
|
|
76
|
-
transforms.push(translate);
|
|
77
|
-
}
|
|
78
|
-
if (degrees !== 0) {
|
|
79
|
-
rotate = svgLayer.createSVGTransform();
|
|
80
|
-
var centerX = Math.round(this.labelWidth / 2),
|
|
81
|
-
centerY = 0;
|
|
82
|
-
rotate.setRotate(degrees, centerX, centerY);
|
|
83
|
-
transforms.push(rotate);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return transforms;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
AxisLabel.prototype.calculateOffsets = function(box) {
|
|
90
|
-
var offsets = {
|
|
91
|
-
x: 0,
|
|
92
|
-
y: 0,
|
|
93
|
-
degrees: 0
|
|
94
|
-
};
|
|
95
|
-
if (this.position === 'bottom') {
|
|
96
|
-
offsets.x = box.left + box.width / 2 - this.labelWidth / 2;
|
|
97
|
-
offsets.y = box.top + box.height - this.labelHeight;
|
|
98
|
-
} else if (this.position === 'top') {
|
|
99
|
-
offsets.x = box.left + box.width / 2 - this.labelWidth / 2;
|
|
100
|
-
offsets.y = box.top;
|
|
101
|
-
} else if (this.position === 'left') {
|
|
102
|
-
offsets.degrees = -90;
|
|
103
|
-
offsets.x = box.left - this.labelWidth / 2;
|
|
104
|
-
offsets.y = box.height / 2 + box.top;
|
|
105
|
-
} else if (this.position === 'right') {
|
|
106
|
-
offsets.degrees = 90;
|
|
107
|
-
offsets.x = box.left + box.width - this.labelWidth / 2;
|
|
108
|
-
offsets.y = box.height / 2 + box.top;
|
|
109
|
-
}
|
|
110
|
-
offsets.x = Math.round(offsets.x);
|
|
111
|
-
offsets.y = Math.round(offsets.y);
|
|
112
|
-
|
|
113
|
-
return offsets;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
AxisLabel.prototype.cleanup = function() {
|
|
117
|
-
var axisId = this.axisName + 'Label',
|
|
118
|
-
layerId = axisId + 'Layer',
|
|
119
|
-
className = axisId + ' axisLabels';
|
|
120
|
-
this.surface.removeText(layerId, 0, 0, this.axisLabel, className);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
AxisLabel.prototype.draw = function(box) {
|
|
124
|
-
var axisId = this.axisName + 'Label',
|
|
125
|
-
layerId = axisId + 'Layer',
|
|
126
|
-
className = axisId + ' axisLabels',
|
|
127
|
-
offsets = this.calculateOffsets(box),
|
|
128
|
-
style = {
|
|
129
|
-
position: 'absolute',
|
|
130
|
-
bottom: '',
|
|
131
|
-
right: '',
|
|
132
|
-
display: 'inline-block',
|
|
133
|
-
'white-space': 'nowrap'
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
var layer = this.surface.getSVGLayer(layerId);
|
|
137
|
-
var transforms = this.transforms(offsets.degrees, offsets.x, offsets.y, layer.parentNode);
|
|
138
|
-
|
|
139
|
-
this.surface.addText(layerId, 0, 0, this.axisLabel, className, undefined, undefined, undefined, undefined, transforms);
|
|
140
|
-
this.surface.render();
|
|
141
|
-
Object.keys(style).forEach(function(key) {
|
|
142
|
-
layer.style[key] = style[key];
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
function init(plot) {
|
|
147
|
-
plot.hooks.processOptions.push(function(plot, options) {
|
|
148
|
-
if (!options.axisLabels.show) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
var axisLabels = {};
|
|
153
|
-
var defaultPadding = 2; // padding between axis and tick labels
|
|
154
|
-
|
|
155
|
-
plot.hooks.axisReserveSpace.push(function(plot, axis) {
|
|
156
|
-
var opts = axis.options;
|
|
157
|
-
var axisName = axis.direction + axis.n;
|
|
158
|
-
|
|
159
|
-
axis.labelHeight += axis.boxPosition.centerY;
|
|
160
|
-
axis.labelWidth += axis.boxPosition.centerX;
|
|
161
|
-
|
|
162
|
-
if (!opts || !opts.axisLabel || !axis.show) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
var padding = opts.axisLabelPadding === undefined
|
|
167
|
-
? defaultPadding
|
|
168
|
-
: opts.axisLabelPadding;
|
|
169
|
-
|
|
170
|
-
var axisLabel = axisLabels[axisName];
|
|
171
|
-
if (!axisLabel) {
|
|
172
|
-
axisLabel = new AxisLabel(axisName,
|
|
173
|
-
opts.position, padding,
|
|
174
|
-
plot.getPlaceholder()[0], opts.axisLabel, plot.getSurface());
|
|
175
|
-
axisLabels[axisName] = axisLabel;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
axisLabel.calculateSize();
|
|
179
|
-
|
|
180
|
-
// Incrementing the sizes of the tick labels.
|
|
181
|
-
axis.labelHeight += axisLabel.height;
|
|
182
|
-
axis.labelWidth += axisLabel.width;
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// TODO - use the drawAxis hook
|
|
186
|
-
plot.hooks.draw.push(function(plot, ctx) {
|
|
187
|
-
$.each(plot.getAxes(), function(flotAxisName, axis) {
|
|
188
|
-
var opts = axis.options;
|
|
189
|
-
if (!opts || !opts.axisLabel || !axis.show) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
var axisName = axis.direction + axis.n;
|
|
194
|
-
axisLabels[axisName].draw(axis.box);
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
plot.hooks.shutdown.push(function(plot, eventHolder) {
|
|
199
|
-
for (var axisName in axisLabels) {
|
|
200
|
-
axisLabels[axisName].cleanup();
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
$.plot.plugins.push({
|
|
207
|
-
init: init,
|
|
208
|
-
options: options,
|
|
209
|
-
name: 'axisLabels',
|
|
210
|
-
version: '3.0'
|
|
211
|
-
});
|
|
212
|
-
})(jQuery);
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/** ## jquery.flot.browser.js
|
|
2
|
-
|
|
3
|
-
This plugin is used to make available some browser-related utility functions.
|
|
4
|
-
|
|
5
|
-
### Methods
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
(function ($) {
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
var browser = {
|
|
12
|
-
/**
|
|
13
|
-
- getPageXY(e)
|
|
14
|
-
|
|
15
|
-
Calculates the pageX and pageY using the screenX, screenY properties of the event
|
|
16
|
-
and the scrolling of the page. This is needed because the pageX and pageY
|
|
17
|
-
properties of the event are not correct while running tests in Edge. */
|
|
18
|
-
getPageXY: function (e) {
|
|
19
|
-
// This code is inspired from https://stackoverflow.com/a/3464890
|
|
20
|
-
var doc = document.documentElement,
|
|
21
|
-
pageX = e.clientX + (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0),
|
|
22
|
-
pageY = e.clientY + (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
|
23
|
-
return { X: pageX, Y: pageY };
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
- getPixelRatio(context)
|
|
28
|
-
|
|
29
|
-
This function returns the current pixel ratio defined by the product of desktop
|
|
30
|
-
zoom and page zoom.
|
|
31
|
-
Additional info: https://www.html5rocks.com/en/tutorials/canvas/hidpi/
|
|
32
|
-
*/
|
|
33
|
-
getPixelRatio: function(context) {
|
|
34
|
-
var devicePixelRatio = window.devicePixelRatio || 1,
|
|
35
|
-
backingStoreRatio =
|
|
36
|
-
context.webkitBackingStorePixelRatio ||
|
|
37
|
-
context.mozBackingStorePixelRatio ||
|
|
38
|
-
context.msBackingStorePixelRatio ||
|
|
39
|
-
context.oBackingStorePixelRatio ||
|
|
40
|
-
context.backingStorePixelRatio || 1;
|
|
41
|
-
return devicePixelRatio / backingStoreRatio;
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
- isSafari, isMobileSafari, isOpera, isFirefox, isIE, isEdge, isChrome, isBlink
|
|
46
|
-
|
|
47
|
-
This is a collection of functions, used to check if the code is running in a
|
|
48
|
-
particular browser or Javascript engine.
|
|
49
|
-
*/
|
|
50
|
-
isSafari: function() {
|
|
51
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
|
52
|
-
// Safari 3.0+ "[object HTMLElementConstructor]"
|
|
53
|
-
return /constructor/i.test(window.top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window.top['safari'] || (typeof window.top.safari !== 'undefined' && window.top.safari.pushNotification));
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
isMobileSafari: function() {
|
|
57
|
-
//isMobileSafari adapted from https://stackoverflow.com/questions/3007480/determine-if-user-navigated-from-mobile-safari
|
|
58
|
-
return navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/);
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
isOpera: function() {
|
|
62
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
|
63
|
-
//Opera 8.0+
|
|
64
|
-
return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
isFirefox: function() {
|
|
68
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
|
69
|
-
// Firefox 1.0+
|
|
70
|
-
return typeof InstallTrigger !== 'undefined';
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
isIE: function() {
|
|
74
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
|
75
|
-
// Internet Explorer 6-11
|
|
76
|
-
return /*@cc_on!@*/false || !!document.documentMode;
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
isEdge: function() {
|
|
80
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
|
81
|
-
// Edge 20+
|
|
82
|
-
return !browser.isIE() && !!window.StyleMedia;
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
isChrome: function() {
|
|
86
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
|
87
|
-
// Chrome 1+
|
|
88
|
-
return !!window.chrome && !!window.chrome.webstore;
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
isBlink: function() {
|
|
92
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
|
93
|
-
return (browser.isChrome() || browser.isOpera()) && !!window.CSS;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
$.plot.browser = browser;
|
|
98
|
-
})(jQuery);
|