Class: Aspose::Cloud::Cells::ChartEditor

Inherits:
Object
  • Object
show all
Defined in:
lib/Cells/chart_editor.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ ChartEditor

Returns a new instance of ChartEditor.



22
23
24
25
26
# File 'lib/Cells/chart_editor.rb', line 22

def initialize(filename)
  @filename = filename
  raise 'filename not specified.' if filename.empty?
  @base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/cells/#{@filename}"
end

Instance Method Details

#add_chart(worksheet_name, chart_type, upper_left_row, upper_left_column, lower_right_row, lower_right_column, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/Cells/chart_editor.rb', line 28

def add_chart(worksheet_name, chart_type, upper_left_row, upper_left_column, lower_right_row, lower_right_column, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_type not specified.' if chart_type.empty?
  raise 'upper_left_row not specified.' if upper_left_row.nil?
  raise 'upper_left_column not specified.' if upper_left_column.nil?
  raise 'lower_right_row not specified.' if lower_right_row.nil?
  raise 'lower_right_column not specified.' if lower_right_column.nil?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts"
  qry = { :chartType => chart_type, :upperLeftRow => upper_left_row, :upperLeftColumn => upper_left_column,
          :lowerRightRow => lower_right_row, :lowerRightColumn => lower_right_column }
  str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  response_stream = RestClient.put(signed_str_uri,'',{:accept=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end

#delete_chart(worksheet_name, chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/Cells/chart_editor.rb', line 58

def delete_chart(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  response_stream = RestClient.delete(signed_str_uri, {:accept=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end

#delete_chart_title(worksheet_name, chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/Cells/chart_editor.rb', line 178

def delete_chart_title(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/title"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

  response_stream = RestClient.delete(signed_str_uri, {:accept=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end

#delete_charts(worksheet_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/Cells/chart_editor.rb', line 47

def delete_charts(worksheet_name, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?          

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  response_stream = RestClient.delete(signed_str_uri, {:accept=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end

#get_border(worksheet_name, chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



140
141
142
143
144
145
146
147
148
# File 'lib/Cells/chart_editor.rb', line 140

def get_border(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/chartArea/border"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Line']
end

#get_chart_area(worksheet_name, chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



120
121
122
123
124
125
126
127
128
# File 'lib/Cells/chart_editor.rb', line 120

def get_chart_area(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/chartArea"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['ChartArea']
end

#get_fill_format(worksheet_name, chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



130
131
132
133
134
135
136
137
138
# File 'lib/Cells/chart_editor.rb', line 130

def get_fill_format(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/chartArea/fillFormat"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['FillFormat']
end

#hide_chart_legend(worksheet_name, chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/Cells/chart_editor.rb', line 83

def hide_chart_legend(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?          

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/legend"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

  response_stream = RestClient.delete(signed_str_uri, {:accept=>'application/json', :content_type=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end

#read_chart_legend(worksheet_name, chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



110
111
112
113
114
115
116
117
118
# File 'lib/Cells/chart_editor.rb', line 110

def read_chart_legend(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/legend"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Legend']
end

#set_chart_title(worksheet_name, chart_index, str_xml, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/Cells/chart_editor.rb', line 150

def set_chart_title(worksheet_name, chart_index, str_xml, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?
  raise 'str_xml not specified.' if str_xml.empty?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/title"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

  response_stream = RestClient.put(signed_str_uri, str_xml, {:accept=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end

#show_chart_legend(worksheet_name, chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/Cells/chart_editor.rb', line 70

def show_chart_legend(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?          

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/legend"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

  response_stream = RestClient.put(signed_str_uri, '', {:accept=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end

#update_chart_legend(worksheet_name, chart_index, str_xml, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/Cells/chart_editor.rb', line 96

def update_chart_legend(worksheet_name, chart_index, str_xml, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?
  raise 'str_xml not specified.' if str_xml.empty?          

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/legend"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

  response_stream = RestClient.post(signed_str_uri, str_xml, {:accept=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end

#update_chart_title(worksheet_name, chart_index, str_xml, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/Cells/chart_editor.rb', line 164

def update_chart_title(worksheet_name, chart_index, str_xml, folder_name='', storage_type = 'Aspose', storage_name = '')
  raise 'worksheet_name not specified.' if worksheet_name.empty?
  raise 'chart_index not specified.' if chart_index.nil?
  raise 'str_xml not specified.' if str_xml.empty?

  str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/title"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

  response_stream = RestClient.post(signed_str_uri, str_xml, {:accept=>'application/json'})
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
  valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
end