src/View/Helper/TimelineHelper.php
public function finalize($return = false, array $scriptOptions = []) {
		$settings = $this->getConfig();
		$timelineId = $settings['id'];
		$data = $this->_format($this->_items);

		$current = '';
		if ($settings['current']) {
			$dateString = date('Y-m-d H:i:s', time());
			$current = 'timeline.setCurrentTime(' . $this->_date($dateString) . ');';
		}
		unset($settings['id']);
		unset($settings['current']);
		$options = $this->_options($settings);

		$script = <<<JS
var timeline;
var data;
var options;

// Called when the Visualization API is loaded.
function drawVisualization() {
	// Create a JSON data table
	data = $data
	options = $options

	// Instantiate our timeline object.
	timeline = new links.Timeline(document.getElementById('$timelineId'));

	// Draw our timeline with the created data and options
	timeline.draw(data, options);
	$current
}

drawVisualization();
JS;
		if ($return) {
			return $script;
		}
		$this->_buffer($script, $scriptOptions);
	}
public function finalize($return = false, array $scriptOptions = []) {
		$settings = $this->getConfig();
		$timelineId = $settings['id'];
		$data = $this->_format($this->_items);

		$current = '';
		if ($settings['current']) {
			$dateString = date('Y-m-d H:i:s', time());
			$current = 'timeline.setCurrentTime(' . $this->_date($dateString) . ');';
		}
		unset($settings['id']);
		unset($settings['current']);
		$options = $this->_options($settings);

		$script = <<<JS
var timeline;
var data;
var options;

// Called when the Visualization API is loaded.
function drawVisualization() {
	// Create a JSON data table
	data = $data
	options = $options

	// Instantiate our timeline object.
	timeline = new links.Timeline(document.getElementById('$timelineId'));

	// Draw our timeline with the created data and options
	timeline.draw(data, options);
	$current
}

drawVisualization();
JS;
		if ($return) {
			return $script;
		}
		$this->_buffer($script, $scriptOptions);
	}
public function finalize ( $ return = false , array $ scriptOptions = [ ] ) { $ settings = $ this -> getConfig ( ) ; $ timelineId = $ settings [ 'id' ] ; $ data = $ this -> _format ( $ this -> _items ) ; $ current = '' ; if ( $ settings [ 'current' ] ) { $ dateString = date ( 'Y-m-d H:i:s' , time ( ) ) ; $ current = 'timeline.setCurrentTime(' . $ this -> _date ( $ dateString ) . ');' ; } unset ( $ settings [ 'id' ] ) ; unset ( $ settings [ 'current' ] ) ; $ options = $ this -> _options ( $ settings ) ; $ script =  <<<JS
var timeline;
var data;
var options;

// Called when the Visualization API is loaded.
function drawVisualization() {
	// Create a JSON data table
	data = $data
	options = $options

	// Instantiate our timeline object.
	timeline = new links.Timeline(document.getElementById('$timelineId'));

	// Draw our timeline with the created data and options
	timeline.draw(data, options);
	$current
}

drawVisualization();
JS ; if ( $ return ) { return $ script ; } $ this -> _buffer ( $ script , $ scriptOptions ) ; }
Finalize the timeline and write the javascript to the buffer.
Make sure that your view does also output the buffer at some place!

@param bool $return If the output should be returned instead
@param array $scriptOptions

@return null|string Javascript if $return is true
Finalize the timeline and write the javascript to the buffer . Make sure that your view does also output the buffer at some place!