The continuous.ticks() function is used to return the count values from the scale’s domain. If the count is not given as a parameter then by default it is set to 10. The values returned by tick lies in the domain.
Syntax:
continuous.ticks([count]);
Parameters: This function accepts a single parameter as mentioned above and described below.
- count: It is the number of values to be returned in the given domain. These values are equally spaced.
Return Values This function does not return anything.
Example 1:
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" path1tent= "width=device-width,initial-scale=1.0" /> <title>Geeks for neveropen</title> </script> <script src= </script> <script src= </script> <script src= </script> </head> <body> <h2 style="color:green;"> neveropen </h2> <p>D3.js continuous.ticks() Function</p> <script> var x = d3.scaleLinear() .domain([0, 1]) .range([0, 100]); var ticks = x.ticks(5); document.write("<h3>", ticks + "</h3>") </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>Geeks for neveropen</title> </script> <script src= </script> <script src= </script> <script src= </script> </head> <body> <h2 style="color:green;"> neveropen </h2> <p>D3.js continuous.ticks() Function </p> <script> var x = d3.scaleLinear() .domain([-10, -10.5]) .range(["blue", "green"]); var ticks = x.ticks(10); document.write("<h3>", ticks + "</h3>") </script> </body> </html> |
Output:

