diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index 1dbc5ed..15f1a08 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -827,7 +827,12 @@ map_date_calc_ticks (GogAxis *axis)
 	}
 
 	maj_months = go_fake_round (major_tick / (DAYS_IN_YEAR / 12));
-	maj_months = CLAMP (maj_months, 1, G_MAXINT / 12);
+	if (maj_months < 1) {
+		map_linear_calc_ticks (axis);
+		return;
+	}
+	if (maj_months > G_MAXINT / 12)
+		maj_months = G_MAXINT / 12;
 	maj_N = 1 + (int)ceil (range / (maj_months * (DAYS_IN_YEAR / 12)));
 
 	min_months = go_fake_round (minor_tick / (DAYS_IN_YEAR / 12));
