Chart.js - 如何禁用悬停上的所有内容 [英] Chart.js - how to disable everything on hover

查看:145
本文介绍了Chart.js - 如何禁用悬停上的所有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何设置代码,在图表上没有悬停效果,悬停选项,(悬停)链接等等?



我使用chart.js 。下面是我的代码,我设置了饼图。



Html ..

 < div id =canvas-holderstyle =width:90%;> 
< canvas id =chart-area/>
< / div>

..和js ...

 $(document).ready(function(){


var config = {
type:'pie',
数据:{
数据集:[{
data:[60,20],
backgroundColor:[
#ddd,
#58AC1C
$,

标签:'数据集1'
}],
标签:[
Bla1,
Bla2+

},
选项:{
响应:真
}
};


window.onload =函数(){
va r ctx = document.getElementById(chart-area)。getContext(2d);
window.myPie =新图(ctx,config);
};
});


解决方案

您可以尝试

  showTooltips:false 

您可以还可以使用以下链接: b
$ b

http:// jsfiddle .net / TZq6q / 298 /

How can I set the code that there will be no hover effects, hover options, (hover) links etc on chart?

I'm using chart.js. Below is my code, where I set pie chart.

Html..

<div id="canvas-holder" style="width:90%;">
    <canvas id="chart-area" />
</div>

..and js...

$(document).ready(function () {


                var config = {
                    type: 'pie',
                    data: {
                        datasets: [{
                            data: [60,20],
                            backgroundColor: [
                                "#ddd",
                                "#58AC1C"
                            ],

                            label: 'Dataset 1'
                        }],
                        labels: [
                            "Bla1 ",
                            "Bla2 "+
                        ]   
                    },
                    options: {
                        responsive: true
                    }
                };


                window.onload = function() {
                    var ctx = document.getElementById("chart-area").getContext("2d");
                    window.myPie = new Chart(ctx, config);
                };      
            });

解决方案

You can try

 showTooltips: false

You can also use the following link

http://jsfiddle.net/TZq6q/298/

这篇关于Chart.js - 如何禁用悬停上的所有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆