Free Support Forum - aspose.com

Chart Plot Area size when adding vertical legends

Dear,


I am creating a pptx presentation using aspose.slide version 7.1 that contains a column chart. I am setting the value axes text to vertical 270 alignment. By doing so i can observe a certain padding to the right of the plotting area, please find attached “chart padding.png” screenshot.

When manually editing the Vertical Axis and setting the text layout alignment to “Rotate all text 270” the left padding disappears. Please find attached “chart padding fixed.png” screenshot.

Bellow is the code I am using:
{
SlideEx sld = pres.Slides[0];

Aspose.Slides.Pptx.ChartEx chart = sld.Shapes.AddChart(ChartTypeEx.ClusteredColumn, 100, 100, 400, 400);

chart.ChartTitle.Text.Text = “Sample Title”;
chart.ChartTitle.Text.CenterText = true;
chart.ChartTitle.Height = 20;
chart.HasTitle = false;
chart.HasLegend = false;

chart.ValueAxis.IsVisible = false;
chart.ValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;

chart.CategoryAxis.MajorGridLines.Style = LineStyleEx.ThickBetweenThin;

ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();

chart.ChartData.Categories.Add(fact.GetCell(0, 1, 0, “01-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 2, 0, “02-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 3, 0, “03-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 4, 0, “04-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 5, 0, “05-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 6, 0, “06-02-2013”));

int Id = chart.ChartData.Series.Add(fact.GetCell(0, 0, 1, “Series 1”), chart.Type);

ChartSeriesEx series = chart.ChartData.Series[Id];

series.Labels.ShowLeaderLines = true;
int defaultWorksheetIndex = 0;

series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 4, 1, 40));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 5, 1, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 6, 1, 50));

TextFrameEx tf = chart.ValueAxis.TextProperties;
tf = chart.CategoryAxis.TextProperties;
tf.TextVerticalType = TextVerticalTypeEx.Vertical270;
}

Could you please share with me a code that allows me to set the value axes layout to “Vertical 270” without causing the Plot Area right padding.

Thank you in advance,
Sami Simon

Hi Sami Simon,


Thanks for sharing the detailed analysis of the issue as it helps in investigating the issue quickly. I have been able to observe and verify the issue shared by you. An issue with ID SLIDESNET-33997 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

Dear,


Any news regarding the above request? Could you please provide me with a time estimate on when this issue will be fixed.

Thank you in advance,
Sami Simon

Hi Sami Simon,


I have observed the issue status from our issue tracking system and regret to share that the concerned issues is still unresolved. However, I have requested our development team to kindly schedule the issue for investigation and resolution. I will share the feedback with you as soon as the issue will be resolved. I also like to share that we have released Aspose.Slides for .NET 7.3.0 in which some of your issues have also been addressed.

Many Thanks,

Hi Sami Simon,


The issue shared has been resolved in Aspose.Slides for .NET 7.4.0. Please use the following sample code to serve the purpose. Please share, if I may help you further in this regard.

PresentationEx pres = new PresentationEx();
{
{
SlideEx sld = pres.Slides[0];

Aspose.Slides.Pptx.ChartEx chart = sld.Shapes.AddChart(ChartTypeEx.ClusteredColumn, 100, 100, 400, 400);

chart.ChartTitle.Text.Text = “Sample Title”;
chart.ChartTitle.Text.CenterText = true;
chart.ChartTitle.Height = 20;

chart.ValueAxis.IsVisible = false;
chart.ValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;

chart.CategoryAxis.MajorGridLines.Style = LineStyleEx.ThickBetweenThin;

ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();

chart.ChartData.Categories.Add(fact.GetCell(0, 1, 0, “01-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 2, 0, “02-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 3, 0, “03-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 4, 0, “04-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 5, 0, “05-02-2013”));
chart.ChartData.Categories.Add(fact.GetCell(0, 6, 0, “06-02-2013”));

int Id = chart.ChartData.Series.Add(fact.GetCell(0, 0, 1, “Series 1”), chart.Type);

ChartSeriesEx series = chart.ChartData.Series[Id];

series.Labels.ShowLeaderLines = true;
int defaultWorksheetIndex = 0;

series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 4, 1, 40));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 5, 1, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 6, 1, 50));

chart.CategoryAxis.RotationAngle = 270;

chart.HasLegend = false;
}

}

pres.Write(@“RotateChartValueAxis.pptx”);

Many Thanks,

The issues you have found earlier (filed as SLIDESNET-33997) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Dear,


I tried the same code shared in my previous message using ASPose.dll v. 7.4 and regret to share that the error has not been solved yet. I’m still getting the same chart in “chart padding.png” screenshot attached in my previous message.

Could you please share a code with me that could fix this error.

Thank you in advance,
Sami Simon

Hi Sami Simon,


I have worked over the scenario shared using the sample code shared in my previous post. I have not been able to observe the issue. I have attached the generated presentation and snapshot for reference.

Many Thanks,