Skip to content

Commit

Permalink
Merge pull request vega#272 from uwdata/kw/data
Browse files Browse the repository at this point in the history
Kw/data
  • Loading branch information
domoritz committed Apr 22, 2015
2 parents d53e1cb + 9d7761f commit 5a35e54
Show file tree
Hide file tree
Showing 9 changed files with 513 additions and 460 deletions.
13 changes: 10 additions & 3 deletions src/app/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ angular.module('polestar')
.factory('Config', function(vl, _) {
var Config = {};

Config.schema = vl.schema.schema.properties.cfg;
Config.schema = vl.schema.schema.properties.config;
Config.dataschema = vl.schema.schema.properties.data;

Config.data = vl.schema.util.instantiate(Config.dataschema);
Config.config = vl.schema.util.instantiate(Config.schema);

Config.getConfig = function() {
return _.cloneDeep(Config.config);
};

Config.getData = function() {
return _.cloneDeep(Config.data);
};

Config.large = function() {
return {
singleWidth: 400,
Expand All @@ -26,8 +33,8 @@ angular.module('polestar')
};

Config.updateDataset = function(dataset, type) {
Config.config.dataUrl = dataset.url;
Config.config.dataFormatType = type;
Config.data.url = dataset.url;
Config.data.formatType = type;
};

return Config;
Expand Down
2 changes: 1 addition & 1 deletion src/app/config/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Service: Config', function() {
}));

it('should have correct schema and config ', function() {
var schema = vl.schema.schema.properties.cfg,
var schema = vl.schema.schema.properties.config,
config = vl.schema.util.instantiate(Config.schema);

config.singleWidth = 500;
Expand Down
5 changes: 3 additions & 2 deletions src/app/spec/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ angular.module('polestar')

// we need to set the marktype because it doesn't have a default.
spec.marktype = vl.schema.schema.properties.marktype.enum[0];
spec.cfg = Config.config;
spec.config = Config.config;
spec.data = Config.data;
return spec;
};

Expand Down Expand Up @@ -95,7 +96,7 @@ angular.module('polestar')
msg: validator.getLastErrors()
});
} else {
vl.merge(cleanSpec.cfg, Config.large());
vl.merge(cleanSpec.config, Config.large());
Spec.encoding = vl.Encoding.fromSpec(cleanSpec);
Spec.vlSpec = Spec.encoding.toSpec(false);
Spec.shorthand = Spec.encoding.toShorthand();
Expand Down
6 changes: 3 additions & 3 deletions src/components/filters/reporturl/reporturl.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ angular.module('polestar')
}

if (params.encoding) {
var encoding = _.omit(params.encoding, 'cfg');
var encoding = _.omit(params.encoding, 'config');
encoding = encodeURI(compactJSONFilter(encoding));
url += 'entry.1323680136=' + encoding + '&';
}

if (params.encoding2) {
var encoding2 = _.omit(params.encoding2, 'cfg');
var encoding2 = _.omit(params.encoding2, 'config');
encoding2 = encodeURI(compactJSONFilter(encoding2));
url += 'entry.853137786=' + encoding2 + '&';
}
Expand All @@ -49,7 +49,7 @@ angular.module('polestar')
function polestarReport(params) {
var url = 'https://docs.google.com/forms/d/1xKs-qGaLZEUfbTmhdmSoS13OKOEpuu_NNWE5TAAml_Y/viewform?';
if (params.encoding) {
var encoding = _.omit(params.encoding, 'cfg');
var encoding = _.omit(params.encoding, 'config');
encoding = encodeURI(compactJSONFilter(encoding));
url += 'entry.1245199477=' + encoding + '&';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<label>
<input ng-model="Spec.spec.cfg.filterNull.O" ng-change="updateFilter()" type="checkbox"> Remove null values
<input ng-model="Spec.spec.config.filterNull.O" ng-change="updateFilter()" type="checkbox"> Remove null values
</label>
2 changes: 1 addition & 1 deletion src/components/vlplot/vlplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ angular.module('polestar')
var configSet = scope.configSet || consts.defaultConfigSet || {};

var vlSpec = _.cloneDeep(scope.vlSpec);
vl.merge(vlSpec.cfg, Config[configSet]());
vl.merge(vlSpec.config, Config[configSet]());

return vl.compile(vlSpec, Dataset.stats);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/vlplotgroup/vlplotgroup.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</a>
<a ng-if="showFilterNull && chart.vlSpec && toggleFilterNull.support(chart.vlSpec, Dataset.stats)"
class="command" ng-click="toggleFilterNull(chart.vlSpec)"
ng-class='{active: chart.vlSpec && chart.vlSpec.cfg.filterNull.O}'>
ng-class='{active: chart.vlSpec && chart.vlSpec.config.filterNull.O}'>
<i class="fa fa-filter"></i>
<small ng-if="showLabel">Filter</small>
<small>NULL</small>
Expand Down
Loading

0 comments on commit 5a35e54

Please sign in to comment.