anchor.diff:                  || caseTypeLower==="local progression") return "orange";
           return "black";
       }
  -    
  -    function setCaseIndicesAndLabels() {
  -        var mapColorCases = {};
  -        for (var c in mapCaseColor) {
  -            var color = mapCaseColor[c];
  -            if (!(color in mapColorCases)) mapColorCases[color] = [];
  -            mapColorCases[color].push(c);
  -        }
  -        
  -        var colors = ["black","orange","red"];
  -        for (var ix=0; ix<3; ix++) {
  -            var color = colors[ix];
  -            var cases = mapColorCases[color];
  -            if (!cases) continue;
  -            var n = cases.length;
  -            if (n===1) {
  -                mapCaseLabels[cases[0]]='';
  -                mapCaseIndices[cases[0]] = ix+1;
  -            } else {
  -                for (var i=0; i<n; i++){
  -                    var _case = cases[i];
  -                    mapCaseLabels[_case] = i+1;
  -                    mapCaseIndices[_case] = ix+1;
  -                };
  -            }
  -        }
  -    }
   }
   
   function plotCaseLabel(svgEl,onlyIfEmpty) {
  
positive.code: var clinicalDataMap = <%=jsonClinicalData%>;
  
  var mapCaseColor = {};
  var mapCaseIndices = {};
  var mapCaseLabels = {};
  
  $(document).ready(function(){
  
negative.code: 
  function outputClinicalData() {
      $("#clinical_div").append("<table id='clinical_table' width='100%'></table>");
      var n=caseIds.length;
      
      // set mapCaseColor
      for (var i=0; i<n; i++) {
          var caseId = caseIds[i];
          var clinicalData = clinicalDataMap[caseId];
          var state = guessClinicalData(clinicalData, ["tumor_type"]);
          mapCaseColor[caseId] = getCaseColor(state);
      }
      
      // reorder based on color
      var colors = {black:1, orange:2, red:3};
      caseIds.sort(function(c1, c2){
          var ret = colors[mapCaseColor[c1]]-colors[mapCaseColor[c2]];
          if (ret===0) return c1<c2?-1:1;
          return ret;
      });
  
      // set labels
      var mapColorCases = {};
      caseIds.forEach(function (caseId) {
          var color = mapCaseColor[caseId];
          if (!(color in mapColorCases)) mapColorCases[color] = [];
          mapColorCases[color].push(caseId);
      });
      for (var color in mapColorCases) {
          var cases = mapColorCases[color];
          var len = cases.length;
          if (len===1) {
              mapCaseLabels[cases[0]]='';
          } else {
              for (var i=0; i<len; i++){
                  var _case = cases[i];
                  mapCaseLabels[_case] = i+1;
              };
          }
      }
          
      // output
      for (var i=0; i<n; i++) {
          var caseId = caseIds[i];
          var clinicalData = clinicalDataMap[caseId];
  