1. In Temporal vis developed vis drilling up from lower level. (see http://issues.library.cornell.edu/browse/NIHVIVO-1800)

2. Refactored client-side code for temporal vis.
This commit is contained in:
cdtank 2011-04-12 17:49:53 +00:00
parent 82c4d1faa7
commit ae43216396
19 changed files with 449 additions and 78 deletions

View file

@ -24,7 +24,7 @@ $(document).ready(function() {
* update the status accordingly.
*/
$("select.comparisonValues").change(function(){
$("select.comparisonValues").change(function() {
var selectedValue = $("select.comparisonValues option:selected").val();
@ -36,6 +36,8 @@ $(document).ready(function() {
currentParameter = parameter.name;
selectedDataURL = parameter.dataLink;
temporalGraphCommonURL = parameter.viewBaseLink;
csvDownloadURL = parameter.csvLink;
}
});
@ -175,47 +177,79 @@ function performEntityCheckboxClickedRedrawActions() {
}
/*
* function to populate the labelToEntityRecord object with the
* values from the json file and
* dynamically generate checkboxes
*/
function loadData(jsonData, dataTableParams) {
$.each(jsonData, function (index, val) {
setOfLabels.push(val.label);
URIToEntityRecord[val.entityURI] = val;
if (val.lastCachedAtDateTime) {
lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime;
}
});
prepareTableForDataTablePagination(jsonData, dataTableParams);
setEntityLevel(getEntityVisMode(jsonData));
entityCheckboxOperatedOnEventListener();
}
/*
* function to populate the labelToEntityRecord object with the
* values from the json file and
* dynamically generate checkboxes
*/
function reloadData(preselectedEntityURIs, jsonData) {
$.each(jsonData, function (index, val) {
setOfLabels.push(val.label);
URIToEntityRecord[val.entityURI] = val;
if (val.lastCachedAtDateTime) {
lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime;
}
});
reloadDataTablePagination(preselectedEntityURIs, jsonData);
setEntityLevel(getEntityVisMode(jsonData));
}
var processJSONData = {
isParentEntityAvailable: false,
setupGlobals: function(jsonContent) {
$.each(jsonContent, function (index, val) {
/*
* We are checking if the "label" attribute is present, because that pertains to
* data used for linegraph visualization.
* */
if (val.label) {
setOfLabels.push(val.label);
URIToEntityRecord[val.entityURI] = val;
if (val.lastCachedAtDateTime) {
lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime;
}
} else if (val.subjectEntityLabel) {
/*
* This is to set the drill-up visualization URLs.
* */
$.each(val.parentURIToLabel, function(index, value) {
$("a#subject-parent-entity-temporal-url").attr("href", getTemporalVisURL(index));
$("a#subject-parent-entity-profile-url").attr("href", getVIVOURL(index));
$("a#subject-parent-entity-profile-url").text(value);
processJSONData.isParentEntityAvailable = true;
});
}
});
if (processJSONData.isParentEntityAvailable) {
$("#subject-parent-entity").show();
} else {
$("#subject-parent-entity").hide();
}
},
/*
* function to populate the labelToEntityRecord object with the
* values from the json file and
* dynamically generate checkboxes
*/
loadData: function(jsonData, dataTableParams) {
processJSONData.setupGlobals(jsonData);
prepareTableForDataTablePagination(jsonData, dataTableParams);
setEntityLevel(getEntityVisMode(jsonData));
entityCheckboxOperatedOnEventListener();
},
/*
* function to populate the labelToEntityRecord object with the
* values from the json file and
* dynamically generate checkboxes
*/
reloadData: function(preselectedEntityURIs, jsonData) {
processJSONData.setupGlobals(jsonData);
reloadDataTablePagination(preselectedEntityURIs, jsonData);
setEntityLevel(getEntityVisMode(jsonData));
$("a#csv").attr("href", csvDownloadURL);
}
};
function entityCheckboxOperatedOnEventListener() {
@ -394,7 +428,7 @@ temporalGraphProcessor = {
/*
* render the temporal graph per the sent content.
* */
loadData(jsonData, this.dataTableParams);
processJSONData.loadData(jsonData, this.dataTableParams);
lastCachedAtDateTimes.sort(lastCachedAtDateTimeParser.ascendingDateSorter);
@ -438,7 +472,7 @@ temporalGraphProcessor = {
/*
* render the temporal graph per the sent content.
* */
reloadData(currentSelectedEntityURIs, jsonData);
processJSONData.reloadData(currentSelectedEntityURIs, jsonData);
lastCachedAtDateTimes.sort(lastCachedAtDateTimeParser.ascendingDateSorter);

View file

@ -640,7 +640,7 @@ function createLegendRow(entity, bottomDiv) {
* there is no drill-down possible, so don't diaply the temporal graph icon.
* */
if (entity.visMode !== "PERSON") {
labelDiv.append('<a class="temporal-vis-url" href="' + getTemporalVisURL(entity) + '"><img src = "' + temporalGraphSmallIcon + '"/></a>');
labelDiv.append('<a class="temporal-vis-url" href="' + getTemporalVisURL(entity.entityURI) + '"><img src = "' + temporalGraphSmallIcon + '"/></a>');
}
@ -649,7 +649,7 @@ function createLegendRow(entity, bottomDiv) {
checkbox.attr('checked', true);
checkbox.attr('id', 'checkbox');
checkbox.attr('class', 'easyDeselectCheckbox');
checkbox.attr('value', entity.label);
checkbox.attr('value', entity.entityURI);
var hiddenLabel = $('<label>');
hiddenLabel.attr('type', 'hidden');
@ -720,7 +720,7 @@ function renderBarAndLabel(entity, divBar, divLabel, spanElement) {
var entityLabelForLegend = divLabel.find(".entity-label-url");
entityLabelForLegend.html(entity.label);
entityLabelForLegend.ellipsis();
entityLabelForLegend.wrap("<a class='entity-url' title='" + entity.label + "' href='" + getVIVOURL(entity) + "'></a>");
entityLabelForLegend.wrap("<a class='entity-url' title='" + entity.label + "' href='" + getVIVOURL(entity.entityURI) + "'></a>");
var countExplanation = 'VIVO knows the ' + COMPARISON_PARAMETERS_INFO[currentParameter].name + ' year for '
+ combinedCount.knownYearCount + ' out of '
@ -731,16 +731,15 @@ function renderBarAndLabel(entity, divBar, divLabel, spanElement) {
spanElement.text(sum).css("font-size", "0.8em").css("color", "#595B5B");
}
function getVIVOURL(entity){
function getVIVOURL(entityURI){
var result = subOrganizationVivoProfileURL + "uri="+entity.entityURI;
return subOrganizationVivoProfileURL + "uri=" + entityURI;
return result;
}
function getTemporalVisURL(entity) {
function getTemporalVisURL(entityURI) {
return subOrganizationTemporalGraphURL + "&uri=" + entity.entityURI ;
return temporalGraphCommonURL + "&uri=" + entityURI ;
}
function getVIVOProfileURL(given_uri) {