Sachin Singh

Sachin Singh

  • 10
  • 55.8k
  • 75.8k

ChartJs with server side data

Dec 8 2020 4:25 AM
hii all
i have below json data from web api
  1. [{"DepartmentName":"HR","Performance":[30,40],"Month":["Jan","feb"]},{"DepartmentName":"Dev","Performance":[60,80],"Month":["Jan","feb"]}] 
 I need to show a bar chart.
Each department's paerformance each month as shown in below figure
 
i am stuck on generating different series 
  1. $(function(){  
  2.        $.ajax({    
  3.            type: "POST",    
  4.            url: "/ChartJS/ThreeChart",    
  5.            contentType: "application/json; charset=utf-8",    
  6.            dataType: "json",    
  7.            success: function (chData) {   
  8.                var ctx = document.getElementById('myChart').getContext('2d');  
  9.                var myChart = new Chart(ctx, {  
  10.                    type: 'bar',  
  11.                    data: [{  
  12.                        label: "??",  
  13.                        data: chData[1], ??  
  14.                        
  15.                    }]  
  16.                });  
  17.              
  18.            }  
  19.                  
  20.        })  
  21.      
  22.      
  23.    }) 
 kindly , suggest me a robust solution.

Answers (1)