Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
485 views
in Technique[技术] by (71.8m points)

javascript - 如何将csv文件导入到JavaScript中以进行绘图?(How can i import a csv file into javascripts for plotly graph?)

import a csv file

(导入一个CSV文件)

Plotly.d3.csv("states.csv", function(error, stateData) {
                if (error) return console.warn(error);



            });
            var trace1 = {
                x: stateData.map(row =>row.state),
                y: stateData.map(row =>row.year),
                type: "bar"
            };

            var data = [trace1]

            var layout = {
                title : " State graph",
                barmode: "group"
            };

Plotly.newPlot("plot", data, layout);

I want to do bar chart from my csv file, code it doesn't work.

(我想从我的csv文件中制作条形图,将其编码无效。)

Is there any other way to approach this problem ?

(还有其他方法可以解决此问题吗?)

  ask by ruddy simonpour translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...