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

Sub Title

2 Answers 259 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Sitefinity
Top achievements
Rank 1
Sitefinity asked on 04 May 2012, 05:19 PM
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

Sort by
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!
0
Daron
Top achievements
Rank 1
answered on 08 May 2012, 02:49 PM
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-sizefont-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;

                        var chartTitle = '<tspan dy="0em">' + title + '</tspan> <tspan dx="' + subtitleDXposition.toString() + '" dy="1em" font-style="italic">' + subTitle + '</tspan>';

Tags
Charts
Asked by
Sitefinity
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Daron
Top achievements
Rank 1
Share this question
or