donut chart in php

Solutions on MaxInterview for donut chart in php by the best coders in the world

showing results for - "donut chart in php"
Esteban
19 Jan 2018
1    var employees = $("#employees").val();
2    //var fairs     = $("#fairs").val();
3
4    $.ajax({
5
6        url     : 'php_script/chart_values.php',
7        method  : 'POST',
8        data    : {employees:employees},
9
10        success : function(data){
11            $("#page_content").fadeIn();
12            $("#bar_chart_div").fadeOut();
13            var obj = JSON.parse(data);
14
15            var a = obj[0]; // labele data "Won","Contracted","Intersted"
16            var b = obj[1]; // label values "100","90","70"
17            var labeldata=[];
18            for( i=0; i<a.length;i++){ 
19
20                labeldata.push({label:a[i],y:parseInt(b[i]),legendText:a[i]});
21            }
22
23            debugger;
24           console.log(JSON.stringify(labeldata));
25
26            var chart = new CanvasJS.Chart("chartContainer", {
27                title: { 
28
29                    fontSize:15
30                }, 
31                axisY: { 
32                    title: "Products in %" 
33                }, 
34                legend :{ 
35                    verticalAlign: "center", 
36                    horizontalAlign: "right" 
37                },
38                data: [{
39                type: "pie", 
40                showInLegend: true, 
41                toolTipContent: "{label} <br/> {y} ", 
42                indexLabel: "{y} %", 
43                dataPoints: labeldata
44
45
46
47        }] 
48}); 
49chart.render();
50
51
52
53        }
54
55    });
56
57});
58
similar questions
queries leading to this page
donut chart in php