簡體   English   中英

錯誤:的值無效 <circle> dimple.js中的屬性cx =“ NaN”

[英]Error: Invalid value for <circle> attribute cx=“NaN” in dimple.js

我正在制作一個圖表,單擊按鈕時可以用不同的數據更新圖表。

當x軸的長度不變時,下面的代碼似乎起作用,但是當x軸的長度改變並且圖表更新時,我收到此錯誤: Error: Invalid value for <circle> attribute cx="NaN"

碼:

var svg = dimple.newSvg("#stepContainer", 400, 300);

        var step_data = [
             {Period: 1, FIP: (Math.random() * 1000000)},
             {Period: 2, FIP: (Math.random() * 1000000)},
             {Period: 3, FIP: (Math.random() * 1000000)},
             {Period: 4, FIP: (Math.random() * 1000000)},
             ];

        var stepChart = new dimple.chart(svg, step_data);
        stepChart.setBounds(50, 40, 305, 205);
        var myAxis = stepChart.addCategoryAxis("x", "Period");
        stepChart.addMeasureAxis("y", "FIP");
        var s = stepChart.addSeries(null, dimple.plot.line);
        s.interpolation = "step";
        stepChart.draw();

        d3.select("#btn").on("click", function() {
        // If the length of the x-axis stays the same I don't get the error
        //var periods = 4;
        var periods = Math.random()* 50;
        arr = [];
        for (i=1; i <=periods; i++) {
            arr.push({Period: i, FIP: (Math.random() * 1000000)});
        }

           stepChart.data = arr;
           stepChart.draw(1000);
        });

是什么導致此錯誤?

小提琴: http : //jsfiddle.net/jdash99/4pgd900f/9/

這是一個突出的錯誤。 它似乎並沒有影響顯示,只是引發了不必要的控制台錯誤:

https://github.com/PMSI-AlignAlytics/dimple/issues/93

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM