templates/reutilisation.html.twig line 1

Open in your IDE?
  1. {% extends 'baseCuveo.html.twig' %}
  2. {# {% block stylesheets %}
  3. <meta charset="utf-8">
  4. {% endblock %} #}
  5. {% block body %}
  6.   <script>
  7.       
  8.       
  9.     // Code JavaScript pour afficher/masquer le texte
  10.     function toggleContent(button, content) {
  11.       button.addEventListener("click", function() {
  12.         if (content.style.display === "none" || content.style.display === "") {
  13.           content.style.display = "block";
  14.           button.textContent = "▲"; // Flèche vers le haut
  15.         } else {
  16.           content.style.display = "none";
  17.           button.textContent = "▼"; // Flèche vers le bas
  18.         }
  19.       });
  20.     }
  21.   </script>
  22.     <br>
  23.     Calcul du taux de réutilisation d'eaux pluviales :
  24.     <br>
  25.     {{ form_start(form) }}
  26.     {{ form_errors(form) }}
  27.             {{ form_label(form.nomDuProjet, 'Nom du projet') }}
  28.             {{ form_widget(form.nomDuProjet, {'attr': {'value': fichePluvio.nomDuProjet}}) }}
  29.     <div class="form-row">
  30.         <div class="form-group col-md-4">
  31.             {{ form_label(form.climat, 'Climat') }}
  32.             {{ form_widget(form.climat, {'attr': {'value': fichePluvio.climat}}) }}</div>
  33.         <div class="form-group col-md-3">
  34.             {{ form_label(form.stationmeteo, 'Station météo') }}
  35.             {{ form_widget(form.stationmeteo, {'attr': {'value': fichePluvio.stationMeteo}}) }}</div>
  36.     </div>
  37.     <div class="form-row">
  38.                 <div class="form-group col-md-4">            
  39.             {{ form_label(form.nomSurface, 'Nom de la surface 1') }}
  40.             {{ form_widget(form.nomSurface, {'attr': {'value': fichePluvio.nomSurface}}) }}</div>
  41.         <div class="form-group col-md-3">            
  42.             {{ form_label(form.surfaceRecuperee, 'Surface de toiture récupérée en m²') }}
  43.             {{ form_widget(form.surfaceRecuperee, {'attr': {'value': fichePluvio.surfaceRecuperee}}) }}</div>
  44.         <div class="form-group col-md-3">
  45.             {{ form_label(form.rendementToiture, 'Type de toiture') }}
  46.             {{ form_widget(form.rendementToiture, {'attr': {'value': fichePluvio.rendementToiture}}) }}</div>
  47.                     <div class="form-group col-md-1">
  48.                     <img src="{{ asset('img/information.png') }}" height="18" title="Kt est le coefficient de rendement de la toiture (La gestion durable de l'eau - CSTB 2009)">
  49.                     </a></div>
  50.     </div>
  51.             
  52.         <div>
  53.         <button type="button" id="toggleButton1" style="font-size: 12px;">▼</button>
  54.         <label for="toggleButton1">Ajouter d'autres toitures:</label>
  55.         </div>
  56.     <div id="texte1" style="display: none;">
  57.     <div class="form-row">
  58.                         <div class="form-group col-md-4">            
  59.             {{ form_label(form.nomSurface2, 'Nom de la surface 2') }}
  60.             {{ form_widget(form.nomSurface2, {'attr': {'value': fichePluvio.nomSurface2}}) }}</div>
  61.         <div class="form-group col-md-3">            
  62.             {{ form_label(form.surfaceRecuperee2, 'Surface n°2 de toiture récupérée') }}
  63.             {{ form_widget(form.surfaceRecuperee2, {'attr': {'value': fichePluvio.surfaceRecuperee2}}) }}</div>
  64.         <div class="form-group col-md-3">
  65.             {{ form_label(form.rendementToiture2, 'Type de toiture n°2') }}
  66.             {{ form_widget(form.rendementToiture2, {'attr': {'value': fichePluvio.rendementToiture2}}) }}</div>
  67.     </div>
  68.     <div class="form-row">
  69.                         <div class="form-group col-md-4">            
  70.             {{ form_label(form.nomSurface3, 'Nom de la surface 3') }}
  71.             {{ form_widget(form.nomSurface3, {'attr': {'value': fichePluvio.nomSurface3}}) }}</div>
  72.         <div class="form-group col-md-3">            
  73.             {{ form_label(form.surfaceRecuperee3, 'Surface n°3 de toiture récupérée') }}
  74.             {{ form_widget(form.surfaceRecuperee3, {'attr': {'value': fichePluvio.surfaceRecuperee3}}) }}</div>
  75.         <div class="form-group col-md-3">
  76.             {{ form_label(form.rendementToiture3, 'Type de toiture n°3') }}
  77.             {{ form_widget(form.rendementToiture3, {'attr': {'value': fichePluvio.rendementToiture3}}) }}</div>
  78.     </div>
  79.     </div>
  80.     <div>
  81.       <button type="button" id="toggleButton2" style="font-size: 12px;">▼</button>
  82.       <label for="toggleButton2">Usage pour les WC :</label>
  83.     </div>
  84.     <div id="texte2" style="display: none;">   
  85.         <div class="form-row">
  86.             <div class="form-group col-md-3">
  87.                 {{ form_label(form.nbreUtilisateur, 'Nombre d\'utilisateur moyen journalier') }}
  88.                 {{ form_widget(form.nbreUtilisateur, {'attr': {'value': fichePluvio.nbreUtilisateur}}) }}</div>
  89.             <div class="form-group col-md-3">
  90.                  {{ form_label(form.volumeParUtilisation, 'Volume par jour par utilisateur (L/jr)') }}
  91.                 {{ form_widget(form.volumeParUtilisation, {'attr': {'value': fichePluvio.volumeParUtilisation}}) }}</div>
  92.             <div class="form-group col-md-2">
  93.                 {{ form_label(form.scenarioUtilisation, 'Scénario d\'utilisation') }}
  94.                 {{ form_widget(form.scenarioUtilisation, {'attr': {'value': fichePluvio.scenarioUtilisation}}) }}</div>
  95.             <div class="form-group col-md-3">
  96.                 {{ form_label(form.tauxRaccordement, 'Taux de WC raccordés en %') }}
  97.                 {{ form_widget(form.tauxRaccordement, {'attr': {'value': fichePluvio.tauxRaccordement}}) }}</div>
  98.         </div>
  99.     </div>
  100.         
  101.     <div>
  102.       <button type="button" id="toggleButton3" style="font-size: 12px;">▼</button>
  103.       <label for="toggleButton3">Usage pour l'arrosage :</label>
  104.     </div>
  105.     <div id="texte3" style="display: none;">
  106.         <div class="form-row">
  107.             <div class="form-group col-md-3">
  108.                 {{ form_label(form.ru, 'Type de sol') }}
  109.                 {{ form_widget(form.ru, {'attr': {'value': fichePluvio.ru}}) }}</div>
  110.             <div class="form-group col-md-3">
  111.                 {{ form_label(form.typePlante, 'Type de plantes') }}
  112.                 {{ form_widget(form.typePlante) }}
  113.                 {#            {{ form_widget(form.typePlante, {'attr': {'value': fichePluvio.typePlante}}) }}
  114.                 #}        </div>
  115.             <div class="form-group col-md-3">
  116.                 {{ form_label(form.profondeurTerre, 'Profondeur de la terre') }}
  117.                 {{ form_widget(form.profondeurTerre, {'attr': {'value': fichePluvio.profondeurTerre}}) }}</div>
  118.             <div class="form-group col-md-3">
  119.                 {{ form_label(form.sArrosage, 'Surface arrosée en m²') }}
  120.                 {{ form_widget(form.sArrosage, {'attr': {'value': fichePluvio.sArrosage}}) }}
  121.             </div>
  122.         </div>
  123.     </div>
  124.     
  125.     <div>
  126.       <button type="button" id="toggleButton4" style="font-size: 12px;">▼</button>
  127.       <label for="toggleButton4">Autres besoins :</label>
  128.     </div>
  129.     <div id="texte4" style="display: none;">
  130.     <div class="form-row">
  131.         <div class="form-group col-md-3">
  132.             {{ form_label(form.besoinEau, 'Autre besoin en eau en litres par jour :') }}
  133.             {{ form_widget(form.besoinEau, {'attr': {'value': fichePluvio.besoinEau}}) }}</div> 
  134.         <div class="form-group col-md-1">
  135.             <img src="{{ asset('img/information.png') }}" height="18" title="Lavage du sol, remplissage de camionnettes autolaveuses... Si le besoin varie suivant les jours, séparez les données par un point-virgule. Les données seront répétées. Exemple : une suite de 7 chiffres '4;0;9;0;0;0;0' pour une suite hebdomadaire">
  136.             </a>
  137.         </div>
  138.     </div>
  139.     </div>        
  140.             
  141.             <div>
  142.       <button type="button" id="toggleButton5" style="font-size: 12px;">▼</button>
  143.       <label for="toggleButton5">Analyse économique :</label>
  144.             </div>
  145.             <div id="texte5" style="display: none;">
  146.                 <div class="form-row" style="background:#f8f9fa">
  147.                 </div>
  148.                 <div class="form-row" style="background:#f8f9fa">
  149.                     <div class="form-group col-md-3">
  150.                         {{ form_label(form.coutEau, 'Coût de l\'eau épargnée en €/m3') }}
  151.                         {{ form_widget(form.coutEau, {'attr': {'value': fichePluvio.coutEau}}) }}
  152.                     </div>
  153.                     <div class="form-group col-md-6">
  154.                         {{ form_label(form.coutPompe, 'Forfait pour le coût de la pompe et du double réseau en €') }}
  155.                         {{ form_widget(form.coutPompe, {'attr': {'value': fichePluvio.coutPompe}}) }}
  156.                     </div>
  157.                 </div>
  158.                 <div class="form-row" style="background:#f8f9fa">
  159.                     <div class="form-group col-md-2">
  160.                         Volumes et coûts de cuve à interpoler :
  161.                     </div>
  162.                     <div class="form-group col-md-2">
  163.                         {{ form_label(form.choixVolume, 'Volume n°1 en litres') }}
  164.                         {{ form_widget(form.choixVolume, {'attr': {'value': fichePluvio.choixVolume}}) }}
  165.                     </div>
  166.                     <div class="form-group col-md-2">
  167.                         {{ form_label(form.coutVolume, 'Coût du volume n°1') }}
  168.                         {{ form_widget(form.coutVolume, {'attr': {'value': fichePluvio.coutVolume}}) }}
  169.                     </div>
  170.                     <div class="form-group col-md-2">
  171.                         {{ form_label(form.choixVolume2, 'Volume n°2 en litres') }}
  172.                         {{ form_widget(form.choixVolume2, {'attr': {'value': fichePluvio.choixVolume2}}) }}
  173.                     </div>
  174.                     <div class="form-group col-md-2">
  175.                         {{ form_label(form.coutVolume2, 'Coût du volume n°2') }}
  176.                         {{ form_widget(form.coutVolume2, {'attr': {'value': fichePluvio.coutVolume2}}) }}
  177.                     </div>
  178.                 </div>
  179.             </div>
  180.           <div class="form-group col-md-4">
  181.             {{ form_label(form.certivea, 'L\'operation est-elle certifiée HQE par Certivéa \?') }}
  182.             {{ form_widget(form.certivea, {'attr': {'value': fichePluvio.certivea}}) }}
  183.         </div>          
  184. <script>
  185. if ({{ fichePluvio.nbreUtilisateur }}0 > 0) {
  186.     document.getElementById("texte2").style.display = "block";
  187.     document.getElementById("toggleButton2").textContent = "▲";
  188. } else {
  189.     document.getElementById("texte2").style.display = "none";
  190.     document.getElementById("toggleButton2").textContent = "▼";
  191. }
  192. if ({{ fichePluvio.surfaceRecuperee2 }}0 > 0) {
  193.     document.getElementById("texte1").style.display = "block";
  194.     document.getElementById("toggleButton1").textContent = "▲";
  195. } else {
  196.     document.getElementById("texte1").style.display = "none";
  197.     document.getElementById("toggleButton1").textContent = "▼";
  198. }
  199. if ({{ fichePluvio.sArrosage }}0 > 0) {
  200.     document.getElementById("texte3").style.display = "block";
  201.     document.getElementById("toggleButton3").textContent = "▲";
  202. } else {
  203.     document.getElementById("texte3").style.display = "none";
  204.     document.getElementById("toggleButton3").textContent = "▼";
  205. }
  206. let besoinEau = parseFloat('{{ fichePluvio.besoinEau|split(";")|first|default(0) }}');
  207. if (besoinEau > 0) {
  208.     document.getElementById("texte4").style.display = "block";
  209.     document.getElementById("toggleButton4").textContent = "▲";
  210. } else {
  211.     document.getElementById("texte4").style.display = "none";
  212.     document.getElementById("toggleButton4").textContent = "▼";
  213. }
  214. // Code JavaScript for afficher le texte lorsque la case est cochée
  215. toggleContent(document.getElementById("toggleButton1"), document.getElementById("texte1"));
  216. toggleContent(document.getElementById("toggleButton2"), document.getElementById("texte2"));
  217. toggleContent(document.getElementById("toggleButton3"), document.getElementById("texte3"));
  218. toggleContent(document.getElementById("toggleButton4"), document.getElementById("texte4"));
  219. toggleContent(document.getElementById("toggleButton5"), document.getElementById("texte5"));
  220. </script>
  221.            {% if  graphParametrique %}     
  222. <BR>
  223. <BR>
  224.      Résultats de l'étude :       
  225. <BR>
  226. <BR>           
  227.             
  228.         <div id="chartParamatrique" style="height: 370px; width: 100%;"></div>
  229.     {% endif %}
  230.      {% if  graphParametrique %}
  231.     <br><br> 
  232.     <table class='table table-striped table-hover table-sm text-center'>
  233.         <thead>
  234.         <tr>
  235.         <th>Volume de la cuve en Litres</th>
  236.         <th >Taux d'autonomie en %</th>
  237.         <th >Quantitée réutilisée moyenne en m3/an</th>
  238.         <th >Complément annuel moyen m3/an</th>
  239.         <th >Trop plein moyen en m3/an</th>
  240.         <th >Gain financier moyen annuel en €/an</th>
  241.         <th >Coût de la cuve + réseau estimée en €HT</th>
  242.         <th >Temps de retour brut en années</th>
  243.         </tr>
  244.     </thead>  
  245.     <tbody>
  246.         {% for Volume in tableauParametrique %}
  247.             <tr>
  248.                 {% for data in Volume %}
  249.                     <td>
  250.                         {{ data }}
  251.                     </td>
  252.                 {% endfor %}
  253.             </tr>
  254.         {% endfor %}
  255.     </tbody>
  256. </table>
  257.             <br><br> 
  258.         <table class='table table-striped table-hover table-sm text-center'>
  259.             <thead>
  260.             <tr>
  261.             <th>Pluviométrie moyenne en mm/an</th>
  262.             <th >Besoin total en eau en m3/an</th>
  263.             <th >Arrosage en mm/an</th>
  264.             </tr>
  265.         </thead>  
  266.         <tbody>
  267.             <tr>
  268.                 <td>
  269.                     {{ tableauSynthese.pluviometrieMoyenne }}
  270.                 </td>
  271.                 <td>
  272.                     {{ tableauSynthese.besoinAnnuel }}
  273.                 </td>
  274.                 <td>
  275.                     {{ tableauSynthese.besoinArrosage }}
  276.                 </td>
  277.             </tr>
  278.         </tbody>
  279.     </table>
  280.                 
  281.     <BR>
  282.     <BR>   
  283.     Obtenez les graphiques jour par jour en choisisssant le volume de la cuve. Un optimum de volume peut être au fléchissement de la courbe du taux de couverture.
  284.     <BR>
  285.     <div class="form-row mt-4" {% if not show_complement %}style="display:none"{% endif %}>
  286.         <div class="form-group col-md-4" >
  287.             {{ form_row(form.volumeCuve, {'label': 'Volume de la cuve choisi en Litres (optionnel) :'}) }}</div>
  288.         <div class="form-group col-md-1 align-self-center d-flex justify-content-center"> OU </div>
  289.         <div class="form-group col-md-4">{{ form_row(form.tauxObjectif, {'label': 'Taux couverture souhaité en %'}) }}</div>
  290.     </div>
  291.     <div class="form-row mt-4">
  292.         <div class="form-group col-md-2">
  293.         {%if show_complement %}
  294.             {{ form_row(form.analyser, {'label': 'Compléter et/ou actualiser l\'analyse'}) }}
  295. {#            <a class="btn btn-primary" href="{{ path('CopieCalcul') }}" role="button">Faire une copie du calcul</a>
  296.             <a class="btn btn-primary" href="{{ path('NouveauCalcul') }}" role="button">Nouveau calcul</a>#}
  297.             {% else %}
  298.             {{ form_row(form.analyser ) }}
  299.             {% endif %}
  300.         </div>
  301.     </div>
  302.     {% else %}
  303.         <div class="form-row mt-4" {% if not show_complement %}style="display:none"{% endif %}>
  304.             <div class="form-group col-md-4">
  305.                 {{ form_row(form.volumeCuve, {'label': 'Volume de la cuve choisi en Litres (optionnel) :'}) }}</div>
  306.             <div class="form-group col-md-1 align-self-center d-flex justify-content-center"> OU</div>
  307.             <div class="form-group col-md-4">{{ form_row(form.tauxObjectif, {'label': 'Taux couverture souhaité en %'}) }}</div>
  308.         </div>
  309.         <div class="form-row mt-4">
  310.             <div class="form-group col-md-2">
  311.                 {% if show_complement %}oo
  312.                     {{ form_row(form.analyser, {'label': 'Compléter et/ou actualiser l\'analyse'}) }}
  313.                 {% else %}
  314.                     {{ form_row(form.analyser ) }}
  315.                 {% endif %}
  316.             </div>
  317.         </div>
  318.     {% endif %}
  319.     
  320. {{ form_rest(form) }}
  321. {{ form_end(form) }}
  322.     <br><br> 
  323.     <script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>   
  324.     {% if  volumeCuveUser %}
  325.         
  326.         Détails pour le volume choisi : {{ volumeCuveUser }} Litres:
  327.         <BR>
  328.         <BR>
  329.         <div id="chartPie" style="height: 370px; width: 100%;"></div>
  330.         <div id="chartPluviometrie" style="height: 100px; width: 100%;"></div><br><br>
  331.         <div id="chartContainer" style="height: 370px; width: 100%;"></div><br><br>
  332.         <div id="chartBarres" style="height: 370px; width: 100%;"></div><br><br>
  333.         
  334.     {% endif %}
  335.    
  336. {% if allowPDF %}
  337. <a class="btn btn-success btnPDF" >Télécharger le bilan en PDF</a>
  338. {% endif %}
  339. <br><br>
  340. {#
  341. {% if  graphParametrique %} Tableau de vérification
  342. <br><br> 
  343. <table class='table table-striped table-hover table-sm'>
  344.     <thead>
  345.     <th>jour</th>
  346.     <th >pluieDuJour</th>
  347.     <th >RFUJournalier</th>
  348.     <th >ETP</th>
  349.     <th >ConsoPlanteJournalier</th>
  350.     <th >besoinArrosageJournalier</th>
  351.     <th >besoinEauJournalier</th>
  352.     <th >volumeEauToiture</th>
  353.     <th >volumeEau</th>
  354.     <th >bilanEau</th>
  355.     <th >manqueEau)</th>
  356. </thead>  
  357. <tbody>
  358.     {% for jour in tableau %}
  359.         <tr>
  360.             {% for data in jour %}
  361.                 <td>
  362.                     {{ data }}
  363.                 </td>
  364.             {% endfor %}
  365.         </tr>
  366.     {% endfor %}
  367. </tbody>
  368. </table>
  369. {% endif %}#}
  370. <script>
  371.     //let myForm = document.getElementById('form');
  372.         document.querySelectorAll('form select').forEach(elem => {
  373.         elem.addEventListener('submit', function(e){ e.preventDefault(); });
  374.     });
  375.     function showFile(blob){
  376.         // It is necessary to create a new blob object with mime-type explicitly set
  377.         // otherwise only Chrome works like it should
  378.         var newBlob = new Blob([blob], {type: "application/pdf"})
  379.         // IE doesn't allow using a blob object directly as link href
  380.         // instead it is necessary to use msSaveOrOpenBlob
  381.         if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  382.             window.navigator.msSaveOrOpenBlob(newBlob);
  383.             return;
  384.         }
  385.         // For other browsers:
  386.         // Create a link pointing to the ObjectURL containing the blob.
  387.         const data = window.URL.createObjectURL(newBlob);
  388.         var link = document.createElement('a');
  389.         link.href = data;
  390.         link.download="bilan.pdf";
  391.         link.click();
  392.         setTimeout(function(){
  393.             // For Firefox it is necessary to delay revoking the ObjectURL
  394.             window.URL.revokeObjectURL(data);
  395.         }, 100);
  396.     }
  397.     const pdfLink="{{ path('RetutilisationBilanPdf',{'idFiche' : idPluvio}) }}";
  398.     const btnPDF = document.querySelector('.btnPDF');
  399.     if (btnPDF) {
  400. // On click convert charts to png and download pdf
  401.         btnPDF.addEventListener('click', () => {
  402.             // create new FormData object
  403.             const formData = new FormData();
  404.             // append form data to formData object
  405.         formData.append('idFiche', {{ idPluvio }});
  406.             // Convert charts to png
  407.         const charts = document.querySelectorAll('.canvasjs-chart-container');
  408.         var index=0;
  409.         charts.forEach(container => {
  410.             chart = container.querySelector('canvas');
  411.             console.log(chart);
  412.                 const img = chart.toDataURL("image/png");
  413.                 // add Img from chart to formData
  414.             formData.append('img['+(index++)+']', img);
  415.             });
  416.             // Send multipart formData to server
  417.             fetch(pdfLink, {
  418.                 method: 'POST',
  419.             body: formData
  420.         }).then(r => r.blob())
  421.             .then(showFile)
  422.         });
  423.     }
  424.     function generatePDF() {
  425.         var doc = new jsPDF();
  426.         doc.fromHTML(document.getElementById('content'), 15, 15, {
  427.             'width': 170
  428.         });
  429.         doc.save('sample-file.pdf');
  430.     }
  431. </script>
  432. <script>
  433.     var renderedImages = [];
  434.     window.onload = function () {
  435.         {% if graphParametrique %}
  436.     var chart = new CanvasJS.Chart("chartParamatrique", {
  437.     animationEnabled: true,
  438.             zoomEnabled: true,
  439.             theme: "light2",
  440.             title: {
  441.             text: "Etude paramétrique de la taille de la cuve"
  442.             },
  443.             axisX: {
  444.             title: "Nombre de litres",
  445.                     titleFontColor: "#4F81BC",
  446.                     includeZero: true,
  447.                     valueFormatString: "# ###L",
  448.             },
  449.             axisY: {
  450.             title: "Taux de couverture des besoins",
  451.                     titleFontColor: "#4F81BC",
  452.                     includeZero: true,
  453.                     suffix: "%"
  454.             },
  455.             axisY2: {
  456.             title: "Temps de retour",
  457.                     titleFontColor: "#4F81BC",
  458.                     includeZero: true,
  459.                     suffix: " ans"
  460.             },
  461.             toolTip: {
  462.             shared: true
  463.             },
  464.             data: [{
  465.             indexLabelFontColor: "darkSlateGray",
  466.                     name: "Taux de couverture",
  467.                     type: "line",
  468.                     markerSize: 0,
  469.                     showInLegend: true,
  470.                     xValueFormatString: "Volume cuve : # ###L",
  471.                     yValueFormatString: "# '%'",
  472.                     dataPoints: [
  473.     {{ graphParametrique }}
  474.                         ]
  475.                 },
  476.                 {
  477.                 indexLabelFontColor: "red",
  478.                         name: "Selection utilisateur",
  479.                         type: "line",
  480.                         markerSize: 12,
  481.                         showInLegend: true,
  482.                         yValueFormatString: "Couverture à #'%'",
  483.                         dataPoints: [
  484.     {{ graphParametriqueUserJson }}
  485.                         ]},
  486.                 {
  487.                 type: "line",
  488.                         name: "Temps de retour",
  489.                         axisYType: "secondary",
  490.                         markerSize: 0,
  491.                         showInLegend: true,
  492.                         yValueFormatString: "0.0 ans",
  493.                         dataPoints:[
  494.     {{ graphTempsDeRetour }}
  495.                         ]
  496.                 }
  497.                 ]
  498.         });
  499.         chart.render();
  500.         renderedImages.push(chart.exportChart({format: "png",toDataURL: true}));
  501.         {% endif %}
  502.         {% if graphJourParJour %}
  503.         {% endif %}
  504.         {% if  volumeCuveUser %}
  505.         var chart1 = new CanvasJS.Chart("chartContainer", {
  506.         animationEnabled: true,
  507.                 zoomEnabled: true,
  508.                 theme: "light2",
  509.                 title: {
  510.                 text: "Niveau de la cuve de la première année"
  511.                 },
  512.                 axisX: {
  513.                 title: "Jour dans l'année",
  514.                         titleFontColor: "#4F81BC",
  515.                         includeZero: true,
  516.                         suffix: ""
  517.                 },
  518.                 axisY: {
  519.                 title: "Nombre de litres",
  520.                         titleFontColor: "#4F81BC",
  521.                         includeZero: true,
  522.                         scaleBreaks: {
  523.                         autoCalculate: true
  524.                         },
  525.                         suffix: " L",
  526.                         maximum:{{graphJourParJour.maximum}}
  527.                 },
  528.                 data: [
  529.                 {
  530.                 indexLabelFontColor: "red",
  531.                         name: "Trop plein de la cuve",
  532.                         type: "area",
  533.                         showInLegend: true,
  534.                         color: "#DF7970",
  535.                         yValueFormatString: "# ##0 L",
  536.                         xValueFormatString: "J#",
  537.                         dataPoints: [
  538.     {{ graphJourParJour.tropPlein }}
  539.                         ]
  540.                 },
  541.                 {
  542.                 indexLabelFontColor: "green",
  543.                         name: "Complément eau de ville",
  544.                         type: "area",
  545.                         showInLegend: true,
  546.                         color:"#51CDA0",
  547.                         yValueFormatString: "# ##0 L",
  548.                         xValueFormatString: "J#",
  549.                         dataPoints: [
  550.     {{ graphJourParJour.manqueEau }}
  551.                         ]
  552.                 },
  553.                 {indexLabelFontColor: "darkSlateGray",
  554.                         name: "Volume d'eau dans la cuve",
  555.                         type: "area",
  556.                         showInLegend: true,
  557.                         color: "#6D78AD",
  558.                         yValueFormatString: "# ##0 L",
  559.                         xValueFormatString: "J#",
  560.                         dataPoints: [
  561.     {{ graphJourParJour.volumeEau }}
  562.                         ]
  563.                 }
  564.                 ]
  565.         });
  566.         chart1.render();
  567.         renderedImages.push(chart1.exportChart({format: "png",toDataURL: true}));
  568.         {% endif %}
  569.         {% if  volumeCuveUser %}
  570.         var chart3 = new CanvasJS.Chart("chartBarres", {
  571.         animationEnabled: true,
  572.                 zoomEnabled: true,
  573.                 theme: "light2",
  574.                 title: {
  575.                 text: "Répartition des besoins jour par jour sur la première année"
  576.                 },
  577.                 axisX: {
  578.                 title: "Jour dans l'année",
  579.                         titleFontColor: "#4F81BC",
  580.                         includeZero: true,
  581.                         suffix: ""
  582.                 },
  583.                 axisY: {
  584.                 title: "Nombre de litres",
  585.                         titleFontColor: "#4F81BC",
  586.                         includeZero: true,
  587.                         suffix: " L"
  588.                 },
  589.                 data: [{
  590.                 indexLabelFontColor: "green",
  591.                         name: "Eau de pluie réutilisée",
  592.                         type: "stackedColumn",
  593.                         yValueFormatString: "# ##0 L",
  594.                         xValueFormatString: "J#",
  595.                         showInLegend: true,
  596.                         dataPoints: [
  597.     {{ graphJourParJour.apportCuve }}
  598.                         ]
  599.                 },
  600.                 {
  601.                 indexLabelFontColor: "darkSlateGray",
  602.                         name: "Complément eau de ville",
  603.                         showInLegend: true,
  604.                         type: "stackedColumn",
  605.                         yValueFormatString: "# ##0 L",
  606.                         xValueFormatString: "J#",
  607.                         dataPoints: [
  608.     {{ graphJourParJour.manqueEauPositif }}
  609.                         ]
  610.                 }
  611.                 ]
  612.         });
  613.         chart3.render();
  614.         renderedImages.push(chart3.exportChart({format: "png",toDataURL: true}));
  615.         {% endif %}
  616.         {% if  volumeCuveUser %}
  617.         var chart2 = new CanvasJS.Chart("chartPluviometrie", {
  618.         animationEnabled: true,
  619.                 theme: "light2",
  620.                 title: {
  621.                 text: "Pluviometrie"
  622.                 },
  623.                 axisX: {
  624.     {#        minimum: new Date(2015, 01, 25),
  625.                     maximum: new Date(2017, 02, 15),
  626.                     valueFormatString: "MMM YY"#}
  627.                                 },
  628.                                 axisY: {
  629.                                 title: "mm par jour",
  630.                                         titleFontColor: "#4F81BC",
  631.                                         includeZero: true,
  632.                                         suffix: ""
  633.                                 },
  634.                                 data: [{
  635.                                 indexLabelFontColor: "darkSlateGray",
  636.                                         name: "views",
  637.                                         type: "area",
  638.                                         yValueFormatString: "0.0",
  639.                                         dataPoints: [
  640.     {{ graphJourParJour.pluviometrie }}
  641.                         ]
  642.                 }]
  643.         });
  644.         chart2.render();
  645.         renderedImages.push(chart2.exportChart({format: "png",toDataURL: true}));
  646.         {% endif %}
  647.         {% if  volumeCuveUser %}
  648.         var chartpie = new CanvasJS.Chart("chartPie", {
  649.         animationEnabled: true,
  650.                 theme: "light2",
  651.                 title: {
  652.                 text: "Répartition des besoins"
  653.                 },
  654.                 data: [{
  655.                 type: "pie",
  656.                         startAngle: 240,
  657.                         yValueFormatString: "0.0%",
  658.                         indexLabel: "{label} {y}",
  659.                         dataPoints: [
  660.                         {y:{{graphTarte.tauxArrosage}}, label: "Arrosage ({{graphTarte.Arrosage}} m3/an) :"},
  661.                         {y:{{graphTarte.tauxWc}}, label: "WC ({{graphTarte.Wc}} m3/an) :"},
  662.                         {y:{{graphTarte.tauxAutres}}, label: "Autres ({{graphTarte.Autres}} m3/an) :"},
  663.                         ]
  664.                 }]
  665.         });
  666.         chartpie.render();
  667.         renderedImages.push(chartpie.exportChart({format: "png",toDataURL: true}));
  668.         {% endif %}
  669.         }
  670. </script>
  671. {% endblock %}