D3.js namespace() Function Last Updated : 19 Aug, 2020 Comments Improve Suggest changes Like Article Like Report The d3.namespace() function is used to return an object that contains space and local attributes that describe the full namespace URL and the local name. If there is a colon in the name than the string on the left side of the colon is a namespace prefix. Syntax: d3.namespace(name); Parameters: This function contains only one parameter that is given above and described below. name: This is a string that contains a prefix that must be registered in d3.namespaces. Return Value: This function returns an object. Example 1: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" path1tent="width=device-width, initial-scale=1.0" /> <script src="https://d3js.org/d3.v4.min.js"> </script> <style> h2 { color: green; } </style> </head> <body> <h2>Geeks for geeks</h2> <script> console.log(d3.namespace("svg:Geeksforgeeks")); document.write("<h3>Space: ", d3.namespace("svg:Geeksforgeeks").space, "</h3>"); document.write("<h3>Local: ", d3.namespace("svg:Geeksforgeeks").local + "</h3>"); </script> </body> </html> Output: Example 2: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" path1tent="width=device-width, initial-scale=1.0" /> <script src="https://d3js.org/d3.v4.min.js"> </script> </head> <body> <script> console.log(d3.namespace("xhtml:Geeksforgeeks")); console.log(d3.namespace("xlink:Geeksforgeeks")); console.log(d3.namespace("xml:Geeksforgeeks")); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js namespace() Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads D3.js mouse() Function The d3.mouse() function in D3.js is used to return the x-coordinate and y-coordinate of the current event when clicked. Syntax:d3.mouse(container);Parameters: This function accepts a single parameter as mentioned above and described below:container: It is the name of the container or the HTML tag to 2 min read D3.js style() Function The d3.style() function is used to style the specified node(attribute) with the specified name(Value). In this, if the node has an inline style with the specified name, its value is returned and if the node has not an inline style, the calculated value is returned.Syntax: d3.style(node, name)Paramet 1 min read D3.js | d3.values() Function The d3.values() function in D3.js is used to return an array containing the property values of the specified object or an associative array. Syntax: d3.values(object) Parameters: This function accepts single parameter object which contains the key, value pairs. Return Value: It returns the values of 1 min read D3.js json() Function The d3.json() function is used to fetch the JSON file. If this function got an init parameter, then this is called along with the fetch operation. Syntax: d3.json(input[, init]); Parameters: This function accepts two parameters as mentioned above and described below. input: This parameter takes the 1 min read D3.js timeout() Function The d3.timeout() function in D3.js is used to automatically stop the function or the timer after a particular interval of time. It works same as setTimeOut() function in JavaScript. Syntax: d3.timeout(callback, delay); Parameters: This function accepts two parameters as mentioned above and described 2 min read Like