简体   繁体   中英

Kendo Chart - How to change tooltip visibility without redrawing chart

I'm using the setOptions method to dynamically show or hide the tooltip. However, every time this changes the entire chart redraws.

Is there a way to use setOptions or another method to set the tooltip visibility without redrawing the chart? I would accept a way to just prevent the re-draw animation.

var chart = $("#chart").data("kendoChart"); chart.setOptions({ tooltip: { visible: false } } );

UPDATE: Thanks to ezanker's answer below, I used the followed to prevent the chart from redrawing every time I updated the tooltip visibility.

$("#chart").kendoChart({
    render: onRender
)}

function onRender(e) {
    var chart = $("#chart").data("kendoChart");
    if (chart.options.transitions)
    {
        setTimeout(function () { //gives chart time to draw initially
            chart.setOptions({ transitions: false });
        }, 1000);
    }
}

If you have a better way to do set transitions to false let me know.

Thank you for your help!

You can turn off the animations

API: http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-transitions

$("#chart").kendoChart({
    transitions: false
});

If you want the initial transition. You could turn it off in the render event so it will only animate the first time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM