AngularJS directive for C3 chart not displaying all graphs -
i working c3 charts first time , came across angular directive of called angular_c3_simple. https://github.com/wasilak/angular-c3-simple
i tried static data , worked fine json data through service not working expected.
i trying display 2 different graphs displaying first graphs correctly second graph showing undefined value.
please me out this, not sure missing.
here plunkr: https://plnkr.co/edit/nyxgjwgrzj4xvzc5xjpg?p=preview
<div class="row"> <c3-simple id="chart" config="chart"></c3-simple> </div> <div class="row"> <c3-simple id="chart1" config="chart1"></c3-simple> </div>
i think missed bindto option in configuration, so, graph not shown correctly.
app.controller('analyticscontroller', function($scope, analyticsservice, c3simpleservice, $http, $q) { console.log("i have entered here"); var chart_size = { width: 480, height: 280 }; var chart_legend = {position: 'bottom'}; $scope.chart = {}; $scope.chart1 = {}; analyticsservice.getcounts() .then(function (dataattr){ $scope.chart= { data: { columns: [ ['production', dataattr.data.meta_charts_wl.wl_in_production], ['experimental', dataattr.data.meta_charts_wl.wl_in_experimental], ], type : 'donut', colors: { production: '#1e91cf', experimental: '#fba6a6', }, }, donut: { title: "area details:", }, size: chart_size, legend: chart_legend, bindto: "#chart" }; $scope.chart1= { data: { columns: [ ['production_1', dataattr.data.meta_charts_wl.wl_policymatched], ['experimental_1', dataattr.data.meta_charts_wl.wl_policy_not_matched], ], type : 'donut', colors: { production_1: '#1e91cf', experimental_1: '#fba6a6', }, }, donut: { title: "area details:", }, size: chart_size, legend: chart_legend, bindto: "#chart1" }; }) });
Comments
Post a Comment