D3.js I';我一直在尝试使用dc.js和crossfilter来构建datatable功能,以列出一些数据。但是数据没有按预期显示
我一直在尝试使用dc.js和crossfilter来构建datatable功能来列出一些数据,但是数据并没有按预期显示 我的数据样本D3.js I';我一直在尝试使用dc.js和crossfilter来构建datatable功能,以列出一些数据。但是数据没有按预期显示,d3.js,dc.js,crossfilter,D3.js,Dc.js,Crossfilter,我一直在尝试使用dc.js和crossfilter来构建datatable功能来列出一些数据,但是数据并没有按预期显示 我的数据样本 { "name": "Thomas Ludlow Hallaway", "urlslug": "\\/wiki\\/thomas_ludlow_hallaway_(new_earth)", "id": "secret identity", "align": "bad characters", "eye": "brown eyes",
{
"name": "Thomas Ludlow Hallaway",
"urlslug": "\\/wiki\\/thomas_ludlow_hallaway_(new_earth)",
"id": "secret identity",
"align": "bad characters",
"eye": "brown eyes",
"hair": "brown hair",
"sex": "male characters",
"gsm": "",
"alive": "deceased characters",
"appearances": 36,
"first appearance": "1940, may",
"year": 1940
},
{
"name": "Jeannette",
"urlslug": "\\/wiki\\/jeannette_(new_earth)",
"id": "secret identity",
"align": "bad characters",
"eye": "blue eyes",
"hair": "white hair",
"sex": "female characters",
"gsm": "",
"alive": "living characters",
"appearances": 35,
"first appearance": "2009, january",
"year": 2009
}
我的代码
function listCharacters(ndx) {
var dim = ndx.dimension(dc.pluck("name"));
dc.dataTable("#all-characters")
.dimension(dim)
.group(function(d) {
return "";
})
.columns(["name", "urlslug", "first appearance"])
.size(Infinity)
.sortBy("name")
.order(d3.ascending)
.transitionDuration(1000);
}
预期产量
名称urlslug首次出现
托马斯\/wiki \/jeannette_(新地球)1940年5月
Jeannette\/wiki\/thomas_ludlow_hallaway(新地球)2009年1月
在开发人员工具控制台中运行代码会产生以下错误。(对于D3和dc.js中的所有编码,这是一个非常有用的工具!)
uncaughttypeerror:\u sortBy不是函数
在VM164 dc.js:7999
在Array.sort(
修复它,我们得到了基本的、像样的输出,下面仍然需要使用CSS进行大量格式化,或者您可以考虑使用或如果需要像分页之类的特性。
使用工作代码。运行代码会在开发人员工具控制台中产生以下错误。(这是一个非常有用的工具,适用于D3和dc.js中的所有编码!)
uncaughttypeerror:\u sortBy不是函数
在VM164 dc.js:7999
在Array.sort(
修复它,我们得到了基本的、像样的输出,下面仍然需要使用CSS进行大量格式化,或者您可以考虑使用或如果需要像分页之类的特性。
使用工作代码
Uncaught TypeError: _sortBy is not a function
at VM164 dc.js:7999
at Array.sort (<anonymous>)
at nestEntries (VM164 dc.js:7998)
at renderSections (VM164 dc.js:7962)
at Object._chart._doRender (VM164 dc.js:7874)
at Object._chart.render (VM164 dc.js:2092)
at Object.dc.renderAll (VM164 dc.js:251)
at (index):85
at dispatch (VM161 jquery-1.11.0.js:4624)
at elemData.handle (VM161 jquery-1.11.0.js:4292)