Hello,
I am currently making a line graph with d3.js.
When you display a line graph on your smartphone, the labels on the x-axis of the date overlap.
Even if you specify the number of scales with ticks(), you will be forced to change the number of scales to d3, so
I can't think of a good way.
I would like to reduce or increase the number of scales according to the size of the SVG.
What should I do?
I think this sample code will be helpful.
You can increase or decrease it by using filters using the tickValues
method and returning true
conditions.
varxAxis=d3.svg.axis()
.scale(x)
.tickValues(x.domain().filter(function(d,i){return!(i%2);}))
.orient("bottom");
© 2024 OneMinuteCode. All rights reserved.