jettro / c3-angular-directive

Contains angularjs directives that use c3js to create good looking graphs
http://jettro.github.io/c3-angular-directive/
MIT License
203 stars 98 forks source link

initialConfig is not working #149

Open minhpq331 opened 7 years ago

minhpq331 commented 7 years ago

Please check initial-config attribute, it is currently not accept object. I have debugged it and saw in your source code: (c3-angular.js line 861) var initialConfig = attrs.initialConfig; // return string ???

My html: <c3chart bindto-id="chart_test" initial-config="myOptions"> My controller: $scope.myOptions = {data: {}};

Am I missing something? Thank you anyway!

mbell8903 commented 7 years ago

I am also having the same issue:

The DOM

<c3chart bindto-id="pie-chart-1" show-labels="false" chart-columns="pieColumns" chart-data="pieData"/>

My scope object

$scope.pieChartInitialConfig = {
            data: {
                columns: [
                    ['data1', 0],
                    ['data2', 0],
                    ['data3', 0],
                    ['data3', 0],
                    ['data4', 0],
                    ['data5', 0]
                ],
                type: 'pie'
            },
            legend: {
                show: false
            }
        };

Console Log


TypeError: Cannot set property 'columns' of undefined
    at ChartController.d [as showGraph] (c3-angular.js:1180)
    at c3-angular.js:898
    at angular.js:19902
    at completeOutstandingRequest (angular.js:6108)
    at angular.js:6387```