How to import XML data using d3.js?

前端 未结 1 1832
别那么骄傲
别那么骄傲 2021-01-31 11:49

can someone provide a basic example how to import data from an XML file using d3?

My XML file looks like this:

    
        71&l         


        
相关标签:
1条回答
  • 2021-01-31 12:13

    The XML object that is passed into the callback is the root element of the XML DOM (see https://github.com/mbostock/d3/wiki/Requests#wiki-d3_xml ), and therefore you need to process it using the JavaScript XML/DOM access facilities.

    I have written a small example that shows how to use d3.xml to create a bar chart (based on the original d3 barchart example http://mbostock.github.com/d3/tutorial/bar-1.html ):

    Link to see example: http://bl.ocks.org/2772585

    Link with XML code: https://gist.github.com/lgrammel/2772585

    0 讨论(0)
提交回复
热议问题