I would like to add a sub title to a chart with different font styles than the title. Is this possible? I did some research on SVG foreignObject and tspan tags but had no luck getting those to work.
2 Answers, 1 is accepted
0
Iliana Dyankova
Telerik team
answered on 07 May 2012, 04:09 PM
Hello Juan,
I am afraid such functionality is not supported in Kendo UI DataViz. Currently our developers are working on most popular feature requests, but we keep in mind the implementation of similar functionality for future releases.
Kind regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
I've needed to do something similar though in my case I needed a subtitle that was centered under my title. Something I found to work was leveraging the SVG's tspan (see last line of code). Elsewhere in my code I set the chart's title text property to the ChartTitle variable. You could do something similar but instead of trying to center the text like I have you could simply set the appropriate SVG font properties inside of the second tspan which is the subtitle's tspan. For example you could use font-style="italic" as I have below or you could set font-size, font-weight, font-family, etc...
var title = 'some title';
var subTitle = 'some subtitle';
var widthOfCharacter = 8; //Approximate average width give the font size, etc.. that we picked
var titleDXposition = title.length * widthOfCharacter * -1;
var subtitleDXposition = (subTitle.length - title.length)/2 * widthOfCharacter * -1;
subtitleDXposition = subtitleDXposition + titleDXposition;