Skip to content

Commit a262be0

Browse files
Added handling for empty data sets
1 parent f18a79e commit a262be0

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

dist/dimple.v1.2.0.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ var dimple = {
736736
yCat = "",
737737
ySortArray = [],
738738
rules = [],
739-
sortedData = series.data || this.data,
739+
sortedData = series.data || this.data || [],
740740
groupRules = [];
741741

742742
if (this.storyboard !== null && this.storyboard !== undefined && this.storyboard.categoryFields.length > 0) {
@@ -754,7 +754,7 @@ var dimple = {
754754
ySortArray = dimple._getOrderedList(sortedData, yCat, series.y._orderRules.concat([{ ordering : series.y.measure, desc : true }]));
755755
}
756756

757-
if (series.categoryFields !== null && series.categoryFields !== undefined && series.categoryFields.length > 0) {
757+
if (sortedData.length > 0 && series.categoryFields !== null && series.categoryFields !== undefined && series.categoryFields.length > 0) {
758758
// Concat is used here to break the reference to the parent array, if we don't do this, in a storyboarded chart,
759759
// the series rules to grow and grow until the system grinds to a halt trying to deal with them all.
760760
rules = [].concat(series._orderRules);

dist/dimple.v1.2.0.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/objects/chart/methods/_getSeriesData.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
yCat = "",
4848
ySortArray = [],
4949
rules = [],
50-
sortedData = series.data || this.data,
50+
sortedData = series.data || this.data || [],
5151
groupRules = [];
5252

5353
if (this.storyboard !== null && this.storyboard !== undefined && this.storyboard.categoryFields.length > 0) {
@@ -65,7 +65,7 @@
6565
ySortArray = dimple._getOrderedList(sortedData, yCat, series.y._orderRules.concat([{ ordering : series.y.measure, desc : true }]));
6666
}
6767

68-
if (series.categoryFields !== null && series.categoryFields !== undefined && series.categoryFields.length > 0) {
68+
if (sortedData.length > 0 && series.categoryFields !== null && series.categoryFields !== undefined && series.categoryFields.length > 0) {
6969
// Concat is used here to break the reference to the parent array, if we don't do this, in a storyboarded chart,
7070
// the series rules to grow and grow until the system grinds to a halt trying to deal with them all.
7171
rules = [].concat(series._orderRules);

tmp/dimple.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ var dimple = {
736736
yCat = "",
737737
ySortArray = [],
738738
rules = [],
739-
sortedData = series.data || this.data,
739+
sortedData = series.data || this.data || [],
740740
groupRules = [];
741741

742742
if (this.storyboard !== null && this.storyboard !== undefined && this.storyboard.categoryFields.length > 0) {
@@ -754,7 +754,7 @@ var dimple = {
754754
ySortArray = dimple._getOrderedList(sortedData, yCat, series.y._orderRules.concat([{ ordering : series.y.measure, desc : true }]));
755755
}
756756

757-
if (series.categoryFields !== null && series.categoryFields !== undefined && series.categoryFields.length > 0) {
757+
if (sortedData.length > 0 && series.categoryFields !== null && series.categoryFields !== undefined && series.categoryFields.length > 0) {
758758
// Concat is used here to break the reference to the parent array, if we don't do this, in a storyboarded chart,
759759
// the series rules to grow and grow until the system grinds to a halt trying to deal with them all.
760760
rules = [].concat(series._orderRules);

0 commit comments

Comments
 (0)