Set text size on charts second y axis

Hello,

Can you tell me if there is a way to set the font size on the second y axis of a chart created in Aspose.Slides?

I can set the primary y axis text size with this code:

ch.ValueAxis.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 10;

But this code results in an 'Object reference not set to instance of an object' error:

ch.SecondValueAxis.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 10;

I would also like to format the second axis to show percentage values, from another post on this forum i tried to use this piece of code but it had no effect, can you tell me what I should do instead?

ch.SecondValueAxis.NumberFormat = "0.0%";

Thanks,

Neil

Hi Niel,


Thanks for your interest in Aspose.Slides. Please use Aspose.Slides for .Net 7.2.0 on your end as I have not been able to reproduce the issue on my end. Please try using the specified version on your end.

public static void TestSecondChart()
{
PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];

ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.ClusteredColumn, 20, 20, 400, 400);
chart.SecondValueAxis.IsVisible = true;
chart.ChartData.Series[0].PlotOnSecondAxis = true;
TextFrameEx tx = chart.SecondValueAxis.TextProperties;

chart.SecondValueAxis.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 10;
// Save presentation with chart
pres.Write(@“D:\Aspose Data\AsposeChart.pptx”);
}

Many Thanks,