Aspose.Cells REST APIs enrich your Cloud-based applications with spreadsheet processing features. The API comes with several SDKs that are distributed under an MIT license, so you can simply integrate the features in your applications. This utility lets you focus on what matters the most, while minor details being managed by the SDK itself.
REST API for Excel Processing
In the context of spreadsheet processing, charts are a very useful way to summarize information and present it in visual form. Therefore, let us explore the chart creation as well as chart rendering support in Aspose.Cells Cloud. Supported Chart types include Area, Bar, Bubble, Column, Cone, Pie, Line and many others. Let us add a Pie chart using Aspose.Cells for .NET SDK.
You need to specify several parameters in this code snippet to add the chart in a specific Worksheet of a Workbook, and other information including Chart Area, Chart Title, Category Data, and others. This code snippet adds a Pie chart in your template file, as shown in the screenshot below:
You can notice the values in the first column and the Pie chart added to the desired worksheet in your Cloud Storage. Chart title and other information are the same as the code snippet we have discussed above. Likewise, you can create other charts that can be different or complicated than this demonstration.
Convert Chart to Image in C#
A chart to image rendering is another useful feature of Aspose.Cells Cloud. Let us continue the example from the same workbook where we have added the chart in the above example. You can use the below .NET code snippet to convert a chart to an image. However, please keep in mind that the charts are zero-based index so the first chart in the worksheet is referred with zero. Following example elaborates on the feature and clarifies this point as well:
You can render a chart to PNG, JPEG, BMP, TIFF, and other image formats. However, the response of this API call will include an instance of System.IO.Stream class that will contain the image of the Chart. Since the images are visual objects, let us convert this stream to a File. Below is one of the possible approaches you can use for this purpose:
The high quality rendered image of the chart will look like the screenshot below:
Likewise, the API includes many other out of the box features for spreadsheets creation, manipulation, and conversion. You can further explore API references to learn more about Charts support and other features in Aspose.Cells Cloud. We host many SDKs at GitHub that include several examples for hands-on experience with the API. You can also refer to API documentation where we maintain the most basic and frequent use cases. In case of any concerns, please feel free to contact us for any help via Free Support Forum.
Related Post
Create, Edit or Convert Excel Files with Aspose.Cells Cloud API