mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Update beforeDraw as inline plugin
This commit is contained in:
		@@ -48,19 +48,18 @@ let config = {
 | 
			
		||||
  centerText: {
 | 
			
		||||
    display: true,
 | 
			
		||||
    text: linkQ + "%"
 | 
			
		||||
  },
 | 
			
		||||
  plugins: [{
 | 
			
		||||
    beforeDraw: function(chart) {
 | 
			
		||||
      if (chart.config.centerText.display !== null &&
 | 
			
		||||
        typeof chart.config.centerText.display !== 'undefined' &&
 | 
			
		||||
        chart.config.centerText.display) {
 | 
			
		||||
          drawLinkQ(chart);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }]
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//Chart.Chart.pluginService.register({
 | 
			
		||||
//    beforeDraw: function(chart) {
 | 
			
		||||
//        if (chart.config.centerText.display !== null &&
 | 
			
		||||
//            typeof chart.config.centerText.display !== 'undefined' &&
 | 
			
		||||
//	    chart.config.centerText.display) {
 | 
			
		||||
//                drawLinkQ(chart);
 | 
			
		||||
//            }
 | 
			
		||||
//    }
 | 
			
		||||
//});
 | 
			
		||||
 | 
			
		||||
function drawLinkQ(chart) {
 | 
			
		||||
 | 
			
		||||
  let width = chart.chart.width;
 | 
			
		||||
@@ -82,7 +81,6 @@ function drawLinkQ(chart) {
 | 
			
		||||
 | 
			
		||||
window.onload = function() {
 | 
			
		||||
  let ctx = document.getElementById("divChartLinkQ").getContext("2d");
 | 
			
		||||
	window.myDoughnut = new Chart(ctx, config);
 | 
			
		||||
	//drawLinkQ(Chart);
 | 
			
		||||
  var chart = new Chart(ctx, config);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user