Changeset 15701


Ignore:
Timestamp:
05/20/13 06:42:57 (12 years ago)
Author:
tanio
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • schedule/Module/calendar.php

    r15699 r15701  
    101101                                                                        newdata=newline.join(",");
    102102                                                                        document.getElementById('data').innerHTML=newdata;
     103                                                                        /*for(var c=0;c<newline.length;c++)
     104                                                                        {
     105                                                                                arr[c];
     106                                                                        };
    103107                                                                        var chart = new Highcharts.Chart({
    104108                                                                       
     
    106110                                                                                chart: {
    107111                                                                                        renderTo: 'container' /* display to div Graph*/
    108                                                                           },
     112                                                                          /* },
    109113                                                                               
    110114                                                                                xAxis: {
     
    114118                                                                                                        },
    115119                                                                                        categories:["","","","","","","","19:00","20:00","21:00","22:00","23:00","24:00","1:00","2:00","3:00","4:00","5:00","6:00","7:00"]},
    116                                                                                 series:[{data:[parseFloat(newdata)]}], /* array of Data  */
    117                                                                                
    118                                                                                 remove:function()
     120                                                                                series:[], /* array of Data  */
     121                                                                               
     122                                                                                /*remove:function()
    119123                                                                                {
    120124                                                                                        return false;
     
    122126                                                                               
    123127                                                                                 exporting: {                                                   /*--------------------*/
    124                                                                                   buttons: {                                                    /*                                        */
    125                                                                                         exportButton: {                                 /*              Export            */
    126                                                                                                         menuItems: null,                        /*                to              */
    127                                                                                                   onclick: function() {                /*                      PNG.file  */
    128                                                                                                                 this.exportChart();             /*--------------------*/
    129                                                                                                         }
     128                                                                                  /*buttons: {                                                  /*                                        */
     129                                                                                        /*exportButton: {                                       /*              Export            */
     130                                                                                                /*      menuItems: null,                        /*                to              */
     131                                                                                                  /* onclick: function() {              /*                      PNG.file  */
     132                                                                                                        /*      this.exportChart();             /*--------------------*/
     133                                                                                                        /*}
    130134                                                                                                }
    131135                                                                                        }
     
    149153                                                                               
    150154                                                                        });*/
    151                                                                        
     155                                                                        $(function () {
     156                                                                                var data = '[{"name":"Station 1","data":"1360191600,398.625"},{"name":"Station 1","data":"1360192500,398.625"},{"name":"Station 1","data":"1360193400,398.25"},{"name":"Station 1","data":"1360194300,397.375"},{"name":"Station 1","data":"1360195200,397.5"},{"name":"Station 1","data":"1360196100,397.5"},{"name":"Station 1","data":"1360199700,396.75"},{"name":"Station 1","data":"1360200600,397"}]';
     157
     158
     159                                                                                var options = {
     160                                                                                        chart: {
     161                                                                                                renderTo: 'container'
     162                                                                                        },
     163                                                                                        xAxis: {
     164                                                                                                type:'datetime'
     165                                                                                        },
     166                                                                                        series: []
     167                                                                                };
     168
     169                                                                                data = JSON.parse(data);
     170                                                                                var names = [];
     171                                                                                $.each(data, function (i, ligne) {
     172                                                                                        var ind = names.indexOf(ligne.name),
     173                                                                                                splited = ligne.data.split(','),
     174                                                                                                x = parseFloat(splited[0]),
     175                                                                                                y = parseFloat(splited[1]);
     176                                                                                        if (ind == -1) {
     177                                                                                                ind = names.push(ligne.name) - 1;
     178                                                                                                options.series.push({
     179                                                                                                        data: [],
     180                                                                                                        name: ligne.name
     181                                                                                                });
     182                                                                                        }
     183                                                                                        if(!isNaN(x) && !isNaN(y)){
     184                                                                                                options.series[ind].data.push([x,y]);   
     185                                                                                        }
     186                                                                                });
     187                                                                               
     188                                                                                console.log(options);
     189
     190                                                                                var chart = new Highcharts.Chart(options);
     191                                                                        });
    152192                                                                       
    153193                                                                }
Note: See TracChangeset for help on using the changeset viewer.