简体   繁体   English

C3js和D3js错误:的值无效 <g> 属性transform =“ translate(0,NaN)”

[英]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循环执行相同操作的原因。

Working code here 这里的工作代码

Hope this helps! 希望这可以帮助!

暂无
暂无

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

相关问题 d3.js:5942错误:的值无效 <g> 属性transform =“ translate(NaN,0)” - d3.js:5942 Error: Invalid value for <g> attribute transform=“translate(NaN,0)” d3.js arc.centroid(d):错误:的值无效 <text> 属性transform =“ translate(NaN,NaN)” - d3.js arc.centroid(d) : Error: Invalid value for <text> attribute transform=“translate(NaN,NaN)” D3.js 错误:<g> 属性变换:预期数字,“translate(NaN,NaN)”</g> - D3.js Error: <g> attribute transform: Expected number, “translate(NaN,NaN)” 错误:无效的值 <g> attribute transform =“scale(NaN)translate(NaN,NaN)” - Error: Invalid value for <g> attribute transform=“scale(NaN) translate(NaN, NaN)” d3js:“错误:<circle> 属性 cy:预期长度,“NaN”</circle> - d3js: “Error: <circle> attribute cy: Expected length, ”NaN" 错误:<g>属性transform =“translate(undefined,undefined)”的值无效 - Error: Invalid value for <g> attribute transform=“translate(undefined,undefined)” 错误:的值无效 <rect> 属性width =“ NaN” 6d3.v3.min.js:1错误:的值无效 <text> 属性x =“ NaN” - Error: Invalid value for <rect> attribute width=“NaN” 6d3.v3.min.js:1 Error: Invalid value for <text> attribute x=“NaN” D3JS:是否可以传递一个检索值的函数来“转换,转换”属性? - D3JS: is it possible to pass a function which retrieves a value to “transform, translate” property? c3js-D3js-在简单的条形图中自定义标签 - c3js - D3js - Customize labels in a simple bar chart 无效的值 <circle> 使用D3.js属性cx =“NaN” - Invalid value for <circle> attribute cx=“NaN” using D3.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM