RadChart ChartTitle set font size?

8 posts, 0 answers
  1. Tim Romano
    Tim Romano avatar
    121 posts
    Member since:
    Feb 2006

    Posted 16 Mar 2009 Link to this post

    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)

     

     

     

     

     

     

     

     

     

     

  2. Dessy
    Admin
    Dessy avatar
    73 posts
    Member since:
    Sep 2012

    Posted 17 Mar 2009 Link to this post

    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.

  3. Tim Romano
    Tim Romano avatar
    121 posts
    Member since:
    Feb 2006

    Posted 17 Mar 2009 Link to this post

    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

  4. Dessy
    Admin
    Dessy avatar
    73 posts
    Member since:
    Sep 2012

    Posted 18 Mar 2009 Link to this post

    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.

  5. Mohammed
    Mohammed avatar
    9 posts
    Member since:
    Jun 2009

    Posted 14 Feb 2011 Link to this post

    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.

  6. Evgenia
    Admin
    Evgenia avatar
    1292 posts
    Member since:
    Sep 2012

    Posted 17 Feb 2011 Link to this post

    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

  7. Abhishek
    Abhishek avatar
    2 posts
    Member since:
    Jul 2011

    Posted 18 Oct 2011 Link to this post

    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 

  8. Evgenia
    Admin
    Evgenia avatar
    1292 posts
    Member since:
    Sep 2012

    Posted 21 Oct 2011 Link to this post

    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

Back to Top