我想你錯過了在配置bindto選項,所以,該圖沒有正確顯示。
Example
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"
};
})
});
ooh..Yes ..謝謝lot..You救了我的天.. – undefined
別擔心,這種錯誤發生的時間。很高興這可以幫助你。 –