In our dc.js
powered d3.js
chart.
Trying to concatenate a few boolean expressions inside crossfilter's's filter
function by using code appending approach.
var field1 = true,
field2 = "XYZ",
field3 = "ABC",
field4 = 1
var filteredData = jsonObject.filter(function(d) {
//condition 1
if (field1 != true && field2 != "GHI") {
var _dataFilter = d.FieldOne >= field1 &&
d.FieldTwo <= field2 &&
d.FieldThree == field3 &&
d.FieldFour == field4
}
return _dataFilter;
});
console.log("FieldOne " + field1 + " FieldTwo " + field2 + " FieldThree " + field3 + " FieldFour " + field4);
var sourceDataForChart = crossfilter(filteredData);
I'm finding that _dataFilter
is coming as nothing on console. By this, I mean literally nothing. No undefined, no object, no value, no function is returned. sourceDataForChart
is the data being used by the chart
I need to implement it for a grouping requirement, there will be a lot of conditions. How do I do it?