Class: ActiveCharts::XYChart
- Inherits:
-
RectangularChart
- Object
- Chart
- RectangularChart
- ActiveCharts::XYChart
- Defined in:
- lib/active_charts/xy_chart.rb
Direct Known Subclasses
Constant Summary collapse
- OFFSET =
6
Constants inherited from RectangularChart
RectangularChart::TOP_LEFT_OFFSET
Constants inherited from Chart
Chart::CSS_CLASSES, Chart::MARGIN
Instance Attribute Summary collapse
-
#section_height ⇒ Object
readonly
Returns the value of attribute section_height.
-
#section_width ⇒ Object
readonly
Returns the value of attribute section_width.
-
#x_label_y ⇒ Object
readonly
Returns the value of attribute x_label_y.
-
#x_labels ⇒ Object
readonly
Returns the value of attribute x_labels.
-
#x_max ⇒ Object
readonly
Returns the value of attribute x_max.
-
#x_min ⇒ Object
readonly
Returns the value of attribute x_min.
-
#x_ticks ⇒ Object
readonly
Returns the value of attribute x_ticks.
-
#y_label_x ⇒ Object
readonly
Returns the value of attribute y_label_x.
-
#y_labels ⇒ Object
readonly
Returns the value of attribute y_labels.
-
#y_max ⇒ Object
readonly
Returns the value of attribute y_max.
-
#y_min ⇒ Object
readonly
Returns the value of attribute y_min.
-
#y_ticks ⇒ Object
readonly
Returns the value of attribute y_ticks.
Attributes inherited from RectangularChart
#grid_height, #grid_width, #svg_height, #svg_width
Attributes inherited from Chart
#collection, #columns_count, #data_formatters, #extra_css_classes, #label_height, #max_values, #rows_count, #series_labels, #title
Instance Method Summary collapse
- #bottom_label_text_tags ⇒ Object
-
#initialize(collection, options = {}) ⇒ XYChart
constructor
A new instance of XYChart.
- #side_label_text_tags ⇒ Object
Methods inherited from RectangularChart
Methods inherited from Chart
#chart_svg_tag, #legend_list_tag, #to_html
Constructor Details
#initialize(collection, options = {}) ⇒ XYChart
Returns a new instance of XYChart.
5 6 7 8 9 10 |
# File 'lib/active_charts/xy_chart.rb', line 5 def initialize(collection, = {}) super section_calcs tick_calcs end |
Instance Attribute Details
#section_height ⇒ Object (readonly)
Returns the value of attribute section_height.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def section_height @section_height end |
#section_width ⇒ Object (readonly)
Returns the value of attribute section_width.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def section_width @section_width end |
#x_label_y ⇒ Object (readonly)
Returns the value of attribute x_label_y.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def x_label_y @x_label_y end |
#x_labels ⇒ Object (readonly)
Returns the value of attribute x_labels.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def x_labels @x_labels end |
#x_max ⇒ Object (readonly)
Returns the value of attribute x_max.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def x_max @x_max end |
#x_min ⇒ Object (readonly)
Returns the value of attribute x_min.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def x_min @x_min end |
#x_ticks ⇒ Object (readonly)
Returns the value of attribute x_ticks.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def x_ticks @x_ticks end |
#y_label_x ⇒ Object (readonly)
Returns the value of attribute y_label_x.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def y_label_x @y_label_x end |
#y_labels ⇒ Object (readonly)
Returns the value of attribute y_labels.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def y_labels @y_labels end |
#y_max ⇒ Object (readonly)
Returns the value of attribute y_max.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def y_max @y_max end |
#y_min ⇒ Object (readonly)
Returns the value of attribute y_min.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def y_min @y_min end |
#y_ticks ⇒ Object (readonly)
Returns the value of attribute y_ticks.
12 13 14 |
# File 'lib/active_charts/xy_chart.rb', line 12 def y_ticks @y_ticks end |
Instance Method Details
#bottom_label_text_tags ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/active_charts/xy_chart.rb', line 23 def x_labels.map.with_index do |label, index| label = formatted_val(label, data_formatters[0]) classes = 'ac-x-label' classes += ' anchor_start' if index.zero? tag.text(label, x: x_tick_x(index), y: x_label_y, class: classes) end.join end |
#side_label_text_tags ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/active_charts/xy_chart.rb', line 15 def y_labels.map.with_index do |label, index| label = formatted_val(label, data_formatters[1]) tag.text(label, x: y_label_x, y: y_tick_y(index), class: 'ac-y-label') end.join end |