fixed a small bug in system.js now the hashchange function is called correctly

This commit is contained in:
Ulf Gebhardt 2015-04-08 21:11:34 +02:00
parent a3c6103b8d
commit df574c658c
2 changed files with 5 additions and 2 deletions

View File

@ -14,12 +14,15 @@ function SYSTEM(endpoint, group,start_state,hashchange){
this.state = {};
this.state_info = {};
this.start_state = start_state;
this.hashchange = hashchange;
this.go_state(start_state);
this.hashchange(this.cur_state());
$(window).bind('hashchange', function( event ) {
system.go_state();
//user callback
if(hashchange){
if(system.hashchange){
hashchange(system.cur_state());}
});
}

View File

@ -89,7 +89,7 @@ function load_visualisation(){
data.addColumn('number',key);
}
});
$.each(json, function(key, value){first = true; data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [(v == null || parseFloat(v) <= 0) ? 0.1 : parseFloat(v)];}}));});
$.each(json, function(key, value){first = true; data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [(v == null || parseFloat(v) <= 0) ? parseFloat(0.00001) : parseFloat(v)];}}));});
var options = {title: name, aggregationTarget: 'category', selectionMode: 'multiple', curveType: 'function', /*focusTarget: 'category',*/ chartArea:{left:100,top:40}, vAxis:{logScale: true}, interpolateNulls: false, width: "1200", height: "500"};
new google.visualization.LineChart(document.getElementById('vis')).draw(data, options);