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_press, #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, #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.
1856 1857 1858 1859 1860 1861 1862 |
# File 'lib/wads/widgets.rb', line 1856 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.
1854 1855 1856 |
# File 'lib/wads/widgets.rb', line 1854 def data_point_size @data_point_size end |
#data_x ⇒ Object
Returns the value of attribute data_x.
1852 1853 1854 |
# File 'lib/wads/widgets.rb', line 1852 def data_x @data_x end |
#data_y ⇒ Object
Returns the value of attribute data_y.
1853 1854 1855 |
# File 'lib/wads/widgets.rb', line 1853 def data_y @data_y end |
Instance Method Details
#decrease_size ⇒ Object
1887 1888 1889 1890 1891 |
# File 'lib/wads/widgets.rb', line 1887 def decrease_size if @data_point_size > 2 @data_point_size = @data_point_size - 2 end end |
#increase_size ⇒ Object
1883 1884 1885 |
# File 'lib/wads/widgets.rb', line 1883 def increase_size @data_point_size = @data_point_size + 2 end |
#render(override_size = nil) ⇒ Object
1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 |
# File 'lib/wads/widgets.rb', line 1864 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
1879 1880 1881 |
# File 'lib/wads/widgets.rb', line 1879 def to_display "#{@x}, #{@y}" end |
#widget_z ⇒ Object
1875 1876 1877 |
# File 'lib/wads/widgets.rb', line 1875 def Z_ORDER_PLOT_POINTS end |