我正在使用 angularjs-nvd3-directives 库中的 nvd3-bullet-chart 来显示最大的当前数据。如果我的最小数字大于 2,它将起作用。它显示整数。但如果我的最大数字 = 1,那么它显示十进制数。如何删除十进制数字?任何帮助将不胜感激,谢谢。
var app = angular.module('plunker', ['nvd3']);
app.controller('MainCtrl', function($scope) {
$scope.options = {
chart: {
type: 'bulletChart',
transitionDuration: 500,
height: 70,
margin: {
top: 10,
right: 10,
bottom: 30,
left: 125
}
},
title: {
enable: true,
text: 'Title for Line Chart',
css: {
'text-align': 'center',
'font-size': '12px'
}
}
};
$scope.dataset = {
data: {
"title": "Revenue",
"subtitle": "US$, in thousands",
"ranges": [1],
"measures": [0],
"markers": [0]
},
data2: {
"title": "Revenue",
"subtitle": "US$, in thousands",
"ranges": [150, 225, 300],
"measures": [220],
"markers": [250]
}
}
});
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.1/nv.d3.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.1/nv.d3.min.js"></script>
<script src="https://rawgit.com/krispo/angular-nvd3/v1.0.4/dist/angular-nvd3.js"></script>
<body ng-app="plunker" ng-controller="MainCtrl">
<div ng-repeat="data in dataset">
<nvd3 options="options" data="data"></nvd3>
</div>
<br><a href="http://krispo.github.io/angular-nvd3/" target="_blank" style="float: right;">See more</a>
</body>
这是一个笨蛋。你可以看到第 1 行。