This is a migrated thread and some comments may be shown as answers.

RadChart ChartTitle set font size?

7 Answers 593 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Tim R
Top achievements
Rank 1
Tim R asked on 16 Mar 2009, 06:25 PM

Using version 2.0.2.0 of the Rad Ajax Chart. 
I cannot figure out how to change the font size for the title of a chart created via the API.
The title is being truncated (it looks like part of a left parenthesis followed by "Enrollmen" and then a few extra pixels of something).
AutoTextWrap is True. 

I'd expect to find the font-size property somewhere in the Appearance.TextProperties hierarchy, but don't see it.

 

 

Dim CTitle As New Telerik.Charting.ChartTitle

  

With CTitle.TextBlock

 

 

    .Text =

"Enrollment Blah Blah"

 

 

 

 

   .Appearance.AutoTextWrap = Telerik.Charting.Styles.AutoTextWrap.True

 

 

    .Appearance.TextProperties.Color = System.Drawing.Color.Maroon

 

End With

 

 

 

 

RadChart1.ChartTitle.Add(CTitle)

 

 

 

 

 

 

 

 

 

 

7 Answers, 1 is accepted

Sort by
0
Dessy
Telerik team
answered on 17 Mar 2009, 08:30 AM
Hi Tim Romano,

In order to change the font-size of the Chart Title you can use CharTitle element
(Text Block->Appearance->TextProperties->Font) from the property grid.
Here is an example:

<ChartTitle> 
     
   <TextBlock Text=" Chart">  
                      
            <Appearance TextProperties-Font="Verdana, 10pt">  
                      
            </Appearance> 
 
   </TextBlock> 
 
</ChartTitle> 

I hope this information helps. I will be glad to assist you further

Regards,
Dessy
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tim R
Top achievements
Rank 1
answered on 17 Mar 2009, 02:33 PM
Does the API support the following approaches? (I'm not on-site to test it).  Or must the font-name be specified (i.e. not font-family and not the CSS "inherit" directive) and does the size have to be specified in pt units?

ChartTitle.Appearance.TextProperties.Font = "medium"

ChartTitle.Appearance.TextProperties.Font = "sans-serif, small"

ChartTitle.Appearance.TextProperties.Font = "inherit, small"


Thanks
0
Dessy
Telerik team
answered on 18 Mar 2009, 05:00 PM
Hello Tim Romano,

RadChart is just an image, rendered on the server, so CSS-like approach will not be applicable as there is no actual text in the browser. You will need to supply the desired font using a System.Drawing.Font object. Here is an example:
 
        RadChart1.ChartTitle.TextBlock.Appearance.TextProperties.Font = New System.Drawing.Font(FontFamily.GenericSansSerif, 26) 


Regards,
Dessy
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Mohammed
Top achievements
Rank 1
answered on 14 Feb 2011, 12:32 PM
I'm facing the same problem, I have tried every single line of code, it is not working. The font remains" Verdana, 15Pt"

any help please.
0
Evgenia
Telerik team
answered on 17 Feb 2011, 10:48 AM
Hi Mohammed,

To be able to change the Font Style and Size of the RadChart's Title you can set it by using the Properties window of the Visual Studio or manually in the markup:
<ChartTitle>
            <TextBlock>
                <Appearance TextProperties-Font="Monotype Corsiva, 18pt, style=Italic">
                </Appearance>
            </TextBlock>
        </ChartTitle>

Regards,
Evgenia
the Telerik team
0
Abhishek
Top achievements
Rank 1
answered on 18 Oct 2011, 04:11 PM
Hi,
Can you please provide a tested sample of code to change the Font size of the chart title from code behind.
 I have tested all the solutions provided above but nothing is working.


Thanks in advance
Abhi 
0
Evgenia
Telerik team
answered on 21 Oct 2011, 12:34 PM
Hello Abhishek,

Just add these code lines in your Page_Load body:
MilestoneChart.ChartTitle.TextBlock.Text = "My Chart Title";
MilestoneChart.ChartTitle.TextBlock.Appearance.TextProperties.Font = new Font(new FontFamily("Monotype Corsiva"),18f, FontStyle.Italic);

Kind regards,
Evgenia
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Chart (Obsolete)
Asked by
Tim R
Top achievements
Rank 1
Answers by
Dessy
Telerik team
Tim R
Top achievements
Rank 1
Mohammed
Top achievements
Rank 1
Evgenia
Telerik team
Abhishek
Top achievements
Rank 1
Share this question
or