Arun AK
Arun AK

Reputation: 4370

how to make ticks function work in d3.js?

I have created x-axis and define the ticks value as 5 and its working fine. But if i want exactly 7 ticks in the axis. I cant get it to work.

I made some search and found an answer that ticks can take only multiple of 2,5,10 not any number. But i am in an scenario that i want to get exactly 7 ticks and i am unable to get it.

Is there any way to get it work? Link

thanks in advance

Upvotes: 0

Views: 40

Answers (1)

Cyril Cherian
Cyril Cherian

Reputation: 32327

Does this solve your purpose if you give the tick values itself

var xAxis = d3.svg.axis()
                   .scale(axisScale)
                   .tickValues([10, 20, 30, 50, 60, 80, 100]);//tick values as per your choice

Working code here

Upvotes: 1

Related Questions