1. Improved bar graph DOM generation for temp vis.
This commit is contained in:
parent
3c1afb45a0
commit
c52e8362bc
1 changed files with 37 additions and 23 deletions
|
@ -703,41 +703,55 @@ function renderBarAndLabel(entity, divBar, divLabel, spanElement) {
|
||||||
var sum = combinedCount.knownYearCount + combinedCount.unknownYearCount;
|
var sum = combinedCount.knownYearCount + combinedCount.unknownYearCount;
|
||||||
|
|
||||||
var normalizedWidth = getNormalizedWidth(entity, sum);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
divBar.css("width", normalizedWidth + 5);
|
divBar.css("width", normalizedWidth + 5);
|
||||||
divBar.children(".known-bar").html(" ").css("background-color", colorToAssign).css("width", knownNormalizedWidth);
|
|
||||||
divBar.children(".current-year-bar").html(" ").css("background-color", colorToAssign).css("width", currentNormalizedWidth);
|
if (combinedCount.knownYearCount - combinedCount.currentYearCount) {
|
||||||
divBar.children(".unknown-bar").children(".unknown-inner-bar").html(" ").css("background-color", colorToAssign).css("width", unknownNormalizedWidth);
|
|
||||||
|
var knownNormalizedWidth = getNormalizedWidth(entity, combinedCount.knownYearCount - combinedCount.currentYearCount);
|
||||||
|
|
||||||
var countExplanation = (combinedCount.knownYearCount - combinedCount.currentYearCount) + ' of '
|
var countExplanation = (combinedCount.knownYearCount - combinedCount.currentYearCount) + ' of '
|
||||||
+ sum + ' were ' + COMPARISON_PARAMETERS_INFO[currentParameter].verbName + " in a completed year";
|
+ sum + ' were ' + COMPARISON_PARAMETERS_INFO[currentParameter].verbName + " in a completed year";
|
||||||
|
|
||||||
divBar.children(".known-bar").attr("title", countExplanation);
|
divBar.children(".known-bar").attr("title", countExplanation);
|
||||||
|
|
||||||
countExplanation = combinedCount.currentYearCount + ' of '
|
divBar.children(".known-bar").html(" ").css("background-color", colorToAssign).css("width", knownNormalizedWidth);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
divBar.children(".known-bar").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (combinedCount.unknownYearCount) {
|
||||||
|
var unknownNormalizedWidth = getNormalizedWidth(entity, combinedCount.unknownYearCount);
|
||||||
|
|
||||||
|
var countExplanation = combinedCount.unknownYearCount + ' of '
|
||||||
|
+ sum + ' have an unknown ' + COMPARISON_PARAMETERS_INFO[currentParameter].name + " year (not charted above)";
|
||||||
|
|
||||||
|
divBar.children(".unknown-bar").attr("title", countExplanation);
|
||||||
|
|
||||||
|
divBar.children(".unknown-bar").children(".unknown-inner-bar").html(" ").css("background-color", colorToAssign).css("width", unknownNormalizedWidth);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
divBar.children(".unknown-bar").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (combinedCount.currentYearCount) {
|
||||||
|
var currentNormalizedWidth = getNormalizedWidth(entity, combinedCount.currentYearCount);
|
||||||
|
|
||||||
|
var countExplanation = combinedCount.currentYearCount + ' of '
|
||||||
+ sum + ' were ' + COMPARISON_PARAMETERS_INFO[currentParameter].verbName + ' in the current incomplete year (not charted above)';
|
+ sum + ' were ' + COMPARISON_PARAMETERS_INFO[currentParameter].verbName + ' in the current incomplete year (not charted above)';
|
||||||
|
|
||||||
divBar.children(".current-year-bar").attr("title", countExplanation);
|
divBar.children(".current-year-bar").attr("title", countExplanation);
|
||||||
|
|
||||||
countExplanation = combinedCount.unknownYearCount + ' of '
|
divBar.children(".current-year-bar").html(" ").css("background-color", colorToAssign).css("width", currentNormalizedWidth);
|
||||||
+ sum + ' have an unknown ' + COMPARISON_PARAMETERS_INFO[currentParameter].name + " year (not charted above)";
|
|
||||||
|
|
||||||
divBar.children(".unknown-bar").attr("title", countExplanation);
|
} else {
|
||||||
|
|
||||||
|
divBar.children(".current-year-bar").hide();
|
||||||
|
}
|
||||||
|
|
||||||
var entityLabelForLegend = divLabel.find(".entity-label-url");
|
var entityLabelForLegend = divLabel.find(".entity-label-url");
|
||||||
entityLabelForLegend.html(entity.label);
|
entityLabelForLegend.html(entity.label);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue