domitry / nyaplot

interactive plots generator for Ruby
MIT License
219 stars 27 forks source link

Ability to manually set intervals of X axis. #47

Open v0dro opened 9 years ago

v0dro commented 9 years ago

Here's my use case:

I have a plot whose X co-ordinates exist only at integer co-ordinates (1,2,3,4,5,6), and I want to see the X axis show me only the integers at which the points exist, i.e. 1,2,3,4,5,6.

It so happens that nyaplot also displays in-between decimal numbers (0,0.5,1,1.5,2...). Having the ability to customize the step size between valid X co-ordinates would be great. OR maybe have the ability to display only the integer X co-ordinates.

Here's a picture of how the X axis looks as of now: screenshot from 2015-06-09 22 49 28

domitry commented 9 years ago

You can implement it by adding some lines to: https://github.com/domitry/Nyaplotjs/blob/master/src/view/components/axis.js#L34

See also: https://github.com/mbostock/d3/wiki/SVG-Axes