我正在尝试扩展it以在级联数据集上工作。最初,我为州的累积案例工作,但现在我也添加了日常案例。 (请参见Line 121-Line 192
)
当前工作=> https://blockbuilder.org/ninjakx/76e7ddf821509e308b741fead46f8bb4
所以我的数据现在看起来像这样:
最初是这样的:
您可以看到没有太大的区别。由于1月31日至3月13日缺少状态数据,因此我通过将个案分配为零来添加状态数据。同样在我的图表中,我的数据是var data = json_data.data.history;
,但在这种情况下,我将直接传递data
。
现在当我使用相同的脚本(创建图表)时,出现此错误:
error TypeError: Cannot destructure property 'state' of 'undefined' as it is undefined.
at untitled1.html:213
at Array.forEach (<anonymous>)
at cases_bar_d.group.reduce.v.statewise.forEach.state.state (untitled1.html:213)
at resetMany (crossfilter.js:1135)
at all (crossfilter.js:1159)
at Object.top (crossfilter.js:1165)
at stateline_chart (untitled1.html:231)
at untitled1.html:191
我可以在Line 215
中看到p[state]
未定义,但对于以前的工作也未定义。因此,这对于上一个工作如何起作用,但对本工作却不起作用。
[某天缺少一种状态:2020-05-17
由于我正在使用循环-> range(37)
,所以它给了我未定义的属性data_add['statewise'][st].state
->变得不确定。
我只需要使用循环range(data_add['statewise'].length)
而不是range(37)