Class: Wads::PlotPoint
Overview
A data point to be used in a Plot widget. This object holds the x, y screen location as well as the data values for x, y.
Instance Attribute Summary collapse
-
#data_point_size ⇒ Object
Returns the value of attribute data_point_size.
-
#data_x ⇒ Object
Returns the value of attribute data_x.
-
#data_y ⇒ Object
Returns the value of attribute data_y.
Attributes inherited from Widget
#base_z, #children, #gui_theme, #height, #is_selected, #layout, #overlay_widget, #override_color, #text_input_fields, #visible, #width, #x, #y
Instance Method Summary collapse
- #decrease_size ⇒ Object
- #increase_size ⇒ Object
-
#initialize(x, y, data_x, data_y, color = COLOR_MAROON, size = 4) ⇒ PlotPoint
constructor
A new instance of PlotPoint.
- #render(override_size = nil) ⇒ Object
- #to_display ⇒ Object
- #widget_z ⇒ Object
Methods inherited from Widget
#add, #add_axis_lines, #add_button, #add_child, #add_delete_button, #add_document, #add_graph_display, #add_image, #add_multi_select_table, #add_overlay, #add_panel, #add_plot, #add_single_select_table, #add_table, #add_text, #border_color, #bottom_edge, #button_down, #button_up, #center_children, #center_x, #center_y, #clear_children, #contains_click, #debug, #disable_background, #disable_border, #draw, #draw_background, #draw_border, #enable_background, #enable_border, #error, #get_layout, #get_theme, #graphics_color, #handle_key_held_down, #handle_key_press, #handle_key_up, #handle_mouse_down, #handle_mouse_up, #handle_right_mouse, #handle_update, #info, #intercept_widget_event, #left_edge, #move_recursive_absolute, #move_recursive_delta, #overlaps_with, #pad, #relative_x, #relative_y, #relative_z_order, #remove_child, #remove_children, #remove_children_by_type, #right_edge, #selection_color, #set_absolute_position, #set_dimensions, #set_layout, #set_selected, #set_theme, #text_color, #top_edge, #unset_selected, #update, #uses_layout, #warn, #x_pixel_to_screen, #y_pixel_to_screen, #z_order
Constructor Details
#initialize(x, y, data_x, data_y, color = COLOR_MAROON, size = 4) ⇒ PlotPoint
Returns a new instance of PlotPoint.
1887 1888 1889 1890 1891 1892 1893 |
# File 'lib/wads/widgets.rb', line 1887 def initialize(x, y, data_x, data_y, color = COLOR_MAROON, size = 4) super(x, y) @override_color = color @data_x = data_x @data_y = data_y @data_point_size = size end |
Instance Attribute Details
#data_point_size ⇒ Object
Returns the value of attribute data_point_size.
1885 1886 1887 |
# File 'lib/wads/widgets.rb', line 1885 def data_point_size @data_point_size end |
#data_x ⇒ Object
Returns the value of attribute data_x.
1883 1884 1885 |
# File 'lib/wads/widgets.rb', line 1883 def data_x @data_x end |
#data_y ⇒ Object
Returns the value of attribute data_y.
1884 1885 1886 |
# File 'lib/wads/widgets.rb', line 1884 def data_y @data_y end |
Instance Method Details
#decrease_size ⇒ Object
1918 1919 1920 1921 1922 |
# File 'lib/wads/widgets.rb', line 1918 def decrease_size if @data_point_size > 2 @data_point_size = @data_point_size - 2 end end |
#increase_size ⇒ Object
1914 1915 1916 |
# File 'lib/wads/widgets.rb', line 1914 def increase_size @data_point_size = @data_point_size + 2 end |
#render(override_size = nil) ⇒ Object
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 |
# File 'lib/wads/widgets.rb', line 1895 def render(override_size = nil) size_to_draw = @data_point_size if override_size size_to_draw = override_size end half_size = size_to_draw / 2 Gosu::draw_rect(@x - half_size, @y - half_size, size_to_draw, size_to_draw, graphics_color, z_order) end |
#to_display ⇒ Object
1910 1911 1912 |
# File 'lib/wads/widgets.rb', line 1910 def to_display "#{@x}, #{@y}" end |
#widget_z ⇒ Object
1906 1907 1908 |
# File 'lib/wads/widgets.rb', line 1906 def Z_ORDER_PLOT_POINTS end |