我有一个像这样的数据
var data = [
{name: "name1",age:100,gender: m ,someotherfiled: ""},
{name: "name2",age:101 ,gender: f,someotherfiled: ""}
]
我想只选择两个像这样的字段
[
{name: "name1",age:100 },
{name: "name2",age:101}
]
如何处理crossfilter?
答案 0 :(得分:0)
你不会用Crossfilter做到这一点。最简单的选择可能是使用Array.map创建一个只包含所需字段的新数组:
var data = [
{name: "name1",age:100,gender: m ,someotherfiled: ""},
{name: "name2",age:101 ,gender: f,someotherfiled: ""}
];
var newData = data.map(function(d) { return { name: d.name, age: d.age }; });