anchor.diff:          
           
   <script>
  +
  +	/**
  +	 * Initializes basic graph parameter using given graph parameters.
  +	 * Uses fields: 
  +	 *	 intervals - array of map from interval name to the starting value for that interval
  +	 *	 score - the score for the assessment we are summarizing
  +	 *	 maxXPoint - the maximum value of any score (end of last interval), this can be undefined if the last interval will be the end of the graph
  +	 * Sets fields:
  +	 *	 legends - names for each interval
  +	 *	 dataset - the array of objects containg x,y which are used by the stack graph to set intervals
  +	 *	 scoresInterval - name of the interval where the score is found
  +	 *	 graphStart - the minimum value of any score (start of first interval)
  +	 */
  +	function processIntervals(graphParams){
  +		graphParams.legends = [];
  +		graphParams.dataset = [];
  +		graphParams.scoresInterval;
  +		graphParams.graphStart = 0;
  +		
  +		var prevInterval, prevName;
  +		
  +		$.each(graphParams.intervals, function(name, intervalStart){
  +			graphParams.legends.push(name);
  +
  +			//skip the first one
  +			if(prevInterval != null){
  +				graphParams.dataset.push([{x:"", y:intervalStart}]);
  +			}
  +			else{
  +				graphParams.graphStart = intervalStart;
  +			}
  +			
  +			if(prevInterval != null && graphParams.score >= prevInterval && graphParams.score < intervalStart){
  +				graphParams.scoresInterval = prevName;
  +		    }
  +			prevInterval = intervalStart;
  +			prevName = name;
  +		}); 
  +		
  +		//check if scoreInterval is in the last interval
  +		if(graphParams.scoresInterval == null && graphParams.score >= prevInterval){
  +			graphParams.scoresInterval = prevName;
  +		}
  +		
  +		//if this is null then that means the final interval will end the graph (there must be a tick for this last point)
  +		if(graphParams.maxXPoint != null){
  +			graphParams.dataset.push([{x:"", y:graphParams.maxXPoint}]);
  +		}
  +		return graphParams;
  +	}
  +	
       //TODO:
   	  // 1. for the colors of each bar, what happens when we have more than 6 intervals?  We need the start color and then end color and then
   	     // we take the number of intervals and calculate the colors needed to get from the start color to the end color.
   	  // 2. the y axis label should not be given 
   	  // 3. the score is not showing up in the graph
          
  -    function graphStacked(graphId, graphObj, parentDiv){
  -        parentDiv.addClass("graphicBlock");
  -        
  -        var titleContainer = parentDiv.children(".moduleTemplateTitle");
  -        var graphContainer = parentDiv.children(".graphSection");
  -        var descriptionContainer = parentDiv.children(".moduleTemplateText");
  -    	  
  -		// Load Objects
  -		var graphparams = graphObj.data;
  -		var graphStart 	= 0;
  -		var graphEnd 	= graphparams.maxXPoint;
  -		var ticks      	= graphparams.ticks;
  -		
  -		var legends = [];
  -		var d3DataSet = [];
  -		var scoresInterval;
  -		var prevInterval, prevName;
  -		$.each(graphparams.intervals, function(name, intervalStart){
  -			legends.push(name);
  -
  -			//skip the first one
  -			if(prevInterval != null){
  -				d3DataSet.push([{x:"", y:intervalStart}]);
  -			}
  -			else{
  -				graphStart = intervalStart;
  -			}
  -			
  -			if(prevInterval != null && graphparams.score >= prevInterval && graphparams.score < intervalStart){
  -				scoresInterval = prevName;
  -		    }
  -			prevInterval = intervalStart;
  -			prevName = name;
  -		}); 
  -		//check if scoreInterval is in the last interval
  -		if(scoresInterval == null && graphparams.score >= prevInterval){
  -			scoresInterval = prevName;
  -		}
  -		
  -		//if this is null then that means the final interval will end the graph (there must be a tick for this last point)
  -		if(graphEnd != null){
  -			d3DataSet.push([{x:"", y:graphEnd}]);
  -		}
  -		
  -		// Update title block to contain the scoring
  -		titleContainer.wrap("<div class='scoreBlock text-center'>");
  -		titleContainer.parent().append("<div><h4>" + graphparams.score + "</h4><h5>" + scoresInterval + "</h5></div>");
  -		
  -		//Start adding to the graphic block with the graph's title 
  -		graphContainer.prepend("<div class='graphHeader'>" + graphObj.title + "</div>"); 
  -		
  -		
  -		//Add d3 graph
  -        var graphContainerId = "graph_" + graphId;
  -        var graphSelector = "#" + graphContainerId;
  -        graphContainer.children(".graphicBody").prop("id", graphContainerId)
  -        
  +    function appendStackGraph(parentSelector, graphparams){
  +
  +		var ticks = graphparams.ticks;
  +		
           //Set d3 graph attributes
   	    var margins = {
   		          top: 46,
  
positive.code:         $('#VeteranSummaryModal').modal('show');
          $(modal_contents).html('<i class="ajax_loading text-center"></i> Loading...');
  
   		  var vaid = ${veteranAssessmentInfo.veteranAssessmentId};
   	    var modal_url = 'assessmentSummary/assessments/' + vaid + '/veteranSummary' ;
   	    $.ajax({
  		  	type : 'get',
  
negative.code: 	
  			//Create Y Scale for bar graph
  			var yScale = d3.scale.linear()
  				 .domain([yStartPoint, d3.max(ticks, function (d) {
  				 return +d.value;
  			})])
  				.range([height, 0]);
  