Method: Rubyvis::Format::Number#fraction_digits
- Defined in:
- lib/rubyvis/format/number.rb
#fraction_digits(min = nil, max = nil) ⇒ Object
Sets or gets the minimum and maximum number of fraction digits. The controls the number of decimal digits to display after the decimal separator for the fractional part of the number. If the number of digits is smaller than the minimum, the digits are padded; if the number of digits is larger, the fractional part is rounded, showing only the higher-order digits. The default range is [0, 0].
If only one argument is specified to this method, this value is used as both the minimum and maximum number. If no arguments are specified, a two-element array is returned containing the minimum and the maximum.
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rubyvis/format/number.rb', line 77 def fraction_digits(min=nil,max=nil) if (!min.nil?) max||=min @minf = min @maxf = max @maxk = 10**@maxf return self end [@minf, @maxf] end |