Skip to content

How Can I send a data from a chart to another chart? #48

Open
@Dayranna

Description

@Dayranna

ok, My english is not so good...
I have a problem I want have several charts in a one page, I'm new in this, por I want that the usser give click in a chart's piece and generate me other chart about this information.
I try to show the specific data from one state.
I append my code:
`(function () {

/**
 * subjectsModule Module
 *
 * Description
 */
angular.module('infoSubjectModule', ["ng-fusioncharts"])
    .directive('infoSubjectsDirective', function () {
        //Return the directive
        return {
            restrict: 'E',
            replace: true,
            templateUrl: 'html/subjects/info.html',
            controller: 'infoSubjectsController'
        }

    })
    .controller('infoSubjectsController', function ($scope, $mdSidenav, $routeParams, $mdSidenav, $location, $route, $rootScope, $window, $filter, $mdToast, subjectsService,usersService, themesService) {


      $scope.myDataSource = {};

usersService.getAllState()
.then(function(response){
console.log(response)
$scope.stateGraficas={};
$scope.stateGraficas = response.map(function(array){
return {
label : array.State,
value : array.Pendientes
};

            })
        

            console.log($scope.stateGraficas)

$scope.stateGraficas =JSON.stringify( $scope.stateGraficas)
console.log(JSON.parse( $scope.stateGraficas))
$scope.myDataSource = {
chart: {
caption: "States",
subcaption: "2018",
startingangle: "120",
showlabels: "0",
showlegend: "1",
enablemultislicing: "0",
slicingdistance: "15",
showpercentvalues: "1",
showpercentintooltip: "0",
plottooltext: "Age group : $label Total visit : $datavalue",
theme: "fint"
},
data : JSON.parse( $scope.stateGraficas)

}
})
console.log($scope.myDataSource)
//$scope.myDataSource=Object.assign($scope.stateGraficas,$scope.myDataSource)

usersService.getAllDistrit()
.then(function(response){
console.log(response)
$scope.distritGraficas={};
$scope.distritGraficas = response.map(function(array){
return {
label : array.Distrit,
value : array.Complete
};
})
console.log($scope.distritGraficas)

$scope.distritGraficas =JSON.stringify($scope.distritGraficas)
console.log(JSON.parse( $scope.distritGraficas))
$scope.myDataSource2 = {
chart: {
caption: "Distrits",
subcaption: "2018",
startingangle: "120",
showlabels: "0",
showlegend: "1",
enablemultislicing: "0",
slicingdistance: "15",
showpercentvalues: "1",
showpercentintooltip: "0",
plottooltext: "Age group : $label Total visit : $datavalue",
theme: "fint"
},
data : JSON.parse( $scope.distritGraficas)
}
})
console.log($scope.myDataSource2)
})()
`
Please I new

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions