Hi Aspose-Community, I need some help here.
I want to place a textbox centered in the hole of a doughnut-chart. We generate Charts in different sizes and sometimes the title of the chart has multiple lines. Therefore I cannot set the position hardcoded, instead I need to get the position from the chart itself.
For better visualization I made an example with colored squares (100x100 and 50x50 pixels), for better visibility of the center I set the doughnut-hole-size to 0. In the final form the hole should be size 40.
The idea to get the position is the following (see screenshot HowItShouldBe.png):
- Get the topleft corner of the plotArea (position of the green rectangle)
- Add half of the width and half of the height of the plotArea (position of the red rectangle)
- Subtract half of the width and half of the height of the Textbox(/Image) that needs to be placed (position of the black rectangle)
I would expect, that chart.PlotArea.X and chart.PlotArea.Y give me the coordinates for the green rectangle from the previous screenshot.
I tried some positions (see screenshot HowItIs.png):
- chart.ChartArea.X and chart.ChartArea.Y -> blue 100x100 rectangle
- chart.PlotArea.X and chart. PlotArea.Y -> pink rectangle
- chart.ChartObject.X and chart. ChartObject.Y -> turquoise rectangle
- chart.ChartObject.Left and chart. ChartObject.Top -> yellow rectangle
- chart.ChartObject.UpperDeltaX and chart. ChartObject.UpperDeltaY -> blue 50x50 rectangle
None of these gives me the upper left corner of the plotArea. One also sees in the screenshot, that the blue 50x50 and the turquoise rectangle depend on the chartposition.
Could anyone help me to get the position I need with Aspose.cells?
Thank you for your help.