We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Modifying chart legend

Hi:

In the code below, I implement your example of how to modify the position of the legend in a chart, but it doesn't work.

Hope you can figure out what's happening.

Thanks beforehand.

Sincerelly,

Alejandro Romero

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I checked you sample code and it works fine and the legend position is set at the bottom. Please find my attached generated excel file for reference. If you have any other issue at your end, please provide further details and share your generated excel file to show the issue. We will check it soon.

Thank You & Best Regards,

Hi:

I attached the generated XL file with the code sended before and I (manually) put the chart I was expecting ("Sheet1" - Q1).

Hope this helps you figure out the "problem".

Alejandro Romero

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the Excel file.

Your issue has been added to our internal issue tracking system with issue id CELLSNET-16354. We will further investigate your issue and get back to you soon.

Thank You & Best Regards,

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We are still working on legend's default position and size. You have to specify the legend's position and size yourself at the moment.

Please consult the following code:

aChart.IsLegendShown = true;

Legend legend = aChart.Legend;

// Set legend.Position before setting legend.X etc.

legend.Position = LegendPositionType.Bottom;

legend.X = 0;

legend.Y = (int)(4000 - 75 * 4000f / aChart.ChartObject.Height);

legend.Width = 200;//in unit of Pt

legend.Height = 75;//in unit of Pt

It will place the legend as per your requirement.

Thank You & Best Regards,

Thank you very much for the code.

Works fine.

Alejandro Romero

Hi, ┬┐any news about this?

When Width grows, the position of the legend goes from manual to automatic and it doesn't respect the X value.

Thanks beforehand.

Alejandro Romero

Hi,

Could you share us a sample project to show the issue you have mentioned?
We will check it soon.

Thank you.