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

Kendo Chart Using an HTML Title

2 Answers 555 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 13 Jan 2017, 01:32 PM

Is there any way to set the title in a Kendo Chart to an HTML template of some sort?
Basically I'm just looking to make the title of my Kendo Chart a link that will open another window. The version of the Kendo library we were using before had support for this functionality, but when updating to the most recent version of Kendo (2016.3.1118), I noticed that we lost this from when we were using the previous library.
Here's how I was declaring my chart title before.

$("#myChart").kendoChart({
    title: {
        text: '<a onclick="openWindow();">' + myChartTitleVar + '</a>',
        color: "black"
    },
    ...

Using jQuery I did find a work around, however with how I have my chart set up, it refreshes every couple of seconds to display new data, so my title doesn't persist, and it ends up going back to the original title that displays as &lt;a onclick="openWindow();"&gt;My Title&lt;/a&gt; when viewed in my inspector in Chrome.

$("#myChart > svg > g > g:eq(1) > g > text").html('<a onclick="openWindow();">' + myChartTitleVar + '</a>');

2 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 17 Jan 2017, 07:05 AM
Hello Kyle,

You can use the dataBound event to set the title (e.sender.options.title) and this way the title will be reset each time new data arrives and the Chart re-renders, e.g.:

http://dojo.telerik.com/ADUvEv

I hope this helps.

Unfortunately, using Kendo UI or other HTML templates in the Chart title text configuration is not supported.

Regards,
Dimiter Topalov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Kyle
Top achievements
Rank 1
answered on 17 Jan 2017, 12:11 PM

Hey Dimter,

I ended up just prepending a div with a link to the container for my charts for what I was needing to do, and took out the title when creating the chart.

Thanks for your response though!

Tags
Charts
Asked by
Kyle
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Kyle
Top achievements
Rank 1
Share this question
or