How specify tickValues in d3.js time scale?
<p>I am using d3 and in my chart I have a scale that is a time scale in UTC format.</p>

<pre><code>xScale  = d3.time.scale.utc().range([0,  chartWidth]);
</code></pre>

<p>I need to specify the ticks dynamically and change the domain dynamically to avoid clutter in the tick label.</p>

<p>I was calculating ticks based on the domain and setting the ticks to its closest multiple of 5. However, I noticed a problem where sometimes the tick positions were not consistent while changing the the domain. See image below:</p>

<p><a href="https://i.stack.imgur.com/Qghea.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qghea.jpg" alt="enter image description here"></a> </p>

<p>Looking in some forum, I saw that it is possible to set the tick values by the function <code>tickValues(d3.range(starting value, end value, interval))</code>. <a href="https://stackoverflow.com/questions/13100314/change-the-ticks-on-x-axis">See this post by mbostock</a>.</p>

<p>Now I am not sure--how can I do the same for my time scale?
If I want to calculate my own tick values for my xAxis (which uses a time scale in UTC) how can I do it?</p>

<p>Thanks.</p>