iobroker.ebus 2.4.2 → 2.5.0
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 +14 -0
- package/admin/index_m.html +19 -12
- package/io-package.json +38 -2
- package/main.js +26 -12
- package/package.json +9 -9
- package/widgets/ebus/lib/js/flot/jquery.canvaswrapper.js +7 -8
- package/widgets/ebus/lib/js/flot/jquery.flot.axislabels.js +215 -0
- package/widgets/ebus/lib/js/flot/jquery.flot.drawSeries.js +3 -4
- package/widgets/ebus/lib/js/flot/jquery.flot.fillbetween.js +12 -12
- package/widgets/ebus/lib/js/flot/jquery.flot.hover.js +7 -8
- package/widgets/ebus/lib/js/flot/jquery.flot.js +49 -56
- package/widgets/ebus/lib/js/flot/jquery.flot.legend.js +2 -2
- package/widgets/ebus/lib/js/flot/jquery.flot.logaxis.js +3 -3
- package/widgets/ebus/lib/js/flot/jquery.flot.navigate.js +44 -8
- package/widgets/ebus/lib/js/flot/jquery.flot.resize.js +1 -1
- package/widgets/ebus/lib/js/flot/jquery.flot.selection.js +11 -1
- package/widgets/ebus/lib/js/flot/jquery.flot.stack.js +3 -3
- package/widgets/ebus/lib/js/flot/jquery.flot.time.js +110 -108
- package/widgets/ebus/lib/js/flot/jquery.flot.touchNavigate.js +1 -1
- package/widgets/ebus.html +106 -95
|
@@ -26,15 +26,15 @@ API.txt for details.
|
|
|
26
26
|
var floorInBase = $.plot.saturated.floorInBase;
|
|
27
27
|
|
|
28
28
|
// Method to provide microsecond support to Date like classes.
|
|
29
|
-
var CreateMicroSecondDate = function(
|
|
30
|
-
var newDate = new
|
|
29
|
+
var CreateMicroSecondDate = function(DateType, microEpoch) {
|
|
30
|
+
var newDate = new DateType(microEpoch);
|
|
31
31
|
|
|
32
32
|
var oldSetTime = newDate.setTime.bind(newDate);
|
|
33
33
|
newDate.update = function(microEpoch) {
|
|
34
34
|
oldSetTime(microEpoch);
|
|
35
35
|
|
|
36
36
|
// Round epoch to 3 decimal accuracy
|
|
37
|
-
microEpoch = Math.round(microEpoch*1000)/1000;
|
|
37
|
+
microEpoch = Math.round(microEpoch * 1000) / 1000;
|
|
38
38
|
|
|
39
39
|
// Microseconds are stored as integers
|
|
40
40
|
this.microseconds = 1000 * (microEpoch - Math.floor(microEpoch));
|
|
@@ -56,7 +56,7 @@ API.txt for details.
|
|
|
56
56
|
|
|
57
57
|
newDate.setMicroseconds = function(microseconds) {
|
|
58
58
|
var epochWithoutMicroseconds = oldGetTime();
|
|
59
|
-
var newEpoch = epochWithoutMicroseconds + microseconds/1000;
|
|
59
|
+
var newEpoch = epochWithoutMicroseconds + microseconds / 1000;
|
|
60
60
|
this.update(newEpoch);
|
|
61
61
|
};
|
|
62
62
|
|
|
@@ -79,29 +79,29 @@ API.txt for details.
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
var leftPad = function(n, pad) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
n = "" + n;
|
|
83
|
+
pad = "" + (pad == null ? "0" : pad);
|
|
84
|
+
return n.length === 1 ? pad + n : n;
|
|
85
|
+
};
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
var formatSubSeconds = function(milliseconds, microseconds, numberDecimalPlaces) {
|
|
88
88
|
var totalMicroseconds = milliseconds * 1000 + microseconds;
|
|
89
89
|
var formattedString;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
if (numberDecimalPlaces < 6 && numberDecimalPlaces > 0) {
|
|
91
|
+
var magnitude = parseFloat('1e' + (numberDecimalPlaces - 6));
|
|
92
|
+
totalMicroseconds = Math.round(Math.round(totalMicroseconds * magnitude) / magnitude);
|
|
93
|
+
formattedString = ('00000' + totalMicroseconds).slice(-6, -(6 - numberDecimalPlaces));
|
|
94
|
+
} else {
|
|
95
95
|
totalMicroseconds = Math.round(totalMicroseconds)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
formattedString = ('00000' + totalMicroseconds).slice(-6);
|
|
97
|
+
}
|
|
98
|
+
return formattedString;
|
|
99
|
+
};
|
|
100
100
|
|
|
101
101
|
var r = [];
|
|
102
102
|
var escape = false;
|
|
103
103
|
var hours = d.getHours();
|
|
104
|
-
|
|
104
|
+
var isAM = hours < 12;
|
|
105
105
|
|
|
106
106
|
if (!monthNames) {
|
|
107
107
|
monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
@@ -112,55 +112,55 @@ API.txt for details.
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
var hours12;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
if (hours > 12) {
|
|
116
|
+
hours12 = hours - 12;
|
|
117
|
+
} else if (hours === 0) {
|
|
118
|
+
hours12 = 12;
|
|
119
|
+
} else {
|
|
120
|
+
hours12 = hours;
|
|
121
|
+
}
|
|
122
122
|
|
|
123
123
|
var decimals = -1;
|
|
124
124
|
for (var i = 0; i < fmt.length; ++i) {
|
|
125
|
-
|
|
125
|
+
var c = fmt.charAt(i);
|
|
126
126
|
|
|
127
127
|
if (!isNaN(Number(c)) && Number(c) > 0) {
|
|
128
128
|
decimals = Number(c);
|
|
129
129
|
} else if (escape) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
130
|
+
switch (c) {
|
|
131
|
+
case 'a': c = "" + dayNames[d.getDay()]; break;
|
|
132
|
+
case 'b': c = "" + monthNames[d.getMonth()]; break;
|
|
133
|
+
case 'd': c = leftPad(d.getDate()); break;
|
|
134
|
+
case 'e': c = leftPad(d.getDate(), " "); break;
|
|
135
|
+
case 'h': // For back-compat with 0.7; remove in 1.0
|
|
136
|
+
case 'H': c = leftPad(hours); break;
|
|
137
|
+
case 'I': c = leftPad(hours12); break;
|
|
138
|
+
case 'l': c = leftPad(hours12, " "); break;
|
|
139
|
+
case 'm': c = leftPad(d.getMonth() + 1); break;
|
|
140
|
+
case 'M': c = leftPad(d.getMinutes()); break;
|
|
141
|
+
// quarters not in Open Group's strftime specification
|
|
142
|
+
case 'q':
|
|
143
|
+
c = "" + (Math.floor(d.getMonth() / 3) + 1); break;
|
|
144
|
+
case 'S': c = leftPad(d.getSeconds()); break;
|
|
145
|
+
case 's': c = "" + formatSubSeconds(d.getMilliseconds(), d.getMicroseconds(), decimals); break;
|
|
146
|
+
case 'y': c = leftPad(d.getFullYear() % 100); break;
|
|
147
|
+
case 'Y': c = "" + d.getFullYear(); break;
|
|
148
|
+
case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break;
|
|
149
|
+
case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break;
|
|
150
|
+
case 'w': c = "" + d.getDay(); break;
|
|
151
|
+
}
|
|
152
|
+
r.push(c);
|
|
153
|
+
escape = false;
|
|
154
|
+
} else {
|
|
155
|
+
if (c === "%") {
|
|
156
|
+
escape = true;
|
|
157
|
+
} else {
|
|
158
|
+
r.push(c);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return r.join("");
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
// To have a consistent view of time-based data independent of which time
|
|
@@ -296,7 +296,6 @@ API.txt for details.
|
|
|
296
296
|
var specQuarters = baseSpec.concat([[1, "quarter"], [2, "quarter"],
|
|
297
297
|
[1, "year"]]);
|
|
298
298
|
|
|
299
|
-
|
|
300
299
|
function dateTickGenerator(axis) {
|
|
301
300
|
var opts = axis.options,
|
|
302
301
|
ticks = [],
|
|
@@ -399,7 +398,7 @@ API.txt for details.
|
|
|
399
398
|
if (step >= timeUnitSize.second) {
|
|
400
399
|
d.setMicroseconds(0);
|
|
401
400
|
} else {
|
|
402
|
-
d.setMicroseconds(d.getMilliseconds()*1000);
|
|
401
|
+
d.setMicroseconds(d.getMilliseconds() * 1000);
|
|
403
402
|
}
|
|
404
403
|
}
|
|
405
404
|
if (step >= timeUnitSize.minute) {
|
|
@@ -482,20 +481,23 @@ API.txt for details.
|
|
|
482
481
|
if (opts.mode === "time") {
|
|
483
482
|
axis.tickGenerator = dateTickGenerator;
|
|
484
483
|
|
|
484
|
+
// if a tick formatter is already provided do not overwrite it
|
|
485
|
+
if ('tickFormatter' in opts && typeof opts.tickFormatter === 'function') return;
|
|
486
|
+
|
|
485
487
|
axis.tickFormatter = function (v, axis) {
|
|
486
488
|
var d = dateGenerator(v, axis.options);
|
|
487
489
|
|
|
488
490
|
// first check global format
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
491
|
+
if (opts.timeformat != null) {
|
|
492
|
+
return formatDate(d, opts.timeformat, opts.monthNames, opts.dayNames);
|
|
493
|
+
}
|
|
492
494
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
axis.options.minTickSize[1]
|
|
495
|
+
// possibly use quarters if quarters are mentioned in
|
|
496
|
+
// any of these places
|
|
497
|
+
var useQuarters = (axis.options.tickSize &&
|
|
498
|
+
axis.options.tickSize[1] === "quarter") ||
|
|
499
|
+
(axis.options.minTickSize &&
|
|
500
|
+
axis.options.minTickSize[1] === "quarter");
|
|
499
501
|
|
|
500
502
|
var timeUnitSize;
|
|
501
503
|
if (opts.timeBase === 'seconds') {
|
|
@@ -506,12 +508,12 @@ API.txt for details.
|
|
|
506
508
|
timeUnitSize = timeUnitSizeMilliseconds;
|
|
507
509
|
}
|
|
508
510
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
511
|
+
var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]];
|
|
512
|
+
var span = axis.max - axis.min;
|
|
513
|
+
var suffix = (opts.twelveHourClock) ? " %p" : "";
|
|
514
|
+
var hourCode = (opts.twelveHourClock) ? "%I" : "%H";
|
|
513
515
|
var factor;
|
|
514
|
-
|
|
516
|
+
var fmt;
|
|
515
517
|
|
|
516
518
|
if (opts.timeBase === 'seconds') {
|
|
517
519
|
factor = 1;
|
|
@@ -522,45 +524,45 @@ API.txt for details.
|
|
|
522
524
|
}
|
|
523
525
|
|
|
524
526
|
if (t < timeUnitSize.second) {
|
|
525
|
-
var decimals = -Math.floor(Math.log10(t/factor))
|
|
527
|
+
var decimals = -Math.floor(Math.log10(t / factor))
|
|
526
528
|
|
|
527
529
|
// the two-and-halves require an additional decimal
|
|
528
530
|
if (String(t).indexOf('25') > -1) {
|
|
529
531
|
decimals++;
|
|
530
532
|
}
|
|
531
533
|
|
|
532
|
-
|
|
534
|
+
fmt = "%S.%" + decimals + "s";
|
|
533
535
|
} else
|
|
534
536
|
if (t < timeUnitSize.minute) {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
537
|
+
fmt = hourCode + ":%M:%S" + suffix;
|
|
538
|
+
} else if (t < timeUnitSize.day) {
|
|
539
|
+
if (span < 2 * timeUnitSize.day) {
|
|
540
|
+
fmt = hourCode + ":%M" + suffix;
|
|
541
|
+
} else {
|
|
542
|
+
fmt = "%b %d " + hourCode + ":%M" + suffix;
|
|
543
|
+
}
|
|
544
|
+
} else if (t < timeUnitSize.month) {
|
|
545
|
+
fmt = "%b %d";
|
|
546
|
+
} else if ((useQuarters && t < timeUnitSize.quarter) ||
|
|
547
|
+
(!useQuarters && t < timeUnitSize.year)) {
|
|
548
|
+
if (span < timeUnitSize.year) {
|
|
549
|
+
fmt = "%b";
|
|
550
|
+
} else {
|
|
551
|
+
fmt = "%b %Y";
|
|
552
|
+
}
|
|
553
|
+
} else if (useQuarters && t < timeUnitSize.year) {
|
|
554
|
+
if (span < timeUnitSize.year) {
|
|
555
|
+
fmt = "Q%q";
|
|
556
|
+
} else {
|
|
557
|
+
fmt = "Q%q %Y";
|
|
558
|
+
}
|
|
559
|
+
} else {
|
|
560
|
+
fmt = "%Y";
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
var rt = formatDate(d, fmt, opts.monthNames, opts.dayNames);
|
|
564
|
+
|
|
565
|
+
return rt;
|
|
564
566
|
};
|
|
565
567
|
}
|
|
566
568
|
});
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
currentTouchedAxis: 'none',
|
|
36
36
|
touchedAxis: null,
|
|
37
37
|
navigationConstraint: 'unconstrained',
|
|
38
|
-
initialState: null
|
|
38
|
+
initialState: null
|
|
39
39
|
},
|
|
40
40
|
useManualPan = options.pan.interactive && options.pan.touchMode === 'manual',
|
|
41
41
|
smartPanLock = options.pan.touchMode === 'smartLock',
|
package/widgets/ebus.html
CHANGED
|
@@ -1277,7 +1277,7 @@
|
|
|
1277
1277
|
|
|
1278
1278
|
// this code can be placed directly in template.html
|
|
1279
1279
|
vis.binds.ebus = {
|
|
1280
|
-
version: "2.
|
|
1280
|
+
version: "2.4.4",
|
|
1281
1281
|
showVersion: function () {
|
|
1282
1282
|
if (vis.binds.ebus.version) {
|
|
1283
1283
|
console.log('Version vis-ebus: ' + vis.binds.ebus.version);
|
|
@@ -1317,130 +1317,141 @@
|
|
|
1317
1317
|
}
|
|
1318
1318
|
|
|
1319
1319
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
function degreeFormatter(v, axis) {
|
|
1328
|
-
return v.toFixed(axis.tickDecimals) + "°C";
|
|
1329
|
-
}
|
|
1320
|
+
function SetMarkingColor(color) {
|
|
1321
|
+
MarkingColor = color;
|
|
1322
|
+
}
|
|
1323
|
+
function noneFormatter(v, axis) {
|
|
1324
|
+
return v.toFixed(axis.tickDecimals);
|
|
1325
|
+
}
|
|
1330
1326
|
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
else if (val > 1000)
|
|
1335
|
-
return (val / 1000).toFixed(axis.tickDecimals) + " kWh";
|
|
1336
|
-
else
|
|
1337
|
-
return val.toFixed(axis.tickDecimals) + " Wh";
|
|
1338
|
-
}
|
|
1339
|
-
function xwFormatter(val, axis) {
|
|
1340
|
-
if (val > 1000000)
|
|
1341
|
-
return (val / 1000000).toFixed(axis.tickDecimals) + " MW";
|
|
1342
|
-
else if (val > 1000)
|
|
1343
|
-
return (val / 1000).toFixed(axis.tickDecimals) + " kW";
|
|
1344
|
-
else
|
|
1345
|
-
return val.toFixed(axis.tickDecimals) + " W";
|
|
1346
|
-
}
|
|
1327
|
+
function degreeFormatter(v, axis) {
|
|
1328
|
+
return v.toFixed(axis.tickDecimals) + "°C";
|
|
1329
|
+
}
|
|
1347
1330
|
|
|
1348
|
-
|
|
1331
|
+
function xwhFormatter(val, axis) {
|
|
1332
|
+
if (val > 1000000)
|
|
1333
|
+
return (val / 1000000).toFixed(axis.tickDecimals) + " MWh";
|
|
1334
|
+
else if (val > 1000)
|
|
1335
|
+
return (val / 1000).toFixed(axis.tickDecimals) + " kWh";
|
|
1336
|
+
else
|
|
1337
|
+
return val.toFixed(axis.tickDecimals) + " Wh";
|
|
1338
|
+
}
|
|
1339
|
+
function xwFormatter(val, axis) {
|
|
1340
|
+
if (val > 1000000)
|
|
1341
|
+
return (val / 1000000).toFixed(axis.tickDecimals) + " MW";
|
|
1342
|
+
else if (val > 1000)
|
|
1343
|
+
return (val / 1000).toFixed(axis.tickDecimals) + " kW";
|
|
1344
|
+
else
|
|
1345
|
+
return val.toFixed(axis.tickDecimals) + " W";
|
|
1346
|
+
}
|
|
1349
1347
|
|
|
1350
|
-
|
|
1351
|
-
if (series.data == null || typeof series.data == "undefined" || typeof series.data[0] == "undefined") {
|
|
1348
|
+
function legendformater(label, series) {
|
|
1352
1349
|
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
}
|
|
1356
|
-
else {
|
|
1357
|
-
console.log('legendformater label ' + label);
|
|
1358
|
-
return label;
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1350
|
+
//wenn keine Daten, dann ausblenden -> (return null)
|
|
1351
|
+
if (series.data == null || typeof series.data == "undefined" || typeof series.data[0] == "undefined") {
|
|
1361
1352
|
|
|
1362
|
-
|
|
1353
|
+
console.log('legendformater no label because no data ');
|
|
1354
|
+
return null;
|
|
1355
|
+
}
|
|
1356
|
+
else {
|
|
1357
|
+
console.log('legendformater label ' + label);
|
|
1358
|
+
return label;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1363
1361
|
|
|
1364
|
-
|
|
1365
|
-
var minDate = new Date(axes.xaxis.min);
|
|
1362
|
+
function GridMarkings(axes) {
|
|
1366
1363
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1364
|
+
var markings = [];
|
|
1365
|
+
var minDate = new Date(axes.xaxis.min);
|
|
1369
1366
|
|
|
1370
|
-
|
|
1367
|
+
const dayDiff = (axes.xaxis.max - axes.xaxis.min) / 1000 / 60 / 60 / 24;
|
|
1368
|
+
console.log('GridMarkings: DayDiff ' + dayDiff + ' (' + axes.xaxis.max + ' ' + axes.xaxis.min + ')');
|
|
1371
1369
|
|
|
1372
|
-
|
|
1373
|
-
if (dayDiff > 2) {
|
|
1374
|
-
do {
|
|
1375
|
-
markings.push({ xaxis: { from: i, to: i + 24 * 60 * 60 * 1000 }, color: MarkingColor });
|
|
1376
|
-
i += 2 * 24 * 60 * 60 * 1000;
|
|
1377
|
-
} while (i < axes.xaxis.max);
|
|
1370
|
+
var i = minDate.getTime();
|
|
1378
1371
|
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1372
|
+
let limit = 0;
|
|
1373
|
+
//if we only few hours then we need markings per hour otherwise per day
|
|
1374
|
+
if (dayDiff > 2) {
|
|
1375
|
+
do {
|
|
1376
|
+
markings.push({ xaxis: { from: i, to: i + 24 * 60 * 60 * 1000 }, color: MarkingColor });
|
|
1377
|
+
i += 2 * 24 * 60 * 60 * 1000;
|
|
1378
|
+
limit++;
|
|
1379
|
+
} while (i < axes.xaxis.max || limit > 200);
|
|
1387
1380
|
|
|
1388
|
-
|
|
1381
|
+
}
|
|
1382
|
+
else {
|
|
1383
|
+
do {
|
|
1384
|
+
markings.push({ xaxis: { from: i, to: i + 60 * 60 * 1000 }, color: MarkingColor });
|
|
1385
|
+
i += 2 * 60 * 60 * 1000;
|
|
1386
|
+
limit++;
|
|
1387
|
+
} while (i < axes.xaxis.max || limit>200);
|
|
1388
|
+
}
|
|
1389
|
+
return markings;
|
|
1389
1390
|
|
|
1390
|
-
|
|
1391
|
+
}
|
|
1391
1392
|
|
|
1392
|
-
|
|
1393
|
+
function CalcTicks4X(axis) {
|
|
1393
1394
|
|
|
1394
|
-
|
|
1395
|
+
var ticks = [];
|
|
1395
1396
|
|
|
1396
|
-
|
|
1397
|
+
var minDate = new Date(axis.min);
|
|
1397
1398
|
|
|
1398
|
-
|
|
1399
|
+
const dayDiff = (axis.max - axis.min) / 1000 / 60 / 60 / 24;
|
|
1399
1400
|
|
|
1400
|
-
|
|
1401
|
-
if (dayDiff > 2) {
|
|
1402
|
-
minDate.setHours(12);
|
|
1403
|
-
minDate.setMinutes(0);
|
|
1404
|
-
var i = minDate.getTime();
|
|
1405
|
-
do {
|
|
1406
|
-
ticks.push([i]);
|
|
1407
|
-
i += 24 * 60 * 60 * 1000;
|
|
1408
|
-
} while (i < axis.max);
|
|
1409
|
-
}
|
|
1410
|
-
else {
|
|
1411
|
-
minDate.setHours(0);
|
|
1412
|
-
minDate.setMinutes(0);
|
|
1413
|
-
var i = minDate.getTime();
|
|
1414
|
-
do {
|
|
1415
|
-
ticks.push([i]);
|
|
1416
|
-
i += 6 * 60 * 60 * 1000;
|
|
1417
|
-
} while (i < axis.max);
|
|
1418
|
-
}
|
|
1419
|
-
return ticks;
|
|
1420
|
-
}
|
|
1401
|
+
console.log('CalcTicks4X: DayDiff ' + dayDiff + ' (' + axis.max + ' ' + axis.min + ')');
|
|
1421
1402
|
|
|
1403
|
+
let limit = 0;
|
|
1404
|
+
//if we only few hours then we need markings per hour otherwise per day
|
|
1405
|
+
if (dayDiff > 2) {
|
|
1406
|
+
minDate.setHours(12);
|
|
1407
|
+
minDate.setMinutes(0);
|
|
1408
|
+
var i = minDate.getTime();
|
|
1409
|
+
do {
|
|
1410
|
+
ticks.push([i]);
|
|
1411
|
+
i += 24 * 60 * 60 * 1000;
|
|
1412
|
+
limit++;
|
|
1413
|
+
} while (i < axis.max || limit>200);
|
|
1414
|
+
}
|
|
1415
|
+
else {
|
|
1416
|
+
minDate.setHours(0);
|
|
1417
|
+
minDate.setMinutes(0);
|
|
1418
|
+
var i = minDate.getTime();
|
|
1419
|
+
do {
|
|
1420
|
+
ticks.push([i]);
|
|
1421
|
+
i += 6 * 60 * 60 * 1000;
|
|
1422
|
+
limit++;
|
|
1423
|
+
} while (i < axis.max || limit>200);
|
|
1424
|
+
}
|
|
1425
|
+
return ticks;
|
|
1426
|
+
}
|
|
1422
1427
|
|
|
1423
1428
|
|
|
1424
1429
|
|
|
1425
1430
|
|
|
1426
1431
|
|
|
1432
|
+
//should avoid endles loops
|
|
1433
|
+
let UpdateRetryCounter = 0;
|
|
1427
1434
|
|
|
1428
1435
|
|
|
1429
1436
|
|
|
1430
1437
|
|
|
1431
1438
|
function update() {
|
|
1432
1439
|
|
|
1433
|
-
console.log("ShowChart ebus (" + widgetID + ")");
|
|
1440
|
+
console.log("ShowChart ebus (" + widgetID + ") retry counter " + UpdateRetryCounter);
|
|
1434
1441
|
|
|
1435
1442
|
var $div = $('#' + widgetID);
|
|
1436
1443
|
// if nothing found => wait
|
|
1437
1444
|
if (!$div.length) {
|
|
1438
1445
|
return setTimeout(function () {
|
|
1439
1446
|
console.log("need to wait... (" + widgetID + ")");
|
|
1440
|
-
|
|
1447
|
+
if (UpdateRetryCounter < 5) {
|
|
1448
|
+
UpdateRetryCounter++;
|
|
1449
|
+
update();
|
|
1450
|
+
}
|
|
1441
1451
|
}, 1000);
|
|
1442
1452
|
}
|
|
1443
1453
|
|
|
1454
|
+
UpdateRetryCounter = 0;
|
|
1444
1455
|
console.log("ShowChart ebus begin (" + widgetID + ")");
|
|
1445
1456
|
|
|
1446
1457
|
if (!data || !data.ebusinstance) {
|
|
@@ -1571,7 +1582,7 @@
|
|
|
1571
1582
|
var names = Object.keys(sVal[0]);
|
|
1572
1583
|
var sValGraph1 = sVal[0][names[0]];
|
|
1573
1584
|
//console.log("graph1 " + sDate + " " + sTime + ": " + sValGraph1);
|
|
1574
|
-
console.log("graph1 " + oDate.toISOString() + " " + sValGraph1);
|
|
1585
|
+
//console.log("graph1 " + oDate.toISOString() + " " + sValGraph1);
|
|
1575
1586
|
values_graph1.push([oDate, sValGraph1]);
|
|
1576
1587
|
|
|
1577
1588
|
if (sValGraph1 > maxY_graph[0]) maxY_graph[0] = sValGraph1;
|
|
@@ -1591,7 +1602,7 @@
|
|
|
1591
1602
|
var names = Object.keys(sVal[0]);
|
|
1592
1603
|
var sValGraph2 = sVal[0][names[0]];
|
|
1593
1604
|
//console.log("graph2 " + sDate + " " + sTime + ": " + sValGraph2);
|
|
1594
|
-
console.log("graph2 " + oDate.toISOString() + " " + sValGraph2);
|
|
1605
|
+
//console.log("graph2 " + oDate.toISOString() + " " + sValGraph2);
|
|
1595
1606
|
values_graph2.push([oDate, sValGraph2]);
|
|
1596
1607
|
|
|
1597
1608
|
if (sValGraph2 > maxY_graph[1]) maxY_graph[1] = sValGraph2;
|
|
@@ -1610,7 +1621,7 @@
|
|
|
1610
1621
|
var names = Object.keys(sVal[0]);
|
|
1611
1622
|
var sValGraph3 = sVal[0][names[0]];
|
|
1612
1623
|
//console.log("graph3 " + sDate + " " + sTime + ": " + sValGraph3);
|
|
1613
|
-
console.log("graph3 " + oDate.toISOString() + " " + sValGraph3);
|
|
1624
|
+
//console.log("graph3 " + oDate.toISOString() + " " + sValGraph3);
|
|
1614
1625
|
values_graph3.push([oDate, sValGraph3]);
|
|
1615
1626
|
|
|
1616
1627
|
if (sValGraph3 > maxY_graph[2]) maxY_graph[2] = sValGraph3;
|
|
@@ -1629,7 +1640,7 @@
|
|
|
1629
1640
|
var names = Object.keys(sVal[0]);
|
|
1630
1641
|
var sValGraph4 = sVal[0][names[0]];
|
|
1631
1642
|
//console.log("graph4 " + sDate + " " + sTime + ": " + sValGraph4);
|
|
1632
|
-
console.log("graph4 " + oDate.toISOString() + " " + sValGraph4);
|
|
1643
|
+
//console.log("graph4 " + oDate.toISOString() + " " + sValGraph4);
|
|
1633
1644
|
values_graph4.push([oDate, sValGraph4]);
|
|
1634
1645
|
|
|
1635
1646
|
if (sValGraph4 > maxY_graph[3]) maxY_graph[3] = sValGraph4;
|
|
@@ -1655,7 +1666,7 @@
|
|
|
1655
1666
|
|
|
1656
1667
|
for (var n = 0; n < 4; n++) {
|
|
1657
1668
|
|
|
1658
|
-
console.log("****** before Graph" + n + " max " + maxY_graph[n] + " min " + minY_graph[n]);
|
|
1669
|
+
//console.log("****** before Graph" + n + " max " + maxY_graph[n] + " min " + minY_graph[n]);
|
|
1659
1670
|
|
|
1660
1671
|
var nTemp = parseFloat(maxY_graph[n]);
|
|
1661
1672
|
//console.log(nTemp);
|
|
@@ -1682,7 +1693,7 @@
|
|
|
1682
1693
|
//console.log(nTemp);
|
|
1683
1694
|
minY_graph[n] = Math.ceil(nTemp) * 10;
|
|
1684
1695
|
}
|
|
1685
|
-
console.log("****** after Graph" + n + "max " + maxY_graph[n] + " min " + minY_graph[n]);
|
|
1696
|
+
//console.log("****** after Graph" + n + "max " + maxY_graph[n] + " min " + minY_graph[n]);
|
|
1686
1697
|
}
|
|
1687
1698
|
|
|
1688
1699
|
var barwidth = 1000 * 60 * 5; //5 Minuten
|
|
@@ -2023,7 +2034,7 @@
|
|
|
2023
2034
|
|
|
2024
2035
|
// backgroundColor: data.nobgcolor ? null : { colors: ["#fff", "#eee"] },
|
|
2025
2036
|
backgroundColor: data.nobgcolor ? null : data.bgcolor,
|
|
2026
|
-
borderWidth:
|
|
2037
|
+
borderWidth: parseFloat(data.borderWidth), //data.withborder,
|
|
2027
2038
|
borderColor: data.bordercolor,
|
|
2028
2039
|
margin: 1,
|
|
2029
2040
|
/*
|
|
@@ -2088,7 +2099,7 @@
|
|
|
2088
2099
|
|
|
2089
2100
|
$div.data('timer', setInterval(function () {
|
|
2090
2101
|
update();
|
|
2091
|
-
}, parseInt(vis.binds.ebus.setup.intervals[data.time_interval]
|
|
2102
|
+
}, parseInt(vis.binds.ebus.setup.intervals[data.time_interval], 10)));
|
|
2092
2103
|
}
|
|
2093
2104
|
|
|
2094
2105
|
}
|