إضافة مخطط في ورقة العمل يشير هذا REST API إلى إضافة مخطط جديد إلى ورقة العمل.
RSET API
Copy
PUT http://api.aspose.cloud/v3.0/cells/{ name} /worksheets/{ sheetName} /charts
معلمات الطلب هي:
اسم المعلمة
يكتب
المسار/سلسلة الاستعلام/نص HTTP
وصف
اسم
خيط
طريق
اسم المصنف.
اسم الورقة
خيط
طريق
اسم ورقة العمل.
نوع المخطط
خيط
استفسار
نوع الرسم البياني، الرجاء الرجوع إلى نوع الخاصية في مورد الرسم البياني.
الصف العلوي الأيسر
عدد صحيح
استفسار
0
العمود الأيسر العلوي
عدد صحيح
استفسار
0
الصف الأيمن السفلي
عدد صحيح
استفسار
0
العمود الأيمن السفلي
عدد صحيح
استفسار
0
منطقة
خيط
استفسار
يحدد القيم التي سيتم رسم سلسلة البيانات منها.
عمودي
منطقي
استفسار
حقيقي
فئة البيانات
خيط
استفسار
يُحصِل أو يُعيِّن نطاق قيم محور الفئة. يُمكن أن يكون نطاقًا من الخلايا (مثل “d1:e10”).
isAutoGetSerialName
منطقي
استفسار
حقيقي
عنوان
خيط
استفسار
يحدد اسم عنوان الرسم البياني.
مجلد
خيط
استفسار
مجلد المصنف.
اسم التخزين
خيط
استفسار
اسم التخزين.
تسميات البيانات
منطقي
استفسار
حقيقي
موضع تسميات البيانات
خيط
استفسار
فوق
ورقة جدول محورية
خيط
استفسار
اسم الجدول المحوري
خيط
استفسار
المواصفات OpenAPI يحدد واجهة برمجة يمكن الوصول إليها بشكل عام ويسمح لك بتنفيذ تفاعلات REST مباشرة من متصفح الويب.
يمكنك استخدام أداة سطر الأوامر cURL للوصول بسهولة إلى خدمات الويب Aspose.Cells. يوضح المثال التالي كيفية إجراء مكالمات إلى Cloud API باستخدام cURL.
عائلة SDK السحابية
يُعد استخدام حزمة تطوير برمجيات (SDK) أفضل طريقة لتسريع عملية التطوير. فهي تُعنى بالتفاصيل البسيطة وتُتيح لك التركيز على مهام مشروعك. يُرجى الاطلاع علىمستودع GitHub للحصول على قائمة كاملة بـ Aspose.Cells Cloud SDKs.
توضح أمثلة التعليمات البرمجية التالية كيفية إجراء مكالمات إلى خدمات الويب Aspose.Cells باستخدام مجموعات أدوات تطوير البرامج المختلفة:
C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet/
namespace Aspose.Cells.Cloud.SDK.Example
{
using Aspose.Cells.Cloud.SDK.Api;
using Aspose.Cells.Cloud.SDK.Request;
using System;
public partial class CellsApiExample
{
public void PutWorksheetAddChartExample()
{
string CellsCloudClientId ="....";//get from https://dashboard.aspose.cloud/#/applications
string CellsCloudClientSecret="...";//get from https://dashboard.aspose.cloud/#/applications
PutWorksheetAddChartRequest request = new PutWorksheetAddChartRequest { name = "Book1.xlsx", sheetName = "Sheet4",
chartType="pie",
upperLeftRow = 5,
upperLeftColumn = 5,
lowerRightRow = 10,
lowerRightColumn = 10,
area = "C7:D11",
isVertical = true, folder = "TestData/In" };
cellsApi.PutWorksheetAddChart(request);
}
}
}
// Obsolet
//CellsApi instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
//string name = MYDOC;
//string sheetName = SHEET4;
//string chartType = "Pie";
//int? upperLeftRow = 5;
//int? upperLeftColumn = 5;
//int? lowerRightRow = 10;
//int? lowerRightColumn = 10;
//string area = "C7:D11";
//bool? isVertical = true;
//string categoryData = null;
//bool? isAutoGetSerialName = null;
//string title = null;
//string folder = TEMPFOLDER;
//instance.UploadFile(folder + @"\" + name, File.Open( @"C:\TestData\" +name));
//var response = instance.CellsChartsPutWorksheetAddChart(name, sheetName, chartType, upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, area, isVertical, categoryData, isAutoGetSerialName, title, folder);
//Assert.IsInstanceOf<ChartsResponse>(response, "response is ChartsResponse");
//Assert.AreEqual(response.Code, 200);
Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-java/
try {
CellsApi api = new CellsApi(System.getenv("CellsCloudTestClientId"),System.getenv("CellsCloudTestClientSecret"),"v3.0",System.getenv("CellsCloudTestApiBaseUrl"));
String remoteFolder = "TestData/";
String localName = "Book1.xlsx";
String remoteName = "Book1.xlsx";
PutWorksheetAddChartRequest request = new PutWorksheetAddChartRequest();
request.setName("myDocument.xlsx");
request.setSheetName("Sheet3");
request.setChartType("pie");
request.setUpperLeftRow(5);
request.setUpperLeftColumn(5);
request.setLowerRightRow(10);
request.setLowerRightColumn(10);
request.setArea("C7:D11");
request.setIsVertical(true);
request.setCategoryData("");
request.setIsAutoGetSerialName(false);
request.setTitle("");
request.setDataLabels(false);
request.setDataLabelsPosition("");
request.setPivotTableSheet("");
request.setPivotTableName("");
request.setFolder(remoteFolder);
request.setStorageName("");
CellsCloudResponse response = api.putWorksheetAddChart(request);
} catch (Exception ex) {
ex.printStackTrace();
}
PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-php
<?php
require_once('vendor\autoload.php');
use \Aspose\Cells\Cloud\Api\CellsApi;
use \Aspose\Cells\Cloud\Request\PutWorksheetChartRequest;
class Chart {
public $instance;
public function __construct() {
$this->instance = new CellsApi(getenv("CellsCloudClientId"),getenv("CellsCloudClientSecret"),"v3.0",getenv("CellsCloudApiBaseUrl"));
}
public function putWorksheetAddChart() {
$remoteFolder = "TestData/In";
$localName = "Book1.xlsx";
$remoteName = "Book1.xlsx";
$request = new PutWorksheetChartRequest();
$request->setName( $remoteName);
$request->setSheetName( "Sheet4");
$request->setChartType( "Pie");
$request->setUpperLeftRow( 5);
$request->setUpperLeftColumn( 5);
$request->setLowerRightRow( 10);
$request->setLowerRightColumn( 10);
$request->setArea( "C7:D11");
$request->setIsVertical( 'true');
$request->setTitle( "Aspose Chart");
$request->setFolder( $remoteFolder);
$request->setStorageName( "");
$this->instance->putWorksheetChart($request);
}
}
$instance = new Chart();
$instance->putWorksheetAddChart();
?>
Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
# Add new chart to worksheet.
def add_new_chart_to_worksheet
name = $MYDOC
sheet_name = $SHEET3
chart_type = 'Pie'
upper_left_row = 5
upper_left_column = 5
lower_right_row = 10
lower_right_column = 10
area = $CELLAREA
is_vertical = true
category_data = nil
is_auto_get_serial_name = nil
title = nil
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_put_worksheet_add_chart(name, sheet_name, chart_type, { :upper_left_row=>upper_left_row, :upper_left_column=>upper_left_column, :lower_right_row=>lower_right_row, :lower_right_column=>lower_right_column, :area=>area, :is_vertical=>is_vertical, :folder=>folder})
expect(result.code).to eql(200)
end
end
chart = Chart.new()
puts chart.add_new_chart_to_worksheet
Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-python
import os
from asposecellscloud.apis.cells_api import CellsApi
from asposecellscloud.requests import *
CellsCloudClientId ='....' # get from https://dashboard.aspose.cloud/#/applications
CellsCloudClientSecret='....' # get from https://dashboard.aspose.cloud/#/applications
api = CellsApi(CellsCloudClientId,CellsCloudClientSecret)
request = PutWorksheetChartRequest( 'myDocument.xlsx', 'Sheet3', 'Pie' ,upper_left_row= 5,upper_left_column= 5,lower_right_row= 10,lower_right_column= 10,area= 'C7:D11',is_vertical= True,title= 'Aspose Chart',folder= 'PythonTest',storage_name= '')
api.put_worksheet_chart(request)
Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-node
import { expect } from "chai";
import "mocha";
import * as model from "../src/model/model";
import * as BaseTest from "./baseTest";
var fs = require('fs');
describe('cellsChartsPutWorksheetAddChart', function() {
it('should call cellsChartsPutWorksheetAddChart successfully', function() {
const cellsApi = new api.CellsApi(process.env.CellsCloudTestClientId, process.env.CellsCloudTestClientSecret,"v3.0",process.env.CellsCloudTestApiBaseUrl);
const filename = "myDocument.xlsx";
var data =fs.createReadStream(localPath + filename);
var req = new model.UploadFileRequest();
req.path = "Temp/" + filename;
req.file = data;
return cellsApi.uploadFile(req)
.then((result) => {
expect(result.body.uploaded.length).greaterThan(0);
var req = new model.CellsCharts_PutWorksheetAddChartRequest();
req.name = filename;
req.sheetName = "Sheet4";
req.chartType = "Pie";
req.upperLeftRow = 5;
req.upperLeftColumn = 5;
req.lowerRightRow = 10;
req.lowerRightColumn = 10;
req.area = "C7:D11";
req.isVertical = true;
req.isAutoGetSerialName = null;
req.folder = "Temp";
return cellsApi.cellsChartsPutWorksheetAddChart(req)
.then((result) => {
expect(result.body.code).to.equal(200);
expect(result.response.statusCode).to.equal(200);
});
});
});
});
Objective C
Perl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-perl/
use strict;
use warnings;
use utf8;
use File::Slurp;
use MIME::Base64;
use AsposeCellsCloud::CellsApi;
my $config = AsposeCellsCloud::Configuration->new( client_id => $ENV{'ProductClientId'}, client_secret => $ENV{'ProductClientSecret'});
my $instance = AsposeCellsCloud::CellsApi->new(AsposeCellsCloud::ApiClient->new( $config));
my $remoteFolder = 'TestData/In';
my $remoteName = 'Book1.xlsx';
my $request = AsposeCellsCloud::Request::PutWorksheetAddChartRequest->new();
$request->{name} = $remoteName;
$request->{sheet_name} = 'Sheet4';
$request->{chart_type} = 'Pie';
$request->{upper_left_row} = 5;
$request->{upper_left_column} = 5;
$request->{lower_right_row} = 10;
$request->{lower_right_column} = 10;
$request->{area} = 'C7:D11';
$request->{is_vertical} = 'true';
$request->{title} = 'Aspose Chart';
$request->{folder} = $remoteFolder;
$request->{storage_name} = '';
my $result = $api->put_worksheet_add_chart(request=> $request);
Android
Go