0.4.0 • Published 2 years ago

spacetime-ticks v0.4.0

Weekly downloads
18
License
MIT
Repository
github
Last release
2 years ago

calculate some sensible break-points between two dates, using the spacetime date library.

npm i spacetime-ticks

import spacetimeTicks from 'spacetime-ticks'

let ticks = spacetimeTicks('June 5th 1992', 'Oct 4 2002', 5)
// [
// { label: "1993", epoch: 725864400000, value: 0.055 }
// { label: "1995", epoch: 788936400000, value: 0.248 }
// { label: "1997", epoch: 852094800000, value: 0.442 }
// { label: "1999", epoch: 915166800000, value: 0.636 }
// { label: "2001", epoch: 978325200000, value: 0.829 }
// ]

This library has some opinions:

  • ticks should always be spaced evenly, even if this means less ticks
  • a tick should appear at the start of months, years, days
  • they don't need to begin or end at the start andend.
  • less ticks are better than too-many ticks

it was built for labelling an x-axis in a space-limited way, but you can use it for whatever weird stuff.

See also:

MIT

0.4.0

2 years ago

0.3.0

2 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago