Font Size for Chart Title and Legend

Hi,

Can we set different font and font size for Chart Title and Legend. Please help with this issue.

Regards,

Hi Sanjay,

Thanks for your interest in Aspose.Slides.

I have observed the requirement shared and like to share that you can set the font related properties for the requested chart entities. Please visit this documentation link for your further kind reference in this regard to see how to format chart.

Many Thanks,

Hi,

Thanks for reply. I am able to set font and their size foe other than legend and title. Because in the given example I am not able to find, ho to set the font size of legends and title of chart. Please help

Regards

Hi Sanjay,

I have observed your comments and have not been able to completely understand the requirements. However, I like to share that in the mentioned documentation link, please look for following lines. You can see that the font and its height is being set for Chart title and legend in below sample code.

//Setting Chart Titile
chart.HasTitle = true;
chart.ChartTitle.AddTextFrameForOverriding("");
IPortion chartTitle = chart.ChartTitle.TextFrameForOverriding.Paragraphs[0].Portions[0];
chartTitle.PortionFormat.LatinFont = new FontData(“Arial”);
chartTitle.Text = “Sample Chart”;
chartTitle.PortionFormat.FillFormat.FillType = FillType.Solid;
chartTitle.PortionFormat.FillFormat.SolidFillColor.Color = Color.Gray;
chartTitle.PortionFormat.FontHeight = 20;
chartTitle.PortionFormat.FontBold = NullableBool.True;
chartTitle.PortionFormat.FontItalic = NullableBool.True;

//Setting Legends Text Properties
IChartPortionFormat txtleg = chart.Legend.TextFormat.PortionFormat;
txtleg.LatinFont = new FontData(“Times New Roman”);
txtleg.FontBold = NullableBool.True;
txtleg.FontHeight = 16;
txtleg.FontItalic = NullableBool.True;
txtleg.FillFormat.FillType = FillType.Solid; ;
txtleg.FillFormat.SolidFillColor.Color = Color.DarkRed;


I hope this will be helpful. Please share, if I may help you further in this regard.

Many Thanks,

Thanks Mudassir,

Now Its working

Thanks Again