简体   繁体   中英

using a d3 axis using a time scale, how do you evenly space wide gaps in time

This is for a multiline chart.

I'm displaying 20 points but in between them you might have a gap of days or weeks. This causes the axis to bump the points left and right when looking at a gap of three weeks. in general the points will be hourly, but long gaps may occur. I tried using d3.svg.axis.tickValues to set the values but it still spaces them unevenly.

You need to use a scale

d3.scale.linear().domain([..]).range([...]); More info here : https://github.com/mbostock/d3/wiki/Quantitative-Scales

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM