Add title to axis

Hi,

Is there an option to add title to chart ValueAxis (and SecondValueAxis too) ?
I see there are properties to support it but id doesn't work:
ch.ValueAxis.Title
ch.ValueAxis.HasTitle

Attached please find chart example that was created in Excel

Regards,
Moshe

Hi Moshe,


Please use the following code snippet for your convenience. Please share if I may help you further in this regard.

public static void MangeChartProperties()
{
PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];
ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.ClusteredColumn, 50, 50, 500, 400);

chart.ValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.Solid;
chart.ValueAxis.MajorGridLines.FillFormat.SolidFillColor.Color = Color.Blue;
chart.ValueAxis.MajorGridLines.Width = 5;

chart.ValueAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.Solid;
chart.ValueAxis.MinorGridLines.FillFormat.SolidFillColor.Color = Color.Red;
chart.ValueAxis.MinorGridLines.Width = 5;

chart.CategoryAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.Solid;
chart.CategoryAxis.MajorGridLines.FillFormat.SolidFillColor.Color = Color.Green;
chart.CategoryAxis.MajorGridLines.Width = 3;

chart.CategoryAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.Solid;
chart.CategoryAxis.MinorGridLines.FillFormat.SolidFillColor.Color = Color.Yellow;
chart.CategoryAxis.MinorGridLines.Width = 3;



TextFrameEx txt = chart.CategoryAxis.TextProperties;

txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;
txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;
txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;
txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;
txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;

TextFrameEx txt2 = chart.ValueAxis.TextProperties;

txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;
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;


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

//Setting Axis Title
TextFrameEx title=chart.ValueAxis.Title.Text;
ParagraphEx text = new ParagraphEx();
text.Text=“Mudassir Fayyaz”;
text.Portions[0].PortionFormat.FontHeight = 20;
text.Portions[0].PortionFormat.FillFormat.FillType=FillTypeEx.Solid;
text.Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Green;
title.Paragraphs.Add(text);
chart.ValueAxis.HasTitle = true;

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

}

Many Thanks,