Skip to content

Commit

Permalink
Fix filters not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandar Jovanov committed Sep 22, 2017
1 parent c1e3229 commit 1b63b5b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ckanext/c3charts/fanstatic/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ this.ckan.views.c3charts = this.ckan.views.c3charts || {};

function initPlot(elementId, resource, resourceView) {

var filters = resourceView.filters || [];
var queryParams = generateQueryParams(resource, {});

jQuery.each(filters, function (field, values) {
queryParams.filters.push({type: 'term', field: field, term: values});
});

$.when(
recline.Backend.Ckan.fetch(resource),
recline.Backend.Ckan.query(queryParams, resource)
Expand Down Expand Up @@ -44,12 +49,12 @@ this.ckan.views.c3charts = this.ckan.views.c3charts || {};
item: {
onclick: function(id) {}
}};

var labelX = resourceView.measure_unit_x;
var labelY = resourceView.measure_unit_y;
var positionX = 'outer-middle';
var positionY = 'outer-middle';

switch (chart_type) {
case 'Pie Chart':
chart_type = 'pie';
Expand All @@ -76,7 +81,7 @@ this.ckan.views.c3charts = this.ckan.views.c3charts || {};
if (!Array.isArray(key_fields)) {
key_fields = [key_fields];
}

if (resourceView.aggregate) {
var remap_data = [],
data_len, remap_data_len, aggregator, flag, tmp;
Expand Down Expand Up @@ -317,4 +322,4 @@ this.ckan.views.c3charts = this.ckan.views.c3charts || {};
return query;
}

})(this.ckan.views.c3charts, this.jQuery, this._);
})(this.ckan.views.c3charts, this.jQuery, this._);

0 comments on commit 1b63b5b

Please sign in to comment.