2013-04-29 77 views

回答

1

您可以啓用/通過顯示/隱藏功能,與SVG相關的禁用目的。

http://jsfiddle.net/N6b6H/1/

 $('#showhide').toggle(function() { 
chart.credits.hide();  
      },function(){ 
chart.credits.show();    
      }); 
+0

非常感謝這是非常有益的 – Leo 2013-05-02 11:18:44

+0

它的完美與chart.credits.hide()或顯示()。我不知道。我在API文檔中尋找,但在這裏沒有關於「學分」的信息:http://api.highcharts.com/highcharts#Chart 非常感謝! – Andynedine 2014-07-07 06:39:56

0

在這裏我創建了一個jsfiddle,其中默認的信用啓用爲false,但是onclick credit enable變爲true。

試試這個:

[http://jsfiddle.net/jvaibhav/N6b6H/] 

HTML就像是:

<script src="http://code.highcharts.com/highcharts.js"></script> 

<div id="container" style="height: 400px"> 

</div> 

<button id="showhide"> Click Me </button> 

腳本類似於:

 $(function() { 

$('#showhide').click(function(){ 
    $('#container').highcharts({ 
    chart: { 
    }, 

    credits: { 
     enabled: true 
    }, 
       xAxis: { 
     categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] 
    }, 

    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]   
    }] 
}); 
}); 

$('#container').highcharts({ 
    chart: { 
    }, 

    credits: { 
     enabled: false 
    }, 

    xAxis: { 
     categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] 
    }, 

    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]   
    }] 
}); 
});