This commit is contained in:
AreWeFastYet 2012-11-29 07:55:07 +00:00
Родитель faf84fded6
Коммит 17886483b1
1 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -57,7 +57,18 @@ Display.prototype.aggregateTicks = function () {
var list = []; var list = [];
// This is all a bunch of hardcoded hacks for now. // This is all a bunch of hardcoded hacks for now.
var preticks = (ticks == 5) ? 6 : ticks; var preticks, preticklist;
if (ticks == 5) {
preticks = 6;
preticklist = [2, 4];
} else if (ticks == 10) {
preticks = 9;
preticklist = [3, 6];
} else {
preticks = ticks;
}
var last_year = undefined; var last_year = undefined;
var current_year = (new Date()).getFullYear(); var current_year = (new Date()).getFullYear();
for (var i = 0; i < this.historical; i += preticks) { for (var i = 0; i < this.historical; i += preticks) {
@ -76,11 +87,12 @@ Display.prototype.aggregateTicks = function () {
// Add the tick mark, then try to add some more empty ones to // Add the tick mark, then try to add some more empty ones to
// make the graph appear denser. // make the graph appear denser.
list.push([i, text]); list.push([i, text]);
if (preticks == 6) { if (preticklist) {
if (i + 2 < this.historical) { for (var j = 0; j < preticklist.length; j++) {
list.push([i + 2, ""]); var v = i + preticklist[j];
if (i + 4 < this.historical) if (v >= this.historical)
list.push([i + 4, ""]); break;
list.push([v, ""]);
} }
} }
} }