简体   繁体   English

Kendo图表-如何在不重绘图表的情况下更改工具提示的可见性

[英]Kendo Chart - How to change tooltip visibility without redrawing chart

I'm using the setOptions method to dynamically show or hide the tooltip. 我正在使用setOptions方法动态显示或隐藏工具提示。 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? 有没有一种方法可以使用setOptions或另一种方法来设置工具提示可见性而无需重绘图表? 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. 更新:感谢下面的ezanker的回答,我使用了Follows来防止每次更新工具提示可见性时都重新绘制图表。

$("#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. 如果您有更好的方法将转换设置为false,请告诉我。

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 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. 您可以在render事件中将其关闭,以便仅在第一时间进行动画处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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