client/annotviz/app/js/utils.js
changeset 128 9f2334598088
parent 124 b5697bcdbaff
child 129 7181e1f28eb0
equal deleted inserted replaced
127:0386fb9efe27 128:9f2334598088
    38                 ts: session.start_ts === null ? new Date(0) : Date.parse(session.start_ts),
    38                 ts: session.start_ts === null ? new Date(0) : Date.parse(session.start_ts),
    39                 colors: {}
    39                 colors: {}
    40             }
    40             }
    41             var categoriesJson = session.categories_json;
    41             var categoriesJson = session.categories_json;
    42             annotCat.order = categoriesJson.order;
    42             annotCat.order = categoriesJson.order;
       
    43             if (typeof(annotCat.order['default']) === 'undefined'){
       
    44             	annotCat.order.push('default');
       
    45             }
    43 			var catList = _.clone(categoriesJson.categories);
    46 			var catList = _.clone(categoriesJson.categories);
    44 			while(catList.length > 0) {
    47 			while(catList.length > 0) {
    45 				var cat = catList.pop();
    48 				var cat = catList.pop();
    46 				if(cat.code) {
    49 				if(cat.code) {
    47 					annotCat.colors[cat.code] = colorToHex(cat.color);
    50 					annotCat.colors[cat.code] = colorToHex(cat.color);
    56 				}
    59 				}
    57             });
    60             });
    58             annotCat.defaultColor = categoriesJson.defaultColor || "#536991";
    61             annotCat.defaultColor = categoriesJson.defaultColor || "#536991";
    59             annotCategories.push(annotCat);
    62             annotCategories.push(annotCat);
    60         });
    63         });
    61         console.log(annotCategories);
       
    62         annotCategories[0].order.push("default");
       
    63     });
    64     });
    64 
    65 
    65     jsonLoader.load();
    66     jsonLoader.load();
    66 
    67 
    67 }
    68 }