0.0.3 • Published 10 years ago

axes-helper v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago
Axes = require 'axes-helper'

Axes.register 'x', 'linear',
  domain: [0, 2000]
  range: [0, 300]

# scales
scale = Axes.scale 'x'
scale 1000 # == 150
scale 2000 # == 300

# tick format
tickFormat = Axes.format 'x'
tickFormat 1337.23 # == '1,337.23' 

# tick generation
Axes.getTicks 'x' # == [ { offset: 0, text: '0' },
                  #      { offset: 25, text: '166.6' },
                  #      { offset: 50, text: '333.3' },
                  #      { offset: 75, text: '500' },
                  #      { offset: 100, text: '666.6' },
                  #      { offset: 124.99999999999999, text: '833.3' },
                  #      { offset: 149.99999999999997, text: '999.9' },
                  #      { offset: 174.99999999999997, text: '1,166' },
                  #      { offset: 200, text: '1,333' },
                  #      { offset: 225, text: '1,500' },
                  #      { offset: 250, text: '1,666' },
                  #      { offset: 275, text: '1,833' } ]