Skip to content

Commit

Permalink
Fix bug with null series
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkiernander committed Jul 23, 2014
1 parent ec96075 commit 9cbe615
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
23 changes: 6 additions & 17 deletions adhoc/adhoc_playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,13 @@
<script type="text/javascript">
var svg = dimple.newSvg("#chartContainer", 590, 400);
d3.tsv("/data/example_data.tsv", function (data) {
data = dimple.filterData(data, "Owner", ["Aperture", "Black Mesa"])
var myChart = new dimple.chart(svg, data);
myChart.setBounds(60, 30, 470, 300)
var x = myChart.addMeasureAxis("x", "Distribution");
var y = myChart.addMeasureAxis("y", "Price");
var p = myChart.addMeasureAxis("p", "Unit Sales");
var z = myChart.addMeasureAxis("z", "Sales Value");
var s = myChart.addSeries(["Price Tier", "Channel"], dimple.plot.pie);
var s2 = myChart.addSeries(["Price Tier", "Owner"], dimple.plot.pie);
x.overrideMin = 40;
x.overrideMax = 70;
y.overrideMax = 150;
s.radius = 75;
s.innerRadius = "-10px";
s.aggregate = dimple.aggregateMethod.avg;
s2.radius = 75;
s2.outerRadius = "-15px";
s2.aggregate = dimple.aggregateMethod.avg;
myChart.setStoryboard("Date");
myChart.setBounds(60, 30, 505, 305);
var x = myChart.addCategoryAxis("x", "Month");
x.addOrderRule("Date");
myChart.addMeasureAxis("y", "Unit Sales");
var s = myChart.addSeries(null, dimple.plot.area);
myChart.draw();
});
</script>
Expand Down
4 changes: 2 additions & 2 deletions dist/dimple.v2.1.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@

// The data for this series
var data = series.data || this.data || [],
cats = [].concat(series.categoryFields),
cats = [].concat(series.categoryFields || "All"),
returnData = this._getData(data, cats, series.aggregate, series._orderRules, series._isStacked(), series.x, series.y, series.z, series.p, series.c),
higherLevelData = [],
i,
Expand Down Expand Up @@ -1527,7 +1527,7 @@
}
}, this);
// Put single values into single value arrays
if (categoryFields !== null && categoryFields !== undefined) {
if (categoryFields) {
categoryFields = [].concat(categoryFields);
}
// Create a series object
Expand Down
2 changes: 1 addition & 1 deletion dist/dimple.v2.1.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/objects/chart/methods/_getSeriesData.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// The data for this series
var data = series.data || this.data || [],
cats = [].concat(series.categoryFields),
cats = [].concat(series.categoryFields || "All"),
returnData = this._getData(data, cats, series.aggregate, series._orderRules, series._isStacked(), series.x, series.y, series.z, series.p, series.c),
higherLevelData = [],
i,
Expand Down
2 changes: 1 addition & 1 deletion src/objects/chart/methods/addSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}
}, this);
// Put single values into single value arrays
if (categoryFields !== null && categoryFields !== undefined) {
if (categoryFields) {
categoryFields = [].concat(categoryFields);
}
// Create a series object
Expand Down

0 comments on commit 9cbe615

Please sign in to comment.