Class: Rubyplot::ArtistGeometry

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyplot/artist/geometry.rb

Constant Summary collapse

LEGEND_MARGIN =

Space around text elements. Mostly used for vertical spacing. This way the vertical text doesn't overlap.

TITLE_MARGIN = 20.0
LABEL_MARGIN =
10.0
DEFAULT_MARGIN =
20.0
DEFAULT_TARGET_WIDTH =
800

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeArtistGeometry

Returns a new instance of ArtistGeometry


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
# File 'lib/rubyplot/artist/geometry.rb', line 119

def initialize(*)
  @spacing_factor = 0.9
  @minimum_value = nil
  @use_data_label = false
  @stacked = nil
  @x_axis_label = @y_axis_label = nil
  @y_axis_increment = nil

  @x_axis_increment = nil
  @norm_data = nil

  @additional_line_values = []
  @additional_line_colors = []
  @theme_options = {}

  @label_stagger_height = 0
  @label_truncation_style = :absolute
  @label_max_size = 0
  @hide_line_markers = @hide_legend = @hide_title = false
  @hide_line_numbers = @legend_at_bottom = @show_labels_for_bar_values = false
  @center_labels_over_point = true

  @legend_box_size = 20.0
  @label_formatting = nil
  @sorted_drawing = false
  @column_count = 0
  @has_left_labels = false
  @marker_count = nil
  @legend_margin = LEGEND_MARGIN
  @raw_columns = 800.0
  @maximum_value = nil
  @has_data = false

  @increment = nil

  @all_colors_array = Magick.colors
  @plot_colors = []
  @top_margin = DEFAULT_MARGIN
  @bottom_margin = DEFAULT_MARGIN
  @left_margin = DEFAULT_MARGIN
  @right_margin = DEFAULT_MARGIN
  @labels_seen = {}
end

Instance Attribute Details

#additional_line_colorsObject

Arrays for setting the colors for different labels of dataset.


102
103
104
# File 'lib/rubyplot/artist/geometry.rb', line 102

def additional_line_colors
  @additional_line_colors
end

#additional_line_valuesObject

Drawing


117
118
119
# File 'lib/rubyplot/artist/geometry.rb', line 117

def additional_line_values
  @additional_line_values
end

#all_colors_arrayObject

Arrays for setting the colors for different labels of dataset.


102
103
104
# File 'lib/rubyplot/artist/geometry.rb', line 102

def all_colors_array
  @all_colors_array
end

#bottom_marginObject

Blank space on the sides of the actual plot. Set in pixels to make appropriate space for the actual plot.


15
16
17
# File 'lib/rubyplot/artist/geometry.rb', line 15

def bottom_margin
  @bottom_margin
end

#center_labels_over_pointObject

Returns the value of attribute center_labels_over_point


110
111
112
# File 'lib/rubyplot/artist/geometry.rb', line 110

def center_labels_over_point
  @center_labels_over_point
end

#column_countObject

Returns the value of attribute column_count


114
115
116
# File 'lib/rubyplot/artist/geometry.rb', line 114

def column_count
  @column_count
end

#fontObject (readonly)

Font used for titles, labels, etc. The font= method below fulfills the role of the writer, so we only need a reader here.


52
53
54
# File 'lib/rubyplot/artist/geometry.rb', line 52

def font
  @font
end

#font_colorObject

Returns the value of attribute font_color


54
55
56
# File 'lib/rubyplot/artist/geometry.rb', line 54

def font_color
  @font_color
end

#has_dataObject

Data Variables


113
114
115
# File 'lib/rubyplot/artist/geometry.rb', line 113

def has_data
  @has_data
end

#has_left_labelsObject

Label values


38
39
40
# File 'lib/rubyplot/artist/geometry.rb', line 38

def has_left_labels
  @has_left_labels
end

#hide_legendObject

Helper variables to hide geometry objects


57
58
59
# File 'lib/rubyplot/artist/geometry.rb', line 57

def hide_legend
  @hide_legend
end

#hide_line_markersObject

Helper variables to hide geometry objects


108
109
110
# File 'lib/rubyplot/artist/geometry.rb', line 108

def hide_line_markers
  @hide_line_markers
end

#hide_line_numbersObject

Helper variables to hide geometry objects


60
61
62
# File 'lib/rubyplot/artist/geometry.rb', line 60

def hide_line_numbers
  @hide_line_numbers
end

#hide_titleObject

Helper variables to hide geometry objects


108
109
110
# File 'lib/rubyplot/artist/geometry.rb', line 108

def hide_title
  @hide_title
end

#incrementObject

Offset


98
99
100
# File 'lib/rubyplot/artist/geometry.rb', line 98

def increment
  @increment
end

#increment_scaledObject

Offset


98
99
100
# File 'lib/rubyplot/artist/geometry.rb', line 98

def increment_scaled
  @increment_scaled
end

#increment_x_scaledObject

Returns the value of attribute increment_x_scaled


99
100
101
# File 'lib/rubyplot/artist/geometry.rb', line 99

def increment_x_scaled
  @increment_x_scaled
end

#label_formattingObject

Label values


93
94
95
# File 'lib/rubyplot/artist/geometry.rb', line 93

def label_formatting
  @label_formatting
end

#label_max_sizeObject

Returns the value of attribute label_max_size


94
95
96
# File 'lib/rubyplot/artist/geometry.rb', line 94

def label_max_size
  @label_max_size
end

#label_stagger_heightObject

Returns the value of attribute label_stagger_height


94
95
96
# File 'lib/rubyplot/artist/geometry.rb', line 94

def label_stagger_height
  @label_stagger_height
end

#label_truncation_styleObject

Returns the value of attribute label_truncation_style


94
95
96
# File 'lib/rubyplot/artist/geometry.rb', line 94

def label_truncation_style
  @label_truncation_style
end

#labelsObject

Label values


35
36
37
# File 'lib/rubyplot/artist/geometry.rb', line 35

def labels
  @labels
end

#labels_seenObject

Label values


93
94
95
# File 'lib/rubyplot/artist/geometry.rb', line 93

def labels_seen
  @labels_seen
end

#left_marginObject

Blank space on the sides of the actual plot. Set in pixels to make appropriate space for the actual plot.


21
22
23
# File 'lib/rubyplot/artist/geometry.rb', line 21

def left_margin
  @left_margin
end

#legend_at_bottomObject

Legends


105
106
107
# File 'lib/rubyplot/artist/geometry.rb', line 105

def legend_at_bottom
  @legend_at_bottom
end

#legend_box_sizeObject

Legends


105
106
107
# File 'lib/rubyplot/artist/geometry.rb', line 105

def legend_box_size
  @legend_box_size
end

#legend_font_sizeObject

Optionally set the size of the font. Based on an 800x600px graph. Default is 20.

Will be scaled down if the graph is smaller than 800px wide.


66
67
68
# File 'lib/rubyplot/artist/geometry.rb', line 66

def legend_font_size
  @legend_font_size
end

#legend_marginObject

Legends


27
28
29
# File 'lib/rubyplot/artist/geometry.rb', line 27

def legend_margin
  @legend_margin
end

#marker_colorObject

The color of the auxiliary lines


72
73
74
# File 'lib/rubyplot/artist/geometry.rb', line 72

def marker_color
  @marker_color
end

#marker_countObject

Drawing


69
70
71
# File 'lib/rubyplot/artist/geometry.rb', line 69

def marker_count
  @marker_count
end

#marker_shadow_colorObject

Returns the value of attribute marker_shadow_color


73
74
75
# File 'lib/rubyplot/artist/geometry.rb', line 73

def marker_shadow_color
  @marker_shadow_color
end

#maximum_valueObject

You can manually set a maximum value, such as a percentage-based graph that always goes to 100.

If you use this, you must set it after you have given all your data to the graph object.


86
87
88
# File 'lib/rubyplot/artist/geometry.rb', line 86

def maximum_value
  @maximum_value
end

#minimum_valueObject

Data Variables


79
80
81
# File 'lib/rubyplot/artist/geometry.rb', line 79

def minimum_value
  @minimum_value
end

#norm_dataObject

Data Variables


113
114
115
# File 'lib/rubyplot/artist/geometry.rb', line 113

def norm_data
  @norm_data
end

#plot_colorsObject

Arrays for setting the colors for different labels of dataset.


102
103
104
# File 'lib/rubyplot/artist/geometry.rb', line 102

def plot_colors
  @plot_colors
end

#raw_columnsObject

Returns the value of attribute raw_columns


114
115
116
# File 'lib/rubyplot/artist/geometry.rb', line 114

def raw_columns
  @raw_columns
end

#raw_rowsObject

Data Variables


113
114
115
# File 'lib/rubyplot/artist/geometry.rb', line 113

def raw_rows
  @raw_rows
end

#right_marginObject

Blank space on the sides of the actual plot. Set in pixels to make appropriate space for the actual plot.


18
19
20
# File 'lib/rubyplot/artist/geometry.rb', line 18

def right_margin
  @right_margin
end

#show_labels_for_bar_valuesObject

Returns the value of attribute show_labels_for_bar_values


109
110
111
# File 'lib/rubyplot/artist/geometry.rb', line 109

def show_labels_for_bar_values
  @show_labels_for_bar_values
end

#sorted_drawingObject

Returns the value of attribute sorted_drawing


114
115
116
# File 'lib/rubyplot/artist/geometry.rb', line 114

def sorted_drawing
  @sorted_drawing
end

#stackedObject

Drawing


117
118
119
# File 'lib/rubyplot/artist/geometry.rb', line 117

def stacked
  @stacked
end

#theme_optionsObject

Drawing


117
118
119
# File 'lib/rubyplot/artist/geometry.rb', line 117

def theme_options
  @theme_options
end

#titleObject

The large title of the graph displayed at the top


47
48
49
# File 'lib/rubyplot/artist/geometry.rb', line 47

def title
  @title
end

#title_marginObject

Blank space below the title


24
25
26
# File 'lib/rubyplot/artist/geometry.rb', line 24

def title_margin
  @title_margin
end

#top_marginObject

Blank space on the sides of the actual plot. Set in pixels to make appropriate space for the actual plot.


12
13
14
# File 'lib/rubyplot/artist/geometry.rb', line 12

def top_margin
  @top_margin
end

#use_data_labelObject

Data Variables


113
114
115
# File 'lib/rubyplot/artist/geometry.rb', line 113

def use_data_label
  @use_data_label
end

#x_axis_incrementObject

Offset


98
99
100
# File 'lib/rubyplot/artist/geometry.rb', line 98

def x_axis_increment
  @x_axis_increment
end

#x_axis_labelObject

A label for the bottom of the graph


41
42
43
# File 'lib/rubyplot/artist/geometry.rb', line 41

def x_axis_label
  @x_axis_label
end

#y_axis_incrementObject

Returns the value of attribute y_axis_increment


99
100
101
# File 'lib/rubyplot/artist/geometry.rb', line 99

def y_axis_increment
  @y_axis_increment
end

#y_axis_labelObject

A label for the left side of the graph


44
45
46
# File 'lib/rubyplot/artist/geometry.rb', line 44

def y_axis_label
  @y_axis_label
end