Free Support Forum - aspose.com

How can i change the chart title font style- color

how can i have differant font for chart title and axis title. i have use the below code but it is apply to both. i want both differ

_chart.ChartArea.TextFont.Color = Color.Black;

_chart.ChartArea.TextFont.Name = "Lucida Sans";

_chart.ChartArea.TextFont.Size = 8;

Hi,

Please see the following sample code for your reference:

e.g
1)
//Set properties of chart title
chart.Title.Text = “This is my Title of Chart”;
chart.Title.TextFont.Color = Color.Blue;
chart.Title.TextFont.IsBold = true;
chart.Title.TextFont.Size = 18;
chart.Title.TextFont.Name = “Calibri”;

2)
//Set properties of valueaxis title
chart.ValueAxis.Title.Text = “In Thousands”;
chart.ValueAxis.Title.TextFont.Name = “Arial”;
chart.ValueAxis.Title.TextFont.Color = Color.Black;
chart.ValueAxis.Title.TextFont.IsBold = true;
chart.ValueAxis.Title.TextFont.Size = 10;
chart.ValueAxis.Title.Rotation = 90;

3)
//Set properties of Axis(categoryaxis) title
Axis categoryAxis = chart.CategoryAxis;
categoryAxis.Title.TextFont.Color = Color.Red;
categoryAxis.Title.TextFont.Size = 8;
categoryAxis.Title.TextFont.Name = “Calibri”;

Thank you.

i did not wrote the below line but chart title is displayed and not taking the style which i had appliyed

chart.Title.Text = "This is my Title of Chart";

Hi,

That is strange, kindly paste the complete sample code here and attach the template file to show/reproduce the issue, we will check it soon.

Thank you.

just remove the below line from your code.

chart.Title.Text = "This is my Title of Chart";

you find chart.Title.Text = null. and it will still show text like "chart title" with default formatting

Hi,

Well, using the lines of the below code:
//Set properties of chart title
chart.Title.TextFont.Color = Color.Blue;
chart.Title.TextFont.IsBold = true;
chart.Title.TextFont.Size = 18;
chart.Title.TextFont.Name = “Calibri”;

The formatting including font attributes and color are applied but we can see the default title “Chart Title” appeared automatically. We have logged it into our issue tracking system with an issue id: CELLSNET-15019. We will look into it soon.

If you don’t want to show the title, I think you may set the line explicitly:
chart.Title.Text = null;

Thank you.