1. Improved language for the message to be displayed when it takes a long time to display temporal vis.

2. Fix for unreadable y-axis numbers for huge values. (see http://issues.library.cornell.edu/browse/NIHVIVO-2277)
3. Changed display text for last cached at date.
This commit is contained in:
cdtank 2011-03-23 17:13:45 +00:00
parent 3a7943c07a
commit 0d21538a1d
5 changed files with 60 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View file

@ -297,7 +297,15 @@ function parseXSDateTime(rawDateTimeString) {
var date = dateTime[0].split("-"); var date = dateTime[0].split("-");
var time = dateTime[1].split(":"); var time = dateTime[1].split(":");
return new Date(date[0], date[1], date[2], time[0], time[1], 0); return new Date(date[0], parseInt(date[1], 10) -1, date[2], time[0], time[1], 0);
}
function getReadableDateForLastCachedAtDate(dateObject) {
var day = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
var month = ['January','February','March','April','May','June','July','August','September','October','November']
return day[dateObject.getDay()] + ", " + month[dateObject.getMonth()] + " " + dateObject.getDate();
} }
temporalGraphProcessor = { temporalGraphProcessor = {
@ -349,9 +357,7 @@ temporalGraphProcessor = {
if ($("#incomplete-data-disclaimer").length > 0 && lastCachedAtDateTimes.length > 0) { if ($("#incomplete-data-disclaimer").length > 0 && lastCachedAtDateTimes.length > 0) {
$("#incomplete-data-disclaimer").attr( $("#incomplete-data-disclaimer").attr(
"title", "title",
$("#incomplete-data-disclaimer").attr("title") + " as of " + parseXSDateTime(lastCachedAtDateTimes[0])); $("#incomplete-data-disclaimer").attr("title") + " as of " + getReadableDateForLastCachedAtDate(parseXSDateTime(lastCachedAtDateTimes[0])));
} }
} }
} }

View file

@ -563,25 +563,53 @@ function setLineWidthAndTickSize(yearRange, flotOptions) {
} }
/** var TickSize = {
* Dynamically change the ticksize of y-axis.
*/
function setTickSizeOfYAxis(maxValue, flotOptions){
var tickSize = 0; maxValue: 0.0,
if (maxValue > 0 && maxValue <= 5) { maxTicks: {
flotOptions.yaxis.tickSize = 1; yAxis: 12.0
} else if (maxValue > 5 && maxValue <= 10) { },
flotOptions.yaxis.tickSize = 2;
} else if (maxValue > 10 && maxValue <= 15) { tickSizeUnits: {
flotOptions.yaxis.tickSize = 5; yAxis: [1.0, 2.5, 5.0]
} else if (maxValue > 15 && maxValue <= 70) { },
flotOptions.yaxis.tickSize = 5;
} else { getApproximateTickSize: function(allowedMaxTicks) {
flotOptions.yaxis.tickSize = 10; return Math.max(Math.ceil(parseFloat(this.maxValue) / allowedMaxTicks), 1.0);
},
getFinalTickSizeForYaxis: function(unitTickSizeGenerator) {
tickSizeMultiplier = 1.0;
finalTickSize = 1.0;
approximateTickSize = this.getApproximateTickSize(this.maxTicks.yAxis);
while (true) {
if (approximateTickSize <= (unitTickSizeGenerator[0] * tickSizeMultiplier)) {
finalTickSize = unitTickSizeGenerator[0] * tickSizeMultiplier;
break;
}
if (approximateTickSize <= (unitTickSizeGenerator[1] * tickSizeMultiplier)) {
finalTickSize = unitTickSizeGenerator[1] * tickSizeMultiplier;
break;
}
if (approximateTickSize <= (unitTickSizeGenerator[2] * tickSizeMultiplier)) {
finalTickSize = unitTickSizeGenerator[2] * tickSizeMultiplier;
break;
}
tickSizeMultiplier *= 10.0;
}
return finalTickSize;
},
getTickSize: function(value, onAxis) {
this.maxValue = value;
if (onAxis.trim().toLowerCase() === 'y') {
return this.getFinalTickSizeForYaxis(this.tickSizeUnits.yAxis);
} }
} }
};
/** /**
* Create a div that represents the rectangular bar A hidden input class that is * Create a div that represents the rectangular bar A hidden input class that is
@ -1186,5 +1214,8 @@ function setTickSizeOfAxes(){
var normalizedYearRange = getNormalizedYearRange(); var normalizedYearRange = getNormalizedYearRange();
setLineWidthAndTickSize(normalizedYearRange.normalizedRange, FlotOptions); setLineWidthAndTickSize(normalizedYearRange.normalizedRange, FlotOptions);
setTickSizeOfYAxis(calcMaxWithinComparisonParameter(checkedLabelToEntityRecord), FlotOptions);
FlotOptions.yaxis.tickSize =
TickSize.getTickSize(calcMaxWithinComparisonParameter(checkedLabelToEntityRecord), 'y');
} }