@ -7,6 +7,7 @@ var Range = require('./Range');  
														
													
														
															
																var  ItemSet  =  require ( './component/ItemSet' ) ; var  ItemSet  =  require ( './component/ItemSet' ) ;  
														
													
														
															
																var  Activator  =  require ( '../shared/Activator' ) ; var  Activator  =  require ( '../shared/Activator' ) ;  
														
													
														
															
																var  DateUtil  =  require ( './DateUtil' ) ; var  DateUtil  =  require ( './DateUtil' ) ;  
														
													
														
															
																var  CustomTime  =  require ( './component/CustomTime' ) ;  
														
													
														
															
																
 
  
														
													
														
															
																/ * * / * *  
														
													
														
															
																 *  Create  a  timeline  visualization   *  Create  a  timeline  visualization   
														
													
												
													
														
															
																
																	
																		
																			 
																	
																	
																		
																			 
																	
																	
																 
																@ -302,6 +303,65 @@ Core.prototype.getCustomTime = function() {  
														
													
														
															
																  return  this . customTime . getCustomTime ( ) ;    return  this . customTime . getCustomTime ( ) ;   
														
													
														
															
																} ; } ;  
														
													
														
															
																
 
  
														
													
														
															
																/ * *  
														
													
														
															
																 *  Add  custom  vertical  bar   
														
													
														
															
																 *  param  { Date  |  String  |  Number }  time   A  Date ,  unix  timestamp ,  or   
														
													
														
															
																 *                                       ISO  date  string .  Time  point  where  the  new  bar  should  be  placed   
														
													
														
															
																 *  @ return  { int }  ID  of  the  new  bar   
														
													
														
															
																 * /   
														
													
														
															
																Core . prototype . addCustomTime  =  function  ( time )  {  
														
													
														
															
																  if  ( ! this . currentTime )  {   
														
													
														
															
																    throw  new  Error ( 'Option showCurrentTime must be true' ) ;   
														
													
														
															
																  }   
														
													
														
															
																
  
														
													
														
															
																  if  ( time  ===  undefined )  {   
														
													
														
															
																    throw  new  Error ( 'Time parameter for the custom bar must be provided' ) ;   
														
													
														
															
																  }   
														
													
														
															
																
  
														
													
														
															
																  var  ts  =  util . convert ( time ,  'Date' ) . valueOf ( ) ,   
														
													
														
															
																      customTime ,  id ;   
														
													
														
															
																
  
														
													
														
															
																  if  ( 'customLastId'  in  this )  {   
														
													
														
															
																    id  =  ++ this . customLastId ;   
														
													
														
															
																  }  else  {   
														
													
														
															
																    id  =  this . customLastId  =  1 ;   
														
													
														
															
																  }   
														
													
														
															
																
  
														
													
														
															
																  customTime  =  new  CustomTime ( this . body ,  {   
														
													
														
															
																    showCustomTime  :  true ,   
														
													
														
															
																    time  :  ts ,   
														
													
														
															
																    id  :  id   
														
													
														
															
																  } ) ;   
														
													
														
															
																
  
														
													
														
															
																  this . components . push ( customTime ) ;   
														
													
														
															
																  this . redraw ( ) ;   
														
													
														
															
																
  
														
													
														
															
																  return  id ;   
														
													
														
															
																} ;  
														
													
														
															
																
  
														
													
														
															
																/ * *  
														
													
														
															
																 *  Remove  previously  added  custom  bar   
														
													
														
															
																 *  @ param  { int }  id  ID  of  the  custom  bar  to  be  removed   
														
													
														
															
																 *  @ return  { boolean }  True  if  the  bar  exists  and  is  removed ,  false  otherwise   
														
													
														
															
																 * /   
														
													
														
															
																Core . prototype . removeCustomTime  =  function  ( id )  {  
														
													
														
															
																  var  me  =  this ;   
														
													
														
															
																
  
														
													
														
															
																  var  reduceLastId  =  function ( )  {   
														
													
														
															
																    if  ( 'customLastId'  in  me  &&  me . customLastId  >  0 )  {   
														
													
														
															
																      me . customLastId -- ;   
														
													
														
															
																    }   
														
													
														
															
																  } ;   
														
													
														
															
																
  
														
													
														
															
																  this . components . forEach ( function  ( bar ,  index ,  components )  {   
														
													
														
															
																    if  ( bar  instanceof  CustomTime  &&  bar . options . id  ===  id )  {   
														
													
														
															
																      reduceLastId ( ) ;   
														
													
														
															
																      components . splice ( index ,  1 ) ;   
														
													
														
															
																      bar . destroy ( ) ;   
														
													
														
															
																    }   
														
													
														
															
																  } ) ;   
														
													
														
															
																} ;  
														
													
														
															
																
  
														
													
														
															
																
 
  
														
													
														
															
																/ * * / * *  
														
													
														
															
																 *  Get  the  id ' s  of  the  currently  visible  items .   *  Get  the  id ' s  of  the  currently  visible  items .