Class: TChart::YItem
- Inherits:
-
Object
- Object
- TChart::YItem
- Defined in:
- lib/tchart/model/y_item.rb
Overview
The input data file specifies settings, data lines, and separators. A data line consists of a description, which becomes a y axis label, zero or more date ranges to be plotted on the chart as horizontal bars, and a TikZ style for the bars. YItem is reponsible for capturing all of that information and for building the label and bar elements.
Instance Attribute Summary collapse
-
#bar_style ⇒ Object
readonly
TikZ style, must be defined in encompasing TeX document.
-
#date_ranges ⇒ Object
readonly
Can be >= 0; drawn as bars on the chart.
-
#description ⇒ Object
readonly
Used for the y-label.
Instance Method Summary collapse
-
#build(layout, y) ⇒ Object
> [ Label, Bar, Bar, … ].
-
#initialize(description, bar_style, date_ranges) ⇒ YItem
constructor
A new instance of YItem.
Constructor Details
#initialize(description, bar_style, date_ranges) ⇒ YItem
Returns a new instance of YItem.
16 17 18 19 20 |
# File 'lib/tchart/model/y_item.rb', line 16 def initialize(description, , date_ranges) @description = description = @date_ranges = date_ranges end |
Instance Attribute Details
#bar_style ⇒ Object (readonly)
TikZ style, must be defined in encompasing TeX document.
13 14 15 |
# File 'lib/tchart/model/y_item.rb', line 13 def end |
#date_ranges ⇒ Object (readonly)
Can be >= 0; drawn as bars on the chart.
14 15 16 |
# File 'lib/tchart/model/y_item.rb', line 14 def date_ranges @date_ranges end |
#description ⇒ Object (readonly)
Used for the y-label.
12 13 14 |
# File 'lib/tchart/model/y_item.rb', line 12 def description @description end |
Instance Method Details
#build(layout, y) ⇒ Object
> [ Label, Bar, Bar, … ]
22 23 24 |
# File 'lib/tchart/model/y_item.rb', line 22 def build(layout, y) # => [ Label, Bar, Bar, ... ] [ new_y_label(layout, y) ].concat (layout, y) end |