axes-helper

0.0.3 • Public • Published
Axes = require 'axes-helper'
 
Axes.register 'x''linear',
  domain: [02000]
  range: [0300]
 
# 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' } ] 
 

Readme

Keywords

Package Sidebar

Install

npm i axes-helper

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • fiatjaf