Chart.js - how to disable everything on hover

后端 未结 6 1519
陌清茗
陌清茗 2021-02-01 15:30

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.

6条回答
  •  借酒劲吻你
    2021-02-01 16:35

    If what you want is prevent any effect when hovering the mouse over any series, you should disable tooltip and hover state. You can do it like this:

    $(function () {
    
        Highcharts.chart('container', {
            plotOptions: {
            	series: {
                states: {
                          hover: {
                              enabled: false
                          }
                      }
              }
            },
    
            tooltip: {
                enabled: false
            },
    
            series: [{
                data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
            }]
        });
    });
    #reporting {
        position: absolute; 
        top: 55px; 
        right: 20px; 
        font: 12px Arial, Verdana; 
        color: #666;
        background: white;
    }
    
    
    
    

    (Template taken from Highcharts documentation).

    Hope it helps :)

提交回复
热议问题