Class: CTioga::Themes::FitsTheme

Inherits:
BaseTheme show all
Includes:
Tioga::FigureConstants
Defined in:
lib/CTioga/themes/fits.rb

Overview

A theme where marker-only curves (data) alternate with lines-only curves (fits)

Constant Summary

Constants inherited from BaseTheme

BaseTheme::THEMES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseTheme

#bod_hook, inherited

Constructor Details

#initialize(color_set = 'standard', marker_set = 'standard', marker_color_set = :"=>color", linestyle_set = Line_Type_Solid) ⇒ FitsTheme

Returns a new instance of FitsTheme.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/CTioga/themes/fits.rb', line 33

def initialize(color_set = 'standard',
               marker_set = 'standard',
               # By default, the marker color will match
               # the line color, even if the latter is set
               # manually.
               marker_color_set = :"=>color",
               linestyle_set = Line_Type_Solid)
  @sets = {
    :colors => MovingArray.new(Styles::COLORS, color_set),
    :markers => MovingArray.new(Styles::MARKERS, marker_set),
    :markers_colors => MovingArray.new(Styles::COLORS, 
                                    marker_color_set),
    :linestyle => MovingArray.new(Styles::LINES, linestyle_set)
  }
  
  @data = true
end

Instance Attribute Details

#setsObject (readonly)

Mainly for listing purposes:



31
32
33
# File 'lib/CTioga/themes/fits.rb', line 31

def sets
  @sets
end

Instance Method Details

#choose_set(type, set) ⇒ Object



78
79
80
# File 'lib/CTioga/themes/fits.rb', line 78

def choose_set(type, set)
  @sets[type].choose_current_set(set)
end

#cmdline_extra_argsObject



82
83
84
# File 'lib/CTioga/themes/fits.rb', line 82

def cmdline_extra_args
  return ["--marker", "auto"]
end

#next_curve_style(name) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/CTioga/themes/fits.rb', line 52

def next_curve_style(name)
  if @data
    @last_color = @sets[:colors].value
    style = CurveStyle.new(@last_color, 
                           @sets[:markers].value,
                           @last_color,
                           false,
                           name, 
                           1.0,
                           false,  # Does not interpolate by default
                           0.5)
    @data = false
  else
    style = CurveStyle.new(@last_color, 
                           false, 
                           @last_color,
                           @sets[:linestyle].value,
                           name, 
                           1.0,
                           true,  # Data is interpolated by default
                           0.5)
    @data = true
  end
  return style
end