Sign in to follow this  
imurpal

Fusion Chart and Angular JS $HTTP request

Recommended Posts

Hi Team,

              I am not able to generate the angular chart if the scope variables are present inside the HTTP request. Thanks in advance . If the scope is available outside http it works perfect. Thanks . Any help on this is appreciated

 

Html 
 
<html ng-app="HelloApp">
<body ng-controller="MyController">
{{myDataSource1}}
<div >
 <fusioncharts 
    id="mychartcontainer"
    chartid="mychart"
    width="400" 
height="200"
type="column2d"
datasource="{{myDataSource}}"
   
    ></fusioncharts>
</div>
</body>
</html>
 
 
 
JS
 
 
var app = angular.module('HelloApp', ["ng-fusioncharts"]);
 
app.controller('MyController', function ($scope,$http) {
var req='Any Rest URL';
$http({
   method: 'GET',
   url: req
  }).then(function successCallback(response) {
  //var data=[];
         alert("test");
         $scope.myDataSource1="nretes"
  $scope.myDataSource = {
        chart: {
            caption: "Harry's SuperMart",
            subCaption: "Top 5 stores in last month by revenue",
            numberPrefix: "$"
        },
        data: [{
            label: "Bakersfield Central",
            value: "880000"
        }, {
            label: "Garden Groove harbour",
            value: "730000"
        }, {
            label: "Los Angeles Topanga",
            value: "590000"
        }, {
            label: "Compton-Rancho Dom",
            value: "520000"
        }, {
            label: "Daly City Serramonte",
            value: "330000"
        }]
    };
 
 
   }, function errorCallback(response) {
  $scope.Status="failed";
  // $scope.Results=gems;
  //$scope.gridOptions.data= gems;
      alert("failure");
   });
 
   
 
});
Edited by imurpal

Share this post


Link to post
Share on other sites

Hi


 


Can you check if there is any error in browser console for the issue?


 


Also, please share a scaled down sample for issue you are facing so that I can assist you accordingly.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this