Class: Chart

Inherits:
Object
  • Object
show all
Defined in:
lib/WriteExcel/chart.rb

Overview

require ‘WriteExcel/biffwriter’

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, name, index, encoding, activesheet, firstsheet) ⇒ Chart

new()

Constructor. Creates a new Chart object from a BIFFwriter object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/WriteExcel/chart.rb', line 28

def initialize(filename, name, index, encoding, activesheet, firstsheet)
  @filename          = filename
  @name              = name
  @index             = index
  @encoding          = encoding
  @activesheet       = activesheet
  @firstsheet        = firstsheet

  @type              = 0x0200
  @ext_sheets        = []
  @using_tmpfile     = 1
  @filehandle        = ""
  @fileclosed        = false
  @offset            = 0
  @xls_rowmax        = 0
  @xls_colmax        = 0
  @xls_strmax        = 0
  @dim_rowmin        = 0
  @dim_rowmax        = 0
  @dim_colmin        = 0
  @dim_colmax        = 0
  @dim_changed       = 0
  @colinfo           = []
  @selection         = [0, 0]
  @panes             = []
  @active_pane       = 3
  @frozen            = 0
  @selected          = 0
  @hidden            = 0

  @paper_size        = 0x0
  @orientation       = 0x1
  @header            = ''
  @footer            = ''
  @hcenter           = 0
  @vcenter           = 0
  @margin_head       = 0.50
  @margin_foot       = 0.50
  @margin_left       = 0.75
  @margin_right      = 0.75
  @margin_top        = 1.00
  @margin_bottom     = 1.00

  @title_rowmin      = nil
  @title_rowmax      = nil
  @title_colmin      = nil
  @title_colmax      = nil
  @print_rowmin      = nil
  @print_rowmax      = nil
  @print_colmin      = nil
  @print_colmax      = nil

  @print_gridlines   = 1
  @screen_gridlines  = 1
  @print_headers     = 0

  @fit_page          = 0
  @fit_width         = 0
  @fit_height        = 0

  @hbreaks           = []
  @vbreaks           = []

  @protect           = 0
  @password          = nil

  @col_sizes         = {}
  @row_sizes         = {}

  @col_formats       = {}
  @row_formats       = {}

  @zoom              = 100
  @print_scale       = 100

  @leading_zeros     = 0

  @outline_row_level = 0
  @outline_style     = 0
  @outline_below     = 1
  @outline_right     = 1
  @outline_on        = 1

  _initialize
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



19
20
21
# File 'lib/WriteExcel/chart.rb', line 19

def name
  @name
end

Instance Method Details

#activateObject

activate()

Set this worksheet as the active worksheet, i.e. the worksheet that is displayed when the workbook is opened. Also set it as selected.



151
152
153
154
155
# File 'lib/WriteExcel/chart.rb', line 151

def activate
  @hidden      = 0 # Active worksheet can't be hidden.
  @selected    = 1
  @activesheet = @index
end

#get_dataObject

get_data().

Retrieves data from memory in one chunk, or from disk in $buffer sized chunks.



121
122
123
124
125
126
127
128
# File 'lib/WriteExcel/chart.rb', line 121

def get_data
  buffer = 4096

  return tmp if read(@filehandle, tmp, buffer)

  # No data to return
  return nil
end

#hideObject

hide()

Hide this worksheet.



164
165
166
167
168
169
170
171
# File 'lib/WriteExcel/chart.rb', line 164

def hide
  @hidd        = 1

  # A hidden worksheet shouldn't be active or selected.
  @selecte     = 0
  @activesheet = 0
  @firstsheet  = 0
end

#selectObject

select()

Set this worksheet as a selected worksheet, i.e. the worksheet has its tab highlighted.



138
139
140
141
# File 'lib/WriteExcel/chart.rb', line 138

def select
  @hidden         = 0 # Selected worksheet can't be hidden.
  @selected       = 1
end

#set_first_sheetObject

set_first_sheet()

Set this worksheet as the first visible sheet. This is necessary when there are a large number of worksheets and the activated worksheet is not visible on the screen.



182
183
184
185
# File 'lib/WriteExcel/chart.rb', line 182

def set_first_sheet
  hidden      = 0 # Active worksheet can't be hidden.
  firstsheet  = index
end