Class: Cosmos::LinegraphPlot
- Defined in:
- lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb
Overview
Represents a line graph plot in a plots definition
Direct Known Subclasses
Instance Attribute Summary collapse
-
#left_y_axis_title ⇒ Object
Left Y Axis Title.
-
#manual_left_y_scale ⇒ Object
Manual left y scale array of y_min and y_max.
-
#manual_right_y_scale ⇒ Object
Manual right y scale array of y_min and y_max.
-
#manual_x_grid_line_scale ⇒ Object
Manual x grid line scale.
-
#manual_y_grid_line_scale ⇒ Object
Manual y grid line scale.
-
#point_size ⇒ Object
Size of points on graph.
-
#right_y_axis_title ⇒ Object
Right Y Axis Title.
-
#show_abs_x_grid_labels ⇒ Object
Show absolute X grid labels.
-
#show_legend ⇒ Object
Show legend of data objects.
-
#show_lines ⇒ Object
Show lines on graph.
-
#show_x_grid_lines ⇒ Object
Show x gridlines.
-
#show_y_grid_lines ⇒ Object
Show y gridlines.
-
#title ⇒ Object
Title of the line graph.
-
#unix_epoch_x_values ⇒ Object
Interpret x values as unix epoch timestamps.
-
#utc_time ⇒ Object
Display x values as UTC time.
-
#x_axis_title ⇒ Object
X Axis Title.
Attributes inherited from Plot
#data_objects, #gui_object, #plot_type, #redraw_needed, #tab
Instance Method Summary collapse
-
#handle_keyword(parser, keyword, parameters) ⇒ Object
Handles plot specific keywords.
-
#initialize ⇒ LinegraphPlot
constructor
A new instance of LinegraphPlot.
Methods inherited from Plot
Constructor Details
#initialize ⇒ LinegraphPlot
Returns a new instance of LinegraphPlot.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 67 def initialize super() @title = nil @x_axis_title = 'Time (Seconds)' @left_y_axis_title = nil @right_y_axis_title = nil @show_abs_x_grid_labels = true @show_x_grid_lines = false @show_y_grid_lines = true @point_size = 5 @show_lines = true @show_legend = true @manual_left_y_scale = nil @manual_right_y_scale = nil @manual_x_grid_line_scale = nil @manual_y_grid_line_scale = nil @unix_epoch_x_values = true @utc_time = false end |
Instance Attribute Details
#left_y_axis_title ⇒ Object
Left Y Axis Title
26 27 28 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 26 def left_y_axis_title @left_y_axis_title end |
#manual_left_y_scale ⇒ Object
Manual left y scale array of y_min and y_max
50 51 52 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 50 def manual_left_y_scale @manual_left_y_scale end |
#manual_right_y_scale ⇒ Object
Manual right y scale array of y_min and y_max
53 54 55 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 53 def manual_right_y_scale @manual_right_y_scale end |
#manual_x_grid_line_scale ⇒ Object
Manual x grid line scale
56 57 58 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 56 def manual_x_grid_line_scale @manual_x_grid_line_scale end |
#manual_y_grid_line_scale ⇒ Object
Manual y grid line scale
59 60 61 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 59 def manual_y_grid_line_scale @manual_y_grid_line_scale end |
#point_size ⇒ Object
Size of points on graph
41 42 43 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 41 def point_size @point_size end |
#right_y_axis_title ⇒ Object
Right Y Axis Title
29 30 31 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 29 def right_y_axis_title @right_y_axis_title end |
#show_abs_x_grid_labels ⇒ Object
Show absolute X grid labels
32 33 34 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 32 def show_abs_x_grid_labels @show_abs_x_grid_labels end |
#show_legend ⇒ Object
Show legend of data objects
47 48 49 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 47 def show_legend @show_legend end |
#show_lines ⇒ Object
Show lines on graph
44 45 46 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 44 def show_lines @show_lines end |
#show_x_grid_lines ⇒ Object
Show x gridlines
35 36 37 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 35 def show_x_grid_lines @show_x_grid_lines end |
#show_y_grid_lines ⇒ Object
Show y gridlines
38 39 40 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 38 def show_y_grid_lines @show_y_grid_lines end |
#title ⇒ Object
Title of the line graph
20 21 22 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 20 def title @title end |
#unix_epoch_x_values ⇒ Object
Interpret x values as unix epoch timestamps
62 63 64 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 62 def unix_epoch_x_values @unix_epoch_x_values end |
#utc_time ⇒ Object
Display x values as UTC time
65 66 67 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 65 def utc_time @utc_time end |
#x_axis_title ⇒ Object
X Axis Title
23 24 25 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 23 def x_axis_title @x_axis_title end |
Instance Method Details
#handle_keyword(parser, keyword, parameters) ⇒ Object
Handles plot specific keywords
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb', line 88 def handle_keyword(parser, keyword, parameters) case keyword when 'TITLE' # Expect 1 parameter parser.verify_num_parameters(1, 1, "TITLE <Title Text>") @title = parameters[0] when 'X_AXIS_TITLE' # Expect 1 parameter parser.verify_num_parameters(1, 1, "X_AXIS_LABEL <Label Text>") @x_axis_title = parameters[0] when 'Y_AXIS_TITLE' # Expect 1 or 2 parameters parser.verify_num_parameters(1, 2, "Y_AXIS_LABEL <Label Text> <LEFT or RIGHT (optional)>") if parameters[1] and parameters[1].upcase == 'RIGHT' @right_y_axis_title = parameters[0] else @left_y_axis_title = parameters[0] end when 'SHOW_ABS_X_GRID_LABELS' # Expect 1 parameter parser.verify_num_parameters(1, 1, "SHOW_ABS_X_GRID_LABELS <TRUE or FALSE>") @show_abs_x_grid_labels = ConfigParser.handle_true_false(parameters[0]) when 'SHOW_X_GRID_LINES' # Expect 1 parameter parser.verify_num_parameters(1, 1, "SHOW_X_GRID_LINES <TRUE or FALSE>") @show_x_grid_lines = ConfigParser.handle_true_false(parameters[0]) when 'SHOW_Y_GRID_LINES' # Expect 1 parameter parser.verify_num_parameters(1, 1, "SHOW_Y_GRID_LINES <TRUE or FALSE>") @show_y_grid_lines = ConfigParser.handle_true_false(parameters[0]) when 'POINT_SIZE' # Expect 1 parameter parser.verify_num_parameters(1, 1, "POINT_SIZE <0 or more>") @point_size = Integer(parameters[0]) when 'SHOW_LINES' # Expect 1 parameter parser.verify_num_parameters(1, 1, "SHOW_LINES <TRUE or FALSE>") @show_lines = ConfigParser.handle_true_false(parameters[0]) when 'SHOW_LEGEND' # Expect 1 parameter parser.verify_num_parameters(1, 1, "SHOW_LEGEND <TRUE or FALSE>") @show_legend = ConfigParser.handle_true_false(parameters[0]) when 'MANUAL_Y_AXIS_SCALE' # Expect 2 or 3 parameters parser.verify_num_parameters(2, 3, "MANUAL_Y_AXIS_SCALE <Y Min> <Y Max> <LEFT or RIGHT (optional)>") manual_scale = [] manual_scale[0] = parameters[0].to_f manual_scale[1] = parameters[1].to_f if manual_scale[0] >= manual_scale[1] raise parser.error("#{keyword} minimum #{manual_scale[0]} not less than maximum #{manual_scale[1]}") else if parameters[2] and parameters[2].upcase == 'RIGHT' manual_scale[2] = :RIGHT @manual_right_y_scale = manual_scale else manual_scale[2] = :LEFT @manual_left_y_scale = manual_scale end end when 'MANUAL_X_GRID_LINE_SCALE' # Expect 1 parameter parser.verify_num_parameters(1, 1, "MANUAL_X_GRID_LINE_SCALE <Scale Value>") @manual_x_grid_line_scale = parameters[0].to_f when 'MANUAL_Y_GRID_LINE_SCALE' # Expect 1 parameter parser.verify_num_parameters(1, 1, "MANUAL_Y_GRID_LINE_SCALE <Scale Value>") @manual_y_grid_line_scale = parameters[0].to_f when 'UNIX_EPOCH_X_VALUES' # Expect 1 parameter parser.verify_num_parameters(1, 1, "UNIX_EPOCH_X_VALUES <TRUE or FALSE>") @unix_epoch_x_values = ConfigParser.handle_true_false(parameters[0]) when 'UTC_TIME' @utc_time = true else # Unknown keywords are passed to parent data object super(parser, keyword, parameters) end # case keyword end |