Read XSSFPivotTable to chart

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Read XSSFPivotTable to chart

Jonathan Ortiz
Hi,

I have created a Excel Pivot Table XSSFPivotTable:

                        //Configure the pivot table
                        String area="A1:I"+last_row;
                        AreaReference ar = new AreaReference(area);
                        CellReference cr = new CellReference("A1");
                        XSSFPivotTable pivotTable =
pivot_sheet.createPivotTable(ar,cr,my_sheet);
                        //Use first column as row label
                        pivotTable.addRowLabel(0);
                        addColLabel(pivotTable,8);

pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 7);

And works fine but the next step will be create a Chart from PivotTable but
i don´t find any documentation as i can read cell values from
XSSFPivotTable to create a Chart.

Thanks in advance
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Read XSSFPivotTable to chart

Greg Woolsey
There is currently no api for creating charts.  As someone working with
reading charts with POI, I can say it will be a major undertaking to create
from scratch.  You might find it easier to start with a template workbook
with a chart defined in Open Office or Excel, and then just edit the data
with POI and save new copies. That has worked for me in the past when I
needed to create files with features not yet supported by POI.

I haven't heard anyone volunteer to write a chart creation api, so POI
won't support that any time soon.

On Fri, Jun 2, 2017, 02:52 Jonathan Ortiz <[hidden email]>
wrote:

> Hi,
>
> I have created a Excel Pivot Table XSSFPivotTable:
>
>                         //Configure the pivot table
>                         String area="A1:I"+last_row;
>                         AreaReference ar = new AreaReference(area);
>                         CellReference cr = new CellReference("A1");
>                         XSSFPivotTable pivotTable =
> pivot_sheet.createPivotTable(ar,cr,my_sheet);
>                         //Use first column as row label
>                         pivotTable.addRowLabel(0);
>                         addColLabel(pivotTable,8);
>
> pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 7);
>
> And works fine but the next step will be create a Chart from PivotTable but
> i don´t find any documentation as i can read cell values from
> XSSFPivotTable to create a Chart.
>
> Thanks in advance
>
Loading...