D3.js | d3.map.values() Function
The map.values() function in D3.js used to return an array of values for every entry in the created map. The order of the returned values are arbitrary.
Syntax:
d3.map.values()
Parameters: This function does not accept any parameters.
Return Value: This function returns an array of values for every entry in the created map. Order of those returned values are arbitrary.
Below programs illustrate the d3.map.values() function in D3.js:
Example 1:
<!DOCTYPE html> <html> <head> <title> d3.map.values() Function</title> </head> <body> <script> // Creating a map var map = d3.map({"Ram": 5, "Geeks": 10, "gfg": 15}); // Calling the map.values() function A = map.values(); // Getting an array of values for // every entry in the map. console.log(A); </script> </body> </html> |
Output:
[5, 10, 15]
Example 2:
<!DOCTYPE html> <html> <head> <title> d3.map.values() Function</title> </head> <body> <script> // Creating some maps var map1 = d3.map({"Ram": 5}); var map2 = d3.map({"Geeks": 10}); var map3 = d3.map({"Ram": 5, "Geeks": 10}); var map4 = d3.map(); // Calling the map.values() function A = map1.values(); B = map2.values(); C = map3.values(); D = map4.values(); // Getting an array of values for // every entry in the map. console.log(A); console.log(B); console.log(C); console.log(D); </script> </body> </html> |
Output:
[5] [10] [5, 10] []
Ref: https://devdocs.io/d3~5/d3-collection#map_values
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- How to get the function name inside a function in PHP ?
- PHP | Ds\Set first() Function
- p5.js | nf() Function
- PHP | pos() Function
- D3.js | d3.min() function
- D3.js | d3.lab() Function
- PHP | Ds\Set last() Function
- p5.js | nfp() Function
- PHP | Ds\Set add() Function
- p5.js | nfc() function
- CSS | url() Function
- p5.js | nfs() Function
- D3.js | d3.rgb() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


