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



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

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

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



79
80
81
82
83
84
85
86
87
# File 'lib/Cells/chart_editor.rb', line 79

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



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

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



69
70
71
72
73
74
75
76
77
# File 'lib/Cells/chart_editor.rb', line 69

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