You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2020/03/22 16:19:55 UTC

[Bug 64256] New: Chart PIE

https://bz.apache.org/bugzilla/show_bug.cgi?id=64256

            Bug ID: 64256
           Summary: Chart PIE
           Product: POI
           Version: 4.1.x-dev
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: francesco.baldi1987@gmail.com
  Target Milestone: ---

Created attachment 37116
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37116&action=edit
image bugs and image google sheets

By opening an xlsx file generated with apache poi-ooxml 4.1.2, it enters
recovery mode by deleting the pie chart.
Instead on google sheets it works!!!!!

Bye
Francesco

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64256] Chart PIE

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64256

Alain Fagot Bearez <Al...@cua.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #2 from Alain Fagot Bearez <Al...@cua.li> ---
You can refer to the newly introduced example manipulating Doughnut chart:
src/examples/src/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java

Like the Doughnut chart, the Pie chart chart does not have category axis and
value axes. if you remove your lines:

                XDDFCategoryAxis bottomAxis =
chart.createCategoryAxis(excelChart.categoryAxis());
                XDDFValueAxis leftAxis =
chart.createValueAxis(excelChart.valueAxis());

your example should produce a file which will not be cleaned by PowerPoint upon
opening it.

I hope we can now close this issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64256] Chart PIE

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64256

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INFORMATIONPROVIDED
             Status|NEEDINFO                    |RESOLVED

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64256] Chart PIE

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64256

--- Comment #1 from Francesco Baldi <fr...@gmail.com> ---
this is the code implemented:


private Integer generateChart(XSSFSheet worksheet, String seriesChart, String
keyChart, ExcelChart excelChart, Integer indexRow, String xAxis) {
                // ExcelChart
                //
excelChart=sheetData.getClass().getAnnotation(ExcelChart.class)
                XSSFDrawing drawing = worksheet.createDrawingPatriarch();
                Integer startChart = indexRow;
                indexRow += excelChart.sizeRow();
                logger.debug("Start Chart: " + startChart);
                XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0,
startChart, excelChart.sizeColumn(), indexRow);

                XSSFChart chart = drawing.createChart(anchor);

                XDDFChartLegend legend = chart.getOrAddLegend();
                legend.setPosition(excelChart.legendPosition());
                XDDFCategoryAxis bottomAxis =
chart.createCategoryAxis(excelChart.categoryAxis());
                XDDFValueAxis leftAxis =
chart.createValueAxis(excelChart.valueAxis());
                logger.debug("-----------------xAxis: " + xAxis);
                XDDFDataSource<String> xs =
XDDFDataSourcesFactory.fromStringCellRange(worksheet,
CellRangeAddress.valueOf(xAxis));
                XDDFChartData chartData =
chart.createData(excelChart.chartTypes(), bottomAxis, leftAxis);
                XDDFChartData.Series series = null;
                logger.debug("------------seriesChart: " + seriesChart);
                series = chartData.addSeries(xs,
XDDFDataSourcesFactory.fromNumericCellRange(worksheet,
CellRangeAddress.valueOf(seriesChart)));
                series.setTitle(keyChart, null);
                series.setShowLeaderLines(true);

                chartData.setVaryColors(true);

                chart.plot(chartData);

                return indexRow;

        }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org