D3.js style() Function Last Updated : 15 Oct, 2024 Comments Improve Suggest changes Like Article Like Report 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)Parameters: This function accepts two parameters as mentioned above and described below:node: This is a property of the selected element.name: This is the value of the specified attribute.Return Value: This function returns the value style property for the specified node(attribute) with the specified name(Value).Example 1: Below examples illustrate the d3.style() function in D3.js html <!DOCTYPE html> <html> <head> <title> D3.js | d3.style() Function </title> <script src="https://d3js.org/d3.v4.min.js"> </script> </head> <body> <p> A computer science portal for geeks </p> <script> // Calling the style() function d3.select("p").style("color", "red"); </script> </body> </html> Output: Example 2: html <!DOCTYPE html> <html> <head> <title> D3.js | d3.style() Function </title> <script src="https://d3js.org/d3.v4.min.js"> </script> </head> <body> <p> A computer science portal for geeks </p> <script> // Calling the style() function d3.select("p").style("font-size", "40px"); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js style() Function M mks075 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads p5.js | style() Function The style() function is used to set the style property of an element with the given value. If this function contains single parameter then use .style() function to return the value of the given property. Note: This function requires the p5.dom library. So add the following line in the head section o 2 min read D3.js lch() Function The d3.lch() function in D3.js is used to construct a new LCH color and returns l, c and h properties of the specified color taken as the parameter of the function. Syntax: d3.lch(color); Parameters: This function accepts single parameter color which is used to specify the CSS color. Return Value: T 1 min read D3.js selector() Function The d3.selector() function is used to return a function that returns the very first descendant of the element given as the parameter. Syntax: d3.selector(selector) Parameters: This function takes only one parameter which is given above and described below: selector: This is the string of the element 2 min read D3.js schemeYlGn[] Function The d3.schemeYlGn[] function in D3.js is used to return a particular color from the âYlGnâ sequential color scheme which is returned as a HEX string. Syntax: d3.schemeYlGn[k] Parameters: This function accepts a single parameter as mentioned above and described below: k: âkâ is a number. Return Value 2 min read D3.js schemeBlues() Function The d3.schemeBlues[] function in D3.js is used to return a particular color from the âBluesâ sequential color scheme which is returned as a HEX string. Syntax: d3.schemeBlues[k] Parameters: This function accepts a single parameter as mentioned above and described below: k: âkâ is a number. Return Va 2 min read Like