Sparkline::Sparker
Inherits Reference < Object
Constants
Constructors
Optionally takes an array of strings for ticks. Ticks must proceed from smallest to largest. Ticks can be multiple characters long although it is generally a bad idea unless you're just doubling the same character on all of them.
Instance methods
Returns a spark string from given iterable of ints. Arguments: ints: an array of integers fit_min: Matches the range of the sparkline to the input integers rather than the default of zero. Useful for large numbers with relatively small differences between the positions defaults to false Usage sparker = Sparker.new() sparker.generate([1, 5, 22, 13, 53]) #=> " ▃▁█" sparker.generate([0, 30, 55, 80, 33, 150], true) # => " ▁▂▄▁█" sparker.generate([80,90,100], true) # =>" ▄█" (true enables data fitting)
Note: there are only 9 steps in the default ticks, so the percentage breakdown is as follows 0-12 :" " 13-24:"▁" 25-37:"▂" 38-49:"▃" 50-62:"▄" 63-74:"▅" 75-87:"▆" 87-99:"▇" 100 :"█"