Class: Aspose::Cloud::Cells::ChartEditor
- Inherits:
-
Object
- Object
- Aspose::Cloud::Cells::ChartEditor
- Defined in:
- lib/Cells/chart_editor.rb
Overview
This class contains features to work with charts
Instance Method Summary collapse
-
#add_chart(chart_type, upper_left_row, upper_left_column, lower_right_row, lower_right_column) ⇒ Object
Adds a new chart chartType upperLeftRow upperLeftColumn lowerRightRow lowerRightColumn.
-
#delete_chart(chart_index) ⇒ Object
Deletes a chart chart_index.
-
#get_border(chart_index) ⇒ Object
Gets border of the ChartArea of a chart chart_index.
-
#get_chart_area(chart_index) ⇒ Object
Gets ChartArea of a chart chart_index.
-
#get_fill_format(chart_index) ⇒ Object
Gets fill format of the ChartArea of a chart chart_index.
-
#initialize(filename, worksheet_name) ⇒ ChartEditor
constructor
A new instance of ChartEditor.
Constructor Details
#initialize(filename, worksheet_name) ⇒ ChartEditor
Returns a new instance of ChartEditor.
6 7 8 9 |
# File 'lib/Cells/chart_editor.rb', line 6 def initialize filename,worksheet_name @filename = filename @worksheet_name = worksheet_name end |
Instance Method Details
#add_chart(chart_type, upper_left_row, upper_left_column, lower_right_row, lower_right_column) ⇒ Object
Adds a new chart chartType upperLeftRow upperLeftColumn lowerRightRow lowerRightColumn
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/Cells/chart_editor.rb', line 18 def add_chart chart_type, upper_left_row, upper_left_column, lower_right_row, lower_right_column begin if @filename=='' raise 'Base file not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/charts?chartType=' + chart_type.to_s + '&upperLeftRow=' + upper_left_row.to_s + '&upperLeftColumn=' + upper_left_column.to_s + '&lowerRightRow=' + lower_right_row.to_s + '&lowerRightColumn=' + lower_right_column.to_s signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.put signed_uri,'', {:accept => 'application/json'} v_output = Aspose::Cloud::Common::Utils.validate_output(response) if v_output==nil || v_output=='' folder = Aspose::Cloud::AsposeStorage::Folder.new outputstream = folder.get_file(@filename) outputpath = $out_put_location + @filename Aspose::Cloud::Common::Utils.save_file(outputstream, outputpath) return 'Chart added' else return v_output end rescue Exception=>e print e end end |
#delete_chart(chart_index) ⇒ Object
Deletes a chart chart_index
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 |
# File 'lib/Cells/chart_editor.rb', line 51 def delete_chart chart_index begin if @filename=='' raise 'Base file not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/charts/' + chart_index.to_s signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.delete signed_uri, {:accept => 'application/json'} v_output = Aspose::Cloud::Common::Utils.validate_output(response) if v_output==nil || v_output=='' folder = Aspose::Cloud::AsposeStorage::Folder.new outputstream = folder.get_file(@filename) outputpath = $out_put_location + @filename Aspose::Cloud::Common::Utils.save_file(outputstream, outputpath) return 'Chart deleted' else return v_output end rescue Exception=>e print e end end |
#get_border(chart_index) ⇒ Object
Gets border of the ChartArea of a chart chart_index
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/Cells/chart_editor.rb', line 123 def get_border chart_index begin if @filename=='' raise 'Base file not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/charts/' + chart_index.to_s + '/chartArea/border' signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get signed_uri, {:accept => 'application/json'} json = JSON.parse(response) return json['Line'] rescue Exception=>e print e end end |
#get_chart_area(chart_index) ⇒ Object
Gets ChartArea of a chart chart_index
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/Cells/chart_editor.rb', line 81 def get_chart_area chart_index begin if @filename=='' raise 'Base file not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/charts/' + chart_index.to_s + '/chartArea' signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get signed_uri, {:accept => 'application/json'} json = JSON.parse(response) return json['ChartArea'] rescue Exception=>e print e end end |
#get_fill_format(chart_index) ⇒ Object
Gets fill format of the ChartArea of a chart chart_index
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/Cells/chart_editor.rb', line 102 def get_fill_format chart_index begin if @filename=='' raise 'Base file not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/charts/' + chart_index.to_s + '/chartArea/fillFormat' signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get signed_uri, {:accept => 'application/json'} json = JSON.parse(response) return json['FillFormat'] rescue Exception=>e print e end end |