[英]C3js and D3js Error: Invalid value for <g> attribute transform=“translate(0,NaN)”
I'm trying to create a bunch of panels with d3js and then trying to fill those panels with graphs using C3js. 我试图用d3js创建一堆面板,然后尝试使用C3js用图填充这些面板。 For some reason, I keep getting: 由于某种原因,我不断得到:
Error: Invalid value for <g> attribute transform="translate(0,NaN)"
When I hardcode the panels, it works just fine. 当我对面板进行硬编码时,它可以正常工作。 Here is some example code that shows the error: https://jsfiddle.net/tgp9gqfb/2/ 这是一些显示错误的示例代码: https : //jsfiddle.net/tgp9gqfb/2/
Any direction on what I'm doing wrong? 我做错了什么方向吗?
Instead of doing it with setting data and making divs: 不用设置数据并制作div:
d3.select("#page-wrapper").selectAll("div")
.data(order_labels["a"]);
Do the same with a for loop: 用for循环做同样的事情:
order_labels["a"].forEach(function(d) {
new_panels = d3.select("#page-wrapper").append('div').attr('class', "panel panel-default");
new_panels.append('div').attr('class', "panel-heading").text(function() {
return readable_lables[d];
});
new_panels.append('div').attr('class', "panel-body").append('div').attr("id", function() {
return d + "graph_wrapper";
});
new_panels.append('div').attr('class', "panel-footer");
});
I agree the way you doing is correct but the internal c3 error is because of the data in the div that is the reason why i am asking you to do the same with the for loop. 我同意您的做法是正确的,但内部c3错误是因为div中的数据,这就是我要您对for循环执行相同操作的原因。
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.