Free Support Forum - aspose.com

Font size of chart title and legend

Hello,

Can you provide an example of how to set the font size for a charts title and legend?

Thanks

Hi Stephen,


I regret to share that the requested features are currently unavailable in Aspose.Slides for .NET. An issue with ID SLIDESNET-33470 has been created in our issue tracking system as new feature request to provide this feature. A separate issue with ID SLIDESNET-33425 has already been created in our issue tracking system to provide the font related properties for charts Legends. We will share the information with you as soon as the feature will be available.

Many Thanks,

Also,

When i add a Clustered Column chart with only one data series i get a chart title with the series name, setting HasTitle to false or trying to set the text of the title has no effect on it.

Hi Stephen,


I would really appreciate you to please try with our latest available version of Aspose.Slides for .NET 6.3.0 and if there is still an issue then please share the sample project along with generated output to reproduce the same issue on our end.

Many Thanks,

Need this too (Font size of chart title and legend) , will it be released on the next version?

Hi Stephen,


I like to share that issues SLIDESNET-33470 and SLIDESNET-33425 have added to provide the font related properties for Chart Legends and Chart Title. This includes setting font size as well. We will share the information with you as soon as it will be resolved.

Many Thanks,

Hi Mudassir,

Can you please confirm if these changes have been implemented or not.

Thanks!!

Hi Stephen,


I have verified from our issue tracking system and regret to share that the issue shared has not yet been resolved. I have raised the priority of the issue and have requested our development team to schedule the issue for investigation and resolution. I will share the further updates with you as soon they will be shred by our development team.

Many Thanks,

Hi Mudassir,

Can you please confirm if these changes have been implemented now or not.

Thanks!!

Hi Stephen,


Please use the following code example for managing the font related properties for charts legends. Please also note that you can only change the legend font related properties only and cannot change the legend text.

PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];
ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.LineWithMarkers, 140, 118, 320, 370);

//Hiding chart Title
chart.HasTitle = false;

///Hiding Values axis
chart.ValueAxis.IsVisible = false;

//Category Axis visibility
chart.CategoryAxis.IsVisible = false;


for (int i = 0; i < chart.ChartData.Series.Count; i++)
{
chart.ChartData.Series.RemoveAt(i);
}

ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;
ChartSeriesEx series = chart.ChartData.Series[0];
fact.GetCell(0, 0, 1, “New_Series1”);
series.Values[0].Value = 1.7;
series.Values[1].Value = 1.7;
series.Values[2].Value = 1.9;
series.Values[3].Value = 1.6;

series.MarkerSymbol = MarkerStyleTypeEx.Circle;
series.Labels.ShowValue = true;
series.Labels.Position = LegendDataLabelPositionEx.Top;
series.MarkerSize = 15;
series.Format.Line.DashStyle = LineDashStyleEx.Dot;

//Setting series line color
//series.Format.Fill.FillType = FillTypeEx.Solid;
series.Format.Line.FillFormat.FillType = FillTypeEx.Solid;
series.Format.Line.FillFormat.SolidFillColor.Color = System.Drawing.Color.Purple;
series.Format.Line.DashStyle = LineDashStyleEx.Solid;

//Setting series marker color and symbol
series.MarkerSymbol = MarkerStyleTypeEx.Diamond;


//Settinng Label color and font
DataLabelEx val = new DataLabelEx(series);
val.TextFrame.Text = “Asd”;
series.Labels.Add(val);
TextFrameEx txt = series.Labels[0].TextFrame;
ParagraphEx para = txt.Paragraphs[0];
PortionEx por = para.Portions[0];
por.PortionFormat.FontHeight = 30;
por.PortionFormat.FillFormat.FillType = FillTypeEx.Solid;
por.PortionFormat.FillFormat.SolidFillColor.Color = System.Drawing.Color.Blue;

chart.Legend.Format.Fill.FillType = FillTypeEx.Solid;
chart.Legend.Format.Fill.SolidFillColor.Color = Color.Green;


TextFrameEx txt2 = chart.Legend.TextProperties;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 30;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;

pres.Write(“D:\Aspose Data\Presentation2.pptx”);


Many Thanks,

Hi Stephen,


I like to share that the issue of setting font related properties for chart title has been resolved. You may please try using the following sample code with latest available Aspose.Slides for .NET 7.1.0. Please share if I may help you further in this regard.

PresentationEx pres2 = new PresentationEx();
ChartEx chart2 = pres2.Slides[0].Shapes.AddChart(ChartTypeEx.StackedColumn, 100, 100, 500, 400);
chart2.HasTitle = true;
chart2.ChartTitle.Text.Text = “My New Title”;
chart2.ChartTitle.Text.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid;
chart2.ChartTitle.Text.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Green;
chart2.ChartTitle.Text.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;
pres2.Write(path + “out.pptx”);

Many Thanks,