Class: Trackplot::Components::Line
- Defined in:
- lib/trackplot/components/line.rb
Instance Attribute Summary collapse
-
#data_key ⇒ Object
readonly
Returns the value of attribute data_key.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(data_key, **options) ⇒ Line
constructor
A new instance of Line.
- #to_config ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(data_key, **options) ⇒ Line
Returns a new instance of Line.
6 7 8 9 |
# File 'lib/trackplot/components/line.rb', line 6 def initialize(data_key, **) @data_key = data_key super(**) end |
Instance Attribute Details
#data_key ⇒ Object (readonly)
Returns the value of attribute data_key.
4 5 6 |
# File 'lib/trackplot/components/line.rb', line 4 def data_key @data_key end |
Instance Method Details
#to_config ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/trackplot/components/line.rb', line 11 def to_config { type: "line", data_key: data_key, color: [:color], curve: .fetch(:curve, false), dashed: .fetch(:dashed, false), stroke_width: [:stroke_width] || 2, dot: .fetch(:dot, true), dot_size: [:dot_size] || 4, y_axis: [:y_axis]&.to_s, name: [:name] || data_key }.compact end |