From: Tore Lervik Date: Mon, 21 Dec 2015 21:34:31 +0000 (+0100) Subject: firstTick and lastTick can be null if the chart is empty. X-Git-Tag: 2.0.0-beta2~10^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=477fc726939f670584a8adf1f096352bb8ccb491;p=thirdparty%2FChart.js.git firstTick and lastTick can be null if the chart is empty. --- diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index a1ce6a35e..6d17e5ee5 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -126,8 +126,15 @@ }, this); // We will modify these, so clone for later - this.firstTick = this.firstTick.clone(); - this.lastTick = this.lastTick.clone(); + if (this.firstTick != null) + this.firstTick = this.firstTick.clone(); + else + this.firstTick = moment(new Date); + + if (this.lastTick != null) + this.lastTick = this.lastTick.clone(); + else + this.lastTick = moment(new Date); }, buildTicks: function(index) {