casillas
casillas

Reputation: 16803

Multiple objects handling in ToolTip

If I have 3 objects in my array, Kendo UI does not show any tooltips. However, if I have only two objects in the array, it works fine.

Here is the code:

$("#chart").kendoChart({
    xAxis: {},
    yAxis: {},
    seriesDefaults: {type: "scatterLine" },
    series: [{data: stats}],
    tooltip:{visible:true}
});

Here is the fiddle with three objects.

Here is the fiddle with two objects.

Upvotes: 1

Views: 283

Answers (1)

casillas
casillas

Reputation: 16803

Here is the answer:

First I should change the array of object to regular javascript object then it works.

var stats = [
    [0 , 200,400], [100, 300,900],[220, 400,1000],[300, 500,1500],[400, 800,1700],[600, 1200,1800],[800, 1600,3000]
];

stats = stats.map(function(x) {
    return { x: x[0], y: x[1], k: x[2] };
});

function createChart() {
    $("#chart")
        .kendoChart({
            xAxis: {},
            yAxis: {},
            seriesDefaults: {type: "scatterLine" },
            series: [{data: stats}],
            tooltip:{visible:true,template: "x : #=kendo.format('{0:n0}', (Math.abs(dataItem.x)))#, y : #=kendo.format('{0:n0}', (Math.abs(dataItem.y)))#, k : #=kendo.format('{0:n0}', (Math.abs(dataItem.k)))# "}
        });
}


$(document)
    .ready(createChart);

Upvotes: 1

Related Questions