Hello,

I am trying to adjust the size of a chart in Excel with Aspose. Basically the size of the container chart is created base on my Excel file, so the ChartArea has the right dimension.

So I would like to ajust the size of the chart (PlotArea) to have exactly the same size as the container (ChartArea). And I am facing several problems.

First the dimension of the ChartArea seems not available (chart.ChartArea.Width = 0, even after havinf call the method chart.Calculate()).

Second, when I set:

chart.PlotArea.X = 0;

chart.PlotArea.Y = 0;

There is always a very small shift between the ChartArea and the PlotArea (

Third, can you confirm that the unit of Width and Heigth of ChartFrame are point, and not 1/4000 of the chart area (like for properties X and Y)

See documentation:`http://www.aspose.com/doctest/.net-components/aspose.cells-for-.net/aspose.cells.charts.chartframe.x.html`

`http://www.aspose.com/doctest/.net-components/aspose.cells-for-.net/aspose.cells.charts.chartframe.width.html`

And finally, can you confirm that properties X and Y of ChartFrame are exactly 1/4000 (not approximatly)?

Thanks a lot,

Alexandre

Aspose version: 7.0.3

.NET version: 3.5

Hi,

Hi,

Thanks for this quick response.

I attached 3 files. One sample of code, the result generated and the result expected.

Basically I generate two charts to show what I am talking about.

The first chart is created by the command:*sheet.Charts.Add(Aspose.Cells.Charts.ChartType.BarStacked, 2, 0, 20, 7);*

The second is created by the command:*chartIndex = sheet.Charts.Add(Aspose.Cells.Charts.ChartType.BarStacked, 21, 0, 39, 10);*

So the second chart is larger than the first one.

And then the configuration of the chart is simply: * chart.PlotArea.X = 0; chart.PlotArea.Y = 0; chart.PlotArea.Width = 3000;*

You will notice, comparing both of my Excel file, that in the “result expected”, there is no margin between the PlotArea and the ChartArea.

Second, if the width’s unit is point, how do you explain that the size of the 2 charts are differents ?

It rather seems to be proportionnal to the size of the ChartArea.

Regards,

Alexandre

Hi,

Hi,

Any news about the problem of resize? Also, as far as I make some test, I still really have the feeling that the width and height of the ChartFrame are in 1/4000 of the whole chart.

In all my test :

4000 < X + Width < 4020

4000 < Y + Height < 4020

Best,

Alexandre

Hi,

Hi,

I actually opened another post for the specific problem of width and height since I believe this is a different issue. Feel free to close one of them if you think it is inappropriate.

<A href="https://forum.aspose.com/t/120422</A></P> <P> </P> <P>Regards,</P> <P> </P>

Hi,

The chart area is big enough as 4000 units for 2003 Excel. The value is dynamic, we need to calculate by the chart size. We created a test based on your codes. Please check the attached archive. Hope, it will help you to understand for your needs.

Thank you.

Hi,

Thanks. It helps a lot. I still have some issues but I cannot reproduce them on a test program.

There are some strange things even in your test code. For exemple, even in your output, the chart touch the top of the graph, but not the bottom. Also, for some reason, there are some small adjustment to perform when you hide the ValueAxis.

It still confirm that the width and height unit are 1/4000 of the chart area, and I also discovered the ChartObject that return the real dimension of the graph. Very useful.

I will get back to you if I face any other problem.

Thanks a lot.

Hi,

Thanks for your feedback.

I have logged your comment in our database. We will look into it further and then update you asap.

Hi,

Thanks for your feedback. I think I will try to place my charts correctly by overlapping them.

Rgds,