Module: SmartChart

Defined in:
lib/smart_chart/encoder.rb,
lib/smart_chart/data_set.rb,
lib/smart_chart/base_chart.rb,
lib/smart_chart/charts/bar.rb,
lib/smart_chart/charts/map.rb,
lib/smart_chart/exceptions.rb,
lib/smart_chart/charts/line.rb,
lib/smart_chart/charts/venn.rb,
lib/smart_chart/charts/meter.rb,
lib/smart_chart/charts/radar.rb,
lib/smart_chart/features/axes.rb,
lib/smart_chart/charts/scatter.rb,
lib/smart_chart/features/grid_lines.rb,
lib/smart_chart/single_data_set_chart.rb,
lib/smart_chart/multiple_data_set_chart.rb

Defined Under Namespace

Modules: Axes, Encoder, GridLines Classes: Bar, BaseChart, ColorFormatError, DataFormatError, DataSet, DimensionsError, Line, LineStyleNameError, Map, Meter, MissingRequiredAttributeError, MultipleDataSetChart, NoAttributeError, Radar, Scatter, SingleDataSetChart, SmartChartError, UrlLengthError, ValidationError, Venn

Constant Summary collapse

URL_MAX_LENGTH =

Maximum length of URL accepted by Google.

2074

Class Method Summary collapse

Class Method Details

.decimal_string(num, frac = 3) ⇒ Object

Takes a decimal number and returns a string with up to frac digits to the right of the ‘.’.



12
13
14
15
16
17
# File 'lib/smart_chart/base_chart.rb', line 12

def self.decimal_string(num, frac = 3)
  str = "%.#{frac}f" % num
  str = str[0...-1] while str[-1,1] == "0"
  str = str[0...-1] if str[-1,1] == "." # leave zeros left of .
  str
end