D3.js | d3.min() function

The d3.min() function in D3.js is used to returns the minimum value in the given array using natural order. If an array is empty then it returns undefined as output.
Syntax:
d3.min(Array)
Parameters: This function accepts a parameters Array which is an array of elements whose minimum value is to be calculated. Here elements might be integers or any strings.
Return Value: It returns the minimum value.
Below programs illustrate the d3.min() function in D3.js.
Example 1:
| <html>  <head>     <title>Getting minimum value</title> </head>  <body>   </script>      <script>         // initialising the array of elements         varArray1 = [10, 20, 30, 40, 50, 60];         varArray2 = [1, 2];         varArray3 = [0, 1.5, 6.8];         varArray4 = [.8, .08, .008];          // Calling to d3.min() function         A = d3.min(Array1);         B = d3.min(Array2);         C = d3.min(Array3);         D = d3.min(Array4);          // Getting minimum value         document.write(A + "<br>");         document.write(B + "<br>");         document.write(C + "<br>");         document.write(D + "<br>");     </script> </body>  </html>  | 
Output:
10 1 0 0.008
Example 2:
| <html>  <head>     <title>Getting minimum value</title> </head>  <body>   </script>      <script>         // initialising the array of elements         varArray1 = [];         varArray2 = ["a", "b", "c"];         varArray3 = ["A", "B", "C"];         varArray4 = ["Geek", "Geeks", "zambiatek"];          // Calling to d3.min() function         A = d3.min(Array1);         B = d3.min(Array2);         C = d3.min(Array3);         D = d3.min(Array4);          // Getting minimum value         document.write(A + "<br>");         document.write(B + "<br>");         document.write(C + "<br>");         document.write(D + "<br>");     </script> </body>  </html>  | 
Output:
undefined a A Geek
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
 
				 
					


