iobroker.ebus 3.0.0 → 3.0.3

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/widgets/ebus.html CHANGED
@@ -6,10 +6,15 @@
6
6
  Copyright 2017,2018,2019 René G. info@rg-engineering.eu
7
7
  -->
8
8
  <!--
9
- <script language="javascript" type="text/javascript" src="widgets/weather/lib/js/flot/jquery.js"></script>
9
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.js"></script>
10
10
  -->
11
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/lib/jquery.event.drag.js"></script>
12
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/lib/jquery.mousewheel.js"></script>
13
+
11
14
  <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.canvaswrapper.js"></script>
12
15
  <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.colorhelpers.js"></script>
16
+
17
+
13
18
  <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.js"></script>
14
19
  <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.saturated.js"></script>
15
20
  <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.browser.js"></script>
@@ -17,8 +22,13 @@
17
22
  <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.uiConstants.js"></script>
18
23
  <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.time.js"></script>
19
24
  <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.legend.js"></script>
25
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.navigate.js"></script>
26
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.touchNavigate.js"></script>
27
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.hover.js"></script>
28
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.touch.js"></script>
29
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.selection.js"></script>
20
30
 
21
- <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.axislabels_V2.js"></script>
31
+ <script language="javascript" type="text/javascript" src="widgets/ebus/lib/js/flot/jquery.flot.axislabels.js"></script>
22
32
 
23
33
  <!-- doku for flot : -->
24
34
  <!-- https://github.com/flot/flot/blob/master/API.md -->
@@ -261,7 +271,7 @@
261
271
  "es": "mostrar eje X",
262
272
  "pl": "pokaż oś X.",
263
273
  },
264
-
274
+
265
275
 
266
276
  "xDateFormat": {
267
277
  "en": "format for date/time on x-axis",
@@ -351,60 +361,60 @@
351
361
  "zh-cn": "图例位置"
352
362
  },
353
363
 
354
-
355
-
364
+
365
+
356
366
  "none": {
357
- "en": "none",
358
- "de": "kein",
359
- "ru": "никто",
360
- "pt": "Nenhum",
361
- "nl": "geen",
362
- "fr": "aucun",
363
- "it": "nessuna",
364
- "es": "ninguna",
365
- "pl": "Żaden",
366
- "zh-cn": "没有"
367
+ "en": "none",
368
+ "de": "kein",
369
+ "ru": "никто",
370
+ "pt": "Nenhum",
371
+ "nl": "geen",
372
+ "fr": "aucun",
373
+ "it": "nessuna",
374
+ "es": "ninguna",
375
+ "pl": "Żaden",
376
+ "zh-cn": "没有"
367
377
  },
368
378
  "kWh": {
369
- "en": "kWh",
370
- "de": "kWh",
371
- "ru": "кВтч",
372
- "pt": "kWh",
373
- "nl": "kWh",
374
- "fr": "kWh",
375
- "it": "kWh",
376
- "es": "kWh",
377
- "pl": "kWh",
378
- "zh-cn": "千瓦时"
379
+ "en": "kWh",
380
+ "de": "kWh",
381
+ "ru": "кВтч",
382
+ "pt": "kWh",
383
+ "nl": "kWh",
384
+ "fr": "kWh",
385
+ "it": "kWh",
386
+ "es": "kWh",
387
+ "pl": "kWh",
388
+ "zh-cn": "千瓦时"
379
389
  },
380
390
  "degree": {
381
- "en": "degree",
382
- "de": "Grad",
383
- "ru": "степень",
384
- "pt": "grau",
385
- "nl": "mate",
386
- "fr": "diplôme",
387
- "it": "grado",
388
- "es": "la licenciatura",
389
- "pl": "stopień",
390
- "zh-cn": "学位"
391
+ "en": "degree",
392
+ "de": "Grad",
393
+ "ru": "степень",
394
+ "pt": "grau",
395
+ "nl": "mate",
396
+ "fr": "diplôme",
397
+ "it": "grado",
398
+ "es": "la licenciatura",
399
+ "pl": "stopień",
400
+ "zh-cn": "学位"
391
401
  },
392
402
 
393
403
  "group_graph1": {
394
404
  "en": "graph 1",
395
- "de": "Grafik 1",
396
- "ru": "график 1",
397
- "pt": "gráfico 1",
398
- "nl": "grafiek 1",
399
- "fr": "graphique 1",
400
- "it": "grafico 1",
401
- "es": "gráfico 1",
402
- "pl": "wykres 1",
405
+ "de": "Grafik 1",
406
+ "ru": "график 1",
407
+ "pt": "gráfico 1",
408
+ "nl": "grafiek 1",
409
+ "fr": "graphique 1",
410
+ "it": "grafico 1",
411
+ "es": "gráfico 1",
412
+ "pl": "wykres 1",
403
413
  "zh-cn": "图1"
404
414
  },
405
415
 
406
416
  "graph1charttype": {
407
- "en": "chart type",
417
+ "en": "chart type",
408
418
  "de": "Diagramm Typ",
409
419
  "ru": "тип диаграммы",
410
420
  "pt": "tipo de gráfico",
@@ -454,19 +464,19 @@
454
464
  "graph1YAxisFomat": { "en": "Y axis fomat", "de": "Y-Achsenformat", "ru": "graph1YAxisFomat" },
455
465
 
456
466
  "group_graph2": {
457
- "en": "graph 2",
458
- "de": "Grafik 2",
459
- "ru": "график 2",
460
- "pt": "gráfico 2",
461
- "nl": "grafiek 2",
462
- "fr": "graphique 2",
463
- "it": "grafico 2",
464
- "es": "gráfico 2",
465
- "pl": "wykres 2",
466
- "zh-cn": "图2"
467
+ "en": "graph 2",
468
+ "de": "Grafik 2",
469
+ "ru": "график 2",
470
+ "pt": "gráfico 2",
471
+ "nl": "grafiek 2",
472
+ "fr": "graphique 2",
473
+ "it": "grafico 2",
474
+ "es": "gráfico 2",
475
+ "pl": "wykres 2",
476
+ "zh-cn": "图2"
467
477
  },
468
478
  "graph2charttype": {
469
- "en": "chart type",
479
+ "en": "chart type",
470
480
  "de": "Diagramm Typ",
471
481
  "ru": "тип диаграммы",
472
482
  "pt": "tipo de gráfico",
@@ -516,19 +526,19 @@
516
526
  "graph2YAxisFomat": { "en": "Y axis fomat", "de": "Y-Achsenformat", "ru": "graph1YAxisFomat" },
517
527
 
518
528
  "group_graph3": {
519
- "en": "graph 3",
520
- "de": "Grafik 3",
521
- "ru": "график 3",
522
- "pt": "gráfico 3",
523
- "nl": "grafiek 3",
524
- "fr": "graphique 3",
525
- "it": "grafico 3",
526
- "es": "gráfico 3",
527
- "pl": "wykres 3",
528
- "zh-cn": "图3"
529
+ "en": "graph 3",
530
+ "de": "Grafik 3",
531
+ "ru": "график 3",
532
+ "pt": "gráfico 3",
533
+ "nl": "grafiek 3",
534
+ "fr": "graphique 3",
535
+ "it": "grafico 3",
536
+ "es": "gráfico 3",
537
+ "pl": "wykres 3",
538
+ "zh-cn": "图3"
529
539
  },
530
540
  "graph3charttype": {
531
- "en": "chart type",
541
+ "en": "chart type",
532
542
  "de": "Diagramm Typ",
533
543
  "ru": "тип диаграммы",
534
544
  "pt": "tipo de gráfico",
@@ -578,19 +588,19 @@
578
588
  "graph3YAxisFomat": { "en": "Y axis fomat", "de": "Y-Achsenformat", "ru": "graph1YAxisFomat" },
579
589
 
580
590
  "group_graph4": {
581
- "en": "graph 4",
582
- "de": "Grafik 4",
583
- "ru": "график 4",
584
- "pt": "gráfico 4",
585
- "nl": "grafiek 4",
586
- "fr": "graphique 4",
587
- "it": "grafico 4",
588
- "es": "gráfico 4",
589
- "pl": "wykres 4",
590
- "zh-cn": "图4"
591
+ "en": "graph 4",
592
+ "de": "Grafik 4",
593
+ "ru": "график 4",
594
+ "pt": "gráfico 4",
595
+ "nl": "grafiek 4",
596
+ "fr": "graphique 4",
597
+ "it": "grafico 4",
598
+ "es": "gráfico 4",
599
+ "pl": "wykres 4",
600
+ "zh-cn": "图4"
591
601
  },
592
602
  "graph4charttype": {
593
- "en": "chart type",
603
+ "en": "chart type",
594
604
  "de": "Diagramm Typ",
595
605
  "ru": "тип диаграммы",
596
606
  "pt": "tipo de gráfico",
@@ -638,77 +648,77 @@
638
648
  "zh-cn": "显示y轴"
639
649
  },
640
650
  "graph4YAxisFomat": {
641
- "en": "Y axis format",
642
- "de": "Y-Achsen-Format",
643
- "ru": "Формат оси Y",
644
- "pt": "Formato do eixo Y",
645
- "nl": "Y-as formaat",
646
- "fr": "Format de l'axe Y",
647
- "it": "Formato dell'asse Y.",
648
- "es": "Formato del eje Y",
649
- "pl": "Format osi Y.",
650
- "zh-cn": "Y轴格式"
651
+ "en": "Y axis format",
652
+ "de": "Y-Achsen-Format",
653
+ "ru": "Формат оси Y",
654
+ "pt": "Formato do eixo Y",
655
+ "nl": "Y-as formaat",
656
+ "fr": "Format de l'axe Y",
657
+ "it": "Formato dell'asse Y.",
658
+ "es": "Formato del eje Y",
659
+ "pl": "Format osi Y.",
660
+ "zh-cn": "Y轴格式"
651
661
  },
652
662
 
653
663
  "oid_historygraph1": {
654
- "en": "OID",
655
- "de": "OID",
656
- "ru": "OID",
657
- "pt": "OID",
658
- "nl": "OID",
659
- "fr": "OID",
660
- "it": "OID",
661
- "es": "OID",
662
- "pl": "OID",
663
- "zh-cn": "OID"
664
+ "en": "OID",
665
+ "de": "OID",
666
+ "ru": "OID",
667
+ "pt": "OID",
668
+ "nl": "OID",
669
+ "fr": "OID",
670
+ "it": "OID",
671
+ "es": "OID",
672
+ "pl": "OID",
673
+ "zh-cn": "OID"
664
674
  },
665
675
  "oid_historygraph2": {
666
- "en": "OID",
667
- "de": "OID",
668
- "ru": "OID",
669
- "pt": "OID",
670
- "nl": "OID",
671
- "fr": "OID",
672
- "it": "OID",
673
- "es": "OID",
674
- "pl": "OID",
675
- "zh-cn": "OID"
676
+ "en": "OID",
677
+ "de": "OID",
678
+ "ru": "OID",
679
+ "pt": "OID",
680
+ "nl": "OID",
681
+ "fr": "OID",
682
+ "it": "OID",
683
+ "es": "OID",
684
+ "pl": "OID",
685
+ "zh-cn": "OID"
676
686
  },
677
687
  "oid_historygraph3": {
678
- "en": "OID",
679
- "de": "OID",
680
- "ru": "OID",
681
- "pt": "OID",
682
- "nl": "OID",
683
- "fr": "OID",
684
- "it": "OID",
685
- "es": "OID",
686
- "pl": "OID",
687
- "zh-cn": "OID"
688
+ "en": "OID",
689
+ "de": "OID",
690
+ "ru": "OID",
691
+ "pt": "OID",
692
+ "nl": "OID",
693
+ "fr": "OID",
694
+ "it": "OID",
695
+ "es": "OID",
696
+ "pl": "OID",
697
+ "zh-cn": "OID"
688
698
  },
689
699
  "oid_historygraph4": {
690
- "en": "OID",
691
- "de": "OID",
692
- "ru": "OID",
693
- "pt": "OID",
694
- "nl": "OID",
695
- "fr": "OID",
696
- "it": "OID",
697
- "es": "OID",
698
- "pl": "OID",
699
- "zh-cn": "OID"
700
+ "en": "OID",
701
+ "de": "OID",
702
+ "ru": "OID",
703
+ "pt": "OID",
704
+ "nl": "OID",
705
+ "fr": "OID",
706
+ "it": "OID",
707
+ "es": "OID",
708
+ "pl": "OID",
709
+ "zh-cn": "OID"
700
710
  },
701
711
  "oid_historydate": {
702
- "en": "OID",
703
- "de": "OID",
704
- "ru": "OID",
705
- "pt": "OID",
706
- "nl": "OID",
707
- "fr": "OID",
708
- "it": "OID",
709
- "es": "OID",
710
- "pl": "OID",
711
- "zh-cn": "OID"
712
+ "en": "OID",
713
+ "de": "OID",
714
+ "ru": "OID",
715
+ "pt": "OID",
716
+ "nl": "OID",
717
+ "fr": "OID",
718
+ "it": "OID",
719
+ "es": "OID",
720
+ "pl": "OID",
721
+ "zh-cn": "OID"
712
722
  },
713
723
 
714
724
  "graph1Name": {
@@ -783,7 +793,7 @@
783
793
  "pl": "kolor znaczników osi",
784
794
  "zh-cn": "轴刻度的颜色"
785
795
  },
786
- "markingcolor": {
796
+ "markingcolor": {
787
797
  "en": "color of marking",
788
798
  "de": "Farbe der Markierung",
789
799
  "ru": "цвет маркировки",
@@ -979,7 +989,7 @@
979
989
  "zh-cn": "小数点"
980
990
  },
981
991
  "graph1tickSize": {
982
- "en": "tick size",
992
+ "en": "tick size",
983
993
  "de": "Tick-Größe",
984
994
  "ru": "размер галочки",
985
995
  "pt": "tamanho do carrapato",
@@ -991,7 +1001,7 @@
991
1001
  "zh-cn": "刻度大小"
992
1002
  },
993
1003
  "graph1minTickSize": {
994
- "en": "min. tick size",
1004
+ "en": "min. tick size",
995
1005
  "de": "Mindest. Tick-Größe",
996
1006
  "ru": "минимум размер галочки",
997
1007
  "pt": "min. tamanho do carrapato",
@@ -1064,7 +1074,7 @@
1064
1074
  "zh-cn": "小数点"
1065
1075
  },
1066
1076
  "graph2tickSize": {
1067
- "en": "tick size",
1077
+ "en": "tick size",
1068
1078
  "de": "Tick-Größe",
1069
1079
  "ru": "размер галочки",
1070
1080
  "pt": "tamanho do carrapato",
@@ -1076,7 +1086,7 @@
1076
1086
  "zh-cn": "刻度大小"
1077
1087
  },
1078
1088
  "graph2minTickSize": {
1079
- "en": "min. tick size",
1089
+ "en": "min. tick size",
1080
1090
  "de": "Mindest. Tick-Größe",
1081
1091
  "ru": "минимум размер галочки",
1082
1092
  "pt": "min. tamanho do carrapato",
@@ -1149,7 +1159,7 @@
1149
1159
  "zh-cn": "小数点"
1150
1160
  },
1151
1161
  "graph3tickSize": {
1152
- "en": "tick size",
1162
+ "en": "tick size",
1153
1163
  "de": "Tick-Größe",
1154
1164
  "ru": "размер галочки",
1155
1165
  "pt": "tamanho do carrapato",
@@ -1161,7 +1171,7 @@
1161
1171
  "zh-cn": "刻度大小"
1162
1172
  },
1163
1173
  "graph3minTickSize": {
1164
- "en": "min. tick size",
1174
+ "en": "min. tick size",
1165
1175
  "de": "Mindest. Tick-Größe",
1166
1176
  "ru": "минимум размер галочки",
1167
1177
  "pt": "min. tamanho do carrapato",
@@ -1234,7 +1244,7 @@
1234
1244
  "zh-cn": "小数点"
1235
1245
  },
1236
1246
  "graph4tickSize": {
1237
- "en": "tick size",
1247
+ "en": "tick size",
1238
1248
  "de": "Tick-Größe",
1239
1249
  "ru": "размер галочки",
1240
1250
  "pt": "tamanho do carrapato",
@@ -1246,7 +1256,7 @@
1246
1256
  "zh-cn": "刻度大小"
1247
1257
  },
1248
1258
  "graph4minTickSize": {
1249
- "en": "min. tick size",
1259
+ "en": "min. tick size",
1250
1260
  "de": "Mindest. Tick-Größe",
1251
1261
  "ru": "минимум размер галочки",
1252
1262
  "pt": "min. tamanho do carrapato",
@@ -1268,6 +1278,30 @@
1268
1278
  "es": "ancho de etiqueta",
1269
1279
  "pl": "szerokość etykiety",
1270
1280
  "zh-cn": "标签宽度"
1281
+ },
1282
+ "WithHOver": {
1283
+ "en": "With Value box",
1284
+ "de": "Mit Wertbox",
1285
+ "ru": "С коробкой ценности",
1286
+ "pt": "Com caixa de valor",
1287
+ "nl": "Met Value box",
1288
+ "fr": "Avec boîte de valeur",
1289
+ "it": "Con Valore",
1290
+ "es": "Con caja de valor",
1291
+ "pl": "Wagon z Value",
1292
+ "zh-cn": "价值箱"
1293
+ },
1294
+ "WithPoints": {
1295
+ "en": "with points",
1296
+ "de": "mit Punkten",
1297
+ "ru": "с точками",
1298
+ "pt": "com pontos",
1299
+ "nl": "met punten",
1300
+ "fr": "avec points",
1301
+ "it": "con punti",
1302
+ "es": "con puntos",
1303
+ "pl": "punkty",
1304
+ "zh-cn": "要点"
1271
1305
  }
1272
1306
 
1273
1307
  });
@@ -1316,6 +1350,24 @@
1316
1350
 
1317
1351
  }
1318
1352
 
1353
+ //****************************************************************************************
1354
+ //hover
1355
+
1356
+ if (data.WithHOver) {
1357
+ //das muss in's init...
1358
+
1359
+
1360
+
1361
+ $("<div id='ebustooltip'></div>").css({
1362
+ position: "absolute",
1363
+ display: "none",
1364
+ border: "1px solid #fdd",
1365
+ padding: "2px",
1366
+ "background-color": "#fee",
1367
+ opacity: 1
1368
+ }).appendTo("body");
1369
+ //****************************************************************************************
1370
+ }
1319
1371
 
1320
1372
  function SetMarkingColor(color) {
1321
1373
  MarkingColor = color;
@@ -1329,20 +1381,64 @@
1329
1381
  }
1330
1382
 
1331
1383
  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";
1384
+ let myval;
1385
+ if (typeof val == "string") {
1386
+ console.log('xwhFormatter convert to number ');
1387
+ myval = Number(val);
1388
+ }
1389
+ else {
1390
+ myval = val;
1391
+ }
1392
+
1393
+ console.log('xwhFormatter for ' + val + " " + typeof val);
1394
+
1395
+ if (myval > 1000000)
1396
+ return (myval / 1000000).toFixed(axis.tickDecimals) + " MWh";
1397
+ else if (myval > 1000)
1398
+ return (myval / 1000).toFixed(axis.tickDecimals) + " kWh";
1336
1399
  else
1337
- return val.toFixed(axis.tickDecimals) + " Wh";
1400
+ return (myval*1).toFixed(axis.tickDecimals) + " Wh";
1338
1401
  }
1339
1402
  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";
1403
+
1404
+ let myval;
1405
+ if (typeof val == "string") {
1406
+ console.log('xwFormatter convert to number ');
1407
+ myval = Number(val);
1408
+ }
1409
+ else {
1410
+ myval = val;
1411
+ }
1412
+
1413
+ console.log('xwFormatter for ' + val + " " + typeof val);
1414
+
1415
+ if (myval > 1000000)
1416
+ return (myval / 1000000).toFixed(axis.tickDecimals) + " MW";
1417
+ else if (myval > 1000)
1418
+ return (myval / 1000).toFixed(axis.tickDecimals) + " kW";
1419
+ else
1420
+ return (myval*1).toFixed(axis.tickDecimals) + " W";
1421
+ }
1422
+
1423
+ function xkwFormatter(val, axis) {
1424
+
1425
+ let myval;
1426
+ if (typeof val == "string") {
1427
+ console.log('xkwFormatter convert to number ');
1428
+ myval = Number(val);
1429
+ }
1430
+ else {
1431
+ myval = val;
1432
+ }
1433
+
1434
+ console.log('xkwFormatter for ' + val + " " + typeof val);
1435
+
1436
+ if (myval > 1000)
1437
+ return (myval / 1000).toFixed(axis.tickDecimals) + " MW";
1438
+ else if (myval > 1)
1439
+ return (myval / 1).toFixed(axis.tickDecimals) + " kW";
1344
1440
  else
1345
- return val.toFixed(axis.tickDecimals) + " W";
1441
+ return (myval * 0.001).toFixed(axis.tickDecimals) + " W";
1346
1442
  }
1347
1443
 
1348
1444
  function legendformater(label, series) {
@@ -1384,7 +1480,7 @@
1384
1480
  markings.push({ xaxis: { from: i, to: i + 60 * 60 * 1000 }, color: MarkingColor });
1385
1481
  i += 2 * 60 * 60 * 1000;
1386
1482
  limit++;
1387
- } while (i < axes.xaxis.max || limit>200);
1483
+ } while (i < axes.xaxis.max || limit > 200);
1388
1484
  }
1389
1485
  return markings;
1390
1486
 
@@ -1402,25 +1498,42 @@
1402
1498
 
1403
1499
  let limit = 0;
1404
1500
  //if we only few hours then we need markings per hour otherwise per day
1501
+ //Achtung, wenn zuwenige Punkte, dann wird X-Achse Beschriftung nicht angezeigt
1405
1502
  if (dayDiff > 2) {
1406
1503
  minDate.setHours(12);
1407
1504
  minDate.setMinutes(0);
1408
1505
  var i = minDate.getTime();
1506
+ console.log('CalcTicks4X: start ' + i);
1409
1507
  do {
1410
1508
  ticks.push([i]);
1411
1509
  i += 24 * 60 * 60 * 1000;
1510
+ console.log('CalcTicks4X: next ' + i + " limit " + limit);
1412
1511
  limit++;
1413
- } while (i < axis.max || limit>200);
1512
+ } while (i < axis.max || limit > 200);
1513
+ }
1514
+ else if (dayDiff > 0.24) {
1515
+ minDate.setHours(12);
1516
+ minDate.setMinutes(0);
1517
+ var i = minDate.getTime();
1518
+ console.log('CalcTicks4X: start ' + i);
1519
+ do {
1520
+ ticks.push([i]);
1521
+ i += 4 * 60 * 60 * 1000;
1522
+ console.log('CalcTicks4X: next ' + i + " limit " + limit);
1523
+ limit++;
1524
+ } while (i < axis.max || limit > 200);
1414
1525
  }
1415
1526
  else {
1416
1527
  minDate.setHours(0);
1417
1528
  minDate.setMinutes(0);
1418
1529
  var i = minDate.getTime();
1530
+ console.log('CalcTicks4X: start ' + i);
1419
1531
  do {
1420
1532
  ticks.push([i]);
1421
- i += 6 * 60 * 60 * 1000;
1533
+ i += 1 * 60 * 60 * 1000;
1534
+ console.log('CalcTicks4X: next ' + i + " limit " + limit);
1422
1535
  limit++;
1423
- } while (i < axis.max || limit>200);
1536
+ } while (i < axis.max || limit > 200);
1424
1537
  }
1425
1538
  return ticks;
1426
1539
  }
@@ -1472,48 +1585,64 @@
1472
1585
  var oid_historygraph2 = data.oid_historygraph2;
1473
1586
  var oid_historygraph3 = data.oid_historygraph3;
1474
1587
  var oid_historygraph4 = data.oid_historygraph4;
1475
- try {
1476
- var data_date = JSON.parse(vis.states[oid_historydate + '.val']);
1477
- var data_value1 = null;
1478
- if (oid_historygraph1 != "") {
1479
- data_value1 = JSON.parse(vis.states[oid_historygraph1 + '.val']);
1588
+
1589
+ var data_value1 = null;
1590
+ var data_value2 = null;
1591
+ var data_value3 = null;
1592
+ var data_value4 = null;
1593
+
1594
+ if (data.graph1visible) {
1595
+ try {
1596
+ var data_date = JSON.parse(vis.states[oid_historydate + '.val']);
1597
+
1598
+ if (oid_historygraph1 != "") {
1599
+ data_value1 = JSON.parse(vis.states[oid_historygraph1 + '.val']);
1600
+ }
1601
+ } catch (e) {
1602
+ console.warn('parse error [' + e + ']');
1603
+ $div.html("<br> <center> <font color='red'>exception in parse data graph1 </font> </center></br>");
1604
+ return;
1480
1605
  }
1481
- } catch (e) {
1482
- console.warn('parse error [' + e + ']');
1483
- $div.html("<br> <center> <font color='red'>exception in parse data graph1 </font> </center></br>");
1484
- return;
1485
1606
  }
1486
- try {
1487
- data_value2 = null;
1488
- if (oid_historygraph2 != "") {
1489
- var data_value2 = JSON.parse(vis.states[oid_historygraph2 + '.val']);
1607
+ if (data.graph2visible) {
1608
+
1609
+ try {
1610
+
1611
+ if (oid_historygraph2 != "") {
1612
+ data_value2 = JSON.parse(vis.states[oid_historygraph2 + '.val']);
1613
+ }
1614
+ } catch (e) {
1615
+ console.warn('parse error [' + e + ']');
1616
+ $div.html("<br> <center> <font color='red'>exception in parse data graph2 </font> </center></br>");
1617
+ return;
1490
1618
  }
1491
- } catch (e) {
1492
- console.warn('parse error [' + e + ']');
1493
- $div.html("<br> <center> <font color='red'>exception in parse data graph2 </font> </center></br>");
1494
- return;
1495
1619
  }
1496
- try {
1497
- data_value3 = null;
1498
- if (oid_historygraph3 != "") {
1499
- var data_value3 = JSON.parse(vis.states[oid_historygraph3 + '.val']);
1620
+ if (data.graph3visible) {
1621
+
1622
+ try {
1623
+
1624
+ if (oid_historygraph3 != "") {
1625
+ data_value3 = JSON.parse(vis.states[oid_historygraph3 + '.val']);
1626
+ }
1627
+ } catch (e) {
1628
+ console.warn('parse error [' + e + ']');
1629
+ $div.html("<br> <center> <font color='red'>exception in parse data graph3 </font> </center></br>");
1630
+ return;
1500
1631
  }
1501
- } catch (e) {
1502
- console.warn('parse error [' + e + ']');
1503
- $div.html("<br> <center> <font color='red'>exception in parse data graph3 </font> </center></br>");
1504
- return;
1505
1632
  }
1506
- try {
1507
- data_value4 = null;
1508
- if (oid_historygraph4 != "") {
1509
- var data_value4 = JSON.parse(vis.states[oid_historygraph4 + '.val']);
1633
+ if (data.graph4visible) {
1634
+
1635
+ try {
1636
+
1637
+ if (oid_historygraph4 != "") {
1638
+ data_value4 = JSON.parse(vis.states[oid_historygraph4 + '.val']);
1639
+ }
1640
+ } catch (e) {
1641
+ console.warn('parse error [' + e + ']');
1642
+ $div.html("<br> <center> <font color='red'>exception in parse data graph4 </font> </center></br>");
1643
+ return;
1510
1644
  }
1511
- } catch (e) {
1512
- console.warn('parse error [' + e + ']');
1513
- $div.html("<br> <center> <font color='red'>exception in parse data graph4 </font> </center></br>");
1514
- return;
1515
1645
  }
1516
-
1517
1646
  if (data_date === null || typeof data_date == "undefined" || data_date.length < 1) {
1518
1647
  $div.html("<br> <center> <font color='red'>no data available yet for ebus </font> </center></br>");
1519
1648
  return;
@@ -1525,10 +1654,8 @@
1525
1654
 
1526
1655
  var values_graph2 = [];
1527
1656
 
1528
-
1529
1657
  var values_graph3 = [];
1530
1658
 
1531
-
1532
1659
  var values_graph4 = [];
1533
1660
 
1534
1661
  //since all datpoints should have the same length we use date datapoint as master
@@ -1706,8 +1833,12 @@
1706
1833
  Graph1Formatter = xwhFormatter;
1707
1834
  console.log("kWh format");
1708
1835
  break;
1709
- case "kW":
1836
+ case "W":
1710
1837
  Graph1Formatter = xwFormatter;
1838
+ console.log("W format");
1839
+ break;
1840
+ case "kW":
1841
+ Graph1Formatter = xkwFormatter;
1711
1842
  console.log("kW format");
1712
1843
  break;
1713
1844
  case "degree":
@@ -1726,8 +1857,12 @@
1726
1857
  Graph2Formatter = xwhFormatter;
1727
1858
  console.log("kWh format");
1728
1859
  break;
1860
+ case "W":
1861
+ Graph1Formatter = xwFormatter;
1862
+ console.log("W format");
1863
+ break;
1729
1864
  case "kW":
1730
- Graph2Formatter = xwFormatter;
1865
+ Graph2Formatter = xkwFormatter;
1731
1866
  console.log("kW format");
1732
1867
  break;
1733
1868
  case "degree":
@@ -1746,8 +1881,12 @@
1746
1881
  Graph3Formatter = xwhFormatter;
1747
1882
  console.log("kWh format");
1748
1883
  break;
1884
+ case "W":
1885
+ Graph1Formatter = xwFormatter;
1886
+ console.log("W format");
1887
+ break;
1749
1888
  case "kW":
1750
- Graph3Formatter = xwFormatter;
1889
+ Graph3Formatter = xkwFormatter;
1751
1890
  console.log("kW format");
1752
1891
  break;
1753
1892
 
@@ -1767,8 +1906,12 @@
1767
1906
  Graph4Formatter = xwhFormatter;
1768
1907
  console.log("kWh format");
1769
1908
  break;
1909
+ case "W":
1910
+ Graph1Formatter = xwFormatter;
1911
+ console.log("W format");
1912
+ break;
1770
1913
  case "kW":
1771
- Graph4Formatter = xwFormatter;
1914
+ Graph4Formatter = xkwFormatter;
1772
1915
  console.log("kW format");
1773
1916
  break;
1774
1917
  case "degree":
@@ -1791,6 +1934,7 @@
1791
1934
  xaxis: 1,
1792
1935
  yaxis: 1,
1793
1936
  lines: { show: data.graph1charttype == "charttypeline" },
1937
+ points: { show: data.WithPoints },
1794
1938
  bars:
1795
1939
  {
1796
1940
  show: data.graph1charttype == "charttypebar",
@@ -1806,6 +1950,7 @@
1806
1950
  xaxis: 1,
1807
1951
  yaxis: 2,
1808
1952
  lines: { show: data.graph2charttype == "charttypeline" },
1953
+ points: { show: data.WithPoints },
1809
1954
  bars:
1810
1955
  {
1811
1956
  show: data.graph2charttype == "charttypebar",
@@ -1821,6 +1966,7 @@
1821
1966
  xaxis: 1,
1822
1967
  yaxis: 3,
1823
1968
  lines: { show: data.graph3charttype == "charttypeline" },
1969
+ points: { show: data.WithPoints },
1824
1970
  bars:
1825
1971
  {
1826
1972
  show: data.graph3charttype == "charttypebar",
@@ -1836,6 +1982,7 @@
1836
1982
  xaxis: 1,
1837
1983
  yaxis: 4,
1838
1984
  lines: { show: data.graph4charttype == "charttypeline" },
1985
+ points: { show: data.WithPoints },
1839
1986
  bars:
1840
1987
  {
1841
1988
  show: data.graph4charttype == "charttypebar",
@@ -2030,6 +2177,10 @@
2030
2177
  ],
2031
2178
  grid:
2032
2179
  {
2180
+ //hover
2181
+ hoverable: true, //to trigger plothover event on mouse hover or tap on a point
2182
+ clickable: true, //to trigger plotclick event on mouse hover
2183
+
2033
2184
  markings: data.withmarking ? GridMarkings : null,
2034
2185
 
2035
2186
  // backgroundColor: data.nobgcolor ? null : { colors: ["#fff", "#eee"] },
@@ -2060,6 +2211,46 @@
2060
2211
  }
2061
2212
  }
2062
2213
  );
2214
+
2215
+
2216
+ //****************************************************************************************
2217
+ //hover
2218
+
2219
+ console.log("hover start " + widgetID + " " + data.WithHOver);
2220
+ if (data.WithHOver) {
2221
+ console.log("hover start " + widgetID);
2222
+ $('#' + widgetID).bind("plotclick", function (event, pos, item) {
2223
+ console.log("clicked at " + pos.x + ", " + pos.y);
2224
+ // axis coordinates for other axes, if present, are in pos.x2, pos.x3, ...
2225
+ // if you need global screen coordinates, they are pos.pageX, pos.pageY
2226
+
2227
+ if (item) {
2228
+
2229
+ let x = item.datapoint[0];
2230
+ let y = item.datapoint[1].toFixed(2);
2231
+
2232
+ var xDate = new Date(x);
2233
+
2234
+ console.log("clicked a point!" + item.series.label + " " + y + " on " + xDate.toLocaleString() + " = " + $.plot.formatDate(xDate, data.xDateFormat));
2235
+
2236
+ let zindex = $div.css("z-index");
2237
+ zindex++;
2238
+ console.log("z-index " + zindex);
2239
+ //damit Tooltip in Vordergrund erscheind, muss z-index vom widget kleiner sein...
2240
+
2241
+ $("#ebustooltip").html($.plot.formatDate(xDate, data.xDateFormat) + "<br> " + item.series.yaxis.tickFormatter(y, item.series.yaxis))
2242
+ .css({ top: item.pageY + 5, left: item.pageX + 5, "z-index": zindex })
2243
+ .fadeIn(200);
2244
+
2245
+ }
2246
+ else {
2247
+ $("#ebustooltip").stop().hide();
2248
+ }
2249
+ });
2250
+ }
2251
+ //****************************************************************************************
2252
+
2253
+
2063
2254
  }
2064
2255
  };
2065
2256
 
@@ -2162,11 +2353,11 @@
2162
2353
  data-vis-name="ebus"
2163
2354
  data-vis-update-style="true"
2164
2355
  data-vis-attrs="ebusinstance/ebus/onInstanceChanged;"
2165
- data-vis-attrs0="time_interval[30 minutes]/select,1 second,10 seconds,30 seconds,1 minute,2 minutes,5 minutes,10 minutes,30 minutes,1 hour,2 hours,4 hours,8 hours,12 hours,24 hours;withxaxix[true]/checkbox;axislabelcolor[#ffffff]/color;tickscolor[#ffffff]/color;LabelFontSize[8];LabelFontFamily[Arial]/fontname;withmarking[true]/checkbox;markingcolor[#eaebe5]/color;xDateFormat[%H:%M];borderWidth[1];bordercolor[#000000]/color;nobgcolor[true]/checkbox;bgcolor[#FFFFFF]/color;withlegend[false]/checkbox;legendposition[ne]/select,ne,nw,se,sw;"
2166
- data-vis-attrs1="group.graph1;graph1visible[true]/checkbox;oid_historygraph1/id;graph1charttype[charttypeline]/select,charttypeline,charttypebar;graph1Name;graph1color[#f1f113]/color;graph1coloraxis[#1d0ed8]/color;graph1colorticklabel[#1d0ed8]/color;graph1withyaxix[true]/checkbox;graph1YAxisFomat[none]/select,none,kWh,kW,degree;graph1tickLength[5];graph1showMinorTicks[true]/checkbox;graph1showTicks[true]/checkbox;graph1tickDecimals[1];graph1tickSize[3];graph1minTickSize[2];graph1labelwidth[30];"
2167
- data-vis-attrs2="group.graph2;graph2visible[true]/checkbox;oid_historygraph2/id;graph2charttype[charttypeline]/select,charttypeline,charttypebar;graph2Name;graph2color[#f1f113]/color;graph2coloraxis[#1d0ed8]/color;graph2colorticklabel[#1d0ed8]/color;graph2withyaxix[true]/checkbox;graph2YAxisFomat[none]/select,none,kWh,kW,degree;graph2tickLength[5];graph2showMinorTicks[true]/checkbox;graph2showTicks[true]/checkbox;graph2tickDecimals[1];graph2tickSize[3];graph2minTickSize[2];graph2labelwidth[30];"
2168
- data-vis-attrs3="group.graph3;graph3visible[true]/checkbox;oid_historygraph3/id;graph3charttype[charttypeline]/select,charttypeline,charttypebar;graph3Name;graph3color[#f1f113]/color;graph3coloraxis[#1d0ed8]/color;graph3colorticklabel[#1d0ed8]/color;graph3withyaxix[true]/checkbox;graph3YAxisFomat[none]/select,none,kWh,kW,degree;graph3tickLength[5];graph3showMinorTicks[true]/checkbox;graph3showTicks[true]/checkbox;graph3tickDecimals[1];graph3tickSize[3];graph3minTickSize[2];graph3labelwidth[30];"
2169
- data-vis-attrs4="group.graph4;graph4visible[true]/checkbox;oid_historygraph4/id;graph4charttype[charttypeline]/select,charttypeline,charttypebar;graph4Name;graph4color[#f1f113]/color;graph4coloraxis[#1d0ed8]/color;graph4colorticklabel[#1d0ed8]/color;graph4withyaxix[true]/checkbox;graph4YAxisFomat[none]/select,none,kWh,kW,degree;graph4tickLength[5];graph4showMinorTicks[true]/checkbox;graph4showTicks[true]/checkbox;graph4tickDecimals[1];graph4tickSize[3];graph4minTickSize[2];graph4labelwidth[30];"
2356
+ data-vis-attrs0="time_interval[30 minutes]/select,1 second,10 seconds,30 seconds,1 minute,2 minutes,5 minutes,10 minutes,30 minutes,1 hour,2 hours,4 hours,8 hours,12 hours,24 hours;withxaxix[true]/checkbox;axislabelcolor[#ffffff]/color;tickscolor[#ffffff]/color;LabelFontSize[8];LabelFontFamily[Arial]/fontname;withmarking[true]/checkbox;markingcolor[#eaebe5]/color;xDateFormat[%H:%M];borderWidth[1];bordercolor[#000000]/color;nobgcolor[true]/checkbox;bgcolor[#FFFFFF]/color;withlegend[false]/checkbox;legendposition[ne]/select,ne,nw,se,sw;WithHOver[true]/checkbox;WithPoints[true]/checkbox;"
2357
+ data-vis-attrs1="group.graph1;graph1visible[true]/checkbox;oid_historygraph1/id;graph1charttype[charttypeline]/select,charttypeline,charttypebar;graph1Name;graph1color[#f1f113]/color;graph1coloraxis[#1d0ed8]/color;graph1colorticklabel[#1d0ed8]/color;graph1withyaxix[true]/checkbox;graph1YAxisFomat[none]/select,none,kWh,W,kW,degree;graph1tickLength[5];graph1showMinorTicks[true]/checkbox;graph1showTicks[true]/checkbox;graph1tickDecimals[1];graph1tickSize[3];graph1minTickSize[2];graph1labelwidth[30];"
2358
+ data-vis-attrs2="group.graph2;graph2visible[true]/checkbox;oid_historygraph2/id;graph2charttype[charttypeline]/select,charttypeline,charttypebar;graph2Name;graph2color[#f1f113]/color;graph2coloraxis[#1d0ed8]/color;graph2colorticklabel[#1d0ed8]/color;graph2withyaxix[true]/checkbox;graph2YAxisFomat[none]/select,none,kWh,W,kW,degree;graph2tickLength[5];graph2showMinorTicks[true]/checkbox;graph2showTicks[true]/checkbox;graph2tickDecimals[1];graph2tickSize[3];graph2minTickSize[2];graph2labelwidth[30];"
2359
+ data-vis-attrs3="group.graph3;graph3visible[true]/checkbox;oid_historygraph3/id;graph3charttype[charttypeline]/select,charttypeline,charttypebar;graph3Name;graph3color[#f1f113]/color;graph3coloraxis[#1d0ed8]/color;graph3colorticklabel[#1d0ed8]/color;graph3withyaxix[true]/checkbox;graph3YAxisFomat[none]/select,none,kWh,W,kW,degree;graph3tickLength[5];graph3showMinorTicks[true]/checkbox;graph3showTicks[true]/checkbox;graph3tickDecimals[1];graph3tickSize[3];graph3minTickSize[2];graph3labelwidth[30];"
2360
+ data-vis-attrs4="group.graph4;graph4visible[true]/checkbox;oid_historygraph4/id;graph4charttype[charttypeline]/select,charttypeline,charttypebar;graph4Name;graph4color[#f1f113]/color;graph4coloraxis[#1d0ed8]/color;graph4colorticklabel[#1d0ed8]/color;graph4withyaxix[true]/checkbox;graph4YAxisFomat[none]/select,none,kWh,W,kW,degree;graph4tickLength[5];graph4showMinorTicks[true]/checkbox;graph4showTicks[true]/checkbox;graph4tickDecimals[1];graph4tickSize[3];graph4minTickSize[2];graph4labelwidth[30];"
2170
2361
  data-vis-attrs5="group.oids;oid_historydate/id;">
2171
2362
 
2172
2363
  <div class="vis-widget <%== this.data.attr('class') %>" style="width:210px; height:170px;" id="<%= this.data.attr('wid') %>">