简体   繁体   English

使用交叉过滤器的递归错误过多

[英]Too much recursion error using crossfilter

The following page loads in Chrome, but in Firefox/IE the error "too much recursion" happens in the crossfilter.js script (crossfilter.js). 以下页面在Chrome中加载,但是在Firefox / IE中,crossfilter.js脚本(crossfilter.js)中发生错误“太多的递归”。

Link: http://bit.ly/1epx0Gs 链接: http//bit.ly/1epx0Gs

How can this be avoided (or debugged)? 如何避免(或调试)这种情况?

EDIT 编辑

Turns out that Chrome can parse dates with dashes ("6-12-2013"), but firefox/ie need spaces ("6 12 2013") 原来Chrome可以用破折号(“ 6-12-2013”​​)解析日期,但是Firefox / ie需要空格(“ 6 12 2013”​​)

There's not really any way I can verify that this is the problem without a runnable example, but you probably have non-naturally-ordered values in your dimensions. 没有可运行的示例,我实际上没有任何方法可以验证这是问题所在,但是您的维度中可能有非自然排序的值。 You need to cast your dimension values and make sure that all your values are valid. 您需要转换尺寸值,并确保所有值均有效。 The relevant section looks to be: 相关部分看起来是:

self.data.push({
            index:index,
            starttime:new Date(d.starttime),
            sex:d.gender == '' ? 'Non-Subscriber' : d.gender,
            value:d.count
        })

I'd at least change this to: 我至少将其更改为:

self.data.push({
                index:+index,
                starttime:new Date(d.starttime),
                sex:d.gender == '' ? 'Non-Subscriber' : '' + d.gender,
                value:+d.count
            })

The Date() could still be tripping you up if you have invalid d.starttime values, so if you are still getting the error you may want to try replacing it with just "new Date()". 如果您有无效的d.starttime值,则Date()可能仍会绊倒您,因此,如果仍然出现错误,您可能希望尝试仅用“ new Date()”替换它。

Again, no guarantee that's causing your issue, but when I get these recursion errors, this is usually the cause. 同样,不能保证会导致您的问题,但是当我遇到这些递归错误时,通常是原因。

I just encountered the same problem, but the solution was not in the date format but in the encoding of the JS-file itself. 我只是遇到了同样的问题,但是解决方案不是日期格式,而是JS文件本身的编码。 Maybe this will help someone else. 也许这会帮助别人。

I was using following dimension to do some filtering: 我正在使用以下维度进行一些过滤:

CF_data = crossfilter(data);
CF_data_id = CF_data.dimension(function(d) { return  +d.properties['Código']; });

Notice the spanish "o" character in the selector of the return statement. 注意return语句选择器中的西班牙语“ o”字符。

And the following error was thrown: 并且引发了以下错误:

# too much recursion crossfilter.js:174:9

After checking everything, I noticed that my file was suddenly encoded in ANSI and not in UTF8. 检查完所有内容后,我注意到我的文件突然被编码为ANSI而不是UTF8。 So in notepadd++ I converted the file back to UTF8 and the error was gone. 因此,在notepadd ++中,我将文件转换回了UTF8,错误消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM