Class: Cosmos::LinegraphWidget
- Includes:
- Widget
- Defined in:
- lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb
Direct Known Subclasses
Constant Summary
Constants inherited from LineGraph
Cosmos::LineGraph::DOUBLE_CLICK_SECONDS, Cosmos::LineGraph::FRAME_OFFSET, Cosmos::LineGraph::GRAPH_SPACER, Cosmos::LineGraph::LABEL_TICK_SIZE, Cosmos::LineGraph::LEFT_X_LABEL_WIDTH_ADJUST
Instance Attribute Summary
Attributes included from Widget
#item, #item_name, #limits_set, #limits_state, #packet, #packet_name, #polling_period, #screen, #settings, #target_name, #value, #value_type
Attributes inherited from LineGraph
#draw_cursor_line_callback, #horizontal_lines, #left_y_max, #left_y_min, #mouse_leave_callback, #mouse_left_button_press_callback, #post_error_callback, #pre_error_callback, #right_y_max, #right_y_min, #x_max, #x_max_label, #x_min, #x_min_label
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(parent_layout, target_name, packet_name, item_name, num_samples = 100, width = 300, height = 200, value_type = :CONVERTED) ⇒ LinegraphWidget
constructor
A new instance of LinegraphWidget.
- #value=(data) ⇒ Object
Methods included from Widget
#context_menu, #get_tooltip_text, included, #process_settings, #set_setting, #set_subsetting, #shutdown, #update_widget
Methods inherited from LineGraph
#add_horizontal_line, #add_line, #add_popups_for_lines, #adjust_popup_positions, attr_accessor_with_redraw, #auto_scale_x, #auto_scale_y, #auto_scale_y_axis, #build_popups_from_x_value, #build_x_grid_lines, #build_y_grid_lines, #calculate_base, #calculate_scaling_factors, #calculate_x_grid_lines, #calculate_y_grid_lines, #calculate_y_labels, #clear_horizontal_lines, #clear_lines, #convert_x_value_to_text, #convert_y_value_to_text, #determine_graph_size, #draw_cursor_line_and_popups, #draw_cursor_line_and_popups_at_x, #draw_error_icon, #draw_frame, #draw_graph_background, #draw_graph_into_back_buffer, #draw_graph_to_screen, #draw_horizontal_lines, #draw_legend, #draw_legend_text, #draw_line, #draw_lines, #draw_origin_lines, #draw_popups, #draw_title, #draw_x_axis_grid_lines, #draw_x_axis_title, #draw_x_label, #draw_y_axis_grid_lines, #draw_y_axis_title, #draw_y_label, #get_legend_position, #graph, #leaveEvent, #manual_scale_x, #manual_scale_y, #mouseMoveEvent, #mousePressEvent, #mouseReleaseEvent, #paintEvent, #remote_draw_cursor_line_at_x, #resizeEvent, #scale_graph, #scale_graph_to_value_x, #scale_left_to_right_y, #scale_value_to_graph_x, #scale_value_to_graph_y, #update_graph_size
Constructor Details
#initialize(parent_layout, target_name, packet_name, item_name, num_samples = 100, width = 300, height = 200, value_type = :CONVERTED) ⇒ LinegraphWidget
Returns a new instance of LinegraphWidget.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb', line 20 def initialize(parent_layout, target_name, packet_name, item_name, num_samples = 100, width = 300, height = 200, value_type = :CONVERTED) super(target_name, packet_name, item_name, value_type) setFixedSize(width.to_i, height.to_i) self.title = "#{@target_name} #{@packet_name} #{@item_name}" self.show_y_grid_lines = true self.unix_epoch_x_values = false @num_samples = num_samples.to_i @data = [] parent_layout.addWidget(self) if parent_layout end |
Class Method Details
.takes_value? ⇒ Boolean
31 32 33 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb', line 31 def self.takes_value? return true end |
Instance Method Details
#value=(data) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb', line 35 def value=(data) @data << data.to_f if @data.length > @num_samples @data = @data[1..-1] end if not @data.empty? self.clear_lines self.add_line('line', @data) self.graph end end |