D3.js | d3.continuous.invert() Function Last Updated : 30 Jul, 2019 Suggest changes Share Like Article Like Report The d3.continuous.invert() function in D3.js is used to return the corresponding value from the domain if a value from the range is given. Syntax: .invert( Value ) Parameters: This function accepts single parameter Value which holds the value of range. Return Value: This function returns the corresponding value from the domain if a value from the range is given. Below programs illustrate the d3.continuous.invert() function in D3.js: Example 1: javascript <!DOCTYPE html> <html> <head> <title> D3.js | d3.continuous.invert() Function </title> <script src = "https://d3js.org/d3.v4.min.js"> </script> </head> <body> <script> // Calling scaleLinear() function var x = d3.scaleLinear().domain([10, 150]) .range([0, 1000]); // Calling the .invert() function // and getting the corresponding value // from domain if value from range is given console.log(x.invert(150)); console.log(x.invert(999)); </script> </body> </html> Output: 31 149.86 Example 2: javascript <!DOCTYPE html> <html> <head> <title> D3.js | d3.continuous.invert() Function </title> <script src = "https://d3js.org/d3.v4.min.js"> </script> </head> <body> <script> // Calling scaleLinear() function var x = d3.scaleLinear().domain([0, 1]) .range([10, 20]); // Calling the .invert() function // and getting the corresponding value // from domain if value from range is given console.log(x.invert(11)); console.log(x.invert(13)); console.log(x.invert(15)); console.log(x.invert(19)); </script> </body> </html> Output: 0.1 0.3 0.5 0.9 Reference: https://devdocs.io/d3~5/d3-scale#continuous_invert K Kanchan_Ray Follow Article Tags : JavaScript Web Technologies JavaScript-p5.js Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)9 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like