我有超过500万的大量记录。我已经设法使用表结构中的crossfilter将数据作为json提取。现在我想使用符号键对数据进行分组。任何帮助将不胜感激。
这是我的代码
d3.json("my_json_file.json", function(error, json_data) {
var data = crossfilter(json_data),
typeDimension = stocks_jsoncs.dimension(function (d) {
return d.symbol;
});
typeGroup = typeDimension.group().all();
$('#stk_table').dataTable({
"aaData": typeDimension.top(Infinity),
"aoColumns": [{
"mDataProp": "id"
}, {
"mDataProp": "symbol"
}, {
"mDataProp": "stock_name"
}, {
"mDataProp": "changepercent"
}, {
"mDataProp": "close"
}, {
"mDataProp": "volume"
}]
});
});
以下是我的json文件的几个内容:
[{"id":"11","symbol":"01KG","stock_name":"Scottish American Investment Co. PLC","changepercent":"0","close":"125.00","volume":"0"},{"id":"63","symbol":"01KG","stock_name":"Scottish American Investment Co. PLC","changepercent":"0","close":"125.00","volume":"0"},{"id":"64","symbol":"01OO","stock_name":"Nordic Investment Bank 5.25% Nts 26\/11\/19","changepercent":"-0.532","close":"118.30","volume":"2000"},{"id":"65","symbol":"01OO","stock_name":"Nordic Investment Bank 5.25% Nts 26\/11\/19","changepercent":"-0.264","close":"118.93","volume":"6000"},{"id":"66","symbol":"01OO","stock_name":"Nordic Investment Bank 5.25% Nts 26\/11\/19","changepercent":"0.602","close":"119.25","volume":"7000"},{"id":"67","symbol":"01OO","stock_name":"Nordic Investment Bank 5.25% Nts 26\/11\/19","changepercent":"1.747","close":"118.53","volume":"3000"},{"id":"68","symbol":"01OO","stock_name":"Nordic Investment Bank 5.25% Nts 26\/11\/19","changepercent":"0","close":"116.50","volume":"10000000"},{"id":"69","symbol":"04LL","stock_name":"British Land Company PLC","changepercent":"0","close":"115.00","volume":"0"},{"id":"132","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0.8","close":"126.00","volume":"0"},{"id":"159","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0.412","close":"122.00","volume":"0"},{"id":"160","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0","close":"121.50","volume":"0"},{"id":"179","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0","close":"119.50","volume":"0"},{"id":"180","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"-3.239","close":"119.50","volume":"6000"},{"id":"181","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0","close":"123.50","volume":"0"},{"id":"191","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0","close":"121.50","volume":"0"},{"id":"192","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0","close":"121.50","volume":"0"},{"id":"193","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0","close":"121.50","volume":"0"},{"id":"194","symbol":"06GH","stock_name":"Barclays Bank Plc 9% Perm Int Brg Cap Bds #","changepercent":"0","close":"121.50","volume":"0"},{"id":"195","symbol":"06HB","stock_name":"Hemingway Debenture LD","changepercent":"0","close":"130.00","volume":"0"},{"id":"228","symbol":"06HB","stock_name":"Hemingway Debenture LD","changepercent":"0","close":"130.00","volume":"0"}]