telerik-mvc

How to change the font size and color of a Telerik MVC Chart title?


Can it be done? I did a lot of research and couldn't find anything. Thanks


Solution

  • It seems that there isn't any settings for that in the Chart API, but what when I inspected Telerik ASP.NET MVC demo page I found out the text element that is used on the title.

    With some JavaScript you could change the title font size and color easily.

    DOM view of the Telerik Chart demo

    This is a jQuery example:

    $('#chart').find('text:nth(0)').css('font-size', '30px').css('text', 'red')
    

    First I'll get the chart control with id and then find the title which is the first text element. Then I'll place my own css styling.

    This isn't the optimal way to do this and it is basically a hack, but if nothing else cannot be done then this might be your solution.