我将Angular Material与C3.js结合使用,我试图用Angular Material开关组件替换默认的C3图例。 它在首页加载后运行良好,但它不起作用after refreshing (reloading) page。请查看plunker
app.controller('GraphCtrl', function($scope) {
$scope.data = {
data1: true,
data2: true
};
// grid lines
var chart_grid_lines = c3.generate({
bindto: '#chart1',
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
],
type: 'spline'
},
legend: {
show: false
}
});
$scope.updateChart = function() {
if ($scope.data.data1)
$scope.chart_grid_lines.show(['data1']);
else
$scope.chart_grid_lines.hide(['data1']);
if ($scope.data.data2)
$scope.chart_grid_lines.show(['data2']);
else
$scope.chart_grid_lines.hide(['data2']);
};
});
有谁知道我们是否在谈论角度材料错误?