From f316300ae8468309cb3bf19b157f4b5c6534205d Mon Sep 17 00:00:00 2001 From: Shelby Sturgis Date: Thu, 5 Nov 2015 00:27:30 -0800 Subject: [PATCH] Closes #5323. Fixes issue when splitting charts on a date field. The issue involved the _normalizeOrdered function not being able to access the ordered object when data objects were nested in rows or columns. --- src/ui/public/vislib/lib/data.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ui/public/vislib/lib/data.js b/src/ui/public/vislib/lib/data.js index 276c1c3f9137..743b8eeeec74 100644 --- a/src/ui/public/vislib/lib/data.js +++ b/src/ui/public/vislib/lib/data.js @@ -668,16 +668,21 @@ define(function (require) { * @return {undefined} */ Data.prototype._normalizeOrdered = function () { - if (!this.data.ordered || !this.data.ordered.date) return; + var data = this.getVisData(); + var self = this; - var missingMin = this.data.ordered.min == null; - var missingMax = this.data.ordered.max == null; + data.forEach(function (d) { + if (!d.ordered || !d.ordered.date) return; - if (missingMax || missingMin) { - var extent = d3.extent(this.xValues()); - if (missingMin) this.data.ordered.min = extent[0]; - if (missingMax) this.data.ordered.max = extent[1]; - } + var missingMin = d.ordered.min == null; + var missingMax = d.ordered.max == null; + + if (missingMax || missingMin) { + var extent = d3.extent(self.xValues()); + if (missingMin) d.ordered.min = extent[0]; + if (missingMax) d.ordered.max = extent[1]; + } + }); }; /**