Chart.js - 如何禁用悬停时的所有内容

2022-01-22 00:00:00 jquery javascript html chart.js

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

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

我正在使用 chart.js.下面是我的代码,我在其中设置了饼图.

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>

..和 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);
                };      
            });

推荐答案

你可以试试

 showTooltips: false

您也可以使用以下链接

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

相关文章