Class: Sol

Inherits:
Object
  • Object
show all
Defined in:
lib/webview/sol.rb,
lib/webview/js.rb,
lib/webview/dcfx.rb,
lib/charts/chart.rb,
lib/charts/scale.rb,
lib/charts/stack.rb,
lib/charts/margins.rb,
lib/charts/interval.rb,
lib/charts/bar_chart.rb,
lib/webview/dashboard.rb,
lib/webview/bootstrap.rb,
lib/charts/base_chart.rb,
lib/charts/line_chart.rb,
lib/charts/coordinate_chart.rb

Overview

Copyright © 2013 Rodrigo Botafogo. All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation, without fee and without a signed licensing agreement, is hereby granted, provided that the above copyright notice, this paragraph and the following two paragraphs appear in all copies, modifications, and distributions.

IN NO EVENT SHALL RODRIGO BOTAFOGO BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RODRIGO BOTAFOGO HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

RODRIGO BOTAFOGO SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED “AS IS”. RODRIGO BOTAFOGO HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

Author:

Defined Under Namespace

Modules: BaseChart, CoordinateChart, Margins, Stack Classes: BarChart, Bootstrap, Bridge, Chart, DCFX, Dashboard, ExecMessages, GuiCommunication, Interval, JS, LineChart, LinearScale, OrdinalScale, ReadBuffer, Scale, TimeScale

Class Method Summary (collapse)

Class Method Details

+ (Object) add_data(js_variable, data)





83
84
85
# File 'lib/webview/sol.rb', line 83

def self.add_data(js_variable, data)
  Bridge.instance.send(:window, :setMember, js_variable, data)
end

+ (Object) camelcase(str, *separators)





36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/webview/sol.rb', line 36

def self.camelcase(str, *separators)
  
  case separators.first
    
  when Symbol, TrueClass, FalseClass, NilClass
    first_letter = separators.shift
  end
  
  separators = ['_', '\s'] if separators.empty?
  
  # str = self.dup
  
  separators.each do |s|
    str = str.gsub(/(?:#{s}+)([a-z])/){ $1.upcase }
  end
  
  case first_letter
  when :upper, true
    str = str.gsub(/(\A|\s)([a-z])/){ $1 + $2.upcase }
  when :lower, false
    str = str.gsub(/(\A|\s)([A-Z])/){ $1 + $2.downcase }
  end
  
  str
  
end

+ (Object) dashboard(name, data, dimension_labels, date_columns = [])





67
68
69
# File 'lib/webview/sol.rb', line 67

def self.dashboard(name, data, dimension_labels, date_columns = [])
  return Dashboard.new(name, data, dimension_labels, date_columns)
end

+ (Object) js





75
76
77
# File 'lib/webview/sol.rb', line 75

def self.js
  return JS.new
end

+ (Object) scale(type)





30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/charts/scale.rb', line 30

def self.scale(type)
  
  case type
  when :time
    scale = Sol::TimeScale.new
  when :time_utc
    scale = Sol::TimeScale.new(true)
  when :linear
    scale = Sol::LinearScale.new
  when :identity
    identity_scale(domain, range)
  when :power
    power_scale(domain, range)
  when :log
    log_scale(domain, range)
  when :quantize
    qunatize_scale(domain, range)
  when :quantile
    quantile_scale(domain, range)
  when :treshold
    treshold_scale(domain, range)
  when :ordinal
    ordinal_scale(domain, range)
  when :categorial_colors
      cat_colors_scale(domain, range)
  when :color_brewer
    color_brewer_scale(domain, range)
  end
  
  scale
  
end

+ (Object) start(width, height)





91
92
93
94
95
# File 'lib/webview/sol.rb', line 91

def self.start(width, height)
  @width = width
  @height = height
  Thread.new { DCFX.launch(@width, @height) }  if !DCFX.launched?
end