Class: Writexlsx::InsertedChart

Inherits:
Object
  • Object
show all
Includes:
Utility::Common
Defined in:
lib/write_xlsx/inserted_chart.rb

Constant Summary

Constants included from Utility::Common

Utility::Common::PERL_TRUE_VALUES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utility::Common

#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message

Constructor Details

#initialize(row, col, chart, x_offset, y_offset, x_scale, y_scale, anchor, description, decorative) ⇒ InsertedChart

Returns a new instance of InsertedChart.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/write_xlsx/inserted_chart.rb', line 12

def initialize(
      row, col, chart, x_offset, y_offset, x_scale, y_scale,
      anchor, description, decorative
    )
  @row         = row
  @col         = col
  @chart       = chart
  @x_offset    = x_offset
  @y_offset    = y_offset
  @x_scale     = x_scale || 0
  @y_scale     = y_scale || 0
  @anchor      = anchor
  @description = description
  @decorative  = decorative
end

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor.



10
11
12
# File 'lib/write_xlsx/inserted_chart.rb', line 10

def anchor
  @anchor
end

#chartObject (readonly)

Returns the value of attribute chart.



8
9
10
# File 'lib/write_xlsx/inserted_chart.rb', line 8

def chart
  @chart
end

#colObject (readonly)

Returns the value of attribute col.



8
9
10
# File 'lib/write_xlsx/inserted_chart.rb', line 8

def col
  @col
end

#decorativeObject (readonly)

Returns the value of attribute decorative.



10
11
12
# File 'lib/write_xlsx/inserted_chart.rb', line 10

def decorative
  @decorative
end

#descriptionObject (readonly)

Returns the value of attribute description.



10
11
12
# File 'lib/write_xlsx/inserted_chart.rb', line 10

def description
  @description
end

#rowObject (readonly)

Returns the value of attribute row.



8
9
10
# File 'lib/write_xlsx/inserted_chart.rb', line 8

def row
  @row
end

#x_offsetObject (readonly)

Returns the value of attribute x_offset.



8
9
10
# File 'lib/write_xlsx/inserted_chart.rb', line 8

def x_offset
  @x_offset
end

#x_scaleObject (readonly)

Returns the value of attribute x_scale.



9
10
11
# File 'lib/write_xlsx/inserted_chart.rb', line 9

def x_scale
  @x_scale
end

#y_offsetObject (readonly)

Returns the value of attribute y_offset.



8
9
10
# File 'lib/write_xlsx/inserted_chart.rb', line 8

def y_offset
  @y_offset
end

#y_scaleObject (readonly)

Returns the value of attribute y_scale.



9
10
11
# File 'lib/write_xlsx/inserted_chart.rb', line 9

def y_scale
  @y_scale
end

Instance Method Details

#nameObject



28
29
30
# File 'lib/write_xlsx/inserted_chart.rb', line 28

def name
  chart.name
end

#scaled_heightObject



37
38
39
40
# File 'lib/write_xlsx/inserted_chart.rb', line 37

def scaled_height
  height = chart.height if ptrue?(chart.height)
  (0.5 + (height * y_scale)).to_i
end

#scaled_widthObject



32
33
34
35
# File 'lib/write_xlsx/inserted_chart.rb', line 32

def scaled_width
  width = chart.width if ptrue?(chart.width)
  (0.5 + (width * x_scale)).to_i
end