]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
firstTick and lastTick can be null if the chart is empty.
authorTore Lervik <tore@lervik.com>
Mon, 21 Dec 2015 21:34:31 +0000 (22:34 +0100)
committerTore Lervik <tore@lervik.com>
Mon, 21 Dec 2015 21:34:31 +0000 (22:34 +0100)
src/scales/scale.time.js

index a1ce6a35edc5c8c249f3971c1cd735295dc1bbeb..6d17e5ee5c21fbf1a2b547d6ea2db34012269189 100644 (file)
                        }, 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) {