Call the getChart Operation from the Controller

The getChart operation is called from the controller, passing in the data model for the chart.

The following is an example of calling BPMChartService.getChart from an application, passing in the chartModel1 data model, which is defined in the controller:

BPMChartService.getChart($scope.chartModel1,{
   onSuccess: function(result){
      var chartData = result.data;

      console.log(chartData);
					
      // categories object
					
      var categories = chartData.categories.category;
					
      $scope.chartConfig1.xAxis.categories = categories;
					
      // series object
					
      var series = [];
					
      if(chartData && chartData.data){
						
      for(var i =0; i< chartData.data.length; i++){
         var temp = {
            name: typeof chartData.data[i].group === 'string'?chartData.data[i].group: "None" ,
            data: chartData.data[i].dataset.value
            }
							
            series.push(temp);
							
         }
      }

      $scope.chartConfig1.series = series;
					
      },
      onFailure: function(exception){
					
         // GetChartFailed:
					
         console.log(exception);
      }
})