Riga 30: Riga 30:
  
 
<script>
 
<script>
 +
// REGIONI
 
Plotly.d3.csv('https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-regioni/dpc-covid19-ita-regioni.csv', function(err, rows){
 
Plotly.d3.csv('https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-regioni/dpc-covid19-ita-regioni.csv', function(err, rows){
  
Riga 283: Riga 284:
 
         var d = new Date();
 
         var d = new Date();
 
         if (d.getHours()<18){
 
         if (d.getHours()<18){
             var when = d.getDate()-1;
+
             var when = d.setDate(d.getDate()-1);
 
         }else{
 
         }else{
             var when = d.getDate();
+
             var when = d;
 
         }
 
         }
 
         [dx, dy,lname, when] = get_logistic(chosenCountry,when);
 
         [dx, dy,lname, when] = get_logistic(chosenCountry,when);
Riga 335: Riga 336:
 
                 width: 2
 
                 width: 2
 
             }
 
             }
         };
+
         };      
  
 
         var data = [trace8,  
 
         var data = [trace8,  
Riga 349: Riga 350:
 
                     trace6,
 
                     trace6,
 
                     trace10,
 
                     trace10,
                     trace13, trace14, trace15, trace16];
+
                     trace13, trace14, trace15, trace16,];
  
 
         var updatemenus=[
 
         var updatemenus=[
Riga 437: Riga 438:
 
         return Math.floor(Math.random() * (max - min)) + min; //Il max è escluso e il min è incluso
 
         return Math.floor(Math.random() * (max - min)) + min; //Il max è escluso e il min è incluso
 
     }
 
     }
 +
 +
    function rapporto(a,b){
 +
        var v = [];
 +
        for (var i=0;i<a.length;i++){
 +
            v.push(a[i]/b[i] * 100);
 +
        }
 +
       
 +
        return v;
 +
    }
 +
    function get_diff(vect){
 +
        var vdiff = [];
 +
        vdiff.push(0);
 +
        for (var i=1;i<vect.length;i++){
 +
            vdiff.push(vect[i]-vect[i-1]);
 +
        }
 +
       
 +
        return vdiff;
 +
    }
 +
    function formatDate(date) {
 +
        var d = new Date(date),
 +
            month = '' + (d.getMonth() + 1),
 +
            day = '' + d.getDate(),
 +
            year = d.getFullYear();
 +
   
 +
        if (month.length < 2)
 +
            month = '0' + month;
 +
        if (day.length < 2)
 +
            day = '0' + day;
 +
   
 +
        return [year, month, day].join('-');
 +
    };
 +
 +
    function formatDate2(date) {
 +
        var d = new Date(date),
 +
            month = '' + (d.getMonth() + 1),
 +
            day = '' + d.getDate()
 +
   
 +
        if (month.length < 2)
 +
            month = '0' + month;
 +
        if (day.length < 2)
 +
            day = '0' + day;
 +
   
 +
        return [day, month].join('.');
 +
    };
 +
 
     function get_logistic(chosenCountry,when){
 
     function get_logistic(chosenCountry,when){
         //document.write('./'+chosenCountry + '.csv');
+
         d = formatDate(when);
         //
+
         d2 = formatDate2(when);
       
+
         var nome = d2+' - Fitting';
         var nome = when+'.04 - Fitting';
 
 
         var x = [];
 
         var x = [];
 
         var y = [];
 
         var y = [];
        when = '0' + when;
+
         var url = "https://raw.githubusercontent.com/vtandrea/labtest/master/"+d+chosenCountry+".csv";
         var url = "https://raw.githubusercontent.com/vtandrea/labtest/master/"+'2020-04-'+when+chosenCountry+".csv";
+
         when.setDate(when.getDate() - 1);
         console.log(url);
 
 
         var request = new XMLHttpRequest();   
 
         var request = new XMLHttpRequest();   
 
         request.open("GET", url, false);   
 
         request.open("GET", url, false);   
Riga 468: Riga 512:
 
         }
 
         }
 
         //console.log(csvData[0][1]);
 
         //console.log(csvData[0][1]);
        when = when-1;
 
 
         return [x,y, nome,when];
 
         return [x,y, nome,when];
 
     }
 
     }
Riga 485: Riga 528:
  
 
<script>
 
<script>
 +
// ITA
 
Plotly.d3.csv('https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv', function(err, rows){
 
Plotly.d3.csv('https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv', function(err, rows){
  
Riga 738: Riga 782:
 
         var d = new Date();
 
         var d = new Date();
 
         if (d.getHours()<18){
 
         if (d.getHours()<18){
             var when = d.getDate()-1;
+
             var when = d.setDate(d.getDate()-1);
 
         }else{
 
         }else{
             var when = d.getDate();
+
             var when = d;
 
         }
 
         }
        console.log(when);
 
 
         [dx, dy,lname, when] = get_logistic(when);
 
         [dx, dy,lname, when] = get_logistic(when);
  
Riga 849: Riga 892:
 
                 tick0: '2020-02-24',
 
                 tick0: '2020-02-24',
 
                 gridcolor: '#555',
 
                 gridcolor: '#555',
                 dtick: 7 * 24 * 60 * 60 * 1000
+
                 dtick: 24 * 60 * 60 * 1000
 
             },
 
             },
 
             yaxis: {
 
             yaxis: {
Riga 878: Riga 921:
 
         }
 
         }
 
     }
 
     }
 +
 +
    function formatDate(date) {
 +
        var d = new Date(date),
 +
            month = '' + (d.getMonth() + 1),
 +
            day = '' + d.getDate(),
 +
            year = d.getFullYear();
 +
   
 +
        if (month.length < 2)
 +
            month = '0' + month;
 +
        if (day.length < 2)
 +
            day = '0' + day;
 +
   
 +
        return [year, month, day].join('-');
 +
    };
 +
 +
    function formatDate2(date) {
 +
        var d = new Date(date),
 +
            month = '' + (d.getMonth() + 1),
 +
            day = '' + d.getDate()
 +
   
 +
        if (month.length < 2)
 +
            month = '0' + month;
 +
        if (day.length < 2)
 +
            day = '0' + day;
 +
   
 +
        return [day, month].join('.');
 +
    };
  
 
     function get_logistic(when){
 
     function get_logistic(when){
         //document.write('./'+chosenCountry + '.csv');
+
         d = formatDate(when);
         //
+
         d2 = formatDate2(when);
       
+
         var nome = d2+' - Fitting';
         var nome = when+'.04 - Fitting';
 
 
         var x = [];
 
         var x = [];
 
         var y = [];
 
         var y = [];
        when = '0' + when;
+
 
         var url = "https://raw.githubusercontent.com/vtandrea/labtest/master/"+'2020-04-'+when+"Italia.csv";
+
         var url = "https://raw.githubusercontent.com/vtandrea/labtest/master/"+d+"Italia.csv";
         console.log(url);
+
         when.setDate(when.getDate() - 1);
 
         var request = new XMLHttpRequest();   
 
         var request = new XMLHttpRequest();   
 
         request.open("GET", url, false);   
 
         request.open("GET", url, false);   
Riga 910: Riga 979:
 
         }
 
         }
 
         //console.log(csvData[0][1]);
 
         //console.log(csvData[0][1]);
        when = when-1;
 
 
         return [x,y, nome,when];
 
         return [x,y, nome,when];
 
     }
 
     }
  
     /*assignOptions(listofRegions, countrySelector);
+
     assignOptions(listofRegions, countrySelector);
  
 
     function updateCountry(){
 
     function updateCountry(){
Riga 920: Riga 988:
 
     }
 
     }
  
     countrySelector.addEventListener('change', updateCountry, false);*/
+
     countrySelector.addEventListener('change', updateCountry, false);
 
});
 
});
 
</script>
 
</script>
 
</html>
 
</html>

Revisione 17:31, 1 Apr 2020

COVID19 - Monitoraggio ed Analisi della situazione italiana

Andamento nazionale

Andamenti regionali

Regione:

Disclaimer

Dati forniti dal Ministero della Salute, elaborazione e gestione dati a cura del Dipartimento della Protezione Civile: https://github.com/pcm-dpc/COVID-19 Rielaborazione a cura del Control of Dynamic System Lab, Politecnico di Bari

COVID19 - Monitoraggio ed Analisi della situazione italiana

Andamento nazionale

Andamenti regionali

Regione:

Disclaimer

Dati forniti dal Ministero della Salute, elaborazione e gestione dati a cura del Dipartimento della Protezione Civile: https://github.com/pcm-dpc/COVID-19 Rielaborazione a cura del Control of Dynamic System Lab, Politecnico di Bari