Class: Writexlsx::Chartsheet

Inherits:
Worksheet show all
Includes:
Utility
Defined in:
lib/write_xlsx/chartsheet.rb

Constant Summary

Constants included from Utility

Utility::COL_MAX, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX

Constants inherited from Worksheet

Worksheet::MAX_DIGIT_WIDTH, Worksheet::PADDING

Instance Attribute Summary collapse

Attributes inherited from Worksheet

#autofilter_area, #charts, #col_formats, #comments, #comments_author, #drawing, #dxf_priority, #images, #index, #set_rows, #shapes, #tables, #vba_codename, #vml_data_id, #vml_shape_id, #writer

Instance Method Summary collapse

Methods included from Utility

#absolute_char, #check_dimensions, #check_dimensions_and_update_max_min_values, #check_parameter, #convert_date_time, delete_files, #float_to_str, #pixels_to_points, #ptrue?, #put_deprecate_message, #row_col_notation, #shape_style_base, #store_col_max_min_values, #store_row_max_min_values, #substitute_cellref, #underline_attributes, #v_shape_attributes_base, #v_shape_style_base, #write_anchor, #write_auto_fill, #write_color, #write_comment_path, #write_div, #write_fill, #write_font, #write_stroke, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xml_str

Methods inherited from Worksheet

#activate, #add_sparkline, #add_table, #autofilter, #buttons_data, #center_horizontally, #center_vertically, #comments_array, #comments_count, #comments_visible?, #conditional_formatting, #data_validation, #date_1904?, #drawing_links, #filter_column, #filter_column_list, #fit_to_pages, #freeze_panes, #get_palette_color, #get_range_data, #has_comments?, #has_vml?, #hidden?, #hide, #hide_gridlines, #hide_zero, #insert_button, #insert_chart, #insert_image, #insert_shape, #is_chartsheet?, #margin_bottom=, #margin_left=, #margin_right=, #margin_top=, #margins=, #margins_left_right=, #margins_top_bottom=, #merge_range, #merge_range_type, #name, #outline_settings, #paper=, #position_object_pixels, #prepare_image, #prepare_shape, #prepare_vml_objects, #print_across, #print_area, #print_repeat_cols, #print_repeat_rows, #print_row_col_headers, #print_scale=, #repeat_columns, #repeat_formula, #repeat_rows, #right_to_left, #select, #set_column, #set_comments_author, #set_default_row, #set_external_comment_links, #set_external_vml_links, #set_first_sheet, #set_footer, #set_h_pagebreaks, #set_header, #set_landscape, #set_margin_bottom, #set_margin_left, #set_margin_right, #set_margin_top, #set_margins, #set_margins_LR, #set_margins_TB, #set_page_view, #set_paper, #set_portrait, #set_print_scale, #set_row, #set_selection, #set_start_page, #set_tab_color, #set_v_pagebreaks, #set_xml_writer, #set_zoom, #show_comments, #split_panes, #start_page=, #store_formula, #tab_color=, #tables_count, #write, #write_array_formula, #write_blank, #write_cell_array_formula, #write_cell_formula, #write_cell_value, #write_col, #write_comment, #write_date_time, #write_formula, #write_number, #write_rich_string, #write_row, #write_string, #write_url, #zoom=

Constructor Details

#initialize(workbook, index, name) ⇒ Chartsheet

Returns a new instance of Chartsheet.



20
21
22
23
24
25
26
27
28
# File 'lib/write_xlsx/chartsheet.rb', line 20

def initialize(workbook, index, name)
  super
  @drawing           = Drawing.new
  @is_chartsheet     = true
  @chart             = nil
  @charts            = [1]
  @zoom_scale_normal = 0
  @page_setup.orientation = false
end

Instance Attribute Details

#chart=(value) ⇒ Object (writeonly)

Sets the attribute chart

Parameters:

  • value

    the value to set the attribute chart to.



18
19
20
# File 'lib/write_xlsx/chartsheet.rb', line 18

def chart=(value)
  @chart = value
end

Instance Method Details

#add_series(*args) ⇒ Object

Encapsulated Chart methods.



89
90
91
# File 'lib/write_xlsx/chartsheet.rb', line 89

def add_series(*args)
  @chart.add_series(*args)
end

#assemble_xml_fileObject

Assemble and write the XML file.



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
# File 'lib/write_xlsx/chartsheet.rb', line 33

def assemble_xml_file # :nodoc:
  return unless @writer
  @writer.xml_decl

  # Write the root chartsheet element.
  write_chartsheet

  # Write the worksheet properties.
  write_sheet_pr

  # Write the sheet view properties.
  write_sheet_views

  # Write the sheetProtection element.
  write_sheet_protection

  # Write the printOptions element.
  write_print_options

  # Write the worksheet page_margins.
  write_page_margins

  # Write the worksheet page setup.
  write_page_setup

  # Write the headerFooter element.
  write_header_footer

  # Write the drawing element.
  write_drawings

  # Close the worksheet tag.
  @writer.end_tag('chartsheet')

  # Close the XML writer object and filehandle.
  @writer.crlf
  @writer.close
end


172
173
174
# File 'lib/write_xlsx/chartsheet.rb', line 172

def external_links
  [@external_drawing_links]
end

#prepare_chart(index, chart_id, drawing_id) ⇒ Object

Set up chart/drawings.



160
161
162
163
164
165
166
167
168
169
170
# File 'lib/write_xlsx/chartsheet.rb', line 160

def prepare_chart(index, chart_id, drawing_id) # :nodoc:
  @chart.id = chart_id - 1

  drawing = Drawing.new
  @drawing = drawing
  @drawing.orientation = @page_setup.orientation

  @external_drawing_links << [ '/drawing', "../drawings/drawing#{drawing_id}.xml" ]

  @drawing_links << [ '/chart', "../charts/chart#{chart_id}.xml"]
end

#protect(password = '', options = {}) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/write_xlsx/chartsheet.rb', line 72

def protect(password = '', options = {})
  @chart.protection = 1

  options[:sheet]     = 0
  options[:content]   = 1
  options[:scenarios] = 1

  super(password, options)
end

#set_chartarea(*args) ⇒ Object



121
122
123
# File 'lib/write_xlsx/chartsheet.rb', line 121

def set_chartarea(*args)
  @chart.set_chartarea(*args)
end

#set_drop_lines(*args) ⇒ Object



149
150
151
# File 'lib/write_xlsx/chartsheet.rb', line 149

def set_drop_lines(*args)
  @chart.set_drop_lines(*args)
end

#set_high_low_lines(*args) ⇒ Object



153
154
155
# File 'lib/write_xlsx/chartsheet.rb', line 153

def set_high_low_lines(*args)
  @chart.set_high_low_lines(*args)
end

#set_legend(*args) ⇒ Object



113
114
115
# File 'lib/write_xlsx/chartsheet.rb', line 113

def set_legend(*args)
  @chart.set_legend(*args)
end

#set_plotarea(*args) ⇒ Object



117
118
119
# File 'lib/write_xlsx/chartsheet.rb', line 117

def set_plotarea(*args)
  @chart.set_plotarea(*args)
end

#set_size(*args) ⇒ Object



137
138
139
# File 'lib/write_xlsx/chartsheet.rb', line 137

def set_size(*args)
  @chart.set_size(*args)
end

#set_style(*args) ⇒ Object



125
126
127
# File 'lib/write_xlsx/chartsheet.rb', line 125

def set_style(*args)
  @chart.set_style(*args)
end

#set_table(*args) ⇒ Object



141
142
143
# File 'lib/write_xlsx/chartsheet.rb', line 141

def set_table(*args)
  @chart.set_table(*args)
end

#set_title(*args) ⇒ Object



109
110
111
# File 'lib/write_xlsx/chartsheet.rb', line 109

def set_title(*args)
  @chart.set_title(*args)
end

#set_up_down_bars(*args) ⇒ Object



145
146
147
# File 'lib/write_xlsx/chartsheet.rb', line 145

def set_up_down_bars(*args)
  @chart.set_up_down_bars(*args)
end

#set_x2_axis(*args) ⇒ Object



101
102
103
# File 'lib/write_xlsx/chartsheet.rb', line 101

def set_x2_axis(*args)
  @chart.set_x2_axis(*args)
end

#set_x_axis(*args) ⇒ Object



93
94
95
# File 'lib/write_xlsx/chartsheet.rb', line 93

def set_x_axis(*args)
  @chart.set_x_axis(*args)
end

#set_y2_axis(*args) ⇒ Object



105
106
107
# File 'lib/write_xlsx/chartsheet.rb', line 105

def set_y2_axis(*args)
  @chart.set_y2_axis(*args)
end

#set_y_axis(*args) ⇒ Object



97
98
99
# File 'lib/write_xlsx/chartsheet.rb', line 97

def set_y_axis(*args)
  @chart.set_y_axis(*args)
end

#show_blanks_as(*args) ⇒ Object



129
130
131
# File 'lib/write_xlsx/chartsheet.rb', line 129

def show_blanks_as(*args)
  @chart.show_blanks_as(*args)
end

#show_hidden_data(*args) ⇒ Object



133
134
135
# File 'lib/write_xlsx/chartsheet.rb', line 133

def show_hidden_data(*args)
  @chart.show_hidden_data(*args)
end