When creating a XSLFChart on a XSLFSlide, I can't seem to get the anchoring to work as intended.
I'm generate the chart as follows
XSLFSlide slide = ppt.createSlide();
XSLFChart chart = ppt.createChart(slide);
slide.addChart(chart, new Rectangle(200, 200, 200, 200));
// Further styling and data
But when I open the Powerpoint, the chart is scrunched up in the top left corner, as if it was anchored with a Rectangle at (0, 0) with a height and width of 0. Creating the chart with the other overload of the function (addChart(XSLFChart)) also creates it in the corner, but with some height and width.
The position of the
XSLFChartneeds to be set in measurement unit English Metric UnitsEMU, not in points as for other anchors ofXSLFSimpleShape. There is org.apache.poi.util.Units to convert between different other units (points also) andEMU.In your case: