Sha256: 7fb4ed3bc404b5ab0c637e015034c0c2f673cc4185f8a23128626a30f8691c59
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
module Seer require 'seer/chart' require 'seer/area_chart' require 'seer/bar_chart' require 'seer/column_chart' require 'seer/gauge' require 'seer/line_chart' require 'seer/pie_chart' VISUALIZERS = [:area_chart, :bar_chart, :column_chart, :gauge, :line_chart, :pie_chart] def self.valid_hex_number?(val) #:nodoc: return false unless val.is_a?(String) && ! val.empty? ! (val =~ /^\#([0-9]|[a-f]|[A-F])+$/).nil? && val.length == 7 end def self.log(message) #:nodoc: RAILS_DEFAULT_LOGGER.info(message) end def self.init_visualization %{<script type="text/javascript" src="http://www.google.com/jsapi"> </script><script type="text/javascript">var Seer = \{ chartsCount: 0, charts: [], chartsData: [] \}</script> } end def self.visualize(data, args={}) raise ArgumentError, "Seer: Invalid visualizer: #{args[:as]}" unless args[:as] && VISUALIZERS.include?(args[:as]) raise ArgumentError, "Seer: No data provided!" unless data && ! data.empty? self.send(args[:as], data, args) end private def self.area_chart(data, args) AreaChart.render(data, args) end def self.bar_chart(data, args) BarChart.render(data, args) end def self.column_chart(data, args) ColumnChart.render(data, args) end def self.gauge(data, args) Gauge.render(data, args) end def self.line_chart(data, args) LineChart.render(data, args) end def self.pie_chart(data, args) PieChart.render(data, args) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ncri-seer-0.5.2 | lib/seer.rb |
ncri-seer-0.5.1 | lib/seer.rb |