Class: Cosmos::XyPlotGuiObject
- Inherits:
-
LinegraphPlotGuiObject
- Object
- Qt::Base
- Qt::Widget
- LineGraph
- LinegraphPlotGuiObject
- Cosmos::XyPlotGuiObject
- Defined in:
- lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb
Overview
Represents a X-Y graph plot in the graphing system. This class extends LinegraphPlotGuiObject by re-implementing the update methods.
Direct Known Subclasses
Constant Summary
Constants inherited from LinegraphPlotGuiObject
LinegraphPlotGuiObject::SELECTED_FRAME_COLOR
Constants inherited from LineGraph
LineGraph::DOUBLE_CLICK_SECONDS, LineGraph::FRAME_OFFSET, LineGraph::GRAPH_SPACER, LineGraph::LABEL_TICK_SIZE, LineGraph::LEFT_X_LABEL_WIDTH_ADJUST
Instance Attribute Summary
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
Instance Method Summary collapse
-
#update(redraw_needed = false) ⇒ Object
Updates the linegraph to new settings.
-
#update_overview(points_plotted, overview_graph) ⇒ Object
Update the overview graph with this plots data.
-
#update_plot(points_plotted, min_x_value, max_x_value, single = false) ⇒ Object
Updates the lines on the plot.
Methods inherited from LinegraphPlotGuiObject
#initialize, #redraw, #select, #selected?, #unselect
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, #initialize, #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
This class inherits a constructor from Cosmos::LinegraphPlotGuiObject
Instance Method Details
#update(redraw_needed = false) ⇒ Object
Updates the linegraph to new settings
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb', line 21 def update(redraw_needed = false) if @plot.manual_x_scale self.manual_scale_x(*(@plot.manual_x_scale)) else self.auto_scale_x end self.ordered_x_values = false self.show_popup_x_y = true super(redraw_needed) end |
#update_overview(points_plotted, overview_graph) ⇒ Object
Update the overview graph with this plots data
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb', line 33 def update_overview(points_plotted, overview_graph) @plot.data_objects.each do |data_object| begin overview_graph.add_line(data_object.name, data_object.y_values, data_object.time_values, nil, nil, nil, nil, data_object.color, :LEFT, points_plotted) unless data_object.y_values.empty? rescue Exception => error # Ignore errors in overview graph raise error if error.class == NoMemoryError end end end |
#update_plot(points_plotted, min_x_value, max_x_value, single = false) ⇒ Object
Updates the lines on the plot
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb', line 45 def update_plot(points_plotted, min_x_value, max_x_value, single = false) self.clear_lines @plot.data_objects.each do |data_object| unless data_object.time_values.empty? begin raise "LineGraph time data must be Numeric" unless data_object.time_values[0].kind_of?(Numeric) range = data_object.time_values.range_within(min_x_value, max_x_value) range = (range.last)..(range.last) if single time_values = data_object.time_values[range] if time_values[0] and time_values[0] >= min_x_value and time_values[0] <= max_x_value x_values = data_object.x_values[range] y_values = data_object.y_values[range] self.add_line(data_object.name, y_values, x_values, nil, nil, data_object.y_states, data_object.x_states, data_object.color, :LEFT, points_plotted) unless y_values.empty? end rescue Exception => error raise error if error.class == NoMemoryError self.error = error unless self.error end end if data_object.error self.error = data_object.error data_object.error = nil end end @plot.redraw_needed = false end |