subratdash8

Fusion_angular with RESTApi

Recommended Posts

HI all,

 

I am using fusionchart angular js plugin..My data coming from database through rest api and stored as JSON format in client...While displaying the data it is showing correct..But while assigning dis data with graph data part no output..

Output is showing no data display...

 

 
var app=angular.module("myApp",["ng-fusioncharts"])
app.controller("MyController",function($scope,$http){
$scope.visibleflag=false;
$scope.myDataSource = {
                //alert("hi")
chart: {
               
              // "subCaption": "Harry's SuperMart",
               
                },
                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"
   }]
              };
$scope.visible=function(data){
$scope.visibleflag=true;
 
res.then(function(response) {
$scope.data1=response.data;
 
alert("hi")
console.log(response.data);
}, function(response) {
alert("error")
});
 
$scope.myDataSource = {
                chart: {
                "caption": "Error Count For Message Family",
              // "subCaption": "Harry's SuperMart",
               "xAxisName": "Name",
               "yAxisName": "Count In Numbers",
               "numberPrefix": "",
               "paletteColors": "#0075c2",
               "bgColor": "#ffffff",
               "borderAlpha": "20",
               "canvasBorderAlpha": "0",
               "usePlotGradientColor": "0",
               "plotBorderAlpha": "10",
               "placevaluesInside": "1",
               "rotatevalues": "1",
               "valueFontColor": "#ffffff",                
               "showXAxisLine": "1",
               "xAxisLineColor": "#999999",
               "divlineColor": "#999999",               
               "divLineIsDashed": "1",
               "showAlternateHGridColor": "0",
               "subcaptionFontBold": "0",
               "subcaptionFontSize": "14"
                },
                data:$scope.data1
 
              };
}
});
 
 
please help me...
value of $scope.data1 =[{'label':'item','value':'4200'}]
 
if I give direct value to data part..it is working..
But above code is not working if i give as $scope.data1..
 
I need the solution asap.
Edited by subratdash8

Share this post


Link to post
Share on other sites

Hi

 

You have to form chart data beforehand and then pass it to chart object.

 

If $scope.data1 is not populated after render method is called then chart will show `No Data to Display` error as chart should have dataSource before chart is being rendered.

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