@@ -983,6 +983,7 @@ function redrawPrediction(vcallsign) {
983983 if ( data . warnings || data . errors ) return ;
984984
985985 var line = [ ] ;
986+ var graph_data = [ ] ;
986987 var latlng = null ;
987988 var max_alt = - 99999 ;
988989 var latlng_burst = null ;
@@ -992,6 +993,7 @@ function redrawPrediction(vcallsign) {
992993 for ( var i = 0 , ii = data . length ; i < ii ; i ++ ) {
993994 latlng = new google . maps . LatLng ( data [ i ] . lat , data [ i ] . lon ) ;
994995 line . push ( latlng ) ;
996+ graph_data . push ( [ parseInt ( data [ i ] . time ) * 1000 , parseInt ( data [ i ] . alt ) ] ) ;
995997
996998 if ( parseFloat ( data [ i ] . alt ) > max_alt ) {
997999 max_alt = parseFloat ( data [ i ] . alt ) ;
@@ -1001,7 +1003,11 @@ function redrawPrediction(vcallsign) {
10011003 if ( i > 1 ) path_length += google . maps . geometry . spherical . computeDistanceBetween ( line [ i - 1 ] , line [ i ] ) ;
10021004 }
10031005
1004- if ( typeof vehicle . prediction_polyline !== 'undefined' ) {
1006+ vehicle . graph_data [ 1 ] . data = graph_data ;
1007+ updateGraph ( vcallsign , true ) ;
1008+ vehicle . prediction_path = line ;
1009+
1010+ if ( vehicle . prediction_polyline !== null ) {
10051011 vehicle . prediction_polyline . setPath ( line ) ;
10061012 } else {
10071013 vehicle . prediction_polyline = new google . maps . Polyline ( {
@@ -1710,13 +1716,14 @@ function addPosition(position) {
17101716 } ) ,
17111717 ] ,
17121718 prediction : null ,
1719+ prediction_polyline : null ,
1720+ prediction_traget : null ,
1721+ prediction_burst : null ,
17131722 ascent_rate : 0.0 ,
17141723 horizontal_rate : 0.0 ,
17151724 max_alt : parseFloat ( position . gps_alt ) ,
17161725 follow : false ,
17171726 color_index : color_index ,
1718- prediction_traget : null ,
1719- prediction_burst : null ,
17201727 graph_data_updated : false ,
17211728 graph_data_map : { } ,
17221729 graph_data : [ ] ,
@@ -1990,6 +1997,8 @@ function graphAddPosition(vcallsign, new_data) {
19901997 else if ( xref [ i ] [ 1 ] !== null && xref [ i ] [ 0 ] + gap_size < ts ) {
19911998 // pad with previous datum
19921999 $ . each ( data , function ( k , v ) {
2000+ if ( k == 1 ) return ; // skip prediction series
2001+
19932002 v . data . splice ( i + 1 , 0 , [ xref [ i ] [ 0 ] + pad_size , v . data [ i ] [ 1 ] ] , [ xref [ i ] [ 0 ] + pad_size + 1 , null ] ) ;
19942003 v . nulls += 2 ;
19952004 } ) ;
@@ -2009,6 +2018,8 @@ function graphAddPosition(vcallsign, new_data) {
20092018 //insert gap when there are 3mins, or more, without telemetry
20102019 if ( ts_last + gap_size < ts ) {
20112020 $ . each ( data , function ( k , v ) {
2021+ if ( k == 1 ) return ; // skip prediction series
2022+
20122023 v . data . push ( [ ts_last + pad_size , v . data [ ts_last_idx ] [ 1 ] ] ) ;
20132024 v . data . push ( [ ts_last + pad_size + 1 , null ] ) ;
20142025 v . nulls += 2 ;
@@ -2031,6 +2042,17 @@ function graphAddPosition(vcallsign, new_data) {
20312042 data : [ ]
20322043 } ;
20332044
2045+ i += 1 ;
2046+
2047+ data [ i ] = {
2048+ label : "pred.alt. = 0" ,
2049+ color : '#999999' ,
2050+ yaxis : i + 1 ,
2051+ lines : { show :true , fill : false , } ,
2052+ nulls : 0 ,
2053+ data : [ ]
2054+ } ;
2055+
20342056 }
20352057
20362058 if ( parseInt ( new_data . gps_alt ) < 0 ) delete vehicle . graph_yaxes [ i ] . min ;
@@ -2052,7 +2074,7 @@ function graphAddPosition(vcallsign, new_data) {
20522074
20532075 i = ( k in vehicle . graph_data_map ) ? vehicle . graph_data_map [ k ] : data . length ;
20542076
2055- if ( i >= 8 ) return ; // up to 8 seperate data plots only
2077+ if ( i >= 8 ) return ; // up to 7 seperate data plots only, 1 taken by alt, 1 by prediction
20562078
20572079 if ( data [ i ] === undefined ) {
20582080 // configure series
0 commit comments