score:1

Accepted answer

i got it now...

// data is variable from $.get()
$.get('http://www.geoinc.org/dropbox/geo/sites/gc_room/example.csv', function(data){   
    // parsing here...
});

new highcharts.chart(options);
});

your problem is the placement of the new highcharts.chart(options) call. $.get (like most ajax calls) is asynchronous so the new highcharts will be called before it completes.

change it to this:

// data is variable from $.get()
$.get('http://www.geoinc.org/dropbox/geo/sites/gc_room/example.csv', function(data){   
    var lines = data.split('\n');
    $.each(lines, function (lineno, line) {
        var items = line.split(',');
        if(lineno !== 0) {
           var x = + new date(items[1]+'/'+items[2]+'/'+items[0]+' '+items[4]),
               kwh = parsefloat(items[5]),
               savings = parsefloat(items[6]);
            if(!isnan(kwh) && !isnan(savings)){
                options.series[0].data.push([x,kwh]);
                options.series[1].data.push([x,savings])
            }
        }
    });
    new highcharts.chart(options); // this is now in the $.get callback function
});

Related Query

More Query from same tag