Class: Daytona::Charts::Chart2D

Inherits:
Chart
  • Object
show all
Defined in:
lib/daytona/common/charts.rb

Direct Known Subclasses

BarChart, BoxAndWhiskerChart, PointChart

Instance Attribute Summary collapse

Attributes inherited from Chart

#elements, #png, #title, #type

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Chart2D

Returns a new instance of Chart2D.

Parameters:

  • data (Hash<Symbol, Object>)


53
54
55
56
57
# File 'lib/daytona/common/charts.rb', line 53

def initialize(data)
  super
  @x_label = data.fetch(:x_label, nil)
  @y_label = data.fetch(:y_label, nil)
end

Instance Attribute Details

#x_labelString, Nil (readonly)

Returns The label of the x-axis.

Returns:

  • (String, Nil)

    The label of the x-axis



47
48
49
# File 'lib/daytona/common/charts.rb', line 47

def x_label
  @x_label
end

#y_labelString, Nil (readonly)

Returns The label of the y-axis.

Returns:

  • (String, Nil)

    The label of the y-axis



50
51
52
# File 'lib/daytona/common/charts.rb', line 50

def y_label
  @y_label
end

Instance Method Details

#to_hHash<Symbol, Object>

Returns original metadata.

Returns:

  • (Hash<Symbol, Object>)

    original metadata



60
# File 'lib/daytona/common/charts.rb', line 60

def to_h = super.merge(x_label:, y_label:)