user2138545
user2138545

Reputation: 508

In kendo chart tooltip is not showing properly

enter image description hereI am working on kendo controls.I am having kendo stock chart in my application.I am providing tool-tip feature for chart.But it is not showing values,it showing values as "Undefined".When using the event which allows us to custom the tool-tips for a bar\line chart. The Data Item that is passed to the event is returned as Undefined . So, is there is property which I can be set that allows custom the tool-tip, even when their is a lot of pionts in a small area. Example: template: "#= dataItem.employeeName #".What is the problem in my chart code?

Upvotes: 2

Views: 4094

Answers (2)

user3584268
user3584268

Reputation: 1

Add #debugger;# keyword as break point in kendo UI template of javascript block. Open your browser console. Browser automatically hits the break point.

Upvotes: 0

OnaBai
OnaBai

Reputation: 40917

In your code you have to use in the template definition #= dataItem.<fieldName> # for example: Freight :#=dataItem.Freight# <br/> since the structure received as data by the KendoUI template processor is dataItem.<fieldName>.

So your template should be:

template: "#OrderDate:#=dataItem.OrderDate# <br/>Freight :#=dataItem.Freight# <br/>ShipVia:#=dataItem.ShipVia# <br/> ShipCity:#= dataItem.ShipCity#"

NOTE As debugging trick, you might define as template:

template: "#console.log('data', data);#"

This executes the code enclosed by #. Kendo UI template manager defines as data the actual data that you have available in something like:

using(data) {
    // Template expanded code
};

This makes correct using #= dataItem.ShipCity # but does not prevent you from still using data. We take advantage of this for displaying on the browser console the data and the checking its structure.

Your modified JSFiddle here: http://jsfiddle.net/OnaBai/5bchz/64/

Upvotes: 2

Related Questions