我遇到的问题是我的图表只以最低值开头,所以我无法看到它,而且我的图例也没有出现。 而且我试图改变默认颜色,但无论我做什么,都没有变化。
HTML:
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/base.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<link rel="stylesheet" href="css/angular-chart.css"/>
<script src="http://jtblin.github.io/angular-chart.js/dist/angular-chart.js"></script>
<script src="js/script.js"></script>
<script src="js/bootstrap.min.js"></script>
...
<div class="col-md-10">
<canvas id="bar" class="chart chart-bar" chart-data="fc.data"
chart-labels="fc.labels" colours="colours" chart-series="fc.series" chart-legend="true">
</canvas>
</div>
角:
app.controller('lhistorico', function ($scope,$http) {
$scope.colours = [{
fillColor: '#46BFBD',
strokeColor: 'rgba(47, 132, 71, 0.8)',
highlightFill: 'rgba(47, 132, 71, 0.8)',
highlightStroke: 'rgba(47, 132, 71, 0.8)'
}];
$http.get('/servico/faberto/').success(function(data) {
$scope.faturas = angular.fromJson(data);
});
$http.get('/servico/historico/').success(function(data){
$scope.fc = angular.fromJson(data);
});
$http.get('/servico/lhist/').success(function(data){
$scope.lhist = angular.fromJson(data);
});
});
的NodeJS /快递:
app.get('/servico/historico/',function(req,res){
connection = createConnection();
var queryString = "SELECT DATE_FORMAT(fatDataVenc, '%d/%l/%Y') AS venc,fatValor FROM faturas WHERE ff_empID = '"+ req.cookies.login.fu_empID +"'GROUP BY venc ORDER BY venc DESC LIMIT 12";
connection.query(queryString,function(err,rows){
var fc = {
series : ["Valor"],
labels : [],
data: []
};
if(rows.length>0){
for(var i = 0;i<rows.length;i++){
fc.labels.push(rows[i].venc);
fc.data.push(rows[i].fatValor);
}
}else{
fc.labels = "";
fc.data = [0];
}
return res.json(fc);
});
connection.end();
});