# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-ruby
require 'aspose_cells_cloud'

class Chart

  include AsposeCellsCloud


  def initialize
     #Get client_id and client_secret from https://cloud.aspose.com
   
    @instance =  AsposeCellsCloud::CellsApi.new($client_id,$client_secret,$api_version,$baseurl) 
  end

  # Update chart legend
  def update_chart_legend
    name = $MYDOC
    sheet_name = $SHEET3
    chart_index = 0
    legend = AsposeCellsCloud::Legend.new
    folder = $TEMPFOLDER
    result = @instance.upload_file( folder+"/"+name,  ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) })
    expect(result.uploaded.size).to  be > 0
    result = @instance.cells_charts_post_worksheet_chart_legend(name, sheet_name, chart_index, { :legend=>legend, :folder=>folder})
    expect(result.code).to eql(200)
  end

end

chart = Chart.new()
puts chart.update_chart_legend