简体   繁体   中英

Show XML data with d3js

i'm working on a little d3.js asignment for school.. I looked at some examples to load a XML file, but I can't figure it out what i'm doing wrong.. The XML file is loading correct.. I'm just figuring out JS so please not to technical ;p..

this is the code:

d3.xml("data.xml", "application/xml", function(xml) {

    var data = d3.select(xml).selectAll("path");

    console.log("data uit de xml=  " + data);

});

Thanx!

Assuming that you have path elements in your XML, you would select them like this:

var data = xml.path;

The XML data is returned as a JavaScript object. It might be easiest to log the entire object and look at it in the debugger/JavaScript console of the browser of your choice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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