Charts in apose using java

Hi team,
I want to create pivot table with charts .
but api of the below api is not clear .
Parameters:
.addFieldToArea
fieldType - A PivotFieldType value. The fields area type.
baseFieldIndex - The field index in the base fields.
Can you please explain?

Thanks,
Nidhi

@Nidhi.chawhan

Thanks for considering Aspose APIs.

Please see this article and its section for your help. It should help you resolve your issue. Let us know if you encounter any problem. We will help you asap.

Please see these sections in the given article.

  • Creating a Pivot Table
  • Creating a Pivot Chart based on the Pivot Table

@Nidhi.chawhan

Please create your desired pivot table and pivot chart manually using Microsoft Excel and provide it to us. We will create a replica of it using Aspose.Cells APIs and then provide you a sample code which you could use and modify as per your needs.

Hi Team,
I dont need pivot table . i need only charts .if it is possible i will provide you excel sheet with my table and required charts.

Thank you for your support.

Nidhi

@Nidhi.chawhan

Sure, your Excel file created by you manually using Microsoft Excel will help us devise the sample code needed by you.

Thank you for the quick response.
I am able to create the pivot tables and charts using API.
Is there a way to to hide the pivot table ?

Is it possible to have chart type as vertical bar chart and horizontal bar chart?
I dont see above chart type in the API.

Looking foward for your response.
Nidhi

@Nidhi.chawhan

Thanks for sharing the good news with us.

Download Links:
sc1.png (51.3 KB)
sc2.png (47.5 KB)

Do you want to delete pivot table? Or do you want to hide pivot table fields as shown in this screenshot?

I think, you are talking about Column Chart and Bar Chart as shown in this screenshot.

Please clarify your issues with some screenshots or Excel files so that we could help you precisely.

Hi Team,
Thank you for the quick response.
Can you please tell me how i can hide whole pivot table as attached in the file
Aspose.png (6.4 KB)

Nidhi

@Nidhi.chawhan

Please let us know (mention all the steps) how do you hide pivot table in Microsoft Excel?

@Nidhi.chawhan

Thanks for using Aspose APIs.

You can hide the pivot table by hiding the rows of the worksheet.

Please see the following sample code, its sample Excel file containing the pivot table and its output Excel file. If you open the output Excel file, you will see Pivot Table is hidden.

Download Links:
sample and output Excel files.zip (16.5 KB)

C#

//Load sample Excel file
Workbook wb = new Workbook("samplePivot.xlsx");

//Access first worksheet
Worksheet ws = wb.Worksheets[0];

//Access the pivot table
PivotTable pt = ws.PivotTables[0];

//Hide the pivot table
CellArea range = pt.TableRange2;
ws.Cells.HideRows(range.StartRow, range.EndRow - range.StartRow + 1);

//Save the output Excel file
wb.Save("outputPivot.xlsx");