Get Chart Legend from a Worksheet

The Get Chart Legend operation returns the legend information of a chart that resides in a worksheet of an Excel workbook. This endpoint is part of Aspose.Cells Cloud API v3.0 and can be used when you need to read legend properties such as position, font, size, and formatting.

REST API

GET https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/charts/{chartIndex}/legend

Request parameters

Parameter Name Type Location Description
name string path Name of the workbook file.
sheetName string path Name of the worksheet.
chartIndex integer path Zero‑based index of the chart.
folder string query Folder path where the workbook is stored.
storageName string query Name of the storage.

The OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.

You can use the cURL command‑line tool to access Aspose.Cells web services easily. The following example shows how to call the Cloud API with cURL.

Response fields reference

Field Type Description
Legend.Position string Position of the legend (e.g., Right, Top).
Legend.AutoScaleFont bool Indicates whether the legend font is auto‑scaled.
Legend.Font.Name string Font family name used for the legend text.
Legend.Font.Size number Font size (points).
Legend.Font.Color object RGBA color object for the legend text.
Legend.Border object Border properties (color, style, weight, etc.).
Legend.Width / Height number Physical size of the legend area (pixels).
Legend.X / Y number Top‑left coordinates of the legend within the chart.
Legend.Area object Background fill and formatting details.
Code int Operation result code (0 = success).
Status string Operation status message.

Possible error responses

HTTP Status Reason Example error JSON
400 Bad request – missing/invalid parameters. {"Error": {"Code": "InvalidParameter", "Message": "Parameter 'name' is required."}}
401 Unauthorized – invalid or expired JWT token. {"Error": {"Code": "Unauthorized", "Message": "Access token is missing or invalid."}}
404 Not found – workbook, worksheet, or chart does not exist. {"Error": {"Code": "ResourceNotFound", "Message": "Chart with index 0 not found."}}
500 Internal server error. {"Error": {"Code": "ServerError", "Message": "An unexpected error occurred."}}

Cloud SDK Family

Using an SDK is the best way to speed up development. An SDK takes care of low‑level details and lets you focus on your project tasks. Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.

The following code examples demonstrate how to call Aspose.Cells web services using various SDKs: