From 1e55fe9f1f0a408fa56d967d668b6ab6b9ba3bc3 Mon Sep 17 00:00:00 2001 From: cdtank Date: Wed, 13 Apr 2011 20:15:47 +0000 Subject: [PATCH] 1. Improved wordings for the hover-over for bars in the legend, --- .../js/visualization/entitycomparison/util.js | 28 +++++++++++++------ .../entityComparisonSetup.ftl | 10 ++++--- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/productMods/js/visualization/entitycomparison/util.js b/productMods/js/visualization/entitycomparison/util.js index d150a44d..496e8bb5 100644 --- a/productMods/js/visualization/entitycomparison/util.js +++ b/productMods/js/visualization/entitycomparison/util.js @@ -678,9 +678,10 @@ function createLegendRow(entity, bottomDiv) { unknownBar.append(unknownBarInnerSpan); + barDiv.append(unknownBar); barDiv.append(knownBar); barDiv.append(currentYearBar); - barDiv.append(unknownBar); + var numAttributeText = $(''); numAttributeText.attr('class', 'bar-count-text'); @@ -712,18 +713,20 @@ function renderBarAndLabel(entity, divBar, divLabel, spanElement) { var combinedCount = calcSumOfComparisonParameter(entity); var sum = combinedCount.knownYearCount + combinedCount.unknownYearCount; - + var normalizedWidth = getNormalizedWidth(entity, sum); var knownNormalizedWidth = getNormalizedWidth(entity, combinedCount.knownYearCount - combinedCount.currentYearCount); if (combinedCount.unknownYearCount) { var unknownNormalizedWidth = getNormalizedWidth(entity, combinedCount.unknownYearCount); + } else { var unknownNormalizedWidth = 0; } if (combinedCount.currentYearCount) { var currentNormalizedWidth = getNormalizedWidth(entity, combinedCount.currentYearCount); + } else { var currentNormalizedWidth = 0; } @@ -733,17 +736,26 @@ function renderBarAndLabel(entity, divBar, divLabel, spanElement) { divBar.children(".current-year-bar").html(" ").css("background-color", colorToAssign).css("width", currentNormalizedWidth); divBar.children(".unknown-bar").children(".unknown-inner-bar").html(" ").css("background-color", colorToAssign).css("width", unknownNormalizedWidth); + var countExplanation = (combinedCount.knownYearCount - combinedCount.currentYearCount) + ' of ' + + sum + ' were ' + COMPARISON_PARAMETERS_INFO[currentParameter].verbName + " in a completed year"; + + divBar.children(".known-bar").attr("title", countExplanation); + + countExplanation = combinedCount.currentYearCount + ' of ' + + sum + ' were ' + COMPARISON_PARAMETERS_INFO[currentParameter].verbName + ' in the current incomplete year (not charted above)'; + + divBar.children(".current-year-bar").attr("title", countExplanation); + + countExplanation = combinedCount.unknownYearCount + ' of ' + + sum + ' have an unknown ' + COMPARISON_PARAMETERS_INFO[currentParameter].name + " year (not charted above)"; + + divBar.children(".unknown-bar").attr("title", countExplanation); + var entityLabelForLegend = divLabel.find(".entity-label-url"); entityLabelForLegend.html(entity.label); entityLabelForLegend.ellipsis(); entityLabelForLegend.wrap(""); - var countExplanation = 'VIVO knows the ' + COMPARISON_PARAMETERS_INFO[currentParameter].name + ' year for ' - + combinedCount.knownYearCount + ' out of ' - + sum + ' of these ' + COMPARISON_PARAMETERS_INFO[currentParameter].pluralName; - - divBar.attr("title", countExplanation); - spanElement.text(sum).css("font-size", "0.8em").css("color", "#595B5B"); } diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl index cb858d88..16812a01 100644 --- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl +++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl @@ -23,7 +23,8 @@ <#assign temporalGraphDownloadCSVCommonURL = '${urls.base}${dataVisualizationURLRoot}?uri=${organizationURI}&labelField=label'> <#assign publicationParameter = { "name": "publication", - "pluralName": "publications", + "pluralName": "publications", + "verbName": "published", "dropDownText": "by Publications", "viewLink": "${organizationPublicationTemporalGraphURL}", "viewBaseLink": "${subOrganizationPublicationTemporalGraphCommonURL}", @@ -32,7 +33,8 @@ "value": "Publications" }> <#assign grantParameter = { "name": "grant", - "pluralName": "grants", + "pluralName": "grants", + "verbName": "granted", "dropDownText": "by Grants", "viewLink": "${organizationGrantTemporalGraphURL}", "viewBaseLink": "${subOrganizationGrantTemporalGraphCommonURL}", @@ -56,8 +58,8 @@ we will use rev 293 (dev build version) of the flot & excanvas files.