D3.js image() Function Last Updated : 17 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The d3.image() function in D3.js is a part of the request API that is used to fetch the images from any given image URL. If init is also given in the function then it sets any additional properties on the image before loading the image. Syntax: d3.image(input[, init]); Parameters: This function accepts a single parameter as mentioned above and described below: input: It takes the address of the image to be fetched. Return Values: It returns the image from the image URL. Below examples illustrate the D3.js image() Function in JavaScript. Example1: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" path1tent="width=device-width, initial-scale=1.0"/> <title>D3.js image() Function</title> </head> <style></style> <body> <script src= "https://d3js.org/d3.v4.min.js"> </script> <script src= "https://d3js.org/d3-dsv.v1.min.js"> </script> <script src= "https://d3js.org/d3-fetch.v1.min.js"> </script> <script> d3.image("https://robohash.org/image", { crossOrigin: "anonymous" }).then((img) => { console.log(img); }); </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"/> <title>D3.js image() Function</title> </head> <style></style> <body> <script src= "https://d3js.org/d3.v4.min.js"> </script> <script src= "https://d3js.org/d3-dsv.v1.min.js"> </script> <script src= "https://d3js.org/d3-fetch.v1.min.js"> </script> <script> d3.image( `https://pbs.twimg.com/profile_images/1138375574726955008/1fNUyEdv_400x400.png`, { crossOrigin: "anonymous" }).then((img) => { document.body.append("Image using d3.image()"); document.body.append(img); }); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article p5.js imageMode() Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads D3.js interval() Function The d3.interval() function is used to call the function after every given time interval or delay. If the delay is not given then the delay is equal to the timer. Syntax: d3.interval(callback, delay); Parameters: It takes the two parameters as mentioned above and described below: callback: It is the 2 min read p5.js imageMode() Function The imageMode() function is used to set the image mode of an image. The image mode defines the position of the image in the canvas, by changing the way that the parameters given to the image() function are interpreted. Syntax: imageMode( mode ) Parameters: This function accepts a single parameter mo 2 min read D3.js dsv() Function The d3.dsv() function in D3.js is a part of the request API that returns a request for the file of type DSV. The mime type is text/DSV. Syntax:d3.dsv(delimiter, inputfile, function);Parameters: This function accepts three parameters as mentioned above and described below:delimiter: It is the delimit 1 min read D3.js arc() Function The d3.arc() function is used to generate an arc generator that produce a circular chart. It is based on the difference between the start angle and the end angle. Syntax: d3.arc(); Parameters: This function does not accept any parameters. Return Values: This function returns an arc generator functio 2 min read D3.js zoom() Function The d3.zoom() Function in D3.js is used to create a new zoom behaviour. It is used to apply the zoom transformation on a selected element. Syntax:d3.zoom();Parameters: This function does not accept any parameter.Return Value: This function returns the zoom behaviour.Below programs illustrate the d3. 2 min read D3.js interpolateOrRd() Function The d3.interpolateOrRd() function in D3.js is used to return a particular color from the âOrRdâ sequential color scheme which is returned as an RGB string. Syntax: d3.interpolateOrRd(t) Parameters: This function accepts a single parameter as mentioned above and described below: t: âtâ is a number in 2 min read Like