Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.46 KB | None | 0 0
  1.  
  2. /**
  3. * \file 1.html
  4. * \author Knowledge Community, Redon N., Descubes G.
  5. * \version 1.0
  6. * \date 20 Aout 2013
  7. * \brief Page d'accueil du concentrateur
  8. *
  9. * \details Permet de visualiser les consommations electriques instantanées.
  10. * \n Visualisation des consommations de deux entrées impulsionnelles (Gaz et Eau par défaut).
  11. * \n Affichage des cinq entrées de mesure Tore sur un graphe de type histogramme horizontal créé avec la bibliothèque Javascript Highcharts
  12. */
  13.  
  14. var jour = 28;
  15. var mois = 10;
  16. var annee = 16;
  17. var heure = 23;
  18. var minute = 31;
  19.  
  20. var version = "3.0.15";
  21.  
  22. //mantis 3694: Présence d'une conso de 1Wh sur certaines voies vides
  23. var conso_minimum = 9;
  24.  
  25. /**
  26. * \brief Fonction Ajax qui récupère les consommations instantanées
  27. * \details Récupère les données provenant du fichier JSON inst.json.
  28. * \n Recharge les données du graphe et des consommations impulsionnelles.
  29. */
  30. function RefreshRepartitionAjax(){
  31. $.ajax({
  32. type: "GET",
  33. dataType:"json",
  34. url: "inst.json",
  35. cache: false,
  36. //complete: une_fonction_on_complete(),
  37. success: function myChangeDatas(reponse){
  38. c1 = 0;
  39. if (parseInt(reponse.data1) > conso_minimum){
  40. c1 = parseInt(reponse.data1);
  41. }
  42. c2 = 0;
  43. if (parseInt(reponse.data2) > conso_minimum){
  44. c2 = parseInt(reponse.data2);
  45. }
  46. c3 = 0;
  47. if (parseInt(reponse.data3) > conso_minimum){
  48. c3 = parseInt(reponse.data3);
  49. }
  50. c4 = 0;
  51. if (parseInt(reponse.data4) > conso_minimum){
  52. c4 = parseInt(reponse.data4);
  53. }
  54. c5 = 0;
  55. if (parseInt(reponse.data5) > conso_minimum){
  56. c5 = parseInt(reponse.data5);
  57. }
  58.  
  59. c6 = reponse.data6.toFixed(2);
  60. c6m3 = reponse.data6m3.toFixed(2);
  61. c7 = reponse.data7.toFixed(2);
  62. c7m3 = reponse.data7m3.toFixed(2);
  63.  
  64. //Mantis 4039 : extension radio
  65. c8 = reponse.CIR1_Nrj.toFixed(2);
  66. //3748: Usage des informations HC HP
  67. //c8_part = reponse.CIR1_Nrj_part.toFixed(2);
  68. c8m3 = reponse.CIR1_Vol.toFixed(2);
  69. //c8m3_part = reponse.CIR1_Vol_part.toFixed(2);
  70.  
  71. c9 = reponse.CIR2_Nrj.toFixed(2);
  72. //3748: Usage des informations HC HP
  73. //c9_part = reponse.CIR2_Nrj_part.toFixed(2);
  74. c9m3 = reponse.CIR2_Vol.toFixed(2);
  75. //c9m3_part = reponse.CIR2_Vol_part.toFixed(2);
  76.  
  77. c10 = reponse.CIR3_Nrj.toFixed(2);
  78. //3748: Usage des informations HC HP
  79. //c10_part = reponse.CIR3_Nrj_part.toFixed(2);
  80. c10m3 = reponse.CIR3_Vol.toFixed(2);
  81. //c10m3_part = reponse.CIR3_Vol_part.toFixed(2);
  82.  
  83. c11 = reponse.CIR4_Nrj.toFixed(2);
  84. //3748: Usage des informations HC HP
  85. //c11_part = reponse.CIR4_Nrj_part.toFixed(2);
  86. c11m3 = reponse.CIR4_Vol.toFixed(2);
  87. //c11m3_part = reponse.CIR4_Vol_part.toFixed(2);
  88.  
  89. //Mantis 4039 : extension radio
  90. var timestamp = reponse.Date_Time;
  91. var date_to_display = new Date(timestamp * 1000);
  92. heure = twoDigitsTime(date_to_display.getUTCHours());
  93. minute = twoDigitsTime(date_to_display.getUTCMinutes());
  94.  
  95. changeDatas(); //Raffraichissement du graphe
  96. inputDatas();
  97. inputDatasRel();
  98. }
  99. });
  100. }
  101.  
  102. /**
  103. * \brief Fonction récursive de mise a jour des données
  104. * \details Fonction récursive qui rappelle chaque seconde la fonction de mise à jour des données RefreshRepartitionAjax()
  105. */
  106. function loopedback(){
  107. setTimeout(function(){
  108. loopedback();
  109. RefreshRepartitionAjax();
  110. },1000);
  111. }
  112.  
  113.  
  114. /**
  115. * \brief Fonction qui met a jour les données du graphique dynamiquement
  116. * \details Met a jour les données du graphique Highchart avec les données provenant des requetes Ajax.
  117. * \n Cette fonction est appelée par RefreshRepartitionAjax()
  118. */
  119. function changeDatas(){
  120. var chart = $('#container').highcharts();
  121.  
  122. //Met à jour avec animation
  123. chart.series[0].data[0].update(c1,true);
  124. chart.series[1].data[1].update(c2,true);
  125. chart.series[2].data[2].update(c3,true);
  126. chart.series[3].data[3].update(c4,true);
  127. chart.series[4].data[4].update(c5,true);
  128.  
  129. }
  130.  
  131. /**
  132. * \brief Fonction qui met a jour les données des entrées impulsionnelles
  133. * \details Met a jour les données des deux entrées impulsionnelles, le nom ansi que la valeur sont rechargés avec les données provenant des requetes Ajax.
  134. * \n Cette fonction est appelée par RefreshRepartitionAjax()
  135. */
  136. function inputDatas(){
  137. var unite_kwh = " kWh";
  138. var unite_m3 = " m<sup>3</sup>";
  139.  
  140. if(0 == 1){ //Si entree 1 est affectee a Eau froide, on affiche des m3
  141. $('#entree1_value').html(c6m3.toString()+unite_m3);
  142. }else{ // Pas pour le reste
  143. $('#entree1_value').html(c6.toString()+unite_kwh);
  144. }
  145.  
  146. if(1 == 1){ //Si entree 2 est affectee a Eau froide, on affiche des m3
  147. $('#entree2_value').html(c7m3.toString()+unite_m3);
  148. }else{ // Pas pour le reste
  149. $('#entree2_value').html(c7.toString()+unite_kwh);
  150. }
  151.  
  152. //Mantis 4039 : extension radio
  153. if(1 == 1){ //Si entree 3 est affectee a Eau froide, on affiche des m3
  154. $('#entree3_value').html(c8m3.toString()+unite_m3);
  155. }else{ // Pas pour le reste
  156. $('#entree3_value').html(c8.toString()+unite_kwh);
  157. }
  158. if(1 == 1){ //Si entree 4 est affectee a Eau froide, on affiche des m3
  159. $('#entree4_value').html(c9m3.toString()+unite_m3);
  160. }else{ // Pas pour le reste
  161. $('#entree4_value').html(c9.toString()+unite_kwh);
  162. }
  163. if(1 == 1){ //Si entree 5 est affectee a Eau froide, on affiche des m3
  164. $('#entree5_value').html(c10m3.toString()+unite_m3);
  165. }else{ // Pas pour le reste
  166. $('#entree5_value').html(c10.toString()+unite_kwh);
  167. }
  168. if(1 == 1){ //Si entree 6 est affectee a Eau froide, on affiche des m3
  169. $('#entree6_value').html(c11m3.toString()+unite_m3);
  170. }else{ // Pas pour le reste
  171. $('#entree6_value').html(c11.toString()+unite_kwh);
  172. }
  173.  
  174. displayTime();
  175. }
  176.  
  177. /**
  178. * \brief Fonction qui met a jour les données des entrées non electriques
  179. * \details Met a jour les données des deux entrées impulsionnelles, le nom ansi que la valeur sont rechargés avec les données provenant des requetes Ajax.
  180. * \n Cette fonction est appelée par RefreshRepartitionAjax()
  181. */
  182. function inputDatasRel(){
  183. var unite_kwh = " kWh";
  184. var unite_m3 = " m<sup>3</sup>";
  185.  
  186. //Mantis 4039 : extension radio
  187. if(1 == 1){ //Si entree 1 est affectee a Eau froide, on affiche des m3
  188. $('#entree3_part_value').html(c8m3_part.toString()+unite_m3);
  189. }else{ // Pas pour le reste
  190. $('#entree3_part_value').html(c8_part.toString()+unite_kwh);
  191. }
  192. if(1 == 1){ //Si entree 1 est affectee a Eau froide, on affiche des m3
  193. $('#entree4_part_value').html(c9m3_part.toString()+unite_m3);
  194. }else{ // Pas pour le reste
  195. $('#entree4_part_value').html(c9_part.toString()+unite_kwh);
  196. }
  197. if(1 == 1){ //Si entree 1 est affectee a Eau froide, on affiche des m3
  198. $('#entree5_part_value').html(c10m3_part.toString()+unite_m3);
  199. }else{ // Pas pour le reste
  200. $('#entree5_part_value').html(c10_part.toString()+unite_kwh);
  201. }
  202. if(1 == 1){ //Si entree 1 est affectee a Eau froide, on affiche des m3
  203. $('#entree6_part_value').html(c11m3_part.toString()+unite_m3);
  204. }else{ // Pas pour le reste
  205. $('#entree6_part_value').html(c11_part.toString()+unite_kwh);
  206. }
  207. }
  208.  
  209. /** \brief Fonction qui affiche la date au bon format suivant la langue*/
  210. function displayDate(){
  211. jour = twoDigitsTime(jour);
  212. mois = twoDigitsTime(mois);
  213. annee = "20"+annee;
  214. if(lang == "en"){
  215. $('#date_displayed').html(mois+"/"+jour+"/"+annee);
  216. }
  217. else{
  218. $('#date_displayed').html(jour+"/"+mois+"/"+annee);
  219. }
  220. }
  221.  
  222. /** \brief Fonction qui affiche l'heure au bon format suivant la langue*/
  223. function displayTime(){
  224. var h = parseInt(heure);
  225. var m = parseInt(minute);
  226. var add = "";
  227.  
  228. if(lang == "en"){
  229. if(h == 12) // midi
  230. add = " PM";
  231. else if(h == 0){ //minuit
  232. h += 12;
  233. add = " AM";
  234. }else if(h > 12){
  235. h -= 12;
  236. add = " PM";
  237. }else
  238. add = " AM";
  239. }
  240.  
  241. $('#hour_displayed').html(twoDigitsTime(h));
  242. $('#minute_displayed').html(twoDigitsTime(m)+add);
  243. }
  244.  
  245.  
  246. /**
  247. * \brief Fonction d'initialisation
  248. * \details Récupère les principales variables utiles.
  249. * \n Telles que la langue, les tarifs en cours, les consommations effectives, les noms des circuits avec les labels traduits avec la fonction getLabel(), la date et l'heure du concentrateur
  250. */
  251. function getDatas(){
  252. lang = (1 == 1) ? 'fr' : 'en' ;//langue
  253.  
  254. tarif = 1; // tarif
  255. isousc = "60"; //intensite souscrite
  256. /*
  257. conso_base = 0.000000;
  258. conso_hc = 4.140625;
  259. conso_hp = 2.062500;
  260. conso_hc_b = 0.000000;
  261. conso_hp_b = 0.000000;
  262. conso_hc_w = 0.000000;
  263. conso_hp_w = 0.000000;
  264. conso_hc_r = 0.000000;
  265. conso_hp_r = 0.000000;
  266. */
  267. //Mantis 3748
  268. conso_base = '0';
  269. if (conso_base != ''){ conso_base = parseFloat(conso_base)/1000;} else { conso_base = 0;}
  270. conso_hc = '100792995';
  271. if (conso_hc != ''){ conso_hc = parseFloat(conso_hc)/1000} else { conso_hc = 0;}
  272. conso_hp = '125303152';
  273. if (conso_hp != ''){ conso_hp = parseFloat(conso_hp)/1000} else { conso_hp = 0;}
  274. conso_hc_b = '0';
  275. if (conso_hc_b != ''){ conso_hc_b = parseFloat(conso_hc_b)/1000} else { conso_hc_b = 0;}
  276. conso_hp_b = '0';
  277. if (conso_hp_b != ''){ conso_hp_b = parseFloat(conso_hp_b)/1000} else { conso_hp_b = 0;}
  278. conso_hc_w = '0';
  279. if (conso_hc_w != ''){ conso_hc_w = parseFloat(conso_hc_w)/1000} else { conso_hc_w = 0;}
  280. conso_hp_w = '0';
  281. if (conso_hp_w != ''){ conso_hp_w = parseFloat(conso_hp_w)/1000} else { conso_hp_w = 0;}
  282. conso_hc_r = '0';
  283. if (conso_hc_r != ''){ conso_hc_r = parseFloat(conso_hc_r)/1000} else { conso_hc_r = 0;}
  284. conso_hp_r = '0';
  285. if (conso_hp_r != ''){ conso_hp_r = parseFloat(conso_hp_r)/1000} else { conso_hp_r = 0;}
  286.  
  287. //circuits
  288. c1Name = getLabel("Chauffage");
  289. c1 = 398.000000;
  290. //mantis 3694: Présence d'une conso de 1Wh sur certaines voies vides
  291. if (c1 <= conso_minimum){
  292. c1 = 0;
  293. }
  294.  
  295. c2Name = getLabel("Refroidissement");
  296. c2 = 0.000000;
  297. //mantis 3694: Présence d'une conso de 1Wh sur certaines voies vides
  298. if (c2 <= conso_minimum){
  299. c2 = 0;
  300. }
  301.  
  302. c3Name = getLabel("Eau chaude");
  303. c3 = 0.000000;
  304. //mantis 3694: Présence d'une conso de 1Wh sur certaines voies vides
  305. if (c3 <= conso_minimum){
  306. c3 = 0;
  307. }
  308.  
  309. c4Name = getLabel("Prises de Courant");
  310. c4 = 0.000000;
  311. //mantis 3694: Présence d'une conso de 1Wh sur certaines voies vides
  312. if (c4 <= conso_minimum){
  313. c4 = 0;
  314. }
  315.  
  316. c5Name = getLabel("Prises de Courant");
  317. c5 = 0.000000;
  318. //mantis 3694: Présence d'une conso de 1Wh sur certaines voies vides
  319. if (c5 <= conso_minimum){
  320. c5 = 0;
  321. }
  322. //mantis 3768 : Label eau et gaz par defaut a la sortie d'usine
  323. c6Name = getLabel("Gaz");
  324. c6 = 0.000000.toFixed(2);
  325. c6m3 = 0.000000.toFixed(2);
  326.  
  327. //mantis 3768 : Label eau et gaz par defaut a la sortie d'usine
  328. c7Name = getLabel("Eau");
  329. c7 = 0.000000.toFixed(2);
  330. c7m3 = 0.000000.toFixed(2);
  331.  
  332. //mantis 4039 : extensions radio
  333. c8Name = getLabel("Eau");
  334. c8 = 0.000000.toFixed(2);
  335. //3748: Usage des informations HC HP
  336. c8_part = 0.000000.toFixed(2);
  337. c8m3 = 0.000000.toFixed(2);
  338. c8m3_part = 0.000000.toFixed(2);
  339.  
  340. c9Name = getLabel("Eau");
  341. c9 = 0.000000.toFixed(2);
  342. //3748: Usage des informations HC HP
  343. c9_part = 0.000000.toFixed(2);
  344. c9m3 = 0.000000.toFixed(2);
  345. c9m3_part = 0.000000.toFixed(2);
  346.  
  347. c10Name = getLabel("Eau");
  348. c10 = 0.000000.toFixed(2);
  349. //3748: Usage des informations HC HP
  350. c10_part = 0.000000.toFixed(2);
  351. c10m3 = 0.000000.toFixed(2);
  352. c10m3_part = 0.000000.toFixed(2);
  353.  
  354. c11Name = getLabel("Eau");
  355. c11 = 0.000000.toFixed(2);
  356. //3748: Usage des informations HC HP
  357. c11_part = 0.000000.toFixed(2);
  358. c11m3 = 0.000000.toFixed(2);
  359. c11m3_part = 0.000000.toFixed(2);
  360.  
  361. //mantis 4039 : affichage des entrée si coché ou pas dans les parametres
  362. entree1Disable = 1;
  363. entree2Disable = 1;
  364. entree3Disable = 1;
  365. entree4Disable = 1;
  366. entree5Disable = 1;
  367. entree6Disable = 1;
  368. }
  369.  
  370. /**
  371. * \brief Fonction d'affichage du tarif
  372. * \details Remplace les différents éléments HTML de la page avec les informations adéquates concernant le tarif en cours transmis par le Téléinfo.
  373. */
  374. function displayFare(){
  375.  
  376. if(isousc == "")
  377. $('#isouscrite').html('<span>ti</span>');
  378. else{
  379. var kva_isousc = isousc/5;
  380. $('#isouscrite').html(isousc+ " A - "+kva_isousc+" kVA");
  381. }
  382.  
  383. // if(tarif == 11)
  384. // tarif = 0;
  385.  
  386. switch(tarif){
  387. case 0:
  388. //if (conso_base == 0){
  389. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  390. //} else {
  391. $('#val_t_en_cours').html('<span>tarif_base</span>');
  392. //}
  393. $('#title_i_conso_1').html('<span>kwh_conso_base</span>'); $('#val_i_conso_1').html(conso_base.toFixed(2)+' kWh');
  394. break;
  395. case 1:
  396. //if (conso_hc == 0 && conso_hp == 0){
  397. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  398. //} else {
  399. $('#val_t_en_cours').html('<span>tarif_hc</span>');
  400. //}
  401. $('#title_i_conso_1').html('<span>kwh_consomes_hc</span>'); $('#val_i_conso_1').html(conso_hc.toFixed(2)+' kWh');
  402. $('#title_i_conso_2').html('<span>kwh_consomes_hp</span>'); $('#val_i_conso_2').html(conso_hp.toFixed(2)+' kWh');
  403. break;
  404. case 2:
  405. //if (conso_hc == 0 && conso_hp == 0){
  406. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  407. //} else {
  408. $('#val_t_en_cours').html('<span>tarif_hp</span>');
  409. //}
  410. $('#title_i_conso_1').html('<span>kwh_conso_hc</span>'); $('#val_i_conso_1').html(conso_hc.toFixed(2)+' kWh');
  411. $('#title_i_conso_2').html('<span>kwh_conso_hp</span>'); $('#val_i_conso_2').html(conso_hp.toFixed(2)+' kWh');
  412. break;
  413. case 3:
  414. //if (conso_base == 0){
  415. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  416. //} else {
  417. $('#val_t_en_cours').html('<span>tarif_h_normale</span>');
  418. //}
  419. $('#title_i_conso_1').html('<span>kwh_conso_normale</span>'); $('#val_i_conso_1').html(conso_base.toFixed(2)+' kWh'); //correspond a EJP sur simu téléinfo
  420. break;
  421. case 4:
  422. //if (conso_base == 0){
  423. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  424. //} else {
  425. $('#val_t_en_cours').html('<span>tarif_hpm</span>');
  426. //}
  427. $('#title_i_conso_1').html('<span>kwh_conso_hpm</span>'); $('#val_i_conso_1').html(conso_base.toFixed(2)+' kWh');//correspond a heure de pointe mobile dans la doc
  428. break;
  429. case 5:
  430. //if (conso_base == 0){
  431. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  432. //} else {
  433. $('#val_t_en_cours').html('<span>tempo_bleu_creuse</span>');
  434. //}
  435. break;
  436. case 6:
  437. //if (conso_base == 0){
  438. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  439. //} else {
  440. $('#val_t_en_cours').html('<span>tempo_blanc_creuse</span>');
  441. //}
  442. break;
  443. case 7:
  444. //if (conso_base == 0){
  445. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  446. //} else {
  447. $('#val_t_en_cours').html('<span>tempo_rouge_creuse</span>');
  448. //}
  449. break;
  450. case 8:
  451. //if (conso_base == 0){
  452. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  453. //} else {
  454. $('#val_t_en_cours').html('<span>tempo_bleu_pleine</span>');
  455. //}
  456. break;
  457. case 9:
  458. //if (conso_base == 0){
  459. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  460. //} else {
  461. $('#val_t_en_cours').html('<span>tempo_blanc_pleine</span>');
  462. //}
  463. break;
  464. case 10:
  465. //if (conso_base == 0){
  466. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  467. //} else {
  468. $('#val_t_en_cours').html('<span>tempo_rouge_pleine</span>');
  469. //}
  470. break;
  471. case 11:
  472. $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  473. $('#title_i_conso_1').html('<span>kwh_conso_base</span>'); $('#val_i_conso_1').html(conso_base.toFixed(2)+' kWh');
  474. break;
  475. default:
  476. //if (conso_hc == 0 && conso_hp == 0){
  477. // $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  478. //} else {
  479. $('#val_t_en_cours').html('<span>no_teleinfo</span>');
  480. //}
  481. $('#title_i_conso_7').html('<span>kwh_consomes_hc</span>'); $('#val_i_conso_7').html(conso_hc.toFixed(2)+' kWh');
  482. $('#title_i_conso_8').html('<span>kwh_consomes_hp</span>'); $('#val_i_conso_8').html(conso_hp.toFixed(2)+' kWh');
  483. }
  484. var style ="display:inline-block;width:20px; height:15px; margin-left:25px; vertical-align:middle;";
  485.  
  486. if(tarif > 4 && tarif != 11){
  487. widthDiv = "120px";
  488. if(lang=='fr'){
  489. widthDiv = "90px";
  490. }
  491.  
  492. $('#title_i_conso_1').html('<div style="display:inline-block;width:'+widthDiv+'"><span>conso_hc_b</span></div><div style="background-color:blue;'+style+'">&nbsp;</div>'); $('#val_i_conso_1').html(conso_hc_b.toFixed(2)+' kWh');
  493. $('#title_i_conso_2').html('<div style="display:inline-block;width:'+widthDiv+'"><span>conso_hp_b</span></div><div style="background-color:blue; '+style+'">&nbsp;</div>'); $('#val_i_conso_2').html(conso_hp_b.toFixed(2)+' kWh');
  494. $('#title_i_conso_3').html('<div style="display:inline-block;width:'+widthDiv+'"><span>conso_hc_w</span></div><div style="background-color:white; '+style+'">&nbsp;</div>'); $('#val_i_conso_3').html(conso_hc_w.toFixed(2)+' kWh');
  495. $('#title_i_conso_4').html('<div style="display:inline-block;width:'+widthDiv+'"><span>conso_hp_w</span></div><div style="background-color:white; '+style+'">&nbsp;</div>'); $('#val_i_conso_4').html(conso_hp_w.toFixed(2)+' kWh');
  496. $('#title_i_conso_5').html('<div style="display:inline-block;width:'+widthDiv+'"><span>conso_hc_r</span></div><div style="background-color:red; '+style+'">&nbsp;</div>'); $('#val_i_conso_5').html(conso_hc_r.toFixed(2)+' kWh');
  497. $('#title_i_conso_6').html('<div style="display:inline-block;width:'+widthDiv+'"><span>conso_hp_r</span></div><div style="background-color:red;'+style+'">&nbsp;</div>'); $('#val_i_conso_6').html(conso_hp_r.toFixed(2)+' kWh');
  498. }
  499. }
  500.  
  501. /**
  502. * \brief Fonction d'affichage de la version
  503. * \details Affiche la version de l'EcoCompteur ou 1.0.10 sinon
  504. */
  505. function displayVersion(){
  506. if(version=="?"){
  507. version="1.0.10"
  508. }
  509. $("#version").html("v "+version);
  510. }
  511.  
  512.  
  513. /**
  514. * \brief Fonction principale de la page
  515. * \details Point d'entrée JQuery qui intervient après la fin du chargement de la page.
  516. * \n Appel des différentes fonctions d'initialisation et tracage du graphe principal.
  517. * \n Les évènements relatifs a l'affichage de fenètres modales pour l'accès a l'administration et l'indication de favoris sont détectés ici.
  518. * \n Changement du titre html de la page
  519. */
  520. $(function () {
  521. getDatas();
  522. displayDate();
  523. //displayTime();
  524. inputDatas(); //Affiche la conso des entrées impulsionnelles + l'heure
  525. inputDatasRel(); //3991: Visualiser les informations de comptage non électrique
  526. document.title = translateSentence('title_html_accueil',lang);
  527. Highcharts.setOptions({
  528. colors: ["#D7FF82", "#FCC646", "#E62EF7", "#007DFF", "#E8FBFF", "#FFE400", "#5DFFF5", "#77a1e5", "#c42525", "#a6c96a","#f26d7d","#8781bd","#c7b299", "#fff799"]
  529. });
  530.  
  531. colorCharts();
  532. loopedback();
  533. $('.entree1_name').html(translateIfPossible(getCleanedSpaceString(c6Name), lang));
  534. $('.entree2_name').html(translateIfPossible(getCleanedSpaceString(c7Name), lang));
  535. $('.entree3_name').html(translateIfPossible(getCleanedSpaceString(c8Name), lang));
  536. $('.entree4_name').html(translateIfPossible(getCleanedSpaceString(c9Name), lang));
  537. $('.entree5_name').html(translateIfPossible(getCleanedSpaceString(c10Name), lang));
  538. $('.entree6_name').html(translateIfPossible(getCleanedSpaceString(c11Name), lang));
  539. displayFare();
  540. displayVersion();
  541. translateContent(lang);//traduction
  542. $("#admin").click(function() {ConfirmAdmin(lang)}); // administration
  543. $("#bookmark").click(function() {ModalBookmark(lang)}); // bookmark
  544.  
  545.  
  546. $("#dialog-modal").attr("title",translateSentence('title_modal_admin',lang));
  547. $("#dialog-modal-bookmark").attr("title",translateSentence('bookmark',lang));
  548.  
  549. // Build the chart
  550. $('#container').highcharts({
  551. chart: {
  552. type: 'bar',
  553. plotBackgroundColor: null,
  554. plotBorderWidth: null,
  555. plotShadow: false,
  556. backgroundColor: null
  557. },
  558. title: {
  559. text: ''
  560. },
  561. xAxis: {
  562. categories: [c1Name, c2Name, c3Name, c4Name, c5Name],
  563. labels: {
  564. style: {
  565. color: 'black'
  566. },
  567. }
  568. },
  569. yAxis: {
  570. min: 0,
  571. title: {
  572. text: ''
  573. },
  574. stackLabels: {
  575. enabled: true,
  576. align: 'center',
  577. style: {
  578. color: 'white',
  579. },
  580. formatter: function() {
  581. if(this.total == null)
  582. return '';
  583. else
  584. return this.total+" W";
  585. },
  586. },
  587. labels: {
  588. style: {
  589. color: 'black',
  590. },
  591. formatter: function() {
  592. return this.value;
  593. }
  594. }
  595. },
  596. tooltip: {
  597. formatter: function() {
  598. return '<b>'+this.series.name+'</b><br/>' + this.y + ' W';
  599. }
  600. },
  601. legend: {
  602. backgroundColor: '#8A7F72',
  603. enabled: true,
  604. itemStyle: {
  605. color: '#FFF'
  606. }
  607. },
  608. plotOptions: {
  609. series: {
  610. stacking: "normal",
  611. }
  612. },
  613. series: [{
  614. name: c1Name,
  615. data: [c1, null, null, null, null]
  616. }, {
  617. name: c2Name,
  618. data: [null, c2, null, null, null]
  619. }, {
  620. name: c3Name,
  621. data: [null, null, c3, null, null]
  622. }
  623. , {
  624. name: c4Name,
  625. data: [null, null, null, c4, null]
  626. }
  627. , {
  628. name: c5Name,
  629. data: [null, null, null, null, c5]
  630. }],
  631. exporting: {
  632. buttons: [
  633. {
  634. enabled: false
  635. }
  636. ]
  637. },
  638. credits: {
  639. enabled: false
  640. },
  641. lang: {
  642. noData: translateSentence("no_data",lang)
  643. }
  644. });
  645.  
  646. //mantis 4039 : affichage des entrée si coché ou pas dans les parametres
  647. if(entree1Disable == 0){
  648. $("#entree1_tr").show();
  649. }
  650. if(entree2Disable == 0){
  651. $("#entree2_tr").show();
  652. }
  653. if(entree3Disable == 0){
  654. $("#entree3_tr").show();
  655. //3991: Visualiser les informations de comptage non électrique
  656. $("#entree3_tr_part").show();
  657. }
  658. if(entree4Disable == 0){
  659. $("#entree4_tr").show();
  660. //3991: Visualiser les informations de comptage non électrique
  661. $("#entree4_tr_part").show();
  662. }
  663. if(entree5Disable == 0){
  664. $("#entree5_tr").show();
  665. //3991: Visualiser les informations de comptage non électrique
  666. $("#entree5_tr_part").show();
  667. }
  668. if(entree6Disable == 0){
  669. $("#entree6_tr").show();
  670. //3991: Visualiser les informations de comptage non électrique
  671. $("#entree6_tr_part").show();
  672. }
  673.  
  674. /*
  675. //cartouches repliables
  676. $( ".toogle-title" ).click(function() {
  677. $(this).next().toggle("blind");
  678. });
  679. */
  680.  
  681. //Mantis 4100
  682. $("#loader").fadeOut("fast");
  683.  
  684. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement